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
This commit is contained in:
Jesse Hall 2013-02-27 16:39:25 -08:00
parent 3e010f3138
commit a9a1b006e4
3 changed files with 19 additions and 8 deletions

View File

@ -1049,5 +1049,21 @@ bool HWComposer::VSyncThread::threadLoop() {
return true; 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 }; // namespace android

View File

@ -289,13 +289,8 @@ private:
struct DisplayData { struct DisplayData {
DisplayData() : xdpi(0), ydpi(0), refresh(0), DisplayData();
connected(false), hasFbComp(false), hasOvComp(false), ~DisplayData();
capacity(0), list(NULL),
framebufferTarget(NULL), fbTargetHandle(NULL), events(0) { }
~DisplayData() {
free(list);
}
uint32_t width; uint32_t width;
uint32_t height; uint32_t height;
uint32_t format; // pixel format from FB hal, for pre-hwc-1.1 uint32_t format; // pixel format from FB hal, for pre-hwc-1.1

View File

@ -892,7 +892,7 @@ void SurfaceFlinger::postComposition()
const HWComposer& hwc = getHwComposer(); const HWComposer& hwc = getHwComposer();
sp<Fence> presentFence = hwc.getDisplayFence(HWC_DISPLAY_PRIMARY); sp<Fence> presentFence = hwc.getDisplayFence(HWC_DISPLAY_PRIMARY);
if (presentFence != NULL) { if (presentFence->isValid()) {
mAnimFrameTracker.setActualPresentFence(presentFence); mAnimFrameTracker.setActualPresentFence(presentFence);
} else { } else {
// The HWC doesn't support present fences, so use the refresh // The HWC doesn't support present fences, so use the refresh