Bug 1163681 - Fix fence handling r=mwu

This commit is contained in:
Sotaro Ikeda 2015-05-14 10:22:07 -07:00
parent bb8bdad0fd
commit 98078d2a0e
2 changed files with 12 additions and 4 deletions

View File

@ -315,18 +315,27 @@ GonkDisplayJB::DequeueBuffer()
return static_cast<ANativeWindowBuffer*>(mBootAnimBuffer.get());
}
ANativeWindowBuffer *buf;
mSTClient->dequeueBuffer(mSTClient.get(), &buf, &mFence);
int fenceFd = -1;
mSTClient->dequeueBuffer(mSTClient.get(), &buf, &fenceFd);
sp<Fence> fence(new Fence(fenceFd));
#if ANDROID_VERSION == 17
fence->waitForever(1000, "GonkDisplayJB_DequeueBuffer");
// 1000 is what Android uses. It is a warning timeout in ms.
// This timeout was removed in ANDROID_VERSION 18.
#else
fence->waitForever("GonkDisplayJB_DequeueBuffer");
#endif
return buf;
}
bool
GonkDisplayJB::QueueBuffer(ANativeWindowBuffer* buf)
{
bool success = Post(buf->handle, -1);
int error = 0;
if (!mBootAnimBuffer.get()) {
error = mSTClient->queueBuffer(mSTClient.get(), buf, mFence);
error = mSTClient->queueBuffer(mSTClient.get(), buf, -1);
}
bool success = Post(mDispSurface->lastHandle, mDispSurface->GetPrevDispAcquireFd());
return error == 0 && success;
}

View File

@ -66,7 +66,6 @@ private:
android::sp<ANativeWindow> mSTClient;
android::sp<android::IGraphicBufferAlloc> mAlloc;
android::sp<android::GraphicBuffer> mBootAnimBuffer;
int mFence;
hwc_display_contents_1_t* mList;
uint32_t mWidth;
uint32_t mHeight;