From 7c86dfe139a930502d77b13cb55540014429ace2 Mon Sep 17 00:00:00 2001 From: Jeykumar Sankaran Date: Thu, 2 Aug 2012 17:41:40 -0700 Subject: [PATCH] libhwcomposer: Reset composition types on idle timeout. SurfaceFlinger re-creates HWC worklist only for new frame and on layer geometry change. Invalidate triggered by idle timeout refreshes the existing worklist retaining its previous composition type. So its MDP comp's responsibility to clear layer composition types to HWC_FRAMEBUFFER on timeout. Change-Id: Ibf11dd6c12c647c75d36d8cbad408c3ea70588bd --- libhwcomposer/hwc_mdpcomp.cpp | 13 +++++++++++-- libhwcomposer/hwc_mdpcomp.h | 5 +++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp index 35b7e7b..d292ea4 100644 --- a/libhwcomposer/hwc_mdpcomp.cpp +++ b/libhwcomposer/hwc_mdpcomp.cpp @@ -125,6 +125,15 @@ void MDPComp::timeout_handler(void *udata) { proc->invalidate(proc); } +void MDPComp::reset_comp_type(hwc_layer_list_t* list) { + for(uint32_t i = 0 ; i < list->numHwLayers; i++ ) { + hwc_layer_t* l = &list->hwLayers[i]; + + if(l->compositionType == HWC_OVERLAY) + l->compositionType = HWC_FRAMEBUFFER; + } +} + void MDPComp::reset( hwc_context_t *ctx, hwc_layer_list_t* list ) { sCurrentFrame.count = 0; free(sCurrentFrame.pipe_layer); @@ -333,8 +342,7 @@ int MDPComp::prepare(hwc_context_t *ctx, hwc_layer_t *layer, * 5. Overlay in use */ -bool MDPComp::is_doable(hwc_composer_device_t *dev, - const hwc_layer_list_t* list) { +bool MDPComp::is_doable(hwc_composer_device_t *dev, hwc_layer_list_t* list) { hwc_context_t* ctx = (hwc_context_t*)(dev); if(!ctx) { @@ -355,6 +363,7 @@ bool MDPComp::is_doable(hwc_composer_device_t *dev, //FB composition on idle timeout if(sIdleFallBack) { + reset_comp_type(list); ALOGD_IF(isDebug(), "%s: idle fallback",__FUNCTION__); return false; } diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h index 199204c..2c50cd1 100644 --- a/libhwcomposer/hwc_mdpcomp.h +++ b/libhwcomposer/hwc_mdpcomp.h @@ -180,8 +180,7 @@ private: mdp_pipe_info& mdp_info); /* checks for conditions where mdpcomp is not possible */ - static bool is_doable(hwc_composer_device_t *dev, - const hwc_layer_list_t* list); + static bool is_doable(hwc_composer_device_t *dev, hwc_layer_list_t* list); static bool setup(hwc_context_t* ctx, hwc_layer_list_t* list); @@ -210,6 +209,8 @@ private: /* reset state */ static void reset( hwc_context_t *ctx, hwc_layer_list_t* list ); + /* reset compostiion type to default */ + static void reset_comp_type(hwc_layer_list_t* list); /* Is feature enabled */ static bool isEnabled() { return sMaxLayers ? true : false; };