summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceTexture.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2012-05-29 19:50:58 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2012-05-29 19:50:58 -0700
commit584fcb3218e07d7b4cc0aeaef41faa4e891b45a4 (patch)
tree7a03095f78529e8b9f519530effce170b4921715 /libs/gui/SurfaceTexture.cpp
parentc7c8334f059e42106c7cfa27cdead277fd5e135d (diff)
parent2c8207e9627fe6c7a90e31fae8d71ae49df56845 (diff)
am 2c8207e9: add the ability to reject buffers in SurfaceTexture::updateTexImage
* commit '2c8207e9627fe6c7a90e31fae8d71ae49df56845': add the ability to reject buffers in SurfaceTexture::updateTexImage
Diffstat (limited to 'libs/gui/SurfaceTexture.cpp')
-rw-r--r--libs/gui/SurfaceTexture.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 30c0d9bfb1..55be4bcf2d 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -176,6 +176,10 @@ status_t SurfaceTexture::setDefaultBufferSize(uint32_t w, uint32_t h)
}
status_t SurfaceTexture::updateTexImage() {
+ return SurfaceTexture::updateTexImage(NULL);
+}
+
+status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) {
ATRACE_CALL();
ST_LOGV("updateTexImage");
Mutex::Autolock lock(mMutex);
@@ -228,6 +232,16 @@ status_t SurfaceTexture::updateTexImage() {
mEGLSlots[buf].mGraphicBuffer = item.mGraphicBuffer;
}
+ // we call the rejecter here, in case the caller has a reason to
+ // not accept this buffer. this is used by SurfaceFlinger to
+ // reject buffers which have the wrong size
+ if (rejecter && rejecter->reject(mEGLSlots[buf].mGraphicBuffer, item)) {
+ mBufferQueue->releaseBuffer(buf, dpy, mEGLSlots[buf].mFence);
+ mEGLSlots[buf].mFence = EGL_NO_SYNC_KHR;
+ glBindTexture(mTexTarget, mTexName);
+ return NO_ERROR;
+ }
+
// Update the GL texture object. We may have to do this even when
// item.mGraphicBuffer == NULL, if we destroyed the EGLImage when
// detaching from a context but the buffer has not been re-allocated.