Commit graph

220656 commits

Author SHA1 Message Date
Samuel Pitoiset
1f8be7bfad spirv: fix OpUntypedVariableKHR with optional data type parameter
This would read OOB and crash because data type is optional per the
SPIRV spec.

Original patch by Faith Ekstrand <faith.ekstrand@collabora.com>.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40731>
2026-04-01 11:46:16 +00:00
Georg Lehmann
eff9f00533 nir/search: remove matching variable type
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Now unused, and if you really need it use a search helper.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40713>
2026-04-01 09:52:45 +00:00
Georg Lehmann
5b1405dcbf nir/opt_algebraic: remove a few non 1bit bool patterns
We almost exclusive optimize 1bit booleans nowadays,
so I think these shouldn't be needed.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40713>
2026-04-01 09:52:45 +00:00
Juan A. Suarez Romero
37a6be551b v3dv/ci: add link to failing CTS test
The failing test seems wrong, and a link to the issue is provided.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40739>
2026-04-01 09:27:22 +00:00
Juan A. Suarez Romero
eeeb71b39f v3d/ci: add new OpenCL failure
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40739>
2026-04-01 09:27:22 +00:00
Juan A. Suarez Romero
48c086cb42 vc4: fix unwanted buffer release on uploader
When converting the index buffer from 4-bytes to 2-bytes, we use the
uploader for the job. Since commit b3133e250e we do an uploader alloc
ref, which releases the uploader buffer if there is no enough space,
creating a new one.

The problem happens when we also need this buffer because it is the one
containing the index buffer to convert. This happens, for instance, if
we need to convert the primitives because they are not supported (e.g.,
converting quads to triangles), as this is done
also using the uploader.

The solution is to ensure the uploader's buffer has an extra reference
so when released, it is not destroyed. This can easily achieved by
calling first pipe_buffer_map_range(), which is required to access the
buffer, and it increases the references.

This fixes `spec@!opengl 1.1@longprim`.

Fixes: b3133e250e ("gallium: add pipe_context::resource_release to eliminate buffer refcounting")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40642>
2026-04-01 09:10:26 +00:00
Samuel Pitoiset
e27e41a842 vulkan,spirv: update headers
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40721>
2026-04-01 07:39:37 +00:00
Samuel Pitoiset
21acbe414e vulkan: rename VK_EXT_device_fault features
They conflict with VK_KHR_device_fault.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40721>
2026-04-01 07:39:37 +00:00
Samuel Pitoiset
bf7e29617d radv: emit BOP events after every draw to workaround a VRS bug on GFX12
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/14812
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40715>
2026-04-01 07:11:45 +00:00
Samuel Pitoiset
dc5e84d47d radv: fix a typo when determining if a VS needs a prolog
This is harmless because shader_stages is filtered based on lib flags.
Also improve the comment while I'm at it.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40714>
2026-04-01 06:49:16 +00:00
Emma Anholt
580381d9e7 vulkan/wsi/display: Check with an atomic commit if the swapchain fails.
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The TEST_ONLY flag lets you run your display configuration past the driver
to see if it exceeds any of the many arbitrary hardware limits that can't
be expressed through the limited properties that DRM exposes.  This maps
quite well to VK_ERROR_INITIALIZATION_FAILED.

Fixes dEQP-VK.wsi.direct_drm.colorspace.basic failure on my anv CFL
system, where we exceeded the primary plane's width restriction for the
specific tiling format chosen.

Closes: #14314
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39466>
2026-03-31 20:45:06 +00:00
Emma Anholt
08f0fd8bd6 vulkan/wsi/display: Don't re-probe connectors in between hotplugs.
The state we return is a single plane per connector, and (effectively)
whether we're currently presenting on it.  We already know what connectors
we're presenting on, and there's no reason to re-probe for hotplugged
connectors here to learn that they're not active --
vkGetPhysicalDeviceDisplayProperties2KHR() is what you'd need to do to get
far more important information about the connector in the first place.

Running dEQP-VK.wsi.direct_drm.maintenance1.present\* on my CFL goes from
5.5s to 4.4s due to not re-probing EDID over and over.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39466>
2026-03-31 20:45:05 +00:00
Mario Kleiner
ab94515b0a dri: Fix "cosmetic" undefined behaviour warning for RGB[A]16_UNORM formats.
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Ian Romanick reported some "undefined behaviour" warnings during some
not specified tests, relating to introduction of RGB[A}16_UNORM formats
in merge request
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38588

This due to overflowing the 32-bits masks[], and then during assignment
the red/green/blue/alphaMask fields in struct gl_config when using a 16
bpc format. Iow. the red/green/blue/alphaMask would not be usable.

Suppress this warning by setting masks[] to zero for unorm16 formats,
just as was previously done for is_float16, ie. fp16 formats.

16 bpc formats are only exposed for display on non-X11 WSI target
platforms like GBM+DRM, Wayland, surfaceless, and these platforms do
not use the info in red/green/blue/alphaMask at all, so the "undefined
behaviour" is meaningless.

Fixes: f2aaa9ce00 ("dri,gallium: Add support for RGB[A]16_UNORM display formats.")
Reported-by: Ian Romanick @idr
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40695>
2026-03-31 18:25:05 +00:00
Karol Herbst
73f0d8ed51 ci: add api@clgetmemobjectinfo to fails
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40726>
2026-03-31 17:39:47 +00:00
Ahmed Hesham
c8d7fad153 rusticl: return correct error from clCreateSubBuffer
From the OpenCL specification, `clCreateSubBuffer` should return:
`CL_MISALIGNED_SUB_BUFFER_OFFSET` if there are no devices in
`context` associated with `buffer` for which the `origin` field of
the `cl_buffer_region` structure passed in `buffer_create_info` is
aligned to the `CL_DEVICE_MEM_BASE_ADDR_ALIGN` value.

This was previously unhandled in the entrypoint, marked as TODO.

Add two functions to `Device` for querying the address alignment in
both bits and bytes, for convenience. Properly retrieving the
alignment value from the underlying device/screen is still marked as
TODO.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40726>
2026-03-31 17:39:47 +00:00
Mario Kleiner
e98c4c59c7 v3dv: Enable VK_EXT_hdr_metadata.
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The extension is implemented in shared Vulkan/WSI code and
not driver specific. The underlying kms driver needs to
support HDR metadata signalling on the drm connector, which
vc4 kms does for VideoCore 5 and later since April 2021.

Successfully tested on RaspberryPi 4/400 with a HDR-10
capable HDMI monitor.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40696>
2026-03-31 16:16:13 +00:00
Mario Kleiner
a0671119ad v3dv: Enable VK_KHR_present_id and VK_KHR_present_wait
These extensions are implemented in shared Vulkan/WSI code and
not driver specific. A Vulkan driver just needs to support
VK_KHR_timeline_semaphore, which v3dv already supports via
emulated timeline semaphores since April 2022.

Successfully tested on RaspberryPi 4/400.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40696>
2026-03-31 16:16:12 +00:00
Valentine Burley
b68037473a lavapipe/ci: Skip flaky Android CTS test
E.g. https://gitlab.freedesktop.org/mesa/mesa/-/jobs/96379768.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40725>
2026-03-31 15:32:25 +00:00
Valentine Burley
fc76edc3e4 meson: Update freedreno-kmds comment
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Turnip has supported virtio for some time, and KGSL support for the
gallium driver is no longer planned, point users to zink instead.
Also document the WSL backend.

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40302>
2026-03-31 15:00:30 +00:00
Valentine Burley
ab40758024 ci: Enable EGL and GLX in debian-no-libdrm
Now that zink can be built without a hard dependency on libdrm by using
the 'software' dri_platform, we can enable EGL, GLX, and the associated
window system platforms (X11, Wayland) in the debian-no-libdrm build job.

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40302>
2026-03-31 15:00:30 +00:00
Valentine Burley
5d5857af27 meson: Fix Turnip libdrm-linking check
Use with_gallium_drm instead of with_gallium_kmsro for the Turnip
libdrm-linking warning. This avoids incorrectly forcing a link to libdrm
when zink is enabled in a KGSL-only build.

Also update the warning to match the others.

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40302>
2026-03-31 15:00:30 +00:00
Valentine Burley
6ebf2d6f32 meson: Add support for buidling zink + Turnip/KGSL
Rename the 'hurd' dri_platform to 'pseudo-drm' to represent non-DRM
presentation platforms.
This platform is now also enabled when building zink and Turnip with the
KGSL backend, allowing zink to use Kopper.

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8634
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40302>
2026-03-31 15:00:29 +00:00
Valentine Burley
14f60b440f egl: Use util/libdrm.h instead of xf86drm.h
This will allow for building and running zink on systems without libdrm
by using Mesa's internal stubs.

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40302>
2026-03-31 15:00:29 +00:00
Valentine Burley
5c56d6c198 util: Add more libdrm stubs
drmGetNodeTypeFromFd and drmGetRenderDeviceNameFromFd will be used in
EGL.

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40302>
2026-03-31 15:00:29 +00:00
Lionel Landwerlin
d6bc20160e nir/lower_robust_access: add heap/bindless support
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
a7cc97ac86 nir/opt_shrink_stores: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
a075b4f501 nir/lower_helper_writes: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
fed72f015d nir/gather_info: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
ce1082c026 nir/validate: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
ffeafc9ef1 nir/opt_preamble: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
ca4facb568 nir/opt_group_loads: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
2e969dc5c7 nir/opt_access: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
def3af6171 nir/opt_uniform_atomics: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
4dd3ff8b99 nir/opt_intrinsics: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Samuel Pitoiset
e7af65d1fe nir/divergence_analysis: add missing nir_intrinsic_image_heap_texel_address
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40710>
2026-03-31 12:42:57 +00:00
Christian Gmeiner
6333bf359b panvk: Advertise VK_KHR_shader_untyped_pointers on v9+
Enable the VK_KHR_shader_untyped_pointers extension and the
shaderUntypedPointers feature for Valhall and newer (v9+).

Bifrost (v6/v7) has issues with 8-bit vector loads through untyped
pointers combined with 16-bit storage, so restrict the extension
to architectures where it's fully functional.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40457>
2026-03-31 11:57:10 +00:00
Christian Gmeiner
37c8ff5416 panvk: Lower memcpy derefs
To make sure all memcpy derefs are lowered before explicit IO lowering.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40457>
2026-03-31 11:57:10 +00:00
Aitor Camacho
2b280305af kk: Implement VK_KHR_draw_indirect_count as HK does
Acked-by: Arcady Goldmints-Orlov <arcady@lunarg.com>
Signed-off-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40703>
2026-03-31 11:42:22 +00:00
Aitor Camacho
b6535654b9 kk: Rework draw recording for easier addition of stages like tessellation
Signed-off-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40703>
2026-03-31 11:42:22 +00:00
Georg Lehmann
5453419086 aco/isel: use s_bitcmp1 for 1bit ubfe
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Avoid the s_pack at the cost of having to use scc.

Foz-DB GFX1201:
Totals from 1514 (0.74% of 205032) affected shaders:
Instrs: 3443431 -> 3434096 (-0.27%); split: -0.27%, +0.00%
CodeSize: 19062100 -> 19024320 (-0.20%); split: -0.20%, +0.00%
Latency: 22343329 -> 22342802 (-0.00%); split: -0.01%, +0.01%
InvThroughput: 4471707 -> 4471632 (-0.00%); split: -0.00%, +0.00%
Copies: 280191 -> 279645 (-0.19%); split: -0.21%, +0.01%
PreSGPRs: 71333 -> 71327 (-0.01%)
VALU: 1598064 -> 1598058 (-0.00%); split: -0.00%, +0.00%
SALU: 691458 -> 686437 (-0.73%)

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40707>
2026-03-31 10:42:33 +00:00
Samuel Pitoiset
4cf6cd85e0 nir/lower_image: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Samuel Pitoiset
78d1aa018a nir/opt_move_discards_to_top: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Samuel Pitoiset
22e1d1a1f4 nir/opt_sink: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Samuel Pitoiset
8a26bbc525 nir/opt_shrink_vectors: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Samuel Pitoiset
6479c1092c nir/lower_mediump: add heap support
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Lionel Landwerlin
b81d13bec3 nir/lower_non_uniform: add heap support
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Lionel Landwerlin
6a89c29029 nir/lower_image_atomics_to_global: add heap support
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Samuel Pitoiset
fb0647fb25 nir: add texture_heap_offset/sampler_heap_offset to nir_build_tex()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Samuel Pitoiset
79e71f5851 vulkan: add DGC support with descriptor heap
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Eric Guo
c1770565f3 panfrost: Fix NULL pointer dereference in panfrost_emit_images
Fix a crash in image descriptor emission caused by stale image_mask bits.

Root cause:
- set_shader_images used a shift expression with count==64 when clearing
  image_mask, which is undefined behavior in C.
- This could leave image_mask inconsistent with actual image bindings,
  so panfrost_emit_images() might dereferences NULL image resources.

Fixes:
- Use 64-bit-safe bit helpers for mask updates to avoid invalid shifts.

Crash observed when running: OpenCL-CTS api/test_api
Backtrace:
  #0 util_image_to_sampler_view (v->resource is NULL)
  #1 panfrost_emit_images
  #2 panfrost_update_shader_state
  #3 panfrost_launch_grid_on_batch
  #4 panfrost_launch_grid

Backport-to: *
Signed-off-by: Eric Guo <eric.guo@nxp.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40621>
2026-03-31 09:46:39 +00:00