diff options
author | Mathias Agopian <mathias@google.com> | 2012-05-23 17:56:42 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-05-23 18:01:33 -0700 |
commit | 2c8207e9627fe6c7a90e31fae8d71ae49df56845 (patch) | |
tree | 7a03095f78529e8b9f519530effce170b4921715 /libs | |
parent | 702634a4dad85cfc292618ac91eda6c00f42b7c5 (diff) | |
download | frameworks_native-2c8207e9627fe6c7a90e31fae8d71ae49df56845.zip frameworks_native-2c8207e9627fe6c7a90e31fae8d71ae49df56845.tar.gz frameworks_native-2c8207e9627fe6c7a90e31fae8d71ae49df56845.tar.bz2 |
add the ability to reject buffers in SurfaceTexture::updateTexImage
SurfaceFlinger is using this new feature to reject buffers that
don't have the right size.
Bug: 6498869
Change-Id: I8a7250a47db6c082a357b703feb3b9d0fc8d3443
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/SurfaceTexture.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index 30c0d9b..55be4bc 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. |