panfrost: Flip point coords in hardware
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 2 May 2022 13:19:41 +0000 (09:19 -0400)
committerAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 2 May 2022 13:56:25 +0000 (09:56 -0400)
commit3641dfe4367e37b3bbe125c9b18044a07e35e502
treebe35e5c759fa01b3e0901bd72792d11eee80eef5
parent5bab8e6cbefc2a22dc4a782a2128fba8bf301853
panfrost: Flip point coords in hardware

On Bifrost, this is very easy: there's an RSD bit to Y-flip gl_PointCoord. It
should map perfectly to the Gallium bit. With this change, we no longer use
lower_pntc_ytransform on Bifrost, saving a bit of ALU when reading point
coordinates.

On Valhall, this is quite hard: the bit is in the framebuffer descriptor now!
That means it can't be changed in a batch. This is expected to be ok: on GLES
and VK, the origin is controlled only by the framebuffer orientation. It's a
bigger problem on big GL, where GL_POINT_SPRITE_COORD_ORIGIN can be set freely.
To cope, a tri-state data structure is used for the state tracking. This has a
failure case on Valhall: every draw toggling the coord origin. However, the
intention of the ORIGIN state bit is smoothing over coordinate system
differences; it should never /actually/ change once set. Until we see an app
doing something so stupid, I don't think we should worry about.

We need all the Valhall tri-state infrastructure for handling provoking vertices
on big GL anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16173>
src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_job.h
src/panfrost/bifrost/bifrost_compile.h
src/panfrost/lib/pan_cs.c
src/panfrost/lib/pan_cs.h