From e1ea460dc4ba4ff4e9060aa233ed454b1675da45 Mon Sep 17 00:00:00 2001 From: Kyong Hwa Bae Date: Thu, 26 Apr 2012 15:27:57 -0700 Subject: [PATCH] HWComposer: Set the transform value correctly When using the bypass, read only last 4 bits of the transfrom value regarding the change of transform value in Layer::setGeometry(). (cherry picked from commit 7689940bec6440b78418cb15a9888312ab96ea04) Change-Id: Ida5781e3e92929b8024947a41e5521f83164a4f7 Conflicts: libhwcomposer/hwcomposer.cpp --- libhwcomposer/hwcomposer.cpp | 8 ++++---- liboverlay/Android.mk | 1 + liboverlay/overlayLib.h | 7 +------ libqcomui/qcom_ui.cpp | 15 ++++++++------- libqcomui/qcom_ui.h | 7 +++++++ 5 files changed, 21 insertions(+), 17 deletions(-) mode change 100755 => 100644 liboverlay/Android.mk mode change 100755 => 100644 liboverlay/overlayLib.h diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index 0fe1450..ea7eb1e 100644 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -149,7 +149,7 @@ struct private_hwc_module_t HAL_MODULE_INFO_SYM = { static void dump_layer(hwc_layer_t const* l) { LOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}, {%d,%d,%d,%d}", - l->compositionType, l->flags, l->handle, l->transform, l->blending, + l->compositionType, l->flags, l->handle, l->transform & FINAL_TRANSFORM_MASK, l->blending, l->sourceCrop.left, l->sourceCrop.top, l->sourceCrop.right, @@ -391,7 +391,7 @@ static int prepareBypass(hwc_context_t *ctx, hwc_layer_t *layer, info.size = hnd->size; int fbnum = 0; - int orientation = layer->transform; + int orientation = layer->transform & FINAL_TRANSFORM_MASK; const bool useVGPipe = #ifdef NO_BYPASS_CROPPING (nPipeIndex != (MAX_BYPASS_LAYERS - 2)); @@ -490,7 +490,7 @@ inline static bool isBypassDoable(hwc_composer_device_t *dev, const int yuvCount //Bypass is not efficient if rotation or asynchronous mode is needed. for(int i = 0; i < list->numHwLayers; ++i) { - if(list->hwLayers[i].transform) { + if(list->hwLayers[i].transform & FINAL_TRANSFORM_MASK) { return false; } if(list->hwLayers[i].flags & HWC_LAYER_ASYNCHRONOUS) { diff --git a/liboverlay/Android.mk b/liboverlay/Android.mk old mode 100755 new mode 100644 index 5949cc9..02bbb84 --- a/liboverlay/Android.mk +++ b/liboverlay/Android.mk @@ -20,6 +20,7 @@ LOCAL_PRELINK_MODULE := false LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES) LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libmemalloc LOCAL_C_INCLUDES += hardware/qcom/display/libgralloc +LOCAL_C_INCLUDES += hardware/qcom/display/libqcomui LOCAL_SRC_FILES := \ overlayLib.cpp \ overlayLibUI.cpp \ diff --git a/liboverlay/overlayLib.h b/liboverlay/overlayLib.h old mode 100755 new mode 100644 index 639d584..d0847cd --- a/liboverlay/overlayLib.h +++ b/liboverlay/overlayLib.h @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef USES_POST_PROCESSING #include "lib-postproc.h" @@ -61,12 +62,6 @@ #define FRAMEBUFFER_1 1 #define FRAMEBUFFER_2 2 -// To extract the src buffer transform -#define SHIFT_SRC_TRANSFORM 4 -#define SRC_TRANSFORM_MASK 0x00F0 -#define FINAL_TRANSFORM_MASK 0x000F - - #define NUM_SHARPNESS_VALS 256 #define SHARPNESS_RANGE 1.0f #define HUE_RANGE 180 diff --git a/libqcomui/qcom_ui.cpp b/libqcomui/qcom_ui.cpp index 0f3769a..2d88842 100644 --- a/libqcomui/qcom_ui.cpp +++ b/libqcomui/qcom_ui.cpp @@ -713,6 +713,7 @@ void dumpLayer(int moduleCompositionType, int listFlags, size_t layerIndex, hwc_rect_t displayFrame = layer->displayFrame; private_handle_t *hnd = (private_handle_t *)layer->handle; char pixelformatstr[32] = "None"; + uint32_t transform = layer->transform & FINAL_TRANSFORM_MASK; if (hnd) getHalPixelFormatStr(hnd->format, pixelformatstr); @@ -737,13 +738,13 @@ void dumpLayer(int moduleCompositionType, int listFlags, size_t layerIndex, (layer->compositionType == HWC_OVERLAY)? "Overlay": (layer->compositionType == HWC_USE_COPYBIT)? "Copybit": "???", pixelformatstr, - (layer->transform == Transform::ROT_0)? "ROT_0": - (layer->transform == Transform::FLIP_H)? "FLIP_H": - (layer->transform == Transform::FLIP_V)? "FLIP_V": - (layer->transform == Transform::ROT_90)? "ROT_90": - (layer->transform == Transform::ROT_180)? "ROT_180": - (layer->transform == Transform::ROT_270)? "ROT_270": - (layer->transform == Transform::ROT_INVALID)? "ROT_INVALID":"???", + (transform == Transform::ROT_0)? "ROT_0": + (transform == Transform::FLIP_H)? "FLIP_H": + (transform == Transform::FLIP_V)? "FLIP_V": + (transform == Transform::ROT_90)? "ROT_90": + (transform == Transform::ROT_180)? "ROT_180": + (transform == Transform::ROT_270)? "ROT_270": + (transform == Transform::ROT_INVALID)? "ROT_INVALID":"???", (layer->flags == 0)? "[None]":"", (layer->flags & HWC_SKIP_LAYER)? "[Skip layer]":"", (layer->flags & HWC_LAYER_NOT_UPDATING)? "[Layer not updating]":"", diff --git a/libqcomui/qcom_ui.h b/libqcomui/qcom_ui.h index b6e8fae..4089022 100644 --- a/libqcomui/qcom_ui.h +++ b/libqcomui/qcom_ui.h @@ -79,6 +79,13 @@ enum { LAYER_ASYNCHRONOUS = 1<<1, }; +/* + * Layer Transformation - refers to Layer::setGeometry() + */ +#define SHIFT_SRC_TRANSFORM 4 +#define SRC_TRANSFORM_MASK 0x00F0 +#define FINAL_TRANSFORM_MASK 0x000F + /* * Flags set by the layer and sent to HWC */