freedreno/turnip: Update GRAS_LAYER_CNTL to GRAS_MAX_LAYER_INDEX
authorBrian Ho <brian@brkho.com>
Mon, 13 Apr 2020 22:30:31 +0000 (15:30 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 15 Apr 2020 16:19:34 +0000 (16:19 +0000)
commit13ce637f1b28381e72470763ff5e39dd3c562476
tree04604dc16a7d4c1f463ffa3c0f6bd6ea5898a253
parentc2399e9574591389bb5640744ab77f22699eea23
freedreno/turnip: Update GRAS_LAYER_CNTL to GRAS_MAX_LAYER_INDEX

After some experimentation, I believe that GRAS_LAYER_CNTL is
actually just a count register storing the number of layers in the
render target. While debugging cube_array geometry tests, I noticed
that the blob was setting an unknown 0x8 to LAYER_CNTL, so I checked
the value of LAYER_CNTL for various layer sizes:

1: LAYER_CNTL=0
2: LAYER_CNTL=1
3: LAYER_CNTL=2
4: LAYER_CNTL=3
9: LAYER_CNTL=8
256: LAYER_CNTL=255
2000: LAYER_CNTL=1999

Seems like this register just stores a count of the largest layer
that can be written to via gl_Layer. This commit updates the reg
docs, freedreno's gs implementation, and turnip's gs implementation.

Fixes dEQP-VK.geometry.layered.cube_array.*

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4541>
src/freedreno/registers/a6xx.xml
src/freedreno/vulkan/tu_cmd_buffer.c
src/gallium/drivers/freedreno/a6xx/fd6_gmem.c