summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueue.cpp
diff options
context:
space:
mode:
author Jesse Hall <jessehall@google.com> 2012-06-14 15:26:33 -0700
committer Jesse Hall <jessehall@google.com> 2012-06-21 22:21:12 -0700
commitf78575400977f644cf0b12beb2fa5fc278b6ed4c (patch)
tree075c491472c6584c30920dbb26f8c97811e2f882 /libs/gui/BufferQueue.cpp
parentef19414bd8b77a26f5751f3845be79025a8263fe (diff)
Pass fences from BufferQueue to SurfaceTextureClient
ISurfaceTexture::dequeueBuffer now returns the buffer's fence for the client to wait on. For BufferQueue, this means passing it through Binder so it can be returned to the SurfaceTextureClient. Now SurfaceTextureClient is responsible for waiting on the fence in dequeueBuffer instead of BufferQueue: one step closer to the goal. Change-Id: I677ae758bcd23acee2d784b8cec11b32cccc196d
Diffstat (limited to 'libs/gui/BufferQueue.cpp')
-rw-r--r--libs/gui/BufferQueue.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 23ac882120..40e43a18d1 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -294,8 +294,8 @@ status_t BufferQueue::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
return NO_ERROR;
}
-status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
- uint32_t format, uint32_t usage) {
+status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>& outFence,
+ uint32_t w, uint32_t h, uint32_t format, uint32_t usage) {
ATRACE_CALL();
ST_LOGV("dequeueBuffer: w=%d h=%d fmt=%#x usage=%#x", w, h, format, usage);
@@ -307,7 +307,6 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
status_t returnFlags(OK);
EGLDisplay dpy = EGL_NO_DISPLAY;
EGLSyncKHR fence = EGL_NO_SYNC_KHR;
- sp<Fence> releaseFence;
{ // Scope for the lock
Mutex::Autolock lock(mMutex);
@@ -490,7 +489,7 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
dpy = mSlots[buf].mEglDisplay;
fence = mSlots[buf].mFence;
- releaseFence = mSlots[buf].mReleaseFence;
+ outFence = mSlots[buf].mReleaseFence;
mSlots[buf].mFence = EGL_NO_SYNC_KHR;
mSlots[buf].mReleaseFence.clear();
} // end lock scope
@@ -508,16 +507,6 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
eglDestroySyncKHR(dpy, fence);
}
- if (releaseFence.get()) {
- int err = releaseFence->wait(1000);
- if (err == -ETIME) {
- ALOGE("dequeueBuffer: timeout waiting for release fence");
- } else if (err != NO_ERROR) {
- ALOGE("dequeueBuffer: error waiting for sync fence: %d", err);
- }
- releaseFence.clear();
- }
-
ST_LOGV("dequeueBuffer: returning slot=%d buf=%p flags=%#x", *outBuf,
mSlots[*outBuf].mGraphicBuffer->handle, returnFlags);