(cherry picked from commit a68048153260fe33f2ec5df48f772f4d1ceaed03) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4413>
(cherry picked from commit b04ae1f964c977035d9c8fd4144424387e0d868e) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4413>