summaryrefslogtreecommitdiffstats
path: root/libs/gui
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2014-04-04 15:37:08 -0700
committerAndy McFadden <fadden@android.com>2014-04-04 15:37:08 -0700
commit87a678478005026d950bedec49ee80b693777b95 (patch)
treedcd8a117f1ebc11b187ebc1f7862d4930e540b37 /libs/gui
parent98e5bf2cc0931fc4e4d88b3f64069bd200690be0 (diff)
downloadframeworks_native-87a678478005026d950bedec49ee80b693777b95.zip
frameworks_native-87a678478005026d950bedec49ee80b693777b95.tar.gz
frameworks_native-87a678478005026d950bedec49ee80b693777b95.tar.bz2
Always release a buffer
In GLConsumer's updateAndReleaseLocked(), we must release either the previously-acquired buffer or the newly-acquired buffer. Bug 13755224 Change-Id: I96adc255400ed008ba6e6ac1725ab3514c7cc8ba
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/GLConsumer.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp
index 7ee3081..3215b2f 100644
--- a/libs/gui/GLConsumer.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -350,20 +350,24 @@ status_t GLConsumer::updateAndReleaseLocked(const BufferQueue::BufferItem& item)
{
status_t err = NO_ERROR;
+ int buf = item.mBuf;
+
if (!mAttached) {
ST_LOGE("updateAndRelease: GLConsumer is not attached to an OpenGL "
"ES context");
+ releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer,
+ mEglDisplay, EGL_NO_SYNC_KHR);
return INVALID_OPERATION;
}
// Confirm state.
err = checkAndUpdateEglStateLocked();
if (err != NO_ERROR) {
+ releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer,
+ mEglDisplay, EGL_NO_SYNC_KHR);
return err;
}
- int buf = item.mBuf;
-
// If the mEglSlot entry is empty, create an EGLImage for the gralloc
// buffer currently in the slot in ConsumerBase.
//
@@ -377,6 +381,12 @@ status_t GLConsumer::updateAndReleaseLocked(const BufferQueue::BufferItem& item)
if (image == EGL_NO_IMAGE_KHR) {
ST_LOGW("updateAndRelease: unable to createImage on display=%p slot=%d",
mEglDisplay, buf);
+ const sp<GraphicBuffer>& gb = mSlots[buf].mGraphicBuffer;
+ ST_LOGW("buffer size=%ux%u st=%u usage=0x%x fmt=%d",
+ gb->getWidth(), gb->getHeight(), gb->getStride(),
+ gb->getUsage(), gb->getPixelFormat());
+ releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer,
+ mEglDisplay, EGL_NO_SYNC_KHR);
return UNKNOWN_ERROR;
}
mEglSlots[buf].mEglImage = image;