diff options
author | Eric Anholt <[email protected]> | 2020-03-30 10:23:45 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-30 21:35:21 +0000 |
commit | 8cdc6c1e4b632cea6934836ca4962a555a1172c6 (patch) | |
tree | ffd6e770048deab98fafcd4165ae95206a66e222 /src/gallium | |
parent | 7ef61c1f1008f26a53db5fdfdb39ea1968c40284 (diff) |
freedreno/a6xx: Fix timestamp queries.
We were returning the same kind of result as time_elapsed (an end - start
time in ns), which on a timestamp query is approximately zero since
begin/end are at the same point in time. What we're supposed to return is
a converted-to-ns timestamp based on the GPU clock. Remove the _pause()
function for time_elapsed to reduce the command stream overhead, and just
capture start (which is, unfortunately, going to happen on each tile and
thus the final start value we ready will be the last tile of the frame,
not the first).
Fixes piglit spec/arb_timer_query/query gl_timestamp
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4356>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_query.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_query.c b/src/gallium/drivers/freedreno/a6xx/fd6_query.c index 374b6f06054..6354e037f39 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_query.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_query.c @@ -178,7 +178,7 @@ timestamp_resume(struct fd_acc_query *aq, struct fd_batch *batch) } static void -timestamp_pause(struct fd_acc_query *aq, struct fd_batch *batch) +time_elapsed_pause(struct fd_acc_query *aq, struct fd_batch *batch) { struct fd_ringbuffer *ring = batch->draw; @@ -201,6 +201,12 @@ timestamp_pause(struct fd_acc_query *aq, struct fd_batch *batch) OUT_RELOC(ring, query_sample(aq, start)); /* srcC */ } +static void +timestamp_pause(struct fd_acc_query *aq, struct fd_batch *batch) +{ + /* We captured a timestamp in timestamp_resume(), nothing to do here. */ +} + static uint64_t ticks_to_ns(uint32_t ts) { @@ -224,7 +230,7 @@ timestamp_accumulate_result(struct fd_acc_query *aq, void *buf, union pipe_query_result *result) { struct fd6_query_sample *sp = buf; - result->u64 = ticks_to_ns(sp->result); + result->u64 = ticks_to_ns(sp->start); } static const struct fd_acc_sample_provider time_elapsed = { @@ -232,14 +238,14 @@ static const struct fd_acc_sample_provider time_elapsed = { .active = FD_STAGE_ALL, .size = sizeof(struct fd6_query_sample), .resume = timestamp_resume, - .pause = timestamp_pause, + .pause = time_elapsed_pause, .result = time_elapsed_accumulate_result, }; /* NOTE: timestamp query isn't going to give terribly sensible results * on a tiler. But it is needed by qapitrace profile heatmap. If you * add in a binning pass, the results get even more non-sensical. So - * we just return the timestamp on the first tile and hope that is + * we just return the timestamp on the last tile and hope that is * kind of good enough. */ |