From ef62685ddd775605827c1892e4989624aa97e06b Mon Sep 17 00:00:00 2001 From: Sushil Chauhan Date: Sat, 19 Nov 2011 16:38:14 -0800 Subject: [PATCH] Enable Composition Bypass. 1. Enable composition bypass for 1 or 2 non-overlapping layers. 2. Open bypass only if video playback status is CLOSED. 3. Close bypass immediately if Video or Camera needs VG pipe. Change-Id: I1bef030b32ff2721d00b61f7717027d4d9219d04 --- libhwcomposer/Android.mk | 2 +- libhwcomposer/hwcomposer.cpp | 34 +++++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/libhwcomposer/Android.mk b/libhwcomposer/Android.mk index 4f0ecc3..71ebf63 100644 --- a/libhwcomposer/Android.mk +++ b/libhwcomposer/Android.mk @@ -21,7 +21,7 @@ ifeq ($(TARGET_HAVE_HDMI_OUT),true) LOCAL_CFLAGS += -DHDMI_DUAL_DISPLAY endif ifeq ($(TARGET_HAVE_BYPASS),true) -#LOCAL_CFLAGS += -DCOMPOSITION_BYPASS +LOCAL_CFLAGS += -DCOMPOSITION_BYPASS endif ifeq ($(TARGET_USE_HDMI_AS_PRIMARY),true) #LOCAL_CFLAGS += -DHDMI_AS_PRIMARY diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index bc18a01..c43d5c1 100644 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -120,7 +120,7 @@ struct private_hwc_module_t { copybit_device_t *copybitEngine; framebuffer_device_t *fbDevice; int compositionType; - bool isBypassEnabled; //from build.prop debug.compbypass.enable + bool isBypassEnabled; //from build.prop ro.sf.compbypass.enable }; struct private_hwc_module_t HAL_MODULE_INFO_SYM = { @@ -225,11 +225,31 @@ static int hwc_closeOverlayChannels(hwc_context_t* ctx) { return 0; } +#ifdef COMPOSITION_BYPASS +// To-do: Merge this with other blocks & move them to a separate file. +void closeBypass(hwc_context_t* ctx) { + for (int index = 0 ; index < MAX_BYPASS_LAYERS; index++) { + ctx->mOvUI[index]->closeChannel(); + #ifdef DEBUG + LOGE("%s", __FUNCTION__); + #endif + } +} +#endif + /* * Configures mdp pipes */ static int prepareOverlay(hwc_context_t *ctx, hwc_layer_t *layer, const bool waitForVsync) { int ret = 0; + +#ifdef COMPOSITION_BYPASS + if(ctx && (ctx->bypassState != BYPASS_OFF)) { + closeBypass(ctx); + ctx->bypassState = BYPASS_OFF; + } +#endif + if (LIKELY(ctx && ctx->mOverlayLibObject)) { private_hwc_module_t* hwcModule = reinterpret_cast(ctx->device.common.module); @@ -502,7 +522,7 @@ inline static bool isBypassDoable(hwc_composer_device_t *dev, const int yuvCount return false; } #endif - return (yuvCount == 0) && isDisjoint(list); + return (yuvCount == 0) && (ctx->hwcOverlayStatus == HWC_OVERLAY_CLOSED) && isDisjoint(list); } /* @@ -550,14 +570,6 @@ void unsetBypassLayerFlags(hwc_layer_list_t* list) { } } -void closeBypass(hwc_context_t* ctx) { - for (int index = 0 ; index < MAX_BYPASS_LAYERS; index++) { - ctx->mOvUI[index]->closeChannel(); - #ifdef DEBUG - LOGE("%s", __FUNCTION__); - #endif - } -} #endif //COMPOSITION_BYPASS @@ -1090,7 +1102,7 @@ static int hwc_module_initialize(struct private_hwc_module_t* hwcModule) } //Check if composition bypass is enabled - if(property_get("debug.compbypass.enable", property, NULL) > 0) { + if(property_get("ro.sf.compbypass.enable", property, NULL) > 0) { if(atoi(property) == 1) { hwcModule->isBypassEnabled = true; }