From b42b1ac1587aebda5e2f334d95b620271fafba4e Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Thu, 28 Jun 2012 14:27:53 -0700 Subject: Return fence from acquireBuffer Change-Id: Iab22054c1dc4fd84affab3cc5bbdcd5a1e689666 --- services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'services/surfaceflinger') diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp index 02d2b10..6cfb190 100644 --- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp +++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp @@ -106,6 +106,16 @@ void FramebufferSurface::onFirstRef() { if (item.mGraphicBuffer != 0) { self->mBuffers[item.mBuf] = item.mGraphicBuffer; } + if (item.mFence.get()) { + err = item.mFence->wait(Fence::TIMEOUT_NEVER); + if (err) { + ALOGE("failed waiting for buffer's fence: %d", err); + self->mBufferQueue->releaseBuffer(item.mBuf, + EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, + item.mFence); + return; + } + } self->fbDev->post(self->fbDev, self->mBuffers[item.mBuf]->handle); if (self->mCurrentBufferIndex >= 0) { self->mBufferQueue->releaseBuffer(self->mCurrentBufferIndex, -- cgit v1.1