summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceTexture.cpp
diff options
context:
space:
mode:
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.