summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2016-09-02 15:07:23 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-09-02 15:07:25 +0000
commit02913603bd2929fc57d4a5e5461ad45ca63b2ba7 (patch)
treeaee0146e44f80e84d82ab1e0f7e231eb4df64f8b /libs
parentbdb81a0a7f9ab18073c2fd0b120feee724450d50 (diff)
parentf8b0360298a3a85449e3469768692bb05ee2422d (diff)
downloadandroid-frameworks-base-02913603bd2929fc57d4a5e5461ad45ca63b2ba7.tar.gz
android-frameworks-base-02913603bd2929fc57d4a5e5461ad45ca63b2ba7.tar.xz
Merge "Fix EGLImage memory leak" into nyc-mr1-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/Readback.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/libs/hwui/Readback.cpp b/libs/hwui/Readback.cpp
index 55f823d..0ab247d 100644
--- a/libs/hwui/Readback.cpp
+++ b/libs/hwui/Readback.cpp
@@ -136,7 +136,7 @@ CopyResult Readback::copySurfaceInto(renderthread::RenderThread& renderThread,
EGL_NATIVE_BUFFER_ANDROID, clientBuffer, attrs);
if (sourceImage == EGL_NO_IMAGE_KHR) {
- ALOGW("Error creating image (%#x)", eglGetError());
+ ALOGW("eglCreateImageKHR failed (%#x)", eglGetError());
return CopyResult::UnknownError;
}
GLuint sourceTexId;
@@ -147,7 +147,8 @@ CopyResult Readback::copySurfaceInto(renderthread::RenderThread& renderThread,
GLenum status = GL_NO_ERROR;
while ((status = glGetError()) != GL_NO_ERROR) {
- ALOGW("Error creating image (%#x)", status);
+ ALOGW("glEGLImageTargetTexture2DOES failed (%#x)", status);
+ eglDestroyImageKHR(display, sourceImage);
return CopyResult::UnknownError;
}
@@ -183,6 +184,13 @@ CopyResult Readback::copySurfaceInto(renderthread::RenderThread& renderThread,
caches.textureState().deleteTexture(texture);
renderState.deleteFramebuffer(fbo);
+ sourceTexture.deleteTexture();
+ // All we're flushing & finishing is the deletion of the texture since
+ // copyTextureInto already did a major flush & finish as an implicit
+ // part of glReadPixels, so this shouldn't pose any major stalls.
+ glFinish();
+ eglDestroyImageKHR(display, sourceImage);
+
GL_CHECKPOINT(MODERATE);
return CopyResult::Success;