Merge "hwc: Configure FbUpdate only when needed"
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,
diff --git a/libhwcomposer/hwc_fbupdate.h b/libhwcomposer/hwc_fbupdate.h
index 5fc7708..ddd24d7 100644
--- a/libhwcomposer/hwc_fbupdate.h
+++ b/libhwcomposer/hwc_fbupdate.h
@@ -41,7 +41,10 @@
virtual void reset();
//Factory method that returns a low-res or high-res version
static IFBUpdate *getObject(const int& width, const int& dpy);
-
+ //To know if configuring FbUpdate is needed.
+ static bool needFbUpdate(hwc_context_t *ctx,
+ const hwc_display_contents_1_t *list,
+ int dpy);
protected:
const int mDpy; // display to update
bool mModeOn; // if prepare happened