[Mesa-dev] [PATCH 10/17] radeonsi: state atom IDs don't have to be off by one

Marek Olšák maraeo at gmail.com
Thu Jan 26 16:04:26 UTC 2017


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

---
 src/gallium/drivers/radeonsi/si_pipe.h  | 4 ++--
 src/gallium/drivers/radeonsi/si_state.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index da6aca1..13b1e34 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -428,33 +428,33 @@ struct pipe_video_buffer *si_video_buffer_create(struct pipe_context *pipe,
 static inline void
 si_invalidate_draw_sh_constants(struct si_context *sctx)
 {
 	sctx->last_base_vertex = SI_BASE_VERTEX_UNKNOWN;
 }
 
 static inline void
 si_set_atom_dirty(struct si_context *sctx,
 		  struct r600_atom *atom, bool dirty)
 {
-	unsigned bit = 1 << (atom->id - 1);
+	unsigned bit = 1 << atom->id;
 
 	if (dirty)
 		sctx->dirty_atoms |= bit;
 	else
 		sctx->dirty_atoms &= ~bit;
 }
 
 static inline bool
 si_is_atom_dirty(struct si_context *sctx,
 		  struct r600_atom *atom)
 {
-	unsigned bit = 1 << (atom->id - 1);
+	unsigned bit = 1 << atom->id;
 
 	return sctx->dirty_atoms & bit;
 }
 
 static inline void
 si_mark_atom_dirty(struct si_context *sctx,
 		   struct r600_atom *atom)
 {
 	si_set_atom_dirty(sctx, atom, true);
 }
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index df4b813..359058b 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -33,31 +33,31 @@
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_memory.h"
 #include "util/u_resource.h"
 
 /* Initialize an external atom (owned by ../radeon). */
 static void
 si_init_external_atom(struct si_context *sctx, struct r600_atom *atom,
 		      struct r600_atom **list_elem)
 {
-	atom->id = list_elem - sctx->atoms.array + 1;
+	atom->id = list_elem - sctx->atoms.array;
 	*list_elem = atom;
 }
 
 /* Initialize an atom owned by radeonsi.  */
 void si_init_atom(struct si_context *sctx, struct r600_atom *atom,
 		  struct r600_atom **list_elem,
 		  void (*emit_func)(struct si_context *ctx, struct r600_atom *state))
 {
 	atom->emit = (void*)emit_func;
-	atom->id = list_elem - sctx->atoms.array + 1; /* index+1 in the atom array */
+	atom->id = list_elem - sctx->atoms.array;
 	*list_elem = atom;
 }
 
 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;
-- 
2.7.4



More information about the mesa-dev mailing list