hwc: Configure FbUpdate only when needed
When video overlay is on and there are no UI layers to compose,
there is no need to configure for framebuffer target.
If framebuffer target is also configured in such cases, video is not
shown on display due to 0 z-order.
Change-Id: I468068fa3a273d61e3688014251043035353cec0
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index e370ecb..6d0b85f 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -38,6 +38,16 @@
mModeOn = false;
}
+bool IFBUpdate::needFbUpdate(hwc_context_t *ctx,
+ const hwc_display_contents_1_t *list, int dpy) {
+ // if Video Overlay is on and and YUV layers are passed through overlay
+ // , no need to configure FB layer.
+ if(ctx->mVidOv[dpy]->isModeOn() &&
+ (ctx->listStats[dpy].yuvCount == ctx->listStats[dpy].numAppLayers))
+ return false;
+
+ return true;
+}
//================= Low res====================================
FBUpdateLowRes::FBUpdateLowRes(const int& dpy): IFBUpdate(dpy) {}
@@ -65,6 +75,11 @@
bool ret = false;
hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
if (LIKELY(ctx->mOverlay)) {
+ // When Video overlay is in use and there are no UI layers to
+ // be composed to FB , no need to configure FbUpdate.
+ if(!needFbUpdate(ctx, list, mDpy))
+ return false;
+
overlay::Overlay& ov = *(ctx->mOverlay);
private_handle_t *hnd = (private_handle_t *)layer->handle;
ovutils::Whf info(hnd->width, hnd->height,
@@ -171,6 +186,11 @@
bool ret = false;
hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
if (LIKELY(ctx->mOverlay)) {
+ // When Video overlay is in use and there are no UI layers to
+ // be composed to FB , no need to configure FbUpdate.
+ if(!needFbUpdate(ctx, list, mDpy))
+ return false;
+
overlay::Overlay& ov = *(ctx->mOverlay);
private_handle_t *hnd = (private_handle_t *)layer->handle;
ovutils::Whf info(hnd->width, hnd->height,