Mesa (main): v3d: do not leak BO on query begin

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 8 14:06:24 UTC 2022


Module: Mesa
Branch: main
Commit: 36066702ade7d51dffd44e7f5d1da282dcc61f9f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=36066702ade7d51dffd44e7f5d1da282dcc61f9f

Author: Juan A. Suarez Romero <jasuarez at igalia.com>
Date:   Thu Apr  7 18:05:36 2022 +0200

v3d: do not leak BO on query begin

This happens when we have a sequence of multiple beginQuery / endQuery
with the same target and query identifier.

As a BO is created on beginQuery but not free on endQuery (we need to
wait until either explicitly deleting the query or querying the
results), in the above sequence we are basically leaking the BO.

This ensures that any BO created before is unreference before creating
the new one.

Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15796>

---

 src/gallium/drivers/v3d/v3d_query_pipe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/v3d/v3d_query_pipe.c b/src/gallium/drivers/v3d/v3d_query_pipe.c
index 7fdc7ac6680..00fcc0f320f 100644
--- a/src/gallium/drivers/v3d/v3d_query_pipe.c
+++ b/src/gallium/drivers/v3d/v3d_query_pipe.c
@@ -82,6 +82,7 @@ v3d_begin_query_pipe(struct v3d_context *v3d, struct v3d_query *query)
         case PIPE_QUERY_OCCLUSION_COUNTER:
         case PIPE_QUERY_OCCLUSION_PREDICATE:
         case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
+                v3d_bo_unreference(&pquery->bo);
                 pquery->bo = v3d_bo_alloc(v3d->screen, 4096, "query");
                 uint32_t *map = v3d_bo_map(pquery->bo);
                 *map = 0;



More information about the mesa-commit mailing list