panfrost: Pass primitive mode to funcs instead of full draw info

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 <loic.molinari@collabora.com>
Reviewed-by: Ashley Smith <ashley.smith@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40124>
This commit is contained in:
Loïc Molinari 2026-02-26 14:42:21 +01:00 committed by Marge Bot
parent 6ad3944290
commit 338b937d01

View file

@ -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;