[Mesa-dev] [PATCH 06/14] radeonsi: only expose *_init_*dma_functions from (S)DMA files

Marek Olšák maraeo at gmail.com
Wed May 4 23:43:35 UTC 2016


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

just normalizing the interfaces
---
 src/gallium/drivers/radeonsi/cik_sdma.c | 19 ++++++++++++-------
 src/gallium/drivers/radeonsi/si_dma.c   | 19 ++++++++++++-------
 src/gallium/drivers/radeonsi/si_pipe.c  |  5 +++++
 src/gallium/drivers/radeonsi/si_pipe.h  | 16 ++--------------
 src/gallium/drivers/radeonsi/si_state.c |  6 ------
 5 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/cik_sdma.c b/src/gallium/drivers/radeonsi/cik_sdma.c
index 7f7db91..a8caf04 100644
--- a/src/gallium/drivers/radeonsi/cik_sdma.c
+++ b/src/gallium/drivers/radeonsi/cik_sdma.c
@@ -193,13 +193,13 @@ static void cik_sdma_copy_tile(struct si_context *ctx,
 	}
 }
 
-void cik_sdma_copy(struct pipe_context *ctx,
-		   struct pipe_resource *dst,
-		   unsigned dst_level,
-		   unsigned dstx, unsigned dsty, unsigned dstz,
-		   struct pipe_resource *src,
-		   unsigned src_level,
-		   const struct pipe_box *src_box)
+static void cik_sdma_copy(struct pipe_context *ctx,
+			  struct pipe_resource *dst,
+			  unsigned dst_level,
+			  unsigned dstx, unsigned dsty, unsigned dstz,
+			  struct pipe_resource *src,
+			  unsigned src_level,
+			  const struct pipe_box *src_box)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct r600_texture *rsrc = (struct r600_texture*)src;
@@ -324,3 +324,8 @@ fallback:
 	si_resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
 				src, src_level, src_box);
 }
+
+void cik_init_sdma_functions(struct si_context *sctx)
+{
+	sctx->b.dma_copy = cik_sdma_copy;
+}
diff --git a/src/gallium/drivers/radeonsi/si_dma.c b/src/gallium/drivers/radeonsi/si_dma.c
index 84961d5..033eb7b 100644
--- a/src/gallium/drivers/radeonsi/si_dma.c
+++ b/src/gallium/drivers/radeonsi/si_dma.c
@@ -190,13 +190,13 @@ static void si_dma_copy_tile(struct si_context *ctx,
 	}
 }
 
-void si_dma_copy(struct pipe_context *ctx,
-		 struct pipe_resource *dst,
-		 unsigned dst_level,
-		 unsigned dstx, unsigned dsty, unsigned dstz,
-		 struct pipe_resource *src,
-		 unsigned src_level,
-		 const struct pipe_box *src_box)
+static void si_dma_copy(struct pipe_context *ctx,
+			struct pipe_resource *dst,
+			unsigned dst_level,
+			unsigned dstx, unsigned dsty, unsigned dstz,
+			struct pipe_resource *src,
+			unsigned src_level,
+			const struct pipe_box *src_box)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct r600_texture *rsrc = (struct r600_texture*)src;
@@ -293,3 +293,8 @@ fallback:
 	si_resource_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
 				src, src_level, src_box);
 }
+
+void si_init_dma_functions(struct si_context *sctx)
+{
+	sctx->b.dma_copy = si_dma_copy;
+}
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 1a69f43..f2692dc 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -192,6 +192,11 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
 	si_init_state_functions(sctx);
 	si_init_shader_functions(sctx);
 
+	if (sctx->b.chip_class >= CIK)
+		cik_init_sdma_functions(sctx);
+	else
+		si_init_dma_functions(sctx);
+
 	if (sscreen->b.debug_flags & DBG_FORCE_DMA)
 		sctx->b.b.resource_copy_region = sctx->b.dma_copy;
 
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index d31e9a9..33d3d25 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -325,13 +325,7 @@ struct si_context {
 };
 
 /* cik_sdma.c */
-void cik_sdma_copy(struct pipe_context *ctx,
-		   struct pipe_resource *dst,
-		   unsigned dst_level,
-		   unsigned dstx, unsigned dsty, unsigned dstz,
-		   struct pipe_resource *src,
-		   unsigned src_level,
-		   const struct pipe_box *src_box);
+void cik_init_sdma_functions(struct si_context *sctx);
 
 /* si_blit.c */
 void si_init_blit_functions(struct si_context *sctx);
@@ -357,13 +351,7 @@ void si_check_vm_faults(struct si_context *sctx);
 bool si_replace_shader(unsigned num, struct radeon_shader_binary *binary);
 
 /* si_dma.c */
-void si_dma_copy(struct pipe_context *ctx,
-		 struct pipe_resource *dst,
-		 unsigned dst_level,
-		 unsigned dstx, unsigned dsty, unsigned dstz,
-		 struct pipe_resource *src,
-		 unsigned src_level,
-		 const struct pipe_box *src_box);
+void si_init_dma_functions(struct si_context *sctx);
 
 /* si_hw_context.c */
 void si_context_gfx_flush(void *context, unsigned flags,
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index c6e10b7..6327f42 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -3387,12 +3387,6 @@ void si_init_state_functions(struct si_context *sctx)
 
 	sctx->b.b.draw_vbo = si_draw_vbo;
 
-	if (sctx->b.chip_class >= CIK) {
-		sctx->b.dma_copy = cik_sdma_copy;
-	} else {
-		sctx->b.dma_copy = si_dma_copy;
-	}
-
 	si_init_config(sctx);
 }
 
-- 
2.7.4



More information about the mesa-dev mailing list