[Mesa-dev] [PATCH 25/25] radeonsi: const-ify the si_query_ops

Nicolai Hähnle nhaehnle at gmail.com
Thu Dec 6 14:00:46 UTC 2018


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/gallium/drivers/radeonsi/si_perfcounter.c | 2 +-
 src/gallium/drivers/radeonsi/si_query.c       | 6 +++---
 src/gallium/drivers/radeonsi/si_query.h       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_perfcounter.c b/src/gallium/drivers/radeonsi/si_perfcounter.c
index 65197c0daa4..fc2c58854bc 100644
--- a/src/gallium/drivers/radeonsi/si_perfcounter.c
+++ b/src/gallium/drivers/radeonsi/si_perfcounter.c
@@ -908,21 +908,21 @@ static bool si_pc_query_get_result(struct si_context *sctx, struct si_query *rqu
 
 		while (results_base != qbuf->results_end) {
 			si_pc_query_add_result(query, map + results_base, result);
 			results_base += query->result_size;
 		}
 	}
 
 	return true;
 }
 
-static struct si_query_ops batch_query_ops = {
+static const struct si_query_ops batch_query_ops = {
 	.destroy = si_pc_query_destroy,
 	.begin = si_pc_query_begin,
 	.end = si_pc_query_end,
 	.get_result = si_pc_query_get_result,
 
 	.suspend = si_pc_query_suspend,
 	.resume = si_pc_query_resume,
 };
 
 static struct si_query_group *get_group_state(struct si_screen *screen,
diff --git a/src/gallium/drivers/radeonsi/si_query.c b/src/gallium/drivers/radeonsi/si_query.c
index 5b0fba0ed92..093643bf684 100644
--- a/src/gallium/drivers/radeonsi/si_query.c
+++ b/src/gallium/drivers/radeonsi/si_query.c
@@ -27,21 +27,21 @@
 #include "si_pipe.h"
 #include "si_query.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
 #include "util/os_time.h"
 #include "util/u_suballoc.h"
 #include "amd/common/sid.h"
 
 #define SI_MAX_STREAMS 4
 
-static struct si_query_ops query_hw_ops;
+static const struct si_query_ops query_hw_ops;
 
 struct si_hw_query_params {
 	unsigned start_offset;
 	unsigned end_offset;
 	unsigned fence_offset;
 	unsigned pair_stride;
 	unsigned pair_count;
 };
 
 /* Queries without buffer handling or suspend/resume. */
@@ -492,21 +492,21 @@ static bool si_query_sw_get_result(struct si_context *sctx,
 	case SI_QUERY_CURRENT_GPU_SCLK:
 	case SI_QUERY_CURRENT_GPU_MCLK:
 		result->u64 *= 1000000;
 		break;
 	}
 
 	return true;
 }
 
 
-static struct si_query_ops sw_query_ops = {
+static const struct si_query_ops sw_query_ops = {
 	.destroy = si_query_sw_destroy,
 	.begin = si_query_sw_begin,
 	.end = si_query_sw_end,
 	.get_result = si_query_sw_get_result,
 	.get_result_resource = NULL
 };
 
 static struct pipe_query *si_query_sw_create(unsigned query_type)
 {
 	struct si_query_sw *query;
@@ -1336,21 +1336,21 @@ static void si_query_hw_add_result(struct si_screen *sscreen,
 void si_query_hw_suspend(struct si_context *sctx, struct si_query *query)
 {
 	si_query_hw_emit_stop(sctx, (struct si_query_hw *)query);
 }
 
 void si_query_hw_resume(struct si_context *sctx, struct si_query *query)
 {
 	si_query_hw_emit_start(sctx, (struct si_query_hw *)query);
 }
 
-static struct si_query_ops query_hw_ops = {
+static const struct si_query_ops query_hw_ops = {
 	.destroy = si_query_hw_destroy,
 	.begin = si_query_hw_begin,
 	.end = si_query_hw_end,
 	.get_result = si_query_hw_get_result,
 	.get_result_resource = si_query_hw_get_result_resource,
 
 	.suspend = si_query_hw_suspend,
 	.resume = si_query_hw_resume,
 };
 
diff --git a/src/gallium/drivers/radeonsi/si_query.h b/src/gallium/drivers/radeonsi/si_query.h
index 63af760a271..0bc1d56f78a 100644
--- a/src/gallium/drivers/radeonsi/si_query.h
+++ b/src/gallium/drivers/radeonsi/si_query.h
@@ -134,21 +134,21 @@ struct si_query_ops {
 				    int index,
 				    struct pipe_resource *resource,
 				    unsigned offset);
 
 	void (*suspend)(struct si_context *, struct si_query *);
 	void (*resume)(struct si_context *, struct si_query *);
 };
 
 struct si_query {
 	struct threaded_query b;
-	struct si_query_ops *ops;
+	const struct si_query_ops *ops;
 
 	/* The PIPE_QUERY_xxx type of query */
 	unsigned type;
 
 	/* The number of dwords for suspend. */
 	unsigned num_cs_dw_suspend;
 
 	/* Linked list of queries that must be suspended at end of CS. */
 	struct list_head active_list;
 };
-- 
2.19.1



More information about the mesa-dev mailing list