summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/crocus/crocus_query.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/crocus/crocus_query.c')
-rw-r--r--src/gallium/drivers/crocus/crocus_query.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gallium/drivers/crocus/crocus_query.c b/src/gallium/drivers/crocus/crocus_query.c
index e31f2ef668b..752193a9778 100644
--- a/src/gallium/drivers/crocus/crocus_query.c
+++ b/src/gallium/drivers/crocus/crocus_query.c
@@ -338,7 +338,7 @@ calculate_result_on_cpu(const struct intel_device_info *devinfo,
break;
case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE:
q->result = false;
- for (int i = 0; i < MAX_VERTEX_STREAMS; i++)
+ for (int i = 0; i < PIPE_MAX_VERTEX_STREAMS; i++)
q->result |= stream_overflowed((void *) q->map, i);
break;
case PIPE_QUERY_PIPELINE_STATISTICS_SINGLE:
@@ -385,12 +385,12 @@ calc_overflow_for_stream(struct mi_builder *b,
static struct mi_value
calc_overflow_any_stream(struct mi_builder *b, struct crocus_query *q)
{
- struct mi_value stream_result[MAX_VERTEX_STREAMS];
- for (int i = 0; i < MAX_VERTEX_STREAMS; i++)
+ struct mi_value stream_result[PIPE_MAX_VERTEX_STREAMS];
+ for (int i = 0; i < PIPE_MAX_VERTEX_STREAMS; i++)
stream_result[i] = calc_overflow_for_stream(b, q, i);
struct mi_value result = stream_result[0];
- for (int i = 1; i < MAX_VERTEX_STREAMS; i++)
+ for (int i = 1; i < PIPE_MAX_VERTEX_STREAMS; i++)
result = mi_ior(b, result, stream_result[i]);
return result;
@@ -516,6 +516,7 @@ crocus_destroy_query(struct pipe_context *ctx, struct pipe_query *p_query)
crocus_syncobj_reference(screen, &query->syncobj, NULL);
screen->base.fence_reference(ctx->screen, &query->fence, NULL);
}
+ pipe_resource_reference(&query->query_state_ref.res, NULL);
free(query);
}
@@ -539,9 +540,11 @@ crocus_begin_query(struct pipe_context *ctx, struct pipe_query *query)
size = sizeof(struct crocus_query_snapshots);
u_upload_alloc(ice->query_buffer_uploader, 0,
- size, size, &q->query_state_ref.offset,
+ size, util_next_power_of_two(size), &q->query_state_ref.offset,
&q->query_state_ref.res, &ptr);
+ if (!q->query_state_ref.res)
+ return false;
if (!crocus_resource_bo(q->query_state_ref.res))
return false;
@@ -678,8 +681,12 @@ crocus_get_query_result(struct pipe_context *ctx,
}
assert(READ_ONCE(q->map->snapshots_landed));
#else
- if (crocus_wait_syncobj(ctx->screen, q->syncobj, wait ? INT64_MAX : 0))
+ if (crocus_wait_syncobj(ctx->screen, q->syncobj, wait ? INT64_MAX : 0)) {
+ /* if we've waited and timedout, just set the query to ready to avoid infinite loop */
+ if (wait)
+ q->ready = true;
return false;
+ }
#endif
calculate_result_on_cpu(devinfo, q);
}
@@ -695,7 +702,7 @@ crocus_get_query_result(struct pipe_context *ctx,
static void
crocus_get_query_result_resource(struct pipe_context *ctx,
struct pipe_query *query,
- bool wait,
+ enum pipe_query_flags flags,
enum pipe_query_value_type result_type,
int index,
struct pipe_resource *p_res,
@@ -755,7 +762,7 @@ crocus_get_query_result_resource(struct pipe_context *ctx,
}
#if GFX_VERx10 >= 75
- bool predicated = !wait && !q->stalled;
+ bool predicated = !(flags & PIPE_QUERY_WAIT) && !q->stalled;
struct mi_builder b;
mi_builder_init(&b, &batch->screen->devinfo, batch);