From ccebcba893cb54f36fec41f548071b08b9f7ba16 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 8 Apr 2018 21:03:51 -0400 Subject: [PATCH] radeonsi: remove si_atom::id MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_pipe.h | 21 +++++++++++---------- src/gallium/drivers/radeonsi/si_state.c | 14 -------------- src/gallium/drivers/radeonsi/si_state.h | 6 +++--- src/gallium/drivers/radeonsi/si_state_draw.c | 2 +- 4 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 37ff050..41f88b9 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -1339,11 +1339,16 @@ si_invalidate_draw_sh_constants(struct si_context *sctx) sctx->last_base_vertex = SI_BASE_VERTEX_UNKNOWN; } +static inline unsigned +si_get_atom_bit(struct si_context *sctx, struct si_atom *atom) +{ + return 1 << (atom - sctx->atoms.array); +} + static inline void -si_set_atom_dirty(struct si_context *sctx, - struct si_atom *atom, bool dirty) +si_set_atom_dirty(struct si_context *sctx, struct si_atom *atom, bool dirty) { - unsigned bit = 1 << atom->id; + unsigned bit = si_get_atom_bit(sctx, atom); if (dirty) sctx->dirty_atoms |= bit; @@ -1352,17 +1357,13 @@ si_set_atom_dirty(struct si_context *sctx, } static inline bool -si_is_atom_dirty(struct si_context *sctx, - struct si_atom *atom) +si_is_atom_dirty(struct si_context *sctx, struct si_atom *atom) { - unsigned bit = 1 << atom->id; - - return sctx->dirty_atoms & bit; + return (sctx->dirty_atoms & si_get_atom_bit(sctx, atom)) != 0; } static inline void -si_mark_atom_dirty(struct si_context *sctx, - struct si_atom *atom) +si_mark_atom_dirty(struct si_context *sctx, struct si_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 13c8fa3..90416b3 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -33,19 +33,11 @@ #include "util/u_resource.h" #include "util/u_upload_mgr.h" -/* Initialize an external atom (owned by ../radeon). */ -static void -si_init_external_atom(struct si_context *sctx, struct si_atom *atom) -{ - atom->id = atom - sctx->atoms.array; -} - /* 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; - atom->id = atom - sctx->atoms.array; } static unsigned si_map_swizzle(unsigned swizzle) @@ -4526,12 +4518,6 @@ static void si_init_config(struct si_context *sctx); void si_init_state_functions(struct si_context *sctx) { - si_init_external_atom(sctx, &sctx->atoms.s.render_cond); - si_init_external_atom(sctx, &sctx->atoms.s.streamout_begin); - si_init_external_atom(sctx, &sctx->atoms.s.streamout_enable); - si_init_external_atom(sctx, &sctx->atoms.s.scissors); - si_init_external_atom(sctx, &sctx->atoms.s.viewports); - 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); diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index 6c9899d..4ee69b9 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -45,11 +45,11 @@ struct si_shader_selector; struct r600_texture; struct si_qbo_state; -/* This encapsulates a state or an operation which can emitted into the GPU - * command stream. */ +/* State atoms are callbacks which write a sequence of packets into a GPU + * command buffer (AKA indirect buffer, AKA IB, AKA command stream, AKA CS). + */ struct si_atom { void (*emit)(struct si_context *ctx, struct si_atom *state); - unsigned short id; }; struct si_state_blend { diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index 8ed87bf..8d41988 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -1436,7 +1436,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) unsigned masked_atoms = 0; if (unlikely(sctx->flags & SI_CONTEXT_FLUSH_FOR_RENDER_COND)) - masked_atoms |= 1u << sctx->atoms.s.render_cond.id; + masked_atoms |= si_get_atom_bit(sctx, &sctx->atoms.s.render_cond); if (!si_upload_graphics_shader_descriptors(sctx)) return; -- 2.7.4