summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2016-09-01 13:59:47 -0700
committerJohn Reck <jreck@google.com>2016-09-01 14:10:20 -0700
commitf8b0360298a3a85449e3469768692bb05ee2422d (patch)
tree316c02eeac333629261a96a8449e6875cb47a00d /libs
parent57bd22ffc136b68f0ae0944079fc1316f3b6f96c (diff)
downloadandroid-frameworks-base-f8b0360298a3a85449e3469768692bb05ee2422d.tar.gz
android-frameworks-base-f8b0360298a3a85449e3469768692bb05ee2422d.tar.xz
Fix EGLImage memory leak
Bug: 31247709 Change-Id: I9e36206b0d7bdb75b84cd53b70f7746ca34a3469
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;