From 46afe552b05d31274b37f210f07ebee8e144348b Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Mon, 8 May 2023 18:02:44 +0200 Subject: [PATCH] mesa: fix refcnt imbalance related to egl_image_target_texture() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Indeed, the locally allocated "stimg" reference was not freed on a specific code path. For instance, this issue is triggered on radeonsi or r600 with: "piglit/bin/egl-ext_egl_image_storage -auto -fbo" while setting GALLIUM_REFCNT_LOG=refcnt.log. Fixes: 6a3f5c65128b ("mesa: simplify st_egl_image binding process for texture storage") Signed-off-by: Patrick Lerda Reviewed-by: Tapani Pälli Part-of: (cherry picked from commit 83cd7d23a26d3cbd1af4805e95c4e588950f0fd5) --- .pick_status.json | 2 +- src/mesa/main/teximage.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 813d40228aa..e545eaeadf5 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -913,7 +913,7 @@ "description": "mesa: fix refcnt imbalance related to egl_image_target_texture()", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "6a3f5c65128b82b87c5fadcf1d42484f6489b11b" }, diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 0a320073d7e..cfa90a3cd38 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3562,6 +3562,7 @@ egl_image_target_texture(struct gl_context *ctx, !(target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(texture is imported from dmabuf)", caller); + pipe_resource_reference(&stimg.texture, NULL); _mesa_unlock_texture(ctx, texObj); return; }