summaryrefslogtreecommitdiff
path: root/drivers/video/b2r2/b2r2_node_split.c
diff options
context:
space:
mode:
authorJorgen Nilsson <jorgen.nilsson@stericsson.com>2012-02-06 17:04:49 +0100
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:04:28 +0200
commit57716d2b65bf5fa56f50a5f3d4ebb3a35b2483ab (patch)
tree8b47440bad8bf338431b9baf62ba737ec34b5d95 /drivers/video/b2r2/b2r2_node_split.c
parent809e8bdcb464d4be59d04825873f41ecebf9dc28 (diff)
video: [ANDROID]: b2r2: Add kernel API to b2r2 and more
Brief: As a preparation for the ICS hardware composer solution a kernel API has been added to the b2r2 driver. Some minor stability fixes are also part of this release. The full support for dual b2r2 configuration should be in place, but has yet to be verified with the apropriate hardware. The change should have minor impact on the single core solution. Details: A new logical device for handling the blitter requests has been added. This is roughly the same device as the old blitter the interfaces are therefore the same. From now there is at least two devices - one blitter device and then for each core one additional device (dual configuration is the current target). As a consequence the maximum number of allowed cores has been raised from 1 to 2. When a dual configuration is active the b2r2 driver seamlessly splits requests over available b2r2 cores. Each request is assigned a core_mask defining which cores are doing part of the job. This helps keep track when waiting for the reports. Also, rectangles are now recalculated (based on intersection of destination rectangle and destination image etc.) before splitting the job in order to maximize throughput. Clock and power source can now be configured from devices-dbxxxx.c or equivalent. Minor bug fixes: - Check the return value from clk_enable - Check if the core is valid before serving a IRQ. - Check if the core is enabled (domain_enabled) before adding a new job. - Return actual job_id used for a request (previously always 0) ST-Ericsson ID: 404691 Original Change-Id: Ic3357c4c1e792a84077c1be4ba4c5acdb19da266 Signed-off-by: Jorgen Nilsson <jorgen.nilsson@stericsson.com>
Diffstat (limited to 'drivers/video/b2r2/b2r2_node_split.c')
-rw-r--r--drivers/video/b2r2/b2r2_node_split.c60
1 files changed, 14 insertions, 46 deletions
diff --git a/drivers/video/b2r2/b2r2_node_split.c b/drivers/video/b2r2/b2r2_node_split.c
index d773865223b..b2fb07580ca 100644
--- a/drivers/video/b2r2/b2r2_node_split.c
+++ b/drivers/video/b2r2/b2r2_node_split.c
@@ -21,9 +21,6 @@
/*
* Macros and constants
*/
-#define ABS(x) ((x) < 0 ? -(x) : (x))
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define INSTANCES_DEFAULT_SIZE 10
#define INSTANCES_GROW_SIZE 5
@@ -111,9 +108,6 @@ static int configure_rot_scale(struct b2r2_control *cont,
struct b2r2_node_split_job *this, struct b2r2_node *node,
struct b2r2_node **next);
-static void recalculate_rects(struct b2r2_control *cont,
- struct b2r2_blt_req *req);
-
static int check_rect(struct b2r2_control *cont,
const struct b2r2_blt_img *img,
const struct b2r2_blt_rect *rect,
@@ -255,13 +249,6 @@ int b2r2_node_split_analyze(const struct b2r2_blt_request *req,
color_fill = (this->flags & (B2R2_BLT_FLAG_SOURCE_FILL |
B2R2_BLT_FLAG_SOURCE_FILL_RAW)) != 0;
- /*
- * B2R2 cannot handle destination clipping on buffers
- * allocated close to 64MiB bank boundaries.
- * recalculate src_ and dst_rect to avoid clipping.
- */
- recalculate_rects(cont, (struct b2r2_blt_req *) &req->user_req);
-
/* Configure the source and destination buffers */
set_buf(cont, &this->src, req->src_resolved.physical_address,
&req->user_req.src_img, &req->user_req.src_rect,
@@ -579,25 +566,6 @@ void b2r2_node_split_cancel(struct b2r2_control *cont,
return;
}
-/*
- * Private functions
- */
-
-static void recalculate_rects(struct b2r2_control *cont,
- struct b2r2_blt_req *req)
-{
- struct b2r2_blt_rect new_dst_rect;
- struct b2r2_blt_rect new_src_rect;
- struct b2r2_blt_rect new_bg_rect;
-
- b2r2_trim_rects(cont,
- req, &new_bg_rect, &new_dst_rect, &new_src_rect);
-
- req->dst_rect = new_dst_rect;
- req->src_rect = new_src_rect;
- req->bg_rect = new_bg_rect;
-}
-
static int check_rect(struct b2r2_control *cont,
const struct b2r2_blt_img *img,
const struct b2r2_blt_rect *rect,
@@ -619,10 +587,10 @@ static int check_rect(struct b2r2_control *cont,
/* If we are using clip we should only look at the intersection of the
rects */
if (clip) {
- l = MAX(rect->x, clip->x);
- t = MAX(rect->y, clip->y);
- r = MIN(rect->x + rect->width, clip->x + clip->width);
- b = MIN(rect->y + rect->height, clip->y + clip->height);
+ l = max(rect->x, clip->x);
+ t = max(rect->y, clip->y);
+ r = min(rect->x + rect->width, clip->x + clip->width);
+ b = min(rect->y + rect->height, clip->y + clip->height);
} else {
l = rect->x;
t = rect->y;
@@ -1338,22 +1306,22 @@ static int analyze_scale_factors(struct b2r2_control *cont,
u16 vsf;
if (this->rotation) {
- ret = calculate_scale_factor(cont, this->src.rect.width,
+ ret = calculate_scale_factor(cont->dev, this->src.rect.width,
this->dst.rect.height, &hsf);
if (ret < 0)
goto error;
- ret = calculate_scale_factor(cont, this->src.rect.height,
+ ret = calculate_scale_factor(cont->dev, this->src.rect.height,
this->dst.rect.width, &vsf);
if (ret < 0)
goto error;
} else {
- ret = calculate_scale_factor(cont, this->src.rect.width,
+ ret = calculate_scale_factor(cont->dev, this->src.rect.width,
this->dst.rect.width, &hsf);
if (ret < 0)
goto error;
- ret = calculate_scale_factor(cont, this->src.rect.height,
+ ret = calculate_scale_factor(cont->dev, this->src.rect.height,
this->dst.rect.height, &vsf);
if (ret < 0)
goto error;
@@ -2791,9 +2759,9 @@ static int setup_tmp_buf(struct b2r2_control *cont,
if (size > max_size) {
/* We need to limit the size, so we choose a different width */
- width = MIN(width, B2R2_RESCALE_MAX_WIDTH);
+ width = min(width, (u32) B2R2_RESCALE_MAX_WIDTH);
pitch = b2r2_fmt_byte_pitch(fmt, width);
- height = MIN(height, max_size / pitch);
+ height = min(height, max_size / pitch);
size = pitch * height;
}
@@ -2918,10 +2886,10 @@ static void set_target(struct b2r2_node *node, u32 addr,
/* Clip to the destination buffer to prevent memory overwrites */
if ((l < 0) || (r > buf->width) || (t < 0) || (b > buf->height)) {
/* The clip rectangle is including the borders */
- l = MAX(l, 0);
- r = MIN(r, buf->width) - 1;
- t = MAX(t, 0);
- b = MIN(b, buf->height) - 1;
+ l = max(l, 0);
+ r = min(r, (s32) buf->width) - 1;
+ t = max(t, 0);
+ b = min(b, (s32) buf->height) - 1;
node->node.GROUP0.B2R2_CIC |= B2R2_CIC_CLIP_WINDOW;
node->node.GROUP0.B2R2_INS |= B2R2_INS_RECT_CLIP_ENABLED;