summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/v3d/v3d_query_pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/v3d/v3d_query_pipe.c')
-rw-r--r--src/gallium/drivers/v3d/v3d_query_pipe.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gallium/drivers/v3d/v3d_query_pipe.c b/src/gallium/drivers/v3d/v3d_query_pipe.c
index eafb7ec6106..7618daaba70 100644
--- a/src/gallium/drivers/v3d/v3d_query_pipe.c
+++ b/src/gallium/drivers/v3d/v3d_query_pipe.c
@@ -43,6 +43,7 @@ struct v3d_query_pipe
struct v3d_bo *bo;
uint32_t start, end;
+ uint32_t result;
};
static void
@@ -69,6 +70,7 @@ v3d_begin_query_pipe(struct v3d_context *v3d, struct v3d_query *query)
if (v3d->prog.gs)
v3d_update_primitive_counters(v3d);
pquery->start = v3d->prims_generated;
+ v3d->n_primitives_generated_queries_in_flight++;
break;
case PIPE_QUERY_PRIMITIVES_EMITTED:
/* If we are inside transform feedback we need to update the
@@ -81,6 +83,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;
@@ -109,6 +112,7 @@ v3d_end_query_pipe(struct v3d_context *v3d, struct v3d_query *query)
if (v3d->prog.gs)
v3d_update_primitive_counters(v3d);
pquery->end = v3d->prims_generated;
+ v3d->n_primitives_generated_queries_in_flight--;
break;
case PIPE_QUERY_PRIMITIVES_EMITTED:
/* If transform feedback has ended, then we have already
@@ -137,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);
@@ -152,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: