From ae67b6bd336ef5277c97acdb20216d8862989393 Mon Sep 17 00:00:00 2001 From: Saurabh Shah Date: Tue, 12 Jul 2011 17:41:10 -0700 Subject: [PATCH] Put HDMI code under compile time flag Put HDMI code in HWC under compile time flag. This prevents crashes in use cases like HDMI used as primary. If not done, non-existing code in gralloc is called in that use case. Change-Id: Ic7e792acf0c35eb12f04a74405619385d7288991 --- libhwcomposer/Android.mk | 3 +++ libhwcomposer/hwcomposer.cpp | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libhwcomposer/Android.mk b/libhwcomposer/Android.mk index 632190b..5f23f61 100755 --- a/libhwcomposer/Android.mk +++ b/libhwcomposer/Android.mk @@ -16,5 +16,8 @@ LOCAL_C_INCLUDES += hardware/msm7k/libgralloc-qsd8k LOCAL_C_INCLUDES += hardware/msm7k/liboverlay LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr +ifeq ($(TARGET_HAVE_HDMI_OUT),true) +LOCAL_CFLAGS += -DHDMI_DUAL_DISPLAY +endif include $(BUILD_SHARED_LIBRARY) diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index f1b32a5..557f566 100755 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -127,6 +127,7 @@ static void dump_layer(hwc_layer_t const* l) { } static void hwc_enableHDMIOutput(hwc_composer_device_t *dev, bool enable) { +#if defined HDMI_DUAL_DISPLAY hwc_context_t* ctx = (hwc_context_t*)(dev); private_hwc_module_t* hwcModule = reinterpret_cast( dev->common.module); @@ -148,10 +149,11 @@ static void hwc_enableHDMIOutput(hwc_composer_device_t *dev, bool enable) { fbDev->videoOverlayStarted(fbDev, false); } } +#endif } static int hwc_updateOverlayStatus(hwc_context_t* ctx, int layerType) { - +#if defined HDMI_DUAL_DISPLAY private_hwc_module_t* hwcModule = reinterpret_cast( ctx->device.common.module); overlay::Overlay *ovLibObject = ctx->mOverlayLibObject; @@ -180,6 +182,7 @@ static int hwc_updateOverlayStatus(hwc_context_t* ctx, int layerType) { ovLibObject->closeChannel(); fbDev->videoOverlayStarted(fbDev, false); } +#endif return 0; }