panfrost: Introduce pan_afbc_mode
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 14 Dec 2022 02:52:26 +0000 (21:52 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 16 Dec 2022 18:27:47 +0000 (18:27 +0000)
commitcb5e417c01bb9a4509a4583be3fb19723dbe5abc
tree23c1914badc9eb24efc6d46bd9435cf506b1cecd
parent0784adc66809828914d3ac6f648c2b04a2970879
panfrost: Introduce pan_afbc_mode

Introduce an enum to represent an AFBC compression mode. These modes are not
formats, on Valhall they are decoupled from the format. As such, it does not
make sense to use a pipe_format to represent them. Add an enum that we can use
in a straightforward way on Midgard and Bifrost to fallback for texture views,
and can map 1:1 to the Valhall hardware enum.

In addition to being less overloaded semantically, this lets -Wswitch kick in to
ensure that we handle all enums when translating. The straightforward
translation raises the following warnings:

../src/panfrost/lib/pan_cs.c:437:9: warning: enumeration value ‘PAN_AFBC_MODE_R5G5B5A1’ not handled in switch [-Wswitch]
  437 |         switch (panfrost_afbc_format(PAN_ARCH, format)) {
      |         ^~~~~~

...indicating that some formats were missed, leading to assertion fails "unknown
canonical AFBC format" when rendering RGB5A1, which dEQP-GLES31 does. Fixes
regressions in
dEQP-GLES31.functional.draw_buffers_indexed.random.max_required_draw_buffers.*
on Valhall.

Given how scarce v9 hardware is, that v10 isn't upstream yet, and the offending
code was merged a week ago, this should not have actually affected anyone. At
any rate, it's a good reminder we really do need CI for v9...

Fixes: 8e125b6c15b ("panfrost: Enable AFBC of more formats")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20311>
src/panfrost/lib/pan_afbc.c
src/panfrost/lib/pan_cs.c
src/panfrost/lib/pan_texture.h