Mesa (staging/19.2): egl/android: Remove our own reference to buffers.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Oct 21 16:18:07 UTC 2019
Module: Mesa
Branch: staging/19.2
Commit: 35b900310b244639108b06d25c1b39aed057d24c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=35b900310b244639108b06d25c1b39aed057d24c
Author: Lepton Wu <lepton at chromium.org>
Date: Tue Sep 17 13:49:17 2019 -0700
egl/android: Remove our own reference to buffers.
We currently doesn't maintain it correctly and the buffer gets leaked if
surface is destroyed before calling swapping buffers.
>From Android frameworks/native/libs/nativewindow/include/system/window.h:
The window holds a reference to the buffer between dequeueBuffer and
either queueBuffer or cancelBuffer, so clients only need their own
reference if they might use the buffer after queueing or canceling it.
v2: Remove our own reference.
Fixes: 0212db35040 ("egl/android: Cancel any outstanding ANativeBuffer in surface destructor")
Reviewed-by: Chia-I Wu <olvaffe at gmail.com> (v1)
Reviewed-By: Tapani Pälli <tapani.palli at intel.com>
Signed-off-by: Lepton Wu <lepton at chromium.org>
(cherry picked from commit f4ba31ff504489b7195c83fa8703ba091406d808)
---
src/egl/drivers/dri2/platform_android.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index dda38d67265..ec79c4a1147 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -231,8 +231,6 @@ droid_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf)
close(fence_fd);
}
- dri2_surf->buffer->common.incRef(&dri2_surf->buffer->common);
-
/* Record all the buffers created by ANativeWindow and update back buffer
* for updating buffer's age in swap_buffers.
*/
@@ -289,7 +287,6 @@ droid_window_enqueue_buffer(_EGLDisplay *disp, struct dri2_egl_surface *dri2_sur
dri2_surf->window->queueBuffer(dri2_surf->window, dri2_surf->buffer,
fence_fd);
- dri2_surf->buffer->common.decRef(&dri2_surf->buffer->common);
dri2_surf->buffer = NULL;
dri2_surf->back = NULL;
@@ -312,6 +309,7 @@ droid_window_cancel_buffer(struct dri2_egl_surface *dri2_surf)
dri2_surf->out_fence_fd = -1;
ret = dri2_surf->window->cancelBuffer(dri2_surf->window,
dri2_surf->buffer, fence_fd);
+ dri2_surf->buffer = NULL;
if (ret < 0) {
_eglLog(_EGL_WARNING, "ANativeWindow::cancelBuffer failed");
dri2_surf->base.Lost = EGL_TRUE;
More information about the mesa-commit
mailing list