summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Diaz Prado <a0273371@ti.com>2012-07-13 14:26:52 -0500
committerJason Simmons <jsimmons@google.com>2012-10-22 15:39:35 -0700
commitcec3d5b8ffff42c2dc5746575172e976feca3450 (patch)
tree69cc35d42efebff7dcf1b0601c03864890db2f4f
parenta9bec459a62ebc71f9e74832047c2d9da8a84ff0 (diff)
downloadomap4-aah-cec3d5b8ffff42c2dc5746575172e976feca3450.tar.gz
hwc: rgz: support layers with the HWC_HINT_CLEAR_FB hint
Allow the regionizer to ignore (and clear if needed) a region with a layer requesting to clear the framebuffer with a hint. This mimics what SurfaceFlinger does when the HWC requests to clear a layer area with transparent pixels. Rebased from p-ics-mr1: 3c9a753 hwc: rgz: support layers with the HWC_HINT_CLEAR_FB hint Change-Id: If61a4f50d0315eb23119d7b97b0f2cb5f994806f Signed-off-by: Gustavo Diaz Prado <a0273371@ti.com> (cherry picked from commit 60d9c93b53b7133aca51d7a125f5d14666a772fe)
-rw-r--r--hwc/rgz_2d.c66
1 files changed, 59 insertions, 7 deletions
diff --git a/hwc/rgz_2d.c b/hwc/rgz_2d.c
index 7bdaaf1..3814118 100644
--- a/hwc/rgz_2d.c
+++ b/hwc/rgz_2d.c
@@ -346,14 +346,30 @@ static int rgz_out_bvcmd_paint(rgz_t *rgz, rgz_out_params_t *params)
rgz_blts_init(&blts);
rgz_out_clrdst(params, NULL);
- unsigned int i;
+ unsigned int i, j;
/* Begin from index 1 to remove the background layer from the output */
- for (i = 1; i < rgz->rgz_layerno; i++) {
- hwc_layer_t *l = rgz->rgz_layers[i].hwc_layer;
+ for (i = 1, j = 0; i < rgz->rgz_layerno; i++) {
+ rgz_layer_t *rgz_layer = &rgz->rgz_layers[i];
+ hwc_layer_t *l = rgz_layer->hwc_layer;
//OUTP("blitting meminfo %d", rgz->rgz_layers[i].buffidx);
+ /*
+ * See if it is needed to put transparent pixels where this layer
+ * is located in the screen
+ */
+ if (rgz_layer->buffidx == -1) {
+ struct bvsurfgeom *scrgeom = params->data.bvc.dstgeom;
+ blit_rect_t srcregion;
+ srcregion.left = max(0, l->displayFrame.left);
+ srcregion.top = max(0, l->displayFrame.top);
+ srcregion.bottom = min(scrgeom->height, l->displayFrame.bottom);
+ srcregion.right = min(scrgeom->width, l->displayFrame.right);
+ rgz_out_clrdst(params, &srcregion);
+ continue;
+ }
+
rv = rgz_hwc_layer_blit(l, params, rgz->rgz_layers[i].buffidx);
if (rv) {
OUTE("bvcmd_paint: error in layer %d: %d", i, rv);
@@ -361,7 +377,7 @@ static int rgz_out_bvcmd_paint(rgz_t *rgz, rgz_out_params_t *params)
rgz_blts_free(&blts);
return rv;
}
- params->data.bvc.out_hndls[i-1] = l->handle;
+ params->data.bvc.out_hndls[j++] = l->handle;
params->data.bvc.out_nhndls++;
}
@@ -608,6 +624,23 @@ static int rgz_in_hwccheck(rgz_in_params_t *p, rgz_t *rgz)
}
possible_blit++;
}
+ continue;
+ }
+
+ if (layers[l].hints & HWC_HINT_CLEAR_FB) {
+ candidates++;
+ if (possible_blit < RGZ_INPUT_MAXLAYERS) {
+ /*
+ * Use only the layer rectangle as an input to regionize when the clear
+ * fb hint is present, mark this layer to identify it.
+ */
+ 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];
+ possible_blit++;
+ }
}
}
@@ -1189,6 +1222,20 @@ static int rgz_hwc_subregion_blit(blit_hregion_t *hregion, int sidx, rgz_out_par
}
}
+ /*
+ * See if the depth most layer needs to be ignored. If this layer is the
+ * only operation, we need to clear this subregion.
+ */
+ if (hregion->rgz_layers[lix]->buffidx == -1) {
+ ldepth--;
+ if (!ldepth) {
+ if (screen_isdirty)
+ 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) {
@@ -1367,9 +1414,13 @@ static int rgz_out_region(rgz_t *rgz, rgz_out_params_t *params)
unsigned int j;
params->data.bvc.out_nhndls = 0;
/* Begin from index 1 to remove the background layer from the output */
- for (j = 1; j < rgz->rgz_layerno; j++) {
- hwc_layer_t *layer = rgz->rgz_layers[j].hwc_layer;
- params->data.bvc.out_hndls[j-1] = layer->handle;
+ for (j = 1, i = 0; j < rgz->rgz_layerno; j++) {
+ rgz_layer_t *rgz_layer = &rgz->rgz_layers[j];
+ /* We don't need the handles for layers marked as -1 */
+ if (rgz_layer->buffidx == -1)
+ continue;
+ hwc_layer_t *layer = rgz_layer->hwc_layer;
+ params->data.bvc.out_hndls[i++] = layer->handle;
params->data.bvc.out_nhndls++;
}
@@ -1469,6 +1520,7 @@ int rgz_get_screengeometry(int fd, struct bvsurfgeom *geom, int fmt)
return -EINVAL;
}
+ bzero(&bg_layer, sizeof(bg_layer));
bg_layer.displayFrame.left = bg_layer.displayFrame.top = 0;
bg_layer.displayFrame.right = fb_varinfo.xres;
bg_layer.displayFrame.bottom = fb_varinfo.yres;