From fd1edbc6e56a3816757bc8122231f74c3dbbec29 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 20 Jun 2022 19:44:28 -0400 Subject: [PATCH] panfrost: Only key points to point coord origin Apparently, the point coord origin within a batch can change with Gallium (seemingly even with GLES? where that's impossible at an API level?) but that doesn't matter if we're not drawing points. This might have to do with internal Gallium CSOs (e.g. u_blitter). Issue noticed in SuperTuxKart, which was getting state change flushes. Performance on one level on a Valhall GPU improved from 26fps to 29fps. Fixes: 3641dfe4367 ("panfrost: Flip point coords in hardware") Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 86da15bd42c..a3f3e85ed3a 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -3966,7 +3966,8 @@ panfrost_indirect_draw(struct panfrost_batch *batch, #endif static bool -panfrost_compatible_batch_state(struct panfrost_batch *batch) +panfrost_compatible_batch_state(struct panfrost_batch *batch, + bool points) { /* Only applies on Valhall */ if (PAN_ARCH < 9) @@ -3978,8 +3979,13 @@ panfrost_compatible_batch_state(struct panfrost_batch *batch) bool coord = (rast->sprite_coord_mode == PIPE_SPRITE_COORD_LOWER_LEFT); bool first = rast->flatshade_first; - return pan_tristate_set(&batch->sprite_coord_origin, coord) && - pan_tristate_set(&batch->first_provoking_vertex, first); + /* gl_PointCoord orientation only matters when drawing points, but + * provoking vertex doesn't matter for points. + */ + if (points) + return pan_tristate_set(&batch->sprite_coord_origin, coord); + else + return pan_tristate_set(&batch->first_provoking_vertex, first); } static void @@ -4012,10 +4018,12 @@ panfrost_draw_vbo(struct pipe_context *pipe, if (unlikely(batch->scoreboard.job_index > 10000)) batch = panfrost_get_fresh_batch_for_fbo(ctx, "Too many draws"); - if (unlikely(!panfrost_compatible_batch_state(batch))) { + bool points = (info->mode == PIPE_PRIM_POINTS); + + if (unlikely(!panfrost_compatible_batch_state(batch, points))) { batch = panfrost_get_fresh_batch_for_fbo(ctx, "State change"); - ASSERTED bool succ = panfrost_compatible_batch_state(batch); + ASSERTED bool succ = panfrost_compatible_batch_state(batch, points); assert(succ && "must be able to set state for a fresh batch"); }