From 36066702ade7d51dffd44e7f5d1da282dcc61f9f Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Thu, 7 Apr 2022 18:05:36 +0200 Subject: [PATCH] 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 Reviewed-by: Iago Toral Quiroga Part-of: --- 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;