summaryrefslogtreecommitdiffstats
path: root/libs/gui/SurfaceTexture.cpp
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-11-17 16:00:44 -0800
committerJamie Gennis <jgennis@google.com>2011-11-17 16:00:44 -0800
commitaaa3ecff4b49e0918c252e02b3aa18a3ad0d503d (patch)
tree49e6cc5b6e605938bfc83d470e42aea3ef60635b /libs/gui/SurfaceTexture.cpp
parent6a6ff2015d23c68875f7e64aa6fe9fda4c4ea6f4 (diff)
downloadframeworks_native-aaa3ecff4b49e0918c252e02b3aa18a3ad0d503d.zip
frameworks_native-aaa3ecff4b49e0918c252e02b3aa18a3ad0d503d.tar.gz
frameworks_native-aaa3ecff4b49e0918c252e02b3aa18a3ad0d503d.tar.bz2
SurfaceTexture: fix a bug with buffer reallocation
This change fixes an issue involving buffer reallocation and the ALLOW_DEQUEUE_CURRENT_BUFFER mode in SurfaceTexture. The bug happened when the buffer slot currently attached to the GL texture was selected for dequeuing, but the dequeue operation caused the buffer to be reallocated. Because the buffer is new, the image producer could fill the buffer and queue it before an updateTexImage call, which would result in the "slot %d is current" error in queueBuffer. Bug: 5631630 Change-Id: Icdd8bc5cad3c7db43953446d9be2603aaea11a8d
Diffstat (limited to 'libs/gui/SurfaceTexture.cpp')
-rw-r--r--libs/gui/SurfaceTexture.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 374f3c5..ab154ed 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -434,6 +434,11 @@ status_t SurfaceTexture::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
mSlots[buf].mEglImage = EGL_NO_IMAGE_KHR;
mSlots[buf].mEglDisplay = EGL_NO_DISPLAY;
}
+ if (mCurrentTexture == buf) {
+ // The current texture no longer references the buffer in this slot
+ // since we just allocated a new buffer.
+ mCurrentTexture = INVALID_BUFFER_SLOT;
+ }
returnFlags |= ISurfaceTexture::BUFFER_NEEDS_REALLOCATION;
}
ST_LOGV("dequeueBuffer: returning slot=%d buf=%p flags=%#x", buf,