[Mesa-dev] [PATCH 10/15] radeonsi: shorten si_pipe_* prefixes to si_*

Marek Olšák maraeo at gmail.com
Fri Sep 19 13:17:13 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

This was the original naming convention in r600g and it somehow crept
into radeonsi.
---
 src/gallium/drivers/radeonsi/si_compute.c     | 15 ++++++-------
 src/gallium/drivers/radeonsi/si_descriptors.c | 14 ++++++------
 src/gallium/drivers/radeonsi/si_pipe.h        | 15 +++++++------
 src/gallium/drivers/radeonsi/si_shader.c      |  6 ++---
 src/gallium/drivers/radeonsi/si_shader.h      | 10 ++++-----
 src/gallium/drivers/radeonsi/si_state.c       | 32 +++++++++++++--------------
 src/gallium/drivers/radeonsi/si_state.h       |  4 ++--
 src/gallium/drivers/radeonsi/si_state_draw.c  | 19 ++++++++--------
 8 files changed, 57 insertions(+), 58 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 049f6c2..9088268 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -38,7 +38,7 @@
 #define NUM_USER_SGPRS 4
 #endif
 
-struct si_pipe_compute {
+struct si_compute {
 	struct si_context *ctx;
 
 	unsigned local_size;
@@ -59,8 +59,7 @@ static void *si_create_compute_state(
 	const struct pipe_compute_state *cso)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
-	struct si_pipe_compute *program =
-					CALLOC_STRUCT(si_pipe_compute);
+	struct si_compute *program = CALLOC_STRUCT(si_compute);
 	const struct pipe_llvm_program_header *header;
 	const unsigned char *code;
 	unsigned i;
@@ -95,7 +94,7 @@ static void *si_create_compute_state(
 static void si_bind_compute_state(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context*)ctx;
-	sctx->cs_shader_state.program = (struct si_pipe_compute*)state;
+	sctx->cs_shader_state.program = (struct si_compute*)state;
 }
 
 static void si_set_global_binding(
@@ -105,7 +104,7 @@ static void si_set_global_binding(
 {
 	unsigned i;
 	struct si_context *sctx = (struct si_context*)ctx;
-	struct si_pipe_compute *program = sctx->cs_shader_state.program;
+	struct si_compute *program = sctx->cs_shader_state.program;
 
 	if (!resources) {
 		for (i = first; i < first + n; i++) {
@@ -169,7 +168,7 @@ static void si_launch_grid(
 		uint32_t pc, const void *input)
 {
 	struct si_context *sctx = (struct si_context*)ctx;
-	struct si_pipe_compute *program = sctx->cs_shader_state.program;
+	struct si_compute *program = sctx->cs_shader_state.program;
 	struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
 	struct r600_resource *input_buffer = program->input_buffer;
 	unsigned kernel_args_size;
@@ -383,7 +382,7 @@ static void si_launch_grid(
 
 
 static void si_delete_compute_state(struct pipe_context *ctx, void* state){
-	struct si_pipe_compute *program = (struct si_pipe_compute *)state;
+	struct si_compute *program = (struct si_compute *)state;
 
 	if (!state) {
 		return;
@@ -392,7 +391,7 @@ static void si_delete_compute_state(struct pipe_context *ctx, void* state){
 	if (program->kernels) {
 		for (int i = 0; i < program->num_kernels; i++){
 			if (program->kernels[i].bo){
-				si_pipe_shader_destroy(ctx, &program->kernels[i]);
+				si_shader_destroy(ctx, &program->kernels[i]);
 			}
 		}
 		FREE(program->kernels);
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 2543052..a0780cd 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -330,8 +330,8 @@ static void si_sampler_views_begin_new_cs(struct si_context *sctx,
 	/* Add relocations to the CS. */
 	while (mask) {
 		int i = u_bit_scan(&mask);
-		struct si_pipe_sampler_view *rview =
-			(struct si_pipe_sampler_view*)views->views[i];
+		struct si_sampler_view *rview =
+			(struct si_sampler_view*)views->views[i];
 
 		r600_context_bo_reloc(&sctx->b, &sctx->b.rings.gfx,
 				      rview->resource, RADEON_USAGE_READ,
@@ -354,8 +354,8 @@ static void si_set_sampler_view(struct si_context *sctx, unsigned shader,
 		return;
 
 	if (view) {
-		struct si_pipe_sampler_view *rview =
-			(struct si_pipe_sampler_view*)view;
+		struct si_sampler_view *rview =
+			(struct si_sampler_view*)view;
 
 		r600_context_bo_reloc(&sctx->b, &sctx->b.rings.gfx,
 				      rview->resource, RADEON_USAGE_READ,
@@ -380,7 +380,7 @@ static void si_set_sampler_views(struct pipe_context *ctx,
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_textures_info *samplers = &sctx->samplers[shader];
-	struct si_pipe_sampler_view **rviews = (struct si_pipe_sampler_view **)views;
+	struct si_sampler_view **rviews = (struct si_sampler_view **)views;
 	int i;
 
 	if (!count || shader >= SI_NUM_SHADERS)
@@ -450,7 +450,7 @@ void si_set_sampler_descriptors(struct si_context *sctx, unsigned shader,
 				unsigned start, unsigned count, void **states)
 {
 	struct si_sampler_states *samplers = &sctx->samplers[shader].states;
-	struct si_pipe_sampler_state **sstates = (struct si_pipe_sampler_state**)states;
+	struct si_sampler_state **sstates = (struct si_sampler_state**)states;
 	int i;
 
 	if (start == 0)
@@ -925,7 +925,7 @@ static void si_invalidate_buffer(struct pipe_context *ctx, struct pipe_resource
 	uint64_t old_va = rbuffer->gpu_address;
 	unsigned num_elems = sctx->vertex_elements ?
 				       sctx->vertex_elements->count : 0;
-	struct si_pipe_sampler_view *view;
+	struct si_sampler_view *view;
 
 	/* Reallocate the buffer in the same pipe_resource. */
 	r600_init_resource(&sctx->screen->b, rbuffer, rbuffer->b.b.width0,
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 00d03be..4b223b4 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -39,13 +39,13 @@
 
 #define SI_MAX_DRAW_CS_DWORDS 18
 
-struct si_pipe_compute;
+struct si_compute;
 
 struct si_screen {
 	struct r600_common_screen	b;
 };
 
-struct si_pipe_sampler_view {
+struct si_sampler_view {
 	struct pipe_sampler_view	base;
 	struct list_head		list;
 	struct r600_resource		*resource;
@@ -53,13 +53,13 @@ struct si_pipe_sampler_view {
 	uint32_t			fmask_state[8];
 };
 
-struct si_pipe_sampler_state {
+struct si_sampler_state {
 	uint32_t			val[4];
 	uint32_t			border_color[4];
 };
 
 struct si_cs_shader_state {
-	struct si_pipe_compute		*program;
+	struct si_compute		*program;
 };
 
 struct si_textures_info {
@@ -118,9 +118,10 @@ struct si_context {
 	unsigned			pa_su_sc_mode_cntl;
 	/* for saving when using blitter */
 	struct pipe_stencil_ref		stencil_ref;
-	struct si_pipe_shader_selector	*ps_shader;
-	struct si_pipe_shader_selector	*gs_shader;
-	struct si_pipe_shader_selector	*vs_shader;
+	/* shaders */
+	struct si_shader_selector	*ps_shader;
+	struct si_shader_selector	*gs_shader;
+	struct si_shader_selector	*vs_shader;
 	struct si_cs_shader_state	cs_shader_state;
 	/* shader information */
 	unsigned			sprite_coord_enable;
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 9b70a35..2fc1632 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2723,12 +2723,12 @@ static int si_generate_gs_copy_shader(struct si_context *sctx,
 	return r;
 }
 
-int si_pipe_shader_create(
+int si_shader_create(
 	struct pipe_context *ctx,
 	struct si_shader *shader)
 {
 	struct si_context *sctx = (struct si_context*)ctx;
-	struct si_pipe_shader_selector *sel = shader->selector;
+	struct si_shader_selector *sel = shader->selector;
 	struct si_shader_context si_shader_ctx;
 	struct tgsi_shader_info shader_info;
 	struct lp_build_tgsi_context * bld_base;
@@ -2897,7 +2897,7 @@ out:
 	return r;
 }
 
-void si_pipe_shader_destroy(struct pipe_context *ctx, struct si_shader *shader)
+void si_shader_destroy(struct pipe_context *ctx, struct si_shader *shader)
 {
 	r600_resource_reference(&shader->bo, NULL);
 }
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 3cc7757..1f1cc32 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -112,7 +112,7 @@ struct si_shader_output {
 
 struct si_shader;
 
-struct si_pipe_shader_selector {
+struct si_shader_selector {
 	struct si_shader *current;
 
 	struct tgsi_token       *tokens;
@@ -147,7 +147,7 @@ union si_shader_key {
 };
 
 struct si_shader {
-	struct si_pipe_shader_selector	*selector;
+	struct si_shader_selector	*selector;
 	struct si_shader		*next_variant;
 
 	struct si_shader		*gs_copy_shader;
@@ -196,10 +196,10 @@ static inline struct si_shader* si_get_vs_state(struct si_context *sctx)
 }
 
 /* radeonsi_shader.c */
-int si_pipe_shader_create(struct pipe_context *ctx, struct si_shader *shader);
-int si_pipe_shader_create(struct pipe_context *ctx, struct si_shader *shader);
+int si_shader_create(struct pipe_context *ctx, struct si_shader *shader);
+int si_shader_create(struct pipe_context *ctx, struct si_shader *shader);
 int si_compile_llvm(struct si_context *sctx, struct si_shader *shader,
 							LLVMModuleRef mod);
-void si_pipe_shader_destroy(struct pipe_context *ctx, struct si_shader *shader);
+void si_shader_destroy(struct pipe_context *ctx, struct si_shader *shader);
 
 #endif
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index bfda528..5f1bfea 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2188,7 +2188,7 @@ static void si_set_min_samples(struct pipe_context *ctx, unsigned min_samples)
 
 /* Compute the key for the hw shader variant */
 static INLINE void si_shader_selector_key(struct pipe_context *ctx,
-					  struct si_pipe_shader_selector *sel,
+					  struct si_shader_selector *sel,
 					  union si_shader_key *key)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
@@ -2242,7 +2242,7 @@ static INLINE void si_shader_selector_key(struct pipe_context *ctx,
 
 /* Select the hw shader variant depending on the current state. */
 int si_shader_select(struct pipe_context *ctx,
-		     struct si_pipe_shader_selector *sel)
+		     struct si_shader_selector *sel)
 {
 	union si_shader_key key;
 	struct si_shader * shader = NULL;
@@ -2283,7 +2283,7 @@ int si_shader_select(struct pipe_context *ctx,
 
 		shader->next_variant = sel->current;
 		sel->current = shader;
-		r = si_pipe_shader_create(ctx, shader);
+		r = si_shader_create(ctx, shader);
 		if (unlikely(r)) {
 			R600_ERR("Failed to build shader variant (type=%u) %d\n",
 				 sel->type, r);
@@ -2301,7 +2301,7 @@ static void *si_create_shader_state(struct pipe_context *ctx,
 				    const struct pipe_shader_state *state,
 				    unsigned pipe_shader_type)
 {
-	struct si_pipe_shader_selector *sel = CALLOC_STRUCT(si_pipe_shader_selector);
+	struct si_shader_selector *sel = CALLOC_STRUCT(si_shader_selector);
 	int r;
 
 	sel->type = pipe_shader_type;
@@ -2345,7 +2345,7 @@ static void *si_create_vs_state(struct pipe_context *ctx,
 static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
-	struct si_pipe_shader_selector *sel = state;
+	struct si_shader_selector *sel = state;
 
 	if (sctx->vs_shader == sel)
 		return;
@@ -2359,7 +2359,7 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
 static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
-	struct si_pipe_shader_selector *sel = state;
+	struct si_shader_selector *sel = state;
 
 	if (sctx->gs_shader == sel)
 		return;
@@ -2370,7 +2370,7 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
 static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
-	struct si_pipe_shader_selector *sel = state;
+	struct si_shader_selector *sel = state;
 
 	/* skip if supplied shader is one already in use */
 	if (sctx->ps_shader == sel)
@@ -2392,7 +2392,7 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
 }
 
 static void si_delete_shader_selector(struct pipe_context *ctx,
-				      struct si_pipe_shader_selector *sel)
+				      struct si_shader_selector *sel)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_shader *p = sel->current, *c;
@@ -2407,7 +2407,7 @@ static void si_delete_shader_selector(struct pipe_context *ctx,
 			si_pm4_delete_state(sctx, es, p->pm4);
 		else
 			si_pm4_delete_state(sctx, vs, p->pm4);
-		si_pipe_shader_destroy(ctx, p);
+		si_shader_destroy(ctx, p);
 		free(p);
 		p = c;
 	}
@@ -2419,7 +2419,7 @@ static void si_delete_shader_selector(struct pipe_context *ctx,
 static void si_delete_vs_shader(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
-	struct si_pipe_shader_selector *sel = (struct si_pipe_shader_selector *)state;
+	struct si_shader_selector *sel = (struct si_shader_selector *)state;
 
 	if (sctx->vs_shader == sel) {
 		sctx->vs_shader = NULL;
@@ -2431,7 +2431,7 @@ static void si_delete_vs_shader(struct pipe_context *ctx, void *state)
 static void si_delete_gs_shader(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
-	struct si_pipe_shader_selector *sel = (struct si_pipe_shader_selector *)state;
+	struct si_shader_selector *sel = (struct si_shader_selector *)state;
 
 	if (sctx->gs_shader == sel) {
 		sctx->gs_shader = NULL;
@@ -2443,7 +2443,7 @@ static void si_delete_gs_shader(struct pipe_context *ctx, void *state)
 static void si_delete_ps_shader(struct pipe_context *ctx, void *state)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
-	struct si_pipe_shader_selector *sel = (struct si_pipe_shader_selector *)state;
+	struct si_shader_selector *sel = (struct si_shader_selector *)state;
 
 	if (sctx->ps_shader == sel) {
 		sctx->ps_shader = NULL;
@@ -2461,7 +2461,7 @@ static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx
 							const struct pipe_sampler_view *state)
 {
 	struct si_context *sctx = (struct si_context*)ctx;
-	struct si_pipe_sampler_view *view = CALLOC_STRUCT(si_pipe_sampler_view);
+	struct si_sampler_view *view = CALLOC_STRUCT(si_sampler_view);
 	struct r600_texture *tmp = (struct r600_texture*)texture;
 	const struct util_format_description *desc;
 	unsigned format, num_format;
@@ -2715,7 +2715,7 @@ static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx
 static void si_sampler_view_destroy(struct pipe_context *ctx,
 				    struct pipe_sampler_view *state)
 {
-	struct si_pipe_sampler_view *view = (struct si_pipe_sampler_view *)state;
+	struct si_sampler_view *view = (struct si_sampler_view *)state;
 
 	if (view->resource->b.b.target == PIPE_BUFFER)
 		LIST_DELINIT(&view->list);
@@ -2748,7 +2748,7 @@ static bool sampler_state_needs_border_color(const struct pipe_sampler_state *st
 static void *si_create_sampler_state(struct pipe_context *ctx,
 				     const struct pipe_sampler_state *state)
 {
-	struct si_pipe_sampler_state *rstate = CALLOC_STRUCT(si_pipe_sampler_state);
+	struct si_sampler_state *rstate = CALLOC_STRUCT(si_sampler_state);
 	unsigned aniso_flag_offset = state->max_anisotropy > 1 ? 2 : 0;
 	unsigned border_color_type;
 
@@ -2792,7 +2792,7 @@ static void *si_create_sampler_state(struct pipe_context *ctx,
 static void si_set_border_colors(struct si_context *sctx, unsigned count,
 				 void **states)
 {
-	struct si_pipe_sampler_state **rstates = (struct si_pipe_sampler_state **)states;
+	struct si_sampler_state **rstates = (struct si_sampler_state **)states;
 	uint32_t *border_color_table = NULL;
 	int i, j;
 
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index 99f5b1a..a5c6720 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -248,7 +248,7 @@ void si_upload_const_buffer(struct si_context *sctx, struct r600_resource **rbuf
 			    const uint8_t *ptr, unsigned size, uint32_t *const_offset);
 
 /* si_state.c */
-struct si_pipe_shader_selector;
+struct si_shader_selector;
 
 boolean si_is_format_supported(struct pipe_screen *screen,
                                enum pipe_format format,
@@ -256,7 +256,7 @@ boolean si_is_format_supported(struct pipe_screen *screen,
                                unsigned sample_count,
                                unsigned usage);
 int si_shader_select(struct pipe_context *ctx,
-		     struct si_pipe_shader_selector *sel);
+		     struct si_shader_selector *sel);
 void si_init_state_functions(struct si_context *sctx);
 void si_init_config(struct si_context *sctx);
 unsigned cik_bank_wh(unsigned bankwh);
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index acc2ef3..a9dedf9 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -39,7 +39,7 @@
  * Shaders
  */
 
-static void si_pipe_shader_es(struct pipe_context *ctx, struct si_shader *shader)
+static void si_shader_es(struct pipe_context *ctx, struct si_shader *shader)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_pm4_state *pm4;
@@ -79,7 +79,7 @@ static void si_pipe_shader_es(struct pipe_context *ctx, struct si_shader *shader
 	sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
 }
 
-static void si_pipe_shader_gs(struct pipe_context *ctx, struct si_shader *shader)
+static void si_shader_gs(struct pipe_context *ctx, struct si_shader *shader)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	unsigned gs_vert_itemsize = shader->noutput * (16 >> 2);
@@ -151,7 +151,7 @@ static void si_pipe_shader_gs(struct pipe_context *ctx, struct si_shader *shader
 	sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
 }
 
-static void si_pipe_shader_vs(struct pipe_context *ctx, struct si_shader *shader)
+static void si_shader_vs(struct pipe_context *ctx, struct si_shader *shader)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_pm4_state *pm4;
@@ -227,7 +227,7 @@ static void si_pipe_shader_vs(struct pipe_context *ctx, struct si_shader *shader
 	sctx->b.flags |= R600_CONTEXT_INV_SHADER_CACHE;
 }
 
-static void si_pipe_shader_ps(struct pipe_context *ctx, struct si_shader *shader)
+static void si_shader_ps(struct pipe_context *ctx, struct si_shader *shader)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_pm4_state *pm4;
@@ -609,9 +609,8 @@ static void si_update_derived_state(struct si_context *sctx)
 		si_shader_select(ctx, sctx->gs_shader);
 
 		if (!sctx->gs_shader->current->pm4) {
-			si_pipe_shader_gs(ctx, sctx->gs_shader->current);
-			si_pipe_shader_vs(ctx,
-					  sctx->gs_shader->current->gs_copy_shader);
+			si_shader_gs(ctx, sctx->gs_shader->current);
+			si_shader_vs(ctx, sctx->gs_shader->current->gs_copy_shader);
 		}
 
 		si_pm4_bind_state(sctx, gs, sctx->gs_shader->current->pm4);
@@ -622,7 +621,7 @@ static void si_update_derived_state(struct si_context *sctx)
 		si_shader_select(ctx, sctx->vs_shader);
 
 		if (!sctx->vs_shader->current->pm4)
-			si_pipe_shader_es(ctx, sctx->vs_shader->current);
+			si_shader_es(ctx, sctx->vs_shader->current);
 
 		si_pm4_bind_state(sctx, es, sctx->vs_shader->current->pm4);
 
@@ -651,7 +650,7 @@ static void si_update_derived_state(struct si_context *sctx)
 		si_shader_select(ctx, sctx->vs_shader);
 
 		if (!sctx->vs_shader->current->pm4)
-			si_pipe_shader_vs(ctx, sctx->vs_shader->current);
+			si_shader_vs(ctx, sctx->vs_shader->current);
 
 		si_pm4_bind_state(sctx, vs, sctx->vs_shader->current->pm4);
 
@@ -672,7 +671,7 @@ static void si_update_derived_state(struct si_context *sctx)
 	si_shader_select(ctx, sctx->ps_shader);
 
 	if (!sctx->ps_shader->current->pm4)
-		si_pipe_shader_ps(ctx, sctx->ps_shader->current);
+		si_shader_ps(ctx, sctx->ps_shader->current);
 
 	si_pm4_bind_state(sctx, ps, sctx->ps_shader->current->pm4);
 
-- 
1.9.1



More information about the mesa-dev mailing list