From 6ee9758eb83f419a74651865d10746b760c17b75 Mon Sep 17 00:00:00 2001 From: Jeff Boody Date: Tue, 6 Mar 2012 11:28:23 -0700 Subject: [PATCH] libhwcomposer/libqcomui: disable composition bypass for asynchronous mode The current composition bypass implementation prevents the app frame rate from being decoupled with vsync. As a result when a graphics application requests EGL swap interval zero it is still limited by vsync. This change disables composition bypass if any layers being composited for the frame are in asynchronous mode. CRs-Fixed: 335498 (cherry picked from commit 8e1a74ffff6a07ac9ef649347b7ac23be143f2ea) Change-Id: Ia0b6b14fbc953b04616667a494d98fcca99932f9 --- libhwcomposer/hwcomposer.cpp | 5 ++++- libqcomui/qcom_ui.cpp | 11 +++++++++++ libqcomui/qcom_ui.h | 5 ++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index d52686d..0190a59 100644 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -406,11 +406,14 @@ inline static bool isBypassDoable(hwc_composer_device_t *dev, const int yuvCount return false; } - //Bypass is not efficient if rotation is needed. + //Bypass is not efficient if rotation or asynchronous mode is needed. for(int i = 0; i < list->numHwLayers; ++i) { if(list->hwLayers[i].transform) { return false; } + if(list->hwLayers[i].flags & HWC_LAYER_ASYNCHRONOUS) { + return false; + } } return (yuvCount == 0) && (ctx->hwcOverlayStatus == HWC_OVERLAY_CLOSED) diff --git a/libqcomui/qcom_ui.cpp b/libqcomui/qcom_ui.cpp index 502a651..6bc4eed 100644 --- a/libqcomui/qcom_ui.cpp +++ b/libqcomui/qcom_ui.cpp @@ -354,6 +354,12 @@ int updateLayerQcomFlags(eLayerAttrib attribute, bool enable, int& currentFlags) else currentFlags &= ~LAYER_UPDATING; } break; + case LAYER_ASYNCHRONOUS_STATUS: { + if (enable) + currentFlags |= LAYER_ASYNCHRONOUS; + else + currentFlags &= ~LAYER_ASYNCHRONOUS; + } break; default: LOGE("%s: invalid attribute(0x%x)", __FUNCTION__, attribute); break; } @@ -375,6 +381,11 @@ int getPerFrameFlags(int hwclFlags, int layerFlags) { else flags |= HWC_LAYER_NOT_UPDATING; + if (layerFlags & LAYER_ASYNCHRONOUS) + flags |= HWC_LAYER_ASYNCHRONOUS; + else + flags &= ~HWC_LAYER_ASYNCHRONOUS; + return flags; } diff --git a/libqcomui/qcom_ui.h b/libqcomui/qcom_ui.h index 6cad8ed..b1fe853 100644 --- a/libqcomui/qcom_ui.h +++ b/libqcomui/qcom_ui.h @@ -67,13 +67,15 @@ enum { */ enum eLayerAttrib { LAYER_UPDATE_STATUS, + LAYER_ASYNCHRONOUS_STATUS, }; /* * Layer Flags */ enum { - LAYER_UPDATING = 1<<0, + LAYER_UPDATING = 1<<0, + LAYER_ASYNCHRONOUS = 1<<1, }; /* @@ -81,6 +83,7 @@ enum { */ enum { HWC_LAYER_NOT_UPDATING = 0x00000002, + HWC_LAYER_ASYNCHRONOUS = 0x00000004, HWC_USE_ORIGINAL_RESOLUTION = 0x10000000, HWC_DO_NOT_USE_OVERLAY = 0x20000000, HWC_COMP_BYPASS = 0x40000000,