mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
llvmpipe: add support for time elapsed queries.
It turns out for QBO you really need to explicitly support time elapsed queries to avoid wierd interactions with the non-qbo query paths. Fixes:506e51b856("llvmpipe: initial query buffer object support. (v2)") Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11946> (cherry picked from commit2f5cd08ede)
This commit is contained in:
parent
3896bd6178
commit
ab6955c9d4
6 changed files with 34 additions and 10 deletions
|
|
@ -130,7 +130,7 @@
|
|||
"description": "llvmpipe: add support for time elapsed queries.",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "506e51b8560f30bc67ee84def535a324b5748208"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -474,12 +474,6 @@ spec/arb_internalformat_query/misc. api error checks: skip
|
|||
spec/arb_pipeline_statistics_query/arb_pipeline_statistics_query-frag: fail
|
||||
spec/arb_post_depth_coverage/arb_post_depth_coverage-multisampling: fail
|
||||
spec/arb_program_interface_query/arb_program_interface_query-getprogramresourceindex/'vs_input2[1][0]' on gl_program_input: fail
|
||||
spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-async_cpu_read_before-gl_int: fail
|
||||
spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-async_cpu_read_before-gl_unsigned_int: fail
|
||||
spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-async_cpu_read_before-gl_unsigned_int64_arb: fail
|
||||
spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-sync_cpu_read_after_cache_test-gl_int: fail
|
||||
spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-sync_cpu_read_after_cache_test-gl_unsigned_int: fail
|
||||
spec/arb_query_buffer_object/qbo/query-gl_time_elapsed-sync_cpu_read_after_cache_test-gl_unsigned_int64_arb: fail
|
||||
spec/arb_sample_locations/test: skip
|
||||
spec/arb_sample_shading/builtin-gl-num-samples 16: skip
|
||||
spec/arb_sample_shading/builtin-gl-num-samples 32: skip
|
||||
|
|
|
|||
|
|
@ -139,6 +139,17 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case PIPE_QUERY_TIME_ELAPSED: {
|
||||
uint64_t start = (uint64_t)-1, end = 0;
|
||||
for (i = 0; i < num_threads; i++) {
|
||||
if (pq->start[i] && pq->start[i] < start)
|
||||
start = pq->start[i];
|
||||
if (pq->end[i] && pq->end[i] > end)
|
||||
end = pq->end[i];
|
||||
}
|
||||
*result = end - start;
|
||||
break;
|
||||
}
|
||||
case PIPE_QUERY_TIMESTAMP_DISJOINT: {
|
||||
struct pipe_query_data_timestamp_disjoint *td =
|
||||
(struct pipe_query_data_timestamp_disjoint *)vresult;
|
||||
|
|
@ -260,6 +271,17 @@ llvmpipe_get_query_result_resource(struct pipe_context *pipe,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case PIPE_QUERY_TIME_ELAPSED: {
|
||||
uint64_t start = (uint64_t)-1, end = 0;
|
||||
for (i = 0; i < num_threads; i++) {
|
||||
if (pq->start[i] && pq->start[i] < start)
|
||||
start = pq->start[i];
|
||||
if (pq->end[i] && pq->end[i] > end)
|
||||
end = pq->end[i];
|
||||
}
|
||||
value = end - start;
|
||||
break;
|
||||
}
|
||||
case PIPE_QUERY_SO_STATISTICS:
|
||||
value = pq->num_primitives_written[0];
|
||||
value2 = pq->num_primitives_generated[0];
|
||||
|
|
|
|||
|
|
@ -528,6 +528,9 @@ lp_rast_begin_query(struct lp_rasterizer_task *task,
|
|||
case PIPE_QUERY_PIPELINE_STATISTICS:
|
||||
pq->start[task->thread_index] = task->thread_data.ps_invocations;
|
||||
break;
|
||||
case PIPE_QUERY_TIME_ELAPSED:
|
||||
pq->start[task->thread_index] = os_time_get_nano();
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
|
|
@ -555,6 +558,7 @@ lp_rast_end_query(struct lp_rasterizer_task *task,
|
|||
pq->start[task->thread_index] = 0;
|
||||
break;
|
||||
case PIPE_QUERY_TIMESTAMP:
|
||||
case PIPE_QUERY_TIME_ELAPSED:
|
||||
pq->end[task->thread_index] = os_time_get_nano();
|
||||
break;
|
||||
case PIPE_QUERY_PIPELINE_STATISTICS:
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
|
|||
return PIPE_MAX_COLOR_BUFS;
|
||||
case PIPE_CAP_OCCLUSION_QUERY:
|
||||
case PIPE_CAP_QUERY_TIMESTAMP:
|
||||
case PIPE_CAP_QUERY_TIME_ELAPSED:
|
||||
return 1;
|
||||
case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -1525,7 +1525,8 @@ lp_setup_begin_query(struct lp_setup_context *setup,
|
|||
if (!(pq->type == PIPE_QUERY_OCCLUSION_COUNTER ||
|
||||
pq->type == PIPE_QUERY_OCCLUSION_PREDICATE ||
|
||||
pq->type == PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE ||
|
||||
pq->type == PIPE_QUERY_PIPELINE_STATISTICS))
|
||||
pq->type == PIPE_QUERY_PIPELINE_STATISTICS ||
|
||||
pq->type == PIPE_QUERY_TIME_ELAPSED))
|
||||
return;
|
||||
|
||||
/* init the query to its beginning state */
|
||||
|
|
@ -1577,7 +1578,8 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq)
|
|||
pq->type == PIPE_QUERY_OCCLUSION_PREDICATE ||
|
||||
pq->type == PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE ||
|
||||
pq->type == PIPE_QUERY_PIPELINE_STATISTICS ||
|
||||
pq->type == PIPE_QUERY_TIMESTAMP) {
|
||||
pq->type == PIPE_QUERY_TIMESTAMP ||
|
||||
pq->type == PIPE_QUERY_TIME_ELAPSED) {
|
||||
if (pq->type == PIPE_QUERY_TIMESTAMP &&
|
||||
!(setup->scene->tiles_x | setup->scene->tiles_y)) {
|
||||
/*
|
||||
|
|
@ -1613,7 +1615,8 @@ fail:
|
|||
if (pq->type == PIPE_QUERY_OCCLUSION_COUNTER ||
|
||||
pq->type == PIPE_QUERY_OCCLUSION_PREDICATE ||
|
||||
pq->type == PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE ||
|
||||
pq->type == PIPE_QUERY_PIPELINE_STATISTICS) {
|
||||
pq->type == PIPE_QUERY_PIPELINE_STATISTICS ||
|
||||
pq->type == PIPE_QUERY_TIME_ELAPSED) {
|
||||
unsigned i;
|
||||
|
||||
/* remove from active binned query list */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue