[Mesa-dev] [PATCH 15/20] radeonsi: split texture decompression for compute shaders

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Sat Apr 2 13:10:58 UTC 2016


Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
 src/gallium/drivers/radeonsi/si_blit.c       | 13 +++++++++++--
 src/gallium/drivers/radeonsi/si_compute.c    |  2 ++
 src/gallium/drivers/radeonsi/si_pipe.h       |  3 ++-
 src/gallium/drivers/radeonsi/si_state_draw.c |  2 +-
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
index e0dbec5..6913336 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -377,7 +377,8 @@ si_decompress_image_color_textures(struct si_context *sctx,
 	}
 }
 
-void si_decompress_textures(struct si_context *sctx)
+static void si_decompress_textures(struct si_context *sctx, int shader_start,
+                                   int shader_end)
 {
 	unsigned compressed_colortex_counter;
 
@@ -392,7 +393,7 @@ void si_decompress_textures(struct si_context *sctx)
 	}
 
 	/* Flush depth textures which need to be flushed. */
-	for (int i = 0; i < SI_NUM_SHADERS; i++) {
+	for (int i = shader_start; i < shader_end; i++) {
 		if (sctx->samplers[i].depth_texture_mask) {
 			si_flush_depth_textures(sctx, &sctx->samplers[i]);
 		}
@@ -405,6 +406,14 @@ void si_decompress_textures(struct si_context *sctx)
 	}
 }
 
+void si_decompress_graphics_textures(struct si_context *sctx) {
+	si_decompress_textures(sctx, 0, SI_NUM_GRAPHICS_SHADERS);
+}
+
+void si_decompress_compute_textures(struct si_context *sctx) {
+	si_decompress_textures(sctx, SI_NUM_GRAPHICS_SHADERS, SI_NUM_SHADERS);
+}
+
 static void si_clear(struct pipe_context *ctx, unsigned buffers,
 		     const union pipe_color_union *color,
 		     double depth, unsigned stencil)
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 64ad2f3..9630332 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -426,6 +426,8 @@ static void si_launch_grid(
 	struct si_compute *program = sctx->cs_shader_state.program;
 	int i;
 
+	si_decompress_compute_textures(sctx);
+
 	si_need_cs_space(sctx);
 
 	if (!sctx->cs_shader_state.initialized)
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 20d5e4e..7e827db 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -346,7 +346,8 @@ void cik_sdma_copy(struct pipe_context *ctx,
 
 /* si_blit.c */
 void si_init_blit_functions(struct si_context *sctx);
-void si_decompress_textures(struct si_context *sctx);
+void si_decompress_graphics_textures(struct si_context *sctx);
+void si_decompress_compute_textures(struct si_context *sctx);
 void si_resource_copy_region(struct pipe_context *ctx,
 			     struct pipe_resource *dst,
 			     unsigned dst_level,
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 84b850a..757b32c 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -777,7 +777,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 		si_mark_atom_dirty(sctx, &sctx->framebuffer.atom);
 	}
 
-	si_decompress_textures(sctx);
+	si_decompress_graphics_textures(sctx);
 
 	/* Set the rasterization primitive type.
 	 *
-- 
2.7.4



More information about the mesa-dev mailing list