From 44906101c4bcd630733ee46fcd9a3b718314461d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 27 Jun 2016 19:46:39 +0200 Subject: [PATCH] gallium/radeon: don't re-create queries for DCC stat gathering MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeon/r600_query.c | 4 ++-- src/gallium/drivers/radeon/r600_query.h | 2 ++ src/gallium/drivers/radeon/r600_texture.c | 9 ++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index d0fa98489c7..f6a65a6c22c 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -728,8 +728,8 @@ static boolean r600_begin_query(struct pipe_context *ctx, return rquery->ops->begin(rctx, rquery); } -static void r600_query_hw_reset_buffers(struct r600_common_context *rctx, - struct r600_query_hw *query) +void r600_query_hw_reset_buffers(struct r600_common_context *rctx, + struct r600_query_hw *query) { struct r600_query_buffer *prev = query->buffer.previous; diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h index aad8eaf8c1e..f3c03f59262 100644 --- a/src/gallium/drivers/radeon/r600_query.h +++ b/src/gallium/drivers/radeon/r600_query.h @@ -258,5 +258,7 @@ void r600_perfcounters_add_block(struct r600_common_screen *, unsigned counters, unsigned selectors, unsigned instances, void *data); void r600_perfcounters_do_destroy(struct r600_perfcounters *); +void r600_query_hw_reset_buffers(struct r600_common_context *rctx, + struct r600_query_hw *query); #endif /* R600_QUERY_H */ diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 614025aeb4f..776ad7c68d0 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -1884,6 +1884,7 @@ void vi_separate_dcc_process_and_reset_stats(struct pipe_context *ctx, struct r600_texture *tex) { struct r600_common_context *rctx = (struct r600_common_context*)ctx; + struct pipe_query *tmp; unsigned i = vi_get_context_dcc_stats_index(rctx, tex); bool query_active = rctx->dcc_stats[i].query_active; bool disable = false; @@ -1894,8 +1895,9 @@ void vi_separate_dcc_process_and_reset_stats(struct pipe_context *ctx, /* Read the results. */ ctx->get_query_result(ctx, rctx->dcc_stats[i].ps_stats[2], true, &result); - ctx->destroy_query(ctx, rctx->dcc_stats[i].ps_stats[2]); - rctx->dcc_stats[i].ps_stats[2] = NULL; + r600_query_hw_reset_buffers(rctx, + (struct r600_query_hw*) + rctx->dcc_stats[i].ps_stats[2]); /* Compute the approximate number of fullscreen draws. */ tex->ps_draw_ratio = @@ -1914,9 +1916,10 @@ void vi_separate_dcc_process_and_reset_stats(struct pipe_context *ctx, vi_separate_dcc_stop_query(ctx, tex); /* Move the queries in the queue by one. */ + tmp = rctx->dcc_stats[i].ps_stats[2]; rctx->dcc_stats[i].ps_stats[2] = rctx->dcc_stats[i].ps_stats[1]; rctx->dcc_stats[i].ps_stats[1] = rctx->dcc_stats[i].ps_stats[0]; - rctx->dcc_stats[i].ps_stats[0] = NULL; + rctx->dcc_stats[i].ps_stats[0] = tmp; /* create and start a new query as ps_stats[0] */ if (query_active) -- 2.30.2