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: 3641dfe436 ("panfrost: Flip point coords in hardware")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17430>
This commit is contained in:
Alyssa Rosenzweig 2022-06-20 19:44:28 -04:00 committed by Marge Bot
parent 44d9c41b6b
commit fd1edbc6e5
1 changed files with 13 additions and 5 deletions

View File

@ -3966,7 +3966,8 @@ panfrost_indirect_draw(struct panfrost_batch *batch,
#endif #endif
static bool static bool
panfrost_compatible_batch_state(struct panfrost_batch *batch) panfrost_compatible_batch_state(struct panfrost_batch *batch,
bool points)
{ {
/* Only applies on Valhall */ /* Only applies on Valhall */
if (PAN_ARCH < 9) 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 coord = (rast->sprite_coord_mode == PIPE_SPRITE_COORD_LOWER_LEFT);
bool first = rast->flatshade_first; bool first = rast->flatshade_first;
return pan_tristate_set(&batch->sprite_coord_origin, coord) && /* gl_PointCoord orientation only matters when drawing points, but
pan_tristate_set(&batch->first_provoking_vertex, first); * 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 static void
@ -4012,10 +4018,12 @@ panfrost_draw_vbo(struct pipe_context *pipe,
if (unlikely(batch->scoreboard.job_index > 10000)) if (unlikely(batch->scoreboard.job_index > 10000))
batch = panfrost_get_fresh_batch_for_fbo(ctx, "Too many draws"); 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"); 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"); assert(succ && "must be able to set state for a fresh batch");
} }