From 7493d7c6ccc76c75d3ce39d744a44d287b579207 Mon Sep 17 00:00:00 2001 From: Andrew Sutherland Date: Mon, 4 Jun 2012 21:18:29 -0500 Subject: [PATCH] libqcomui: convert *FormatInHW to a switch and ifdef it caf removed this hack when the mdp driver was updated for the YAMATO format. We dont have that yet so keep it around but make it optional. depends on BOARD_ADRENO_DECIDE_TEXTURE_TARGET enable with BOARD_ADRENO_AVOID_EXTERNAL_TEXTURE:= true Change-Id: I99b9a60d76d4515682db9717e3cb68bc17aff800 --- libqcomui/Android.mk | 20 ++++++++++---------- libqcomui/qcom_ui.cpp | 32 ++++++++++++++++---------------- libqcomui/qcom_ui.h | 2 ++ 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/libqcomui/Android.mk b/libqcomui/Android.mk index 08d971b..22d15c2 100644 --- a/libqcomui/Android.mk +++ b/libqcomui/Android.mk @@ -6,16 +6,6 @@ LOCAL_SRC_FILES := \ utils/profiler.cpp \ utils/IdleTimer.cpp -LOCAL_CFLAGS := -DLOG_TAG=\"libQcomUI\" - -ifeq ($(TARGET_BOARD_PLATFORM),qsd8k) # these are originally for 7x27a - LOCAL_CFLAGS += -DCHECK_FOR_EXTERNAL_FORMAT -endif - -ifeq ($(BOARD_ADRENO_DECIDE_TEXTURE_TARGET),true) - LOCAL_CFLAGS += -DDECIDE_TEXTURE_TARGET -endif - LOCAL_SHARED_LIBRARIES := \ libutils \ libcutils \ @@ -29,7 +19,17 @@ LOCAL_C_INCLUDES := $(TOP)/hardware/qcom/display/libgralloc \ $(TOP)/external/skia/include/core \ $(TOP)/external/skia/include/images +LOCAL_CFLAGS := -DLOG_TAG=\"libQcomUI\" LOCAL_CFLAGS += -DDEBUG_CALC_FPS + +# Hacks for broken mdp versions +ifeq ($(BOARD_ADRENO_DECIDE_TEXTURE_TARGET),true) + LOCAL_CFLAGS += -DDECIDE_TEXTURE_TARGET + ifeq ($(BOARD_ADRENO_AVOID_EXTERNAL_TEXTURE),true) + LOCAL_CFLAGS += -DCHECK_FOR_EXTERNAL_FORMAT + endif +endif + LOCAL_MODULE := libQcomUI LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) diff --git a/libqcomui/qcom_ui.cpp b/libqcomui/qcom_ui.cpp index b4fcda8..b83e0a8 100644 --- a/libqcomui/qcom_ui.cpp +++ b/libqcomui/qcom_ui.cpp @@ -190,25 +190,25 @@ int decideTextureTarget(int pixel_format) * * @return true if the format is supported by the GPU. */ -bool isGPUSupportedFormatInHW(int format) { - // For 7x27A bypass creating EGL image for formats not natively supported - // in GPU. - // This is done to save CPU utilization by SurfaceFlinger thread #ifdef CHECK_FOR_EXTERNAL_FORMAT - - if (format == HAL_PIXEL_FORMAT_YV12){ - return false; - } else if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP) { - return false; - } else if (format == HAL_PIXEL_FORMAT_YCbCr_420_SP) { - return false; - } else if (format == HAL_PIXEL_FORMAT_NV12_ENCODEABLE) { - return false; +bool isGPUSupportedFormatInHW(int format) { + // For 7x27A bypass creating EGL image for formats not natively supported in GPU. + // This is done to save CPU utilization by SurfaceFlinger thread + bool retVal = true; + switch(format) { + case HAL_PIXEL_FORMAT_YV12: + case HAL_PIXEL_FORMAT_YCrCb_420_SP: + case HAL_PIXEL_FORMAT_YCbCr_420_SP: + case HAL_PIXEL_FORMAT_NV12_ENCODEABLE: + retVal = false; + break; + default: + retVal = true; + break; } -#endif - - return true; + return retVal; } +#endif /* diff --git a/libqcomui/qcom_ui.h b/libqcomui/qcom_ui.h index 7e7a6b1..f78650c 100644 --- a/libqcomui/qcom_ui.h +++ b/libqcomui/qcom_ui.h @@ -211,7 +211,9 @@ bool isGPUSupportedFormat(int format); * * @return true if the format is supported by the GPU. */ +#ifdef CHECK_FOR_EXTERNAL_FORMAT bool isGPUSupportedFormatInHW(int format); +#endif /* * Adreno is not optimized for GL_TEXTURE_EXTERNAL_OES