pvr: Write descriptor set addrs table dev addr into shareds
authorKarmjit Mahil <Karmjit.Mahil@imgtec.com>
Wed, 7 Dec 2022 16:13:30 +0000 (16:13 +0000)
committerMarge Bot <emma+marge@anholt.net>
Mon, 20 Feb 2023 13:34:02 +0000 (13:34 +0000)
commitce67f5ac944bdc6ebf27e3b115706bec5b63f002
treeb590e9a643a1bce58dd8a49d39a3d8cba0b57dcb
parentd67ed3eb24060dce78ca7bacdce2dcc4f698c85d
pvr: Write descriptor set addrs table dev addr into shareds

Previously UBOs and various buffers, as well as the native
descriptor sets were DMAed into the shared registers. This added
complexity in allocating the registers and various other places.
We also ended up being in situations were we wouldn't know the size
of a buffer by the time the shaders were being compiled. It would
be possible to determine the size by inspecting the shader but
that would introduce more complexity in the compiler.
To get things working sooner, avoid extra complexity for
now, a different approach was devised.

The driver will write the addresses of the currently bound
descriptor sets into a device buffer. The device buffer is referred
to as the descriptor set addrs table. The dev addr of the table is
written into a shared register. To access the buffers the shader
will first get the address of the descriptor set from the in memory
table. Then get the primary descriptor from the descriptor set. And
finally access the in memory buffer with the address it read from
the descriptor. Essentially there's three level of indirection and
all the buffers are in memory. The shader will know what offset the
primary descriptor is located based on the descriptor set layout.
The descriptor set address could have been written into the shareds
directly but that would require extra handling on the compiler side
so opted to just write the table address instead.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21331>
src/imagination/vulkan/pds/pvr_pds.h
src/imagination/vulkan/pds/pvr_xgl_pds.c
src/imagination/vulkan/pvr_cmd_buffer.c
src/imagination/vulkan/pvr_pipeline.c