From de4fb088d3e39ef79b9818e4e5bfce425985f20d Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Tue, 29 Apr 2025 11:08:11 +0800 Subject: [PATCH] radeonsi: share some vertex pipe function with mesh pipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_pipe.h | 39 +++++++++++++++++++ .../drivers/radeonsi/si_state_draw.cpp | 39 ------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 12300a02110..9c3e5e80df4 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -2276,6 +2276,45 @@ static inline bool si_vs_uses_vbos(struct si_shader_selector *sel) return !sel || !sel->info.base.vs.blit_sgprs_amd; } +static inline bool si_is_line_stipple_enabled(struct si_context *sctx) +{ + struct si_state_rasterizer *rs = sctx->queued.named.rasterizer; + + return rs->line_stipple_enable && sctx->current_rast_prim != MESA_PRIM_POINTS && + (rs->polygon_mode_is_lines || util_prim_is_lines(sctx->current_rast_prim)); +} + +static ALWAYS_INLINE void +si_emit_all_states(struct si_context *sctx, uint64_t skip_atom_mask) +{ + /* Emit states by calling their emit functions. */ + uint64_t dirty = sctx->dirty_atoms & ~skip_atom_mask; + + if (dirty) { + sctx->dirty_atoms &= skip_atom_mask; + + /* u_bit_scan64 is too slow on i386. */ + if (sizeof(void*) == 8) { + do { + unsigned i = u_bit_scan64(&dirty); + sctx->atoms.array[i].emit(sctx, i); + } while (dirty); + } else { + unsigned dirty_lo = dirty; + unsigned dirty_hi = dirty >> 32; + + while (dirty_lo) { + unsigned i = u_bit_scan(&dirty_lo); + sctx->atoms.array[i].emit(sctx, i); + } + while (dirty_hi) { + unsigned i = 32 + u_bit_scan(&dirty_hi); + sctx->atoms.array[i].emit(sctx, i); + } + } + } +} + #define PRINT_ERR(fmt, args...) \ mesa_loge("%s:%d %s - " fmt, __FILE__, __LINE__, __func__, ##args) diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index 97ecad319c8..a0cd954d720 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -842,14 +842,6 @@ static void si_init_ia_multi_vgt_param_table(struct si_context *sctx) } } -static bool si_is_line_stipple_enabled(struct si_context *sctx) -{ - struct si_state_rasterizer *rs = sctx->queued.named.rasterizer; - - return rs->line_stipple_enable && sctx->current_rast_prim != MESA_PRIM_POINTS && - (rs->polygon_mode_is_lines || util_prim_is_lines(sctx->current_rast_prim)); -} - enum si_is_draw_vertex_state { DRAW_VERTEX_STATE_OFF, DRAW_VERTEX_STATE_ON, @@ -2047,37 +2039,6 @@ static void si_get_draw_start_count(struct si_context *sctx, const struct pipe_d } } -ALWAYS_INLINE -static void si_emit_all_states(struct si_context *sctx, uint64_t skip_atom_mask) -{ - /* Emit states by calling their emit functions. */ - uint64_t dirty = sctx->dirty_atoms & ~skip_atom_mask; - - if (dirty) { - sctx->dirty_atoms &= skip_atom_mask; - - /* u_bit_scan64 is too slow on i386. */ - if (sizeof(void*) == 8) { - do { - unsigned i = u_bit_scan64(&dirty); - sctx->atoms.array[i].emit(sctx, i); - } while (dirty); - } else { - unsigned dirty_lo = dirty; - unsigned dirty_hi = dirty >> 32; - - while (dirty_lo) { - unsigned i = u_bit_scan(&dirty_lo); - sctx->atoms.array[i].emit(sctx, i); - } - while (dirty_hi) { - unsigned i = 32 + u_bit_scan(&dirty_hi); - sctx->atoms.array[i].emit(sctx, i); - } - } - } -} - #define DRAW_CLEANUP do { \ if (release_indexbuf) \ pipe_resource_reference(&indexbuf, NULL); \