From d3f47768bcaec76362e3ab0066790e8ee112fda2 Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Thu, 25 May 2023 16:15:28 +0200 Subject: [PATCH] mesa: fix refcnt imbalance related to _mesa_delete_semaphore_object() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Indeed, the fence reference was not freed. For instance, this issue is triggered with "piglit/bin/ext_external_objects-vk-semaphores-2 -auto -fbo" while setting GALLIUM_REFCNT_LOG=refcnt.log. Fixes: 7b6cd912a59a ("mesa/st: get rid of ST_CALLOC_STRUCT use CALLOC_STRUCT") Signed-off-by: Patrick Lerda Reviewed-by: Marek Olšák Part-of: (cherry picked from commit 84f465ec810bd3210010fb9633cd678881ca74f5) --- .pick_status.json | 2 +- src/mesa/main/externalobjects.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 331ef2be156..fbfc5c5f9c2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1678,7 +1678,7 @@ "description": "mesa: fix refcnt imbalance related to _mesa_delete_semaphore_object()", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "7b6cd912a59a63e8d479970137b706cb38bede02" }, diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c index ed3f7cd07a3..5dac6d558b5 100644 --- a/src/mesa/main/externalobjects.c +++ b/src/mesa/main/externalobjects.c @@ -754,8 +754,11 @@ void _mesa_delete_semaphore_object(struct gl_context *ctx, struct gl_semaphore_object *semObj) { - if (semObj != &DummySemaphoreObject) + if (semObj != &DummySemaphoreObject) { + struct pipe_context *pipe = ctx->pipe; + pipe->screen->fence_reference(ctx->screen, &semObj->fence, NULL); FREE(semObj); + } } void GLAPIENTRY