From 2d998a965819ead06f8575b42eebde0a49bed308 Mon Sep 17 00:00:00 2001 From: Saurabh Shah Date: Tue, 14 May 2013 17:55:58 -0700 Subject: [PATCH] hwc: Implement idle-fallback for videos In case of videos, do a fallback using 2 pipes per mixer at most. This redraw will happen only once to reduce pipes from at most 4 to at most 2 and never draw again until there is an update. Change-Id: I78c0dc2af4e3bd7e9128994e507e777187b4e247 --- libhwcomposer/hwc.cpp | 2 +- libhwcomposer/hwc_mdpcomp.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 9dcb439d..bf997ee4 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -235,7 +235,6 @@ static int hwc_prepare(hwc_composer_device_1 *dev, size_t numDisplays, ctx->mOverlay->configDone(); ctx->mRotMgr->configDone(); - MDPComp::resetIdleFallBack(); return ret; } @@ -501,6 +500,7 @@ static int hwc_set(hwc_composer_device_1 *dev, // This is only indicative of how many times SurfaceFlinger posts // frames to the display. CALC_FPS(); + MDPComp::resetIdleFallBack(); return ret; } diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp index b88674fe..22d90424 100644 --- a/libhwcomposer/hwc_mdpcomp.cpp +++ b/libhwcomposer/hwc_mdpcomp.cpp @@ -366,11 +366,7 @@ bool MDPComp::isFrameDoable(hwc_context_t *ctx) { ctx->isPaddingRound = false; ALOGD_IF(isDebug(), "%s: padding round",__FUNCTION__); ret = false; - } else if(sIdleFallBack) { - ALOGD_IF(isDebug(), "%s: idle fallback",__FUNCTION__); - ret = false; } - return ret; } @@ -381,6 +377,11 @@ bool MDPComp::isFullFrameDoable(hwc_context_t *ctx, const int numAppLayers = ctx->listStats[mDpy].numAppLayers; + if(sIdleFallBack) { + ALOGD_IF(isDebug(), "%s: Idle fallback dpy %d",__FUNCTION__, mDpy); + return false; + } + if(mDpy > HWC_DISPLAY_PRIMARY){ ALOGD_IF(isDebug(), "%s: Cannot support External display(s)", __FUNCTION__); @@ -856,7 +857,7 @@ bool MDPCompLowRes::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) { } /* reset Invalidator */ - if(idleInvalidator && mCurrentFrame.mdpCount) + if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount) idleInvalidator->markForSleep(); overlay::Overlay& ov = *ctx->mOverlay; @@ -1024,7 +1025,7 @@ bool MDPCompHighRes::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) { } /* reset Invalidator */ - if(idleInvalidator && mCurrentFrame.mdpCount) + if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount) idleInvalidator->markForSleep(); overlay::Overlay& ov = *ctx->mOverlay;