v3d: cache pipe query results

As the BO storing the results is destroyed after getting the query
results, store the results in case requesting the results again.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17373>
This commit is contained in:
Juan A. Suarez Romero 2022-07-06 11:18:14 +02:00 committed by Marge Bot
parent 957186102f
commit 6d21d563a1

View file

@ -43,6 +43,7 @@ struct v3d_query_pipe
struct v3d_bo *bo;
uint32_t start, end;
uint32_t result;
};
static void
@ -140,7 +141,6 @@ v3d_get_query_result_pipe(struct v3d_context *v3d, struct v3d_query *query,
bool wait, union pipe_query_result *vresult)
{
struct v3d_query_pipe *pquery = (struct v3d_query_pipe *)query;
uint32_t result = 0;
if (pquery->bo) {
v3d_flush_jobs_using_bo(v3d, pquery->bo);
@ -155,18 +155,18 @@ v3d_get_query_result_pipe(struct v3d_context *v3d, struct v3d_query *query,
/* XXX: Sum up per-core values. */
uint32_t *map = v3d_bo_map(pquery->bo);
result = *map;
pquery->result = *map;
v3d_bo_unreference(&pquery->bo);
}
switch (pquery->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
vresult->u64 = result;
vresult->u64 = pquery->result;
break;
case PIPE_QUERY_OCCLUSION_PREDICATE:
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
vresult->b = result != 0;
vresult->b = pquery->result != 0;
break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED: