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@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15796>
This commit is contained in:
Juan A. Suarez Romero 2022-04-07 18:05:36 +02:00 committed by Marge Bot
parent 82ca8a707e
commit 36066702ad
1 changed files with 1 additions and 0 deletions

View File

@ -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;