From 338b937d0181505071f2f24dd3fcfbf6bb391692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Molinari?= Date: Thu, 26 Feb 2026 14:42:21 +0100 Subject: [PATCH] panfrost: Pass primitive mode to funcs instead of full draw info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit panfrost_update_active_prim() and prepare_draw() both take a pipe_draw_info struct pointer only for accessing the primitive mode. Directly pass the primitive mode instead in order to ease the addition of new draw functions. Signed-off-by: Loïc Molinari Reviewed-by: Ashley Smith Acked-by: Boris Brezillon Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 41227ef3fe6..7709293bb67 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -3360,13 +3360,12 @@ panfrost_increase_vertex_count(struct panfrost_batch *batch, uint32_t increment) * because all dirty flags are set there. */ static void -panfrost_update_active_prim(struct panfrost_context *ctx, - const struct pipe_draw_info *info) +panfrost_update_active_prim(struct panfrost_context *ctx, enum mesa_prim prim) { const enum mesa_prim prev_prim = u_reduced_prim(ctx->active_prim); - const enum mesa_prim new_prim = u_reduced_prim(info->mode); + const enum mesa_prim new_prim = u_reduced_prim(prim); - ctx->active_prim = info->mode; + ctx->active_prim = prim; if ((ctx->dirty & PAN_DIRTY_RASTERIZER) || (prev_prim != new_prim)) { @@ -3433,7 +3432,7 @@ panfrost_single_draw_direct(struct panfrost_batch *batch, struct panfrost_context *ctx = batch->ctx; - panfrost_update_active_prim(ctx, info); + panfrost_update_active_prim(ctx, info->mode); /* Take into account a negative bias */ ctx->vertex_count = @@ -3508,7 +3507,7 @@ panfrost_compatible_batch_state(struct panfrost_batch *batch, } static struct panfrost_batch * -prepare_draw(struct pipe_context *pipe, const struct pipe_draw_info *info) +prepare_draw(struct pipe_context *pipe, enum mesa_prim prim) { struct panfrost_context *ctx = pan_context(pipe); struct panfrost_device *dev = pan_device(pipe->screen); @@ -3530,7 +3529,7 @@ prepare_draw(struct pipe_context *pipe, const struct pipe_draw_info *info) return NULL; } - enum mesa_prim reduced_prim = u_reduced_prim(info->mode); + enum mesa_prim reduced_prim = u_reduced_prim(prim); if (unlikely(!panfrost_compatible_batch_state(batch, reduced_prim))) { batch = panfrost_get_fresh_batch_for_fbo(ctx, "State change"); @@ -3573,7 +3572,7 @@ panfrost_draw_indirect(struct pipe_context *pipe, return; } - struct panfrost_batch *batch = prepare_draw(pipe, info); + struct panfrost_batch *batch = prepare_draw(pipe, info->mode); if (!batch) { mesa_loge("prepare_draw failed"); return; @@ -3584,7 +3583,7 @@ panfrost_draw_indirect(struct pipe_context *pipe, panfrost_batch_read_rsrc(batch, pan_resource(indirect->buffer), MESA_SHADER_VERTEX); - panfrost_update_active_prim(ctx, &tmp_info); + panfrost_update_active_prim(ctx, info->mode); ctx->drawid = drawid_offset; @@ -3622,7 +3621,7 @@ panfrost_multi_draw_direct(struct pipe_context *pipe, unsigned num_draws) { struct panfrost_context *ctx = pan_context(pipe); - struct panfrost_batch *batch = prepare_draw(pipe, info); + struct panfrost_batch *batch = prepare_draw(pipe, info->mode); if (!batch) { mesa_loge("prepare_draw failed"); return;