intel: Fix crashes for importing drm buffer
authorPeng Huang <shawn.p.huang@gmail.com>
Sun, 11 Dec 2022 21:07:06 +0000 (16:07 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 12 Dec 2022 23:02:38 +0000 (23:02 +0000)
commit7642f3b99c8b17c7cfa1f140c65ce82e7dbcea2b
tree92a4d11f8b7f014bb4ea42bb022a76e0b89932fc
parent68b546ec3daacc93513b31583cbe6eb7f8fdc25c
intel: Fix crashes for importing drm buffer

image_aspect_to_binding() converts aspect to index by subrracting
VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT, however these enum values
are bitfields, not consecutive numbers, so comparing and subtracting
them won't work.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20269>
src/intel/vulkan/anv_image.c