From: Jesse Hall Date: Thu, 28 Feb 2013 00:39:25 +0000 (-0800) Subject: Initialize DisplayData fences to NO_FENCE, not NULL X-Git-Tag: android-x86-4.4-r1~115^2~160 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a9a1b006;p=android-x86%2Fframeworks-native.git Initialize DisplayData fences to NO_FENCE, not NULL Also fix another place that was checking for NULL fence rather than Fence::isValid(). Bug 8283950 Change-Id: Ie06db327eb416828d8dac139171d96d4470b2e35 --- diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 6f85f69031..11f65f6245 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -1049,5 +1049,21 @@ bool HWComposer::VSyncThread::threadLoop() { return true; } +HWComposer::DisplayData::DisplayData() +: width(0), height(0), format(0), + xdpi(0.0f), ydpi(0.0f), + refresh(0), + connected(false), + hasFbComp(false), hasOvComp(false), + capacity(0), list(NULL), + framebufferTarget(NULL), fbTargetHandle(0), + lastRetireFence(Fence::NO_FENCE), lastDisplayFence(Fence::NO_FENCE), + events(0) +{} + +HWComposer::DisplayData::~DisplayData() { + free(list); +} + // --------------------------------------------------------------------------- }; // namespace android diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h index 05f7784352..f7ed1aa0b4 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.h +++ b/services/surfaceflinger/DisplayHardware/HWComposer.h @@ -289,13 +289,8 @@ private: struct DisplayData { - DisplayData() : xdpi(0), ydpi(0), refresh(0), - connected(false), hasFbComp(false), hasOvComp(false), - capacity(0), list(NULL), - framebufferTarget(NULL), fbTargetHandle(NULL), events(0) { } - ~DisplayData() { - free(list); - } + DisplayData(); + ~DisplayData(); uint32_t width; uint32_t height; uint32_t format; // pixel format from FB hal, for pre-hwc-1.1 diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 09a1c59331..ee3e93b1a4 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -892,7 +892,7 @@ void SurfaceFlinger::postComposition() const HWComposer& hwc = getHwComposer(); sp presentFence = hwc.getDisplayFence(HWC_DISPLAY_PRIMARY); - if (presentFence != NULL) { + if (presentFence->isValid()) { mAnimFrameTracker.setActualPresentFence(presentFence); } else { // The HWC doesn't support present fences, so use the refresh