summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lofthouse <a0741364@ti.com>2012-07-20 09:50:51 -0500
committerDaniel Levin <dendy@ti.com>2012-11-28 21:16:24 +0200
commitfbff7e9bd654f4c9bf0fb1355bcfd075668e6cfb (patch)
tree3ba59d9df358a1194c918e80e07949282d41b807
parent5aeda27950fd51e0623eba11937a5e5893985fac (diff)
downloadhardware_ti_omap4-fbff7e9bd654f4c9bf0fb1355bcfd075668e6cfb.zip
hardware_ti_omap4-fbff7e9bd654f4c9bf0fb1355bcfd075668e6cfb.tar.gz
hardware_ti_omap4-fbff7e9bd654f4c9bf0fb1355bcfd075668e6cfb.tar.bz2
hwc: rgz: Fix dirty region not working when blitting only one layer
The dirty region handling doesn't work properly when only one layer is being blitted. The problem was the screen dirty state was only set to zero when one layer reaches the dirty count to zero. In case only one layer was being blitted the dirty region handling is never triggered making the empty areas to be cleared on every frame even if it was not needed. This patch removes the screen dirty flag and instead introduces a dirty count for the background and layers with the clear fb hint as well, since we don't care about the handle, the dirty count is decreased on every frame, in this way the dirty region handling sees the background and layers with the clear fb hint as any other layer. Rebased from p-ics-mr1: 11e5f7e hwc: rgz: Fix dirty region not working when blitting only one layer Change-Id: Ifbb111ce7738cd097e74ac01e2c48f3994857416 Signed-off-by: Gustavo Diaz Prado <a0273371@ti.com> Conflicts: hwc/rgz_2d.c Signed-off-by: Tony Lofthouse <a0741364@ti.com>
-rw-r--r--hwc/rgz_2d.c71
-rw-r--r--hwc/rgz_2d.h1
2 files changed, 41 insertions, 31 deletions
diff --git a/hwc/rgz_2d.c b/hwc/rgz_2d.c
index 9e2dcea..abf2722 100644
--- a/hwc/rgz_2d.c
+++ b/hwc/rgz_2d.c
@@ -624,10 +624,18 @@ static int rgz_in_hwccheck(rgz_in_params_t *p, rgz_t *rgz)
}
int possible_blit = 0, candidates = 0;
- rgz->screen_isdirty = 1;
- /* Insert the background layer at the beginning of the list */
- rgz->rgz_layers[0].hwc_layer = &bg_layer;
+ /*
+ * Insert the background layer at the beginning of the list, maintain a
+ * state for dirty region handling
+ */
+ rgz_layer_t *rgz_layer = &rgz->rgz_layers[0];
+ rgz_layer->hwc_layer = &bg_layer;
+ if (!rgz_layer->dirty_hndl) {
+ rgz_layer->dirty_hndl = (void*)0x1;
+ rgz_layer->dirty_count = RGZ_NUM_FB;
+ } else
+ rgz_layer->dirty_count -= rgz_layer->dirty_count ? 1 : 0;
for (l = 0; l < layerno; l++) {
if (layers[l].compositionType == HWC_FRAMEBUFFER) {
@@ -640,11 +648,9 @@ static int rgz_in_hwccheck(rgz_in_params_t *p, rgz_t *rgz)
if (rgz_layer->hwc_layer->handle != rgz_layer->dirty_hndl) {
rgz_layer->dirty_count = RGZ_NUM_FB;
rgz_layer->dirty_hndl = (void*)rgz_layer->hwc_layer->handle;
- } else {
+ } else
rgz_layer->dirty_count -= rgz_layer->dirty_count ? 1 : 0;
- if (rgz_layer->dirty_count == 0)
- rgz->screen_isdirty = 0; /* Just update dirty regions from now on */
- }
+
possible_blit++;
}
continue;
@@ -659,9 +665,16 @@ static int rgz_in_hwccheck(rgz_in_params_t *p, rgz_t *rgz)
*/
rgz_layer_t *rgz_layer = &rgz->rgz_layers[possible_blit+1];
rgz_layer->buffidx = -1;
- rgz_layer->dirty_count = 0;
- rgz_layer->dirty_hndl = NULL;
rgz_layer->hwc_layer = &layers[l];
+ /*
+ * We don't care about the handle but we want to maintain a layer state for
+ * dirty region handling
+ */
+ if (!rgz_layer->dirty_hndl) {
+ rgz_layer->dirty_hndl = (void*)0x1;
+ rgz_layer->dirty_count = RGZ_NUM_FB;
+ } else
+ rgz_layer->dirty_count -= rgz_layer->dirty_count ? 1 : 0;
possible_blit++;
}
}
@@ -1263,7 +1276,7 @@ static void rgz_batch_entry(struct rgz_blt_entry* e, unsigned int flag, unsigned
e->bp.batchflags |= set;
}
-static int rgz_hwc_subregion_blit(blit_hregion_t *hregion, int sidx, rgz_out_params_t *params, int screen_isdirty)
+static int rgz_hwc_subregion_blit(blit_hregion_t *hregion, int sidx, rgz_out_params_t *params)
{
static int loaded = 0;
if (!loaded)
@@ -1293,12 +1306,26 @@ static int rgz_hwc_subregion_blit(blit_hregion_t *hregion, int sidx, rgz_out_par
return -1;
}
+ /* Determine if this region is dirty */
+ int dirty = 0, dirtylix = lix;
+ while (dirtylix != -1) {
+ rgz_layer_t *rgz_layer = hregion->rgz_layers[dirtylix];
+ if (rgz_layer->dirty_count){
+ /* One of the layers is dirty, we need to generate blits for this subregion */
+ dirty = 1;
+ break;
+ }
+ dirtylix = get_layer_ops_next(hregion, sidx, dirtylix);
+ }
+
+ if (!dirty)
+ return 0;
+
/* Check if the bottom layer is the background */
if (hregion->rgz_layers[lix]->hwc_layer == &bg_layer) {
if (ldepth == 1) {
/* Background layer is the only operation, clear subregion */
- if (screen_isdirty)
- rgz_out_clrdst(params, &hregion->blitrects[lix][sidx]);
+ rgz_out_clrdst(params, &hregion->blitrects[lix][sidx]);
return 0;
} else {
/* No need to generate blits with background layer if there is
@@ -1316,28 +1343,12 @@ static int rgz_hwc_subregion_blit(blit_hregion_t *hregion, int sidx, rgz_out_par
if (hregion->rgz_layers[lix]->buffidx == -1) {
ldepth--;
if (!ldepth) {
- if (screen_isdirty)
- rgz_out_clrdst(params, &hregion->blitrects[lix][sidx]);
+ rgz_out_clrdst(params, &hregion->blitrects[lix][sidx]);
return 0;
}
lix = get_layer_ops_next(hregion, sidx, lix);
}
- /* Determine if this region is dirty */
- int dirty = 0, dirtylix = lix;
- while (dirtylix != -1) {
- rgz_layer_t *rgz_layer = hregion->rgz_layers[dirtylix];
- if (rgz_layer->dirty_count){
- /* One of the layers is dirty, we need to generate blits for this subregion */
- dirty = 1;
- break;
- }
- dirtylix = get_layer_ops_next(hregion, sidx, dirtylix);
- }
-
- if (!dirty)
- return 0;
-
if (!noblend && ldepth > 1) { /* BLEND */
blit_rect_t *rect = &hregion->blitrects[lix][sidx];
struct rgz_blt_entry* e = rgz_blts_get(&blts, params);
@@ -1489,7 +1500,7 @@ static int rgz_out_region(rgz_t *rgz, rgz_out_params_t *params)
}
for (s = 0; s < hregion->nsubregions; s++) {
ALOGD_IF(debug, "h[%d] -> [%d]", i, s);
- rgz_hwc_subregion_blit(hregion, s, params, rgz->screen_isdirty);
+ rgz_hwc_subregion_blit(hregion, s, params);
}
}
diff --git a/hwc/rgz_2d.h b/hwc/rgz_2d.h
index 4b4d3fb..44867b8 100644
--- a/hwc/rgz_2d.h
+++ b/hwc/rgz_2d.h
@@ -285,7 +285,6 @@ struct rgz {
int state;
unsigned int rgz_layerno;
rgz_layer_t rgz_layers[RGZ_MAXLAYERS];
- int screen_isdirty;
};
#endif /* __RGZ_2D__ */