Mesa (master): gallium/radeon: don' t re-create queries for DCC stat gathering

Marek Olšák mareko at kemper.freedesktop.org
Wed Jun 29 18:12:16 UTC 2016


Module: Mesa
Branch: master
Commit: 44906101c4bcd630733ee46fcd9a3b718314461d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=44906101c4bcd630733ee46fcd9a3b718314461d

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Jun 27 19:46:39 2016 +0200

gallium/radeon: don't re-create queries for DCC stat gathering

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 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 d0fa984..f6a65a6 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 aad8eaf..f3c03f5 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 614025a..776ad7c 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)




More information about the mesa-commit mailing list