panfrost: Require 64-byte alignment on imports
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: <mesa/mesa!19620> (cherry picked from commit 811f8a19)
- .pick_status.json 1 addition, 1 deletion.pick_status.json
- src/panfrost/lib/pan_layout.c 51 additions, 3 deletionssrc/panfrost/lib/pan_layout.c
- src/panfrost/lib/pan_texture.c 8 additions, 0 deletionssrc/panfrost/lib/pan_texture.c
- src/panfrost/lib/pan_texture.h 6 additions, 0 deletionssrc/panfrost/lib/pan_texture.h