From 8d7ff87f5c874ea1af716379e9bfbc485ef869ec Mon Sep 17 00:00:00 2001 From: Naomi Luis Date: Sun, 11 Dec 2011 15:25:13 -0800 Subject: [PATCH] libQcomUI: Add support for qcom specific layer flags. Add support for updating the qcom specific layer flags. Add support for getting the per frame HWC flags based on the layer flags. Change-Id: I5f7759a6a7fae6d4f70dd26f380a9b08e48e9475 --- libqcomui/qcom_ui.cpp | 41 ++++++++++++++++++++++++++++++++++++++ libqcomui/qcom_ui.h | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/libqcomui/qcom_ui.cpp b/libqcomui/qcom_ui.cpp index df82cae..9de00e7 100644 --- a/libqcomui/qcom_ui.cpp +++ b/libqcomui/qcom_ui.cpp @@ -249,4 +249,45 @@ int updateBufferGeometry(sp buffer, const qBufGeometry updatedGeo return 0; } +/* + * Updates the flags for the layer + * + * @param: Attribute + * @param: Identifies if the attribute was enabled or disabled. + * + * @return: -EINVAL if the attribute is invalid + */ +int updateLayerQcomFlags(eLayerAttrib attribute, bool enable, int& currentFlags) +{ + int ret = 0; + switch (attribute) { + case LAYER_UPDATE_STATUS: { + if (enable) + currentFlags |= LAYER_UPDATING; + else + currentFlags &= ~LAYER_UPDATING; + } break; + default: LOGE("%s: invalid attribute(0x%x)", __FUNCTION__, attribute); + break; + } + return ret; +} + +/* + * Gets the per frame HWC flags for this layer. + * + * @param: current hwcl flags + * @param: current layerFlags + * + * @return: the per frame flags. + */ +int getPerFrameFlags(int hwclFlags, int layerFlags) { + int flags = hwclFlags; + if (layerFlags & LAYER_UPDATING) + flags &= ~HWC_LAYER_NOT_UPDATING; + else + flags |= HWC_LAYER_NOT_UPDATING; + + return flags; +} diff --git a/libqcomui/qcom_ui.h b/libqcomui/qcom_ui.h index 0b78f47..6744edf 100644 --- a/libqcomui/qcom_ui.h +++ b/libqcomui/qcom_ui.h @@ -44,6 +44,30 @@ enum { NATIVE_WINDOW_UPDATE_BUFFERS_GEOMETRY = 0x20000000, }; +/* + * Layer Attributes + */ +enum eLayerAttrib { + LAYER_UPDATE_STATUS, +}; + +/* + * Layer Flags + */ +enum { + LAYER_UPDATING = 1<<0, +}; + +/* + * Flags set by the layer and sent to HWC + */ +enum { + HWC_LAYER_NOT_UPDATING = 0x00000002, + HWC_USE_ORIGINAL_RESOLUTION = 0x10000000, + HWC_DO_NOT_USE_OVERLAY = 0x20000000, + HWC_COMP_BYPASS = 0x40000000, +}; + /* * Structure to hold the buffer geometry */ @@ -109,4 +133,26 @@ bool needNewBuffer(const qBufGeometry currentGeometry, * @param: Updated buffer geometry */ int updateBufferGeometry(sp buffer, const qBufGeometry bufGeometry); + +/* + * Updates the flags for the layer + * + * @param: Attribute + * @param: Identifies if the attribute was enabled or disabled. + * @param: current Layer flags. + * + * @return: Flags for the layer + */ +int updateLayerQcomFlags(eLayerAttrib attribute, bool enable, int& currentFlags); + +/* + * Gets the per frame HWC flags for this layer. + * + * @param: current hwcl flags + * @param: current layerFlags + * + * @return: the per frame flags. + */ +int getPerFrameFlags(int hwclFlags, int layerFlags); + #endif // INCLUDE_LIBQCOM_UI