hwc : Enable ABC only for non intersecting layers.
To prevent artifact(s), we should enable ABC only in case
of non intersecting layers.
Change-Id: I3dd265e834340dcb298d7b9e06d135a4583a17b8
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index f703fa0..78e71eb 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -415,9 +415,20 @@
if(layerCount == 1)
return true;
- if(layerCount == MAX_LAYERS_FOR_ABC) {
- // Pass the Acquire Fence FD to driver for base layer
+ if(layerCount == MAX_LAYERS_FOR_ABC) {
int abcRenderBufIdx = ctx->listStats[dpy].renderBufIndexforABC;
+ //enable ABC only for non intersecting layers.
+ hwc_rect_t displayFrame =
+ list->hwLayers[abcRenderBufIdx].displayFrame;
+ for (int i = abcRenderBufIdx + 1; i < layerCount; i++) {
+ hwc_rect_t tmpDisplayFrame = list->hwLayers[i].displayFrame;
+ hwc_rect_t result = getIntersection(displayFrame,tmpDisplayFrame);
+ if (isValidRect(result)) {
+ ctx->listStats[dpy].renderBufIndexforABC = -1;
+ return false;
+ }
+ }
+ // Pass the Acquire Fence FD to driver for base layer
private_handle_t *renderBuffer =
(private_handle_t *)list->hwLayers[abcRenderBufIdx].handle;
copybit_device_t *copybit = getCopyBitDevice();
@@ -425,7 +436,7 @@
copybit->set_sync(copybit,
list->hwLayers[abcRenderBufIdx].acquireFenceFd);
}
- for(int i = 1; i < layerCount; i++){
+ for(int i = abcRenderBufIdx + 1; i < layerCount; i++){
int retVal = drawLayerUsingCopybit(ctx,
&(list->hwLayers[i]),renderBuffer, 0);
if(retVal < 0) {