pan/mdg: Use smaller LD_UNIFORM instructions
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 12 May 2021 17:22:24 +0000 (13:22 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 12 May 2021 20:04:21 +0000 (20:04 +0000)
commit01ef56a7e49cf0f6c93748333e903ba1776c720f
tree83c19e38c89e4c9f2922d8631535904b36b78b2e
parentdf3edfc72994d26a87008ddd322ffbc38c2343b2
pan/mdg: Use smaller LD_UNIFORM instructions

If we only read 8 bytes from a UBO, we need to use LD_UNIFORM.64 as
opposed to LD_UNIFORM.128. In addition to probably being faster, this
fixes a buffer overrun manifesting as MMU faults with source ID
0x500/0x600/0x700, visible in WebGL Aquarium.

This is essentially the same patch as 616394cf31c ("pan/mdg: Use
appropriate sizes for global loads/stores"), only this is for UBOs where
that was for SSBOs.

Before enabling PACKED_UNIFORMS, this bug was not visible since we could
guarantee the UBO size was a multiple of 16. We no longer have that
invariant, and in rare cases the last 8 bytes of the last 16-byte slot
of a mapped uniform buffer would overrun the BO and trigger a fault,
even if the result is unused.

Fixes: 24d7c413fe7 ("panfrost: Enable packed uniforms.")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10772>
src/panfrost/midgard/midgard_compile.c