[Mesa-dev] [PATCH 5/9] radeonsi: remove function si_init_atom

Marek Olšák maraeo at gmail.com
Tue Apr 17 00:42:07 UTC 2018


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

---
 src/gallium/drivers/radeonsi/si_descriptors.c |  3 +-
 src/gallium/drivers/radeonsi/si_state.c       | 29 +++++++------------
 src/gallium/drivers/radeonsi/si_state.h       |  4 ---
 .../drivers/radeonsi/si_state_shaders.c       |  5 ++--
 4 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 4efae9704bc..8bb2a5d95d8 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -2755,22 +2755,21 @@ void si_init_all_descriptors(struct si_context *sctx)
 	sctx->b.set_shader_buffers = si_set_shader_buffers;
 	sctx->b.set_sampler_views = si_set_sampler_views;
 	sctx->b.create_texture_handle = si_create_texture_handle;
 	sctx->b.delete_texture_handle = si_delete_texture_handle;
 	sctx->b.make_texture_handle_resident = si_make_texture_handle_resident;
 	sctx->b.create_image_handle = si_create_image_handle;
 	sctx->b.delete_image_handle = si_delete_image_handle;
 	sctx->b.make_image_handle_resident = si_make_image_handle_resident;
 
 	/* Shader user data. */
-	si_init_atom(sctx, &sctx->atoms.s.shader_pointers,
-		     si_emit_graphics_shader_pointers);
+	sctx->atoms.s.shader_pointers.emit = si_emit_graphics_shader_pointers;
 
 	/* Set default and immutable mappings. */
 	si_set_user_data_base(sctx, PIPE_SHADER_VERTEX, R_00B130_SPI_SHADER_USER_DATA_VS_0);
 
 	if (sctx->chip_class >= GFX9) {
 		si_set_user_data_base(sctx, PIPE_SHADER_TESS_CTRL,
 				      R_00B430_SPI_SHADER_USER_DATA_LS_0);
 		si_set_user_data_base(sctx, PIPE_SHADER_GEOMETRY,
 				      R_00B330_SPI_SHADER_USER_DATA_ES_0);
 	} else {
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 568b11d1eea..78ca1f436c9 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -26,27 +26,20 @@
 #include "gfx9d.h"
 #include "si_query.h"
 
 #include "util/u_dual_blend.h"
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_memory.h"
 #include "util/u_resource.h"
 #include "util/u_upload_mgr.h"
 
-/* Initialize an atom owned by radeonsi.  */
-void si_init_atom(struct si_context *sctx, struct si_atom *atom,
-		  void (*emit_func)(struct si_context *ctx, struct si_atom *state))
-{
-	atom->emit = emit_func;
-}
-
 static unsigned si_map_swizzle(unsigned swizzle)
 {
 	switch (swizzle) {
 	case PIPE_SWIZZLE_Y:
 		return V_008F0C_SQ_SEL_Y;
 	case PIPE_SWIZZLE_Z:
 		return V_008F0C_SQ_SEL_Z;
 	case PIPE_SWIZZLE_W:
 		return V_008F0C_SQ_SEL_W;
 	case PIPE_SWIZZLE_0:
@@ -4511,31 +4504,31 @@ static void *si_create_blend_custom(struct si_context *sctx, unsigned mode)
 	memset(&blend, 0, sizeof(blend));
 	blend.independent_blend_enable = true;
 	blend.rt[0].colormask = 0xf;
 	return si_create_blend_state_mode(&sctx->b, &blend, mode);
 }
 
 static void si_init_config(struct si_context *sctx);
 
 void si_init_state_functions(struct si_context *sctx)
 {
-	si_init_atom(sctx, &sctx->atoms.s.framebuffer, si_emit_framebuffer_state);
-	si_init_atom(sctx, &sctx->atoms.s.msaa_sample_locs, si_emit_msaa_sample_locs);
-	si_init_atom(sctx, &sctx->atoms.s.db_render_state, si_emit_db_render_state);
-	si_init_atom(sctx, &sctx->atoms.s.dpbb_state, si_emit_dpbb_state);
-	si_init_atom(sctx, &sctx->atoms.s.msaa_config, si_emit_msaa_config);
-	si_init_atom(sctx, &sctx->atoms.s.sample_mask, si_emit_sample_mask);
-	si_init_atom(sctx, &sctx->atoms.s.cb_render_state, si_emit_cb_render_state);
-	si_init_atom(sctx, &sctx->atoms.s.blend_color, si_emit_blend_color);
-	si_init_atom(sctx, &sctx->atoms.s.clip_regs, si_emit_clip_regs);
-	si_init_atom(sctx, &sctx->atoms.s.clip_state, si_emit_clip_state);
-	si_init_atom(sctx, &sctx->atoms.s.stencil_ref, si_emit_stencil_ref);
+	sctx->atoms.s.framebuffer.emit = si_emit_framebuffer_state;
+	sctx->atoms.s.msaa_sample_locs.emit = si_emit_msaa_sample_locs;
+	sctx->atoms.s.db_render_state.emit = si_emit_db_render_state;
+	sctx->atoms.s.dpbb_state.emit = si_emit_dpbb_state;
+	sctx->atoms.s.msaa_config.emit = si_emit_msaa_config;
+	sctx->atoms.s.sample_mask.emit = si_emit_sample_mask;
+	sctx->atoms.s.cb_render_state.emit = si_emit_cb_render_state;
+	sctx->atoms.s.blend_color.emit = si_emit_blend_color;
+	sctx->atoms.s.clip_regs.emit = si_emit_clip_regs;
+	sctx->atoms.s.clip_state.emit = si_emit_clip_state;
+	sctx->atoms.s.stencil_ref.emit = si_emit_stencil_ref;
 
 	sctx->b.create_blend_state = si_create_blend_state;
 	sctx->b.bind_blend_state = si_bind_blend_state;
 	sctx->b.delete_blend_state = si_delete_blend_state;
 	sctx->b.set_blend_color = si_set_blend_color;
 
 	sctx->b.create_rasterizer_state = si_create_rs_state;
 	sctx->b.bind_rasterizer_state = si_bind_rs_state;
 	sctx->b.delete_rasterizer_state = si_delete_rs_state;
 
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index 4ee69b95bd3..5e3c543f579 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -372,24 +372,20 @@ void si_set_active_descriptors_for_shader(struct si_context *sctx,
 					  struct si_shader_selector *sel);
 bool si_bindless_descriptor_can_reclaim_slab(void *priv,
 					     struct pb_slab_entry *entry);
 struct pb_slab *si_bindless_descriptor_slab_alloc(void *priv, unsigned heap,
 						  unsigned entry_size,
 						  unsigned group_index);
 void si_bindless_descriptor_slab_free(void *priv, struct pb_slab *pslab);
 void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf,
 		      uint64_t old_va);
 /* si_state.c */
-struct si_shader_selector;
-
-void si_init_atom(struct si_context *sctx, struct si_atom *atom,
-		  void (*emit_func)(struct si_context *ctx, struct si_atom *state));
 void si_init_state_functions(struct si_context *sctx);
 void si_init_screen_state_functions(struct si_screen *sscreen);
 void
 si_make_buffer_descriptor(struct si_screen *screen, struct r600_resource *buf,
 			  enum pipe_format format,
 			  unsigned offset, unsigned size,
 			  uint32_t *state);
 void
 si_make_texture_descriptor(struct si_screen *screen,
 			   struct r600_texture *tex,
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 747a2abc7e1..c073b8ddf60 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -3402,23 +3402,22 @@ void *si_get_blit_vs(struct si_context *sctx, enum blitter_attrib_type type,
 			 ureg_scalar(instance_id, TGSI_SWIZZLE_X));
 	}
 	ureg_END(ureg);
 
 	*vs = ureg_create_shader_and_destroy(ureg, &sctx->b);
 	return *vs;
 }
 
 void si_init_shader_functions(struct si_context *sctx)
 {
-	si_init_atom(sctx, &sctx->atoms.s.spi_map, si_emit_spi_map);
-	si_init_atom(sctx, &sctx->atoms.s.scratch_state,
-		     si_emit_scratch_state);
+	sctx->atoms.s.spi_map.emit = si_emit_spi_map;
+	sctx->atoms.s.scratch_state.emit = si_emit_scratch_state;
 
 	sctx->b.create_vs_state = si_create_shader_selector;
 	sctx->b.create_tcs_state = si_create_shader_selector;
 	sctx->b.create_tes_state = si_create_shader_selector;
 	sctx->b.create_gs_state = si_create_shader_selector;
 	sctx->b.create_fs_state = si_create_shader_selector;
 
 	sctx->b.bind_vs_state = si_bind_vs_shader;
 	sctx->b.bind_tcs_state = si_bind_tcs_shader;
 	sctx->b.bind_tes_state = si_bind_tes_shader;
-- 
2.17.0



More information about the mesa-dev mailing list