From 85ff2df3a56ef44bd9b101d01be430d0bb4494ad Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Tue, 7 Aug 2012 19:56:31 -0700 Subject: [PATCH] display: Add option to disable hardware VSYNC * Set TARGET_NO_HW_VSYNC to disable use of VSYNC Change-Id: I9c48f89ba6d4a39baf7c149717b13c83c0b7f3eb Conflicts: common.mk libhwcomposer/hwc.cpp --- common.mk | 10 ++-------- libhwcomposer/hwc.cpp | 15 +++++++++------ libhwcomposer/hwc_external.cpp | 2 ++ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/common.mk b/common.mk index 11766fd..07afeb3 100644 --- a/common.mk +++ b/common.mk @@ -26,12 +26,6 @@ ifeq ($(ARCH_ARM_HAVE_NEON),true) common_flags += -D__ARM_HAVE_NEON endif -common_deps := -kernel_includes := -#Kernel includes -ifeq ($(call is-vendor-board-platform,QCOM),true) - common_deps += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr - kernel_includes += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include +ifeq ($(TARGET_NO_HW_VSYNC),true) + common_flags += -DNO_HW_VSYNC endif - - diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index ff4d5a0..4779a96 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -120,6 +120,7 @@ static int hwc_eventControl(struct hwc_composer_device* dev, private_module_t* m = reinterpret_cast( ctx->mFbDev->common.module); switch(event) { +#ifndef NO_HW_VSYNC case HWC_EVENT_VSYNC: if(ioctl(m->framebuffer->fd, MSMFB_OVERLAY_VSYNC_CTRL, &value) < 0) ret = -errno; @@ -128,6 +129,7 @@ static int hwc_eventControl(struct hwc_composer_device* dev, ret = ctx->mExtDisplay->enableHDMIVsync(value); } break; +#endif case HWC_EVENT_ORIENTATION: ctx->deviceOrientation = value; break; @@ -219,12 +221,13 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name, methods->eventControl = hwc_eventControl; dev->device.common.tag = HARDWARE_DEVICE_TAG; - //XXX: This disables hardware vsync on 8x55 - // Fix when HW vsync is available on 8x55 - if(dev->mMDP.version == 400) - dev->device.common.version = 0; - else - dev->device.common.version = HWC_DEVICE_API_VERSION_0_3; +#ifdef NO_HW_VSYNC + dev->device.common.version = 0; + ALOGI("%s: Hardware VSYNC not supported", __FUNCTION__); +#else + dev->device.common.version = HWC_DEVICE_API_VERSION_0_3; + ALOGI("%s: Hardware VSYNC supported", __FUNCTION__); +#endif dev->device.common.module = const_cast(module); dev->device.common.close = hwc_device_close; dev->device.prepare = hwc_prepare; diff --git a/libhwcomposer/hwc_external.cpp b/libhwcomposer/hwc_external.cpp index e624b20..70421a6 100644 --- a/libhwcomposer/hwc_external.cpp +++ b/libhwcomposer/hwc_external.cpp @@ -496,6 +496,7 @@ bool ExternalDisplay::commit() int ExternalDisplay::enableHDMIVsync(int enable) { +#ifndef NO_HW_VSYNC if(mFd > 0) { int ret = ioctl(mFd, MSMFB_OVERLAY_VSYNC_CTRL, &enable); if (ret<0) { @@ -503,6 +504,7 @@ int ExternalDisplay::enableHDMIVsync(int enable) strerror(errno)); } } +#endif return -errno; }