From 9426f3d6aad3b9ce919a22aaa80f9d062cfcf2d1 Mon Sep 17 00:00:00 2001 From: Jiyu Yang Date: Fri, 01 Sep 2017 10:45:56 +0000 Subject: hwc2: sync_wait in hwcomposer [5/7] PD#149525 Change-Id: Ifcc791bb9cf4ca95496d0f3abf22aa8460d9e655 --- diff --git a/hwc2/common/devices/PhysicalDevice.cpp b/hwc2/common/devices/PhysicalDevice.cpp index 7311796..cf4babd 100644 --- a/hwc2/common/devices/PhysicalDevice.cpp +++ b/hwc2/common/devices/PhysicalDevice.cpp @@ -740,10 +740,20 @@ int32_t PhysicalDevice::postFramebuffer(int32_t* outRetireFence, bool hasVideoOv mFbSyncRequest.op |= OSD_BLANK_OP_BIT; mFramebufferContext->setStatus(true); mPriorFrameRetireFence = hwc_fb_post_with_fence_locked(&fbInfo, &mFbSyncRequest, NULL); +#if PLATFORM_SDK_VERSION >= 26 //TEMP, will remove later. + HwcFenceControl::wait(*outRetireFence, -1); + HwcFenceControl::closeFd(*outRetireFence); + *outRetireFence = -1; +#endif } else { *outRetireFence = HwcFenceControl::dupFence(mPriorFrameRetireFence); if (*outRetireFence >= 0) { DTRACE("Get prior frame's retire fence %d", *outRetireFence); +#if PLATFORM_SDK_VERSION >= 26 //TEMP, will remove later. + HwcFenceControl::wait(*outRetireFence, -1); + HwcFenceControl::closeFd(*outRetireFence); + *outRetireFence = -1; +#endif } else { ETRACE("No valid prior frame's retire returned. %d ", *outRetireFence); // -1 means no fence, less than -1 is some error @@ -754,6 +764,13 @@ int32_t PhysicalDevice::postFramebuffer(int32_t* outRetireFence, bool hasVideoOv // real post framebuffer here. DTRACE("render type: %d", mFbSyncRequest.type); + +#if PLATFORM_SDK_VERSION >= 26 //TEMP, will remove later. + HwcFenceControl::wait(mTargetAcquireFence, -1); + HwcFenceControl::closeFd(mTargetAcquireFence); + mTargetAcquireFence = -1; +#endif + if (!mIsContinuousBuf) { mPriorFrameRetireFence = fb_post_with_fence_locked(&fbInfo, mClientTargetHnd, mTargetAcquireFence); } else { @@ -841,6 +858,7 @@ int32_t PhysicalDevice::presentDisplay(int32_t* outRetireFence) { mClientTargetHnd = NULL; + ALOGE("presentDisplay return err %d", err); return err; } diff --git a/hwc2/platforms/Android.mk b/hwc2/platforms/Android.mk index 518d88f..31b6698 100644 --- a/hwc2/platforms/Android.mk +++ b/hwc2/platforms/Android.mk @@ -119,5 +119,7 @@ ifneq ($(TARGET_BUILD_VARIANT),user) LOCAL_CFLAGS += -DHWC_TRACE_FPS endif +LOCAL_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) + include $(BUILD_SHARED_LIBRARY) -- cgit