hwc : Add support for single layer Bypass in MDP3
If the display list contains single layer and that layer
has same properties as Frame Buffer, avoid BLIT on Frame buffer
and pass it directly to display.
Change-Id: I24decaca4788432a55b550caa2a1354a670cd6fa
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index f379cf8..2cd2d2a 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -340,8 +340,46 @@
return ret;
}
-bool CopyBit::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list,
- int dpy, int32_t *fd) {
+bool CopyBit::drawUsingAppBufferComposition(hwc_context_t *ctx,
+ hwc_display_contents_1_t *list,
+ int dpy) {
+ int layerCount = 0;
+ uint32_t last = list->numHwLayers - 1;
+ hwc_layer_1_t *fbLayer = &list->hwLayers[last];
+ private_handle_t *fbhnd = (private_handle_t *)fbLayer->handle;
+
+ if(ctx->enableABC == false)
+ return false;
+
+ if(ctx->listStats[dpy].numAppLayers != MAX_LAYERS_FOR_ABC )
+ return false;
+
+ layerCount = ctx->listStats[dpy].numAppLayers;
+ //bottom most layer should
+ //equal to FB
+ hwc_layer_1_t *tmpLayer = &list->hwLayers[0];
+ private_handle_t *hnd = (private_handle_t *)tmpLayer->handle;
+ if(hnd && fbhnd && (hnd->size == fbhnd->size) &&
+ (hnd->width == fbhnd->width) && (hnd->height == fbhnd->height)){
+ if(tmpLayer->transform ||
+ (!(hnd->format == HAL_PIXEL_FORMAT_RGBA_8888 ||
+ hnd->format == HAL_PIXEL_FORMAT_RGBX_8888)) ||
+ (needsScaling(tmpLayer) == true)) {
+ return false;
+ }else {
+ ctx->listStats[dpy].renderBufIndexforABC = 0;
+ }
+ }
+
+ if(ctx->listStats[dpy].renderBufIndexforABC == 0){
+ return true;
+ // Todo::same for two layers.
+ }
+ return false;
+}
+
+bool CopyBit::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list,
+ int dpy, int32_t *fd) {
// draw layers marked for COPYBIT
int retVal = true;
int copybitLayerCount = 0;
@@ -353,6 +391,10 @@
mFbCache.reset(); // there is no layer marked for copybit
return false ;
}
+
+ if(drawUsingAppBufferComposition(ctx, list, dpy)) {
+ return true;
+ }
//render buffer
if (ctx->mMDP.version == qdutils::MDP_V3_0_4) {
last = (uint32_t)list->numHwLayers - 1;