diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeon/r600_query.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index 4571b3c22b3..8d80612b68e 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -52,6 +52,8 @@ struct r600_query { /* for custom non-GPU queries */ uint64_t begin_result; uint64_t end_result; + /* Fence for GPU_FINISHED. */ + struct pipe_fence_handle *fence; }; @@ -75,6 +77,7 @@ static struct r600_resource *r600_new_query_buffer(struct r600_common_context *c /* Non-GPU queries. */ switch (type) { case PIPE_QUERY_TIMESTAMP_DISJOINT: + case PIPE_QUERY_GPU_FINISHED: case R600_QUERY_DRAW_CALLS: case R600_QUERY_REQUESTED_VRAM: case R600_QUERY_REQUESTED_GTT: @@ -113,7 +116,6 @@ static struct r600_resource *r600_new_query_buffer(struct r600_common_context *c } ctx->ws->buffer_unmap(buf->cs_buf); break; - case PIPE_QUERY_GPU_FINISHED: case PIPE_QUERY_TIME_ELAPSED: case PIPE_QUERY_TIMESTAMP: break; @@ -275,8 +277,6 @@ static void r600_emit_query_end(struct r600_common_context *ctx, struct r600_que radeon_emit(cs, va); radeon_emit(cs, (va >> 32UL) & 0xFF); break; - case PIPE_QUERY_GPU_FINISHED: - break; default: assert(0); } @@ -360,8 +360,6 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q query->result_size = 16 * rctx->max_db; query->num_cs_dw = 6; break; - case PIPE_QUERY_GPU_FINISHED: - query->num_cs_dw = 2; break; case PIPE_QUERY_TIME_ELAPSED: query->result_size = 16; @@ -384,8 +382,9 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q query->result_size = (rctx->chip_class >= EVERGREEN ? 11 : 8) * 16; query->num_cs_dw = 8; break; - /* Non-GPU queries. */ + /* Non-GPU queries and queries not requiring a buffer. */ case PIPE_QUERY_TIMESTAMP_DISJOINT: + case PIPE_QUERY_GPU_FINISHED: case R600_QUERY_DRAW_CALLS: case R600_QUERY_REQUESTED_VRAM: case R600_QUERY_REQUESTED_GTT: @@ -498,6 +497,9 @@ static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) switch (rquery->type) { case PIPE_QUERY_TIMESTAMP_DISJOINT: return; + case PIPE_QUERY_GPU_FINISHED: + rctx->rings.gfx.flush(rctx, RADEON_FLUSH_ASYNC, &rquery->fence); + return; case R600_QUERY_DRAW_CALLS: rquery->end_result = rctx->num_draw_calls; return; @@ -555,6 +557,7 @@ static boolean r600_get_query_buffer_result(struct r600_common_context *ctx, boolean wait, union pipe_query_result *result) { + struct pipe_screen *screen = ctx->b.screen; unsigned results_base = 0; char *map; @@ -566,6 +569,10 @@ static boolean r600_get_query_buffer_result(struct r600_common_context *ctx, (uint64_t)ctx->screen->info.r600_clock_crystal_freq * 1000; result->timestamp_disjoint.disjoint = FALSE; return TRUE; + case PIPE_QUERY_GPU_FINISHED: + result->b = screen->fence_finish(screen, query->fence, + wait ? PIPE_TIMEOUT_INFINITE : 0); + return result->b; case R600_QUERY_DRAW_CALLS: case R600_QUERY_REQUESTED_VRAM: case R600_QUERY_REQUESTED_GTT: @@ -600,9 +607,6 @@ static boolean r600_get_query_buffer_result(struct r600_common_context *ctx, results_base += 16; } break; - case PIPE_QUERY_GPU_FINISHED: - result->b = TRUE; - break; case PIPE_QUERY_TIME_ELAPSED: while (results_base != qbuf->results_end) { result->u64 += |