[Mesa-dev] [PATCH 2/7] radeonsi: add si_so_target_reference

Marek Olšák maraeo at gmail.com
Sat Oct 7 22:47:01 UTC 2017


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

The src type is different on purpose.
---
 src/gallium/drivers/radeonsi/si_state_streamout.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_streamout.c b/src/gallium/drivers/radeonsi/si_state_streamout.c
index 42a83d4..92c5c59 100644
--- a/src/gallium/drivers/radeonsi/si_state_streamout.c
+++ b/src/gallium/drivers/radeonsi/si_state_streamout.c
@@ -25,20 +25,26 @@
  */
 
 #include "si_pipe.h"
 #include "si_state.h"
 #include "radeon/r600_cs.h"
 
 #include "util/u_memory.h"
 
 static void si_set_streamout_enable(struct si_context *sctx, bool enable);
 
+static inline void si_so_target_reference(struct si_streamout_target **dst,
+					  struct pipe_stream_output_target *src)
+{
+	pipe_so_target_reference((struct pipe_stream_output_target**)dst, src);
+}
+
 static struct pipe_stream_output_target *
 si_create_so_target(struct pipe_context *ctx,
 		    struct pipe_resource *buffer,
 		    unsigned buffer_offset,
 		    unsigned buffer_size)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_streamout_target *t;
 	struct r600_resource *rbuffer = (struct r600_resource*)buffer;
 
@@ -93,31 +99,31 @@ void si_common_set_streamout_targets(struct pipe_context *ctx,
 	unsigned i;
         unsigned enabled_mask = 0, append_bitmask = 0;
 
 	/* Stop streamout. */
 	if (sctx->streamout.num_targets && sctx->streamout.begin_emitted) {
 		si_emit_streamout_end(sctx);
 	}
 
 	/* Set the new targets. */
 	for (i = 0; i < num_targets; i++) {
-		pipe_so_target_reference((struct pipe_stream_output_target**)&sctx->streamout.targets[i], targets[i]);
+		si_so_target_reference(&sctx->streamout.targets[i], targets[i]);
 		if (!targets[i])
 			continue;
 
 		r600_context_add_resource_size(ctx, targets[i]->buffer);
 		enabled_mask |= 1 << i;
 		if (offsets[i] == ((unsigned)-1))
 			append_bitmask |= 1 << i;
 	}
 	for (; i < sctx->streamout.num_targets; i++) {
-		pipe_so_target_reference((struct pipe_stream_output_target**)&sctx->streamout.targets[i], NULL);
+		si_so_target_reference(&sctx->streamout.targets[i], NULL);
 	}
 
 	sctx->streamout.enabled_mask = enabled_mask;
 
 	sctx->streamout.num_targets = num_targets;
 	sctx->streamout.append_bitmask = append_bitmask;
 
 	if (num_targets) {
 		si_streamout_buffers_dirty(sctx);
 	} else {
-- 
2.7.4



More information about the mesa-dev mailing list