mirror of https://gitlab.freedesktop.org/mesa/mesa
While Panfrost allocates linear images with strides that are a multiple of 64
bytes, other dma-buf producers on the system may not satisfy this requirement.
However, at least on v7 and newer, any image with a regular format must have a
stride that is a multiple of 64 bytes.
This fixes a real bug in an application that created a linear R8_UNORM image
with stride 480 bytes, imported it as an EGL_image, and then tried to texture
from it with the GPU. Previously, the driver allowed this situation but it
resulted in an imprecise fault from the GPU. This patch corrects the driver to
reject the import as invalid due to the unaligned stride, ensuring we never
attempt to texture from such a resource.
To implement, we add some new layout queries to centralize knowledge about the
stride alignment requirements, and we sprinkle in asserts to show how the
invariant is upheld throughout the lifecycle of image creation to texturing.
Cc: mesa-stable
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19620>
(cherry picked from commit
|
||
---|---|---|
.. | ||
amd | ||
android_stub | ||
asahi | ||
broadcom | ||
c11 | ||
compiler | ||
drm-shim | ||
egl | ||
etnaviv | ||
freedreno | ||
gallium | ||
gbm | ||
getopt | ||
glx | ||
gtest | ||
hgl | ||
imagination | ||
imgui | ||
intel | ||
loader | ||
mapi | ||
mesa | ||
microsoft | ||
nouveau | ||
panfrost | ||
tool | ||
util | ||
virtio | ||
vulkan | ||
meson.build |