radv: implement graphics shaders relocation for a RGP workaround
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 2 Feb 2023 15:52:15 +0000 (16:52 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 10 Feb 2023 13:42:14 +0000 (13:42 +0000)
commitbd30f3619d573fd9ca357856314b06dd6d615d90
treedbec41336103ec480413e1693719eeb865c072a8
parent69bd1c0c40236f7429b2c97c4d2b9b0aba40d338
radv: implement graphics shaders relocation for a RGP workaround

RGP requires shaders to be uploaded consecutively inside the same
buffer object. Otherwise, either it makes the driver generating
huge traces (ie. in GiB) or it fails to load traces at all. Hopefully,
this will be improved soon when AMDGPU drivers will have GPL support.

To workaround this, the driver relocates graphics shaders in the same
buffer object when a pipeline is created. Then at draw time, it
overwrites SPI_SHADER_PGM_xxx registers to make sure SQTT can match
between emitted and exported shaders. It's a bit suboptimal because
graphics shaders are uploaded twice but it's the best solution I found.

This will allow to implement GPL caching without breaking capturing
shaders with RGP.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21078>
src/amd/vulkan/layers/radv_sqtt_layer.c
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_private.h