Commit graph

217932 commits

Author SHA1 Message Date
David Rosca
5447f81cc5 radeonsi: Set multi plane format also for imported textures
multi_plane_format is used to correctly copy all planes for staging texture
copies, otherwise only the first plane gets copied.
It's now also used in si_video_dec, which doesn't work when decoding into
imported surfaces if multi_plane_format is not set.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15232
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 3dbbd94ffd)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:46 +02:00
Georg Lehmann
599bb79ff4 aco/optimizer: do not try to create 3 byte constant operands
Operand::get_const will assert.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15239
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Cc: mesa-stable
(cherry picked from commit d1ed4e1774)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:46 +02:00
Icenowy Zheng
fa0abe9510 pvr: fix pvr_clear_vdm_state_get_size_in_dw() inverted feature condition
The pvr_clear_vdm_state_get_size_in_dw() wrongly think instance count
inputs are needed when doing RTA clear for cores without the
gs_rta_support feature. However, the instance ID is exploited to output
the target layer ID, which isn't supported at all for cores w/o that
feature, so it looks that the condition is inverted. In addition, the
pvr_pack_clear_vdm_state() function seems to have similar logic deciding
whether to emit instance_count, and the logic is opposite to the logic
in pvr_clear_vdm_state_get_size_in_dw() for the part checking the
gs_rta_support feature.

Invert the condition to take instance ID inputs for cores with the
gs_rta_support feature instead of those without this feature.

Fixes: b59eb30e88 ("pvr: Fix cs corruption in pvr_pack_clear_vdm_state()")
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
(cherry picked from commit 3db93bbf34)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:46 +02:00
Rhys Perry
eb4618b1b5 util: fix UBSan error with _mesa_bfloat16_bits_to_float
runtime error: left shift of 65535 by 16 places cannot be represented in type 'int'

This fixes nir_opt_algebraic_pattern_test.bf2f.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: ecd2d2cf46 ("util: Add functions to convert float to/from bfloat16")
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
(cherry picked from commit 72f2b8a034)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:46 +02:00
Ian Romanick
92bfcb208f brw: brw_reg::nr for an accumulator is not part of the offset
Without this, reg_offset will return 1024 for acc0. This causes
has_invalid_dst_region to decide that the destination region is invalid
(because 1024 != 0), and the lowering code tries to treat the floating
point accumulators as integers. It's a mess.

v2: Add and use set_gfx_platform. Suggested by Caio.

Fixes: 937373eb25 ("i965/fs: Handle fixed HW GRF subnr in reg_offset().")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
(cherry picked from commit cfdb3ddb93)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Ian Romanick
a46e96fbdb brw/const: Don't allow type changes when accumulators are involved
Integer accumulators and float accumulators do not occupy the same bits,
so the types cannot be arbitrarily changed.

No shader-db or fossil-db changes on any Intel platform.

v2: Use is_accumulator() instead if brw_reg_is_arf(). Add an extra test
to show the desired behavior when an accumulator is not
involved. Suggested by Caio.

Fixes: 64c251bb3a ("intel/fs: Combine constants for SEL instructions too")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
(cherry picked from commit ffdc310bf1)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Mixie
c72a0457e1 xlib: clear currentDpy when releasing the current context
After abe6d750e5, glXDestroyContext() can defer destruction by marking
the context with xid == None while it is still current.

However, the release-current path did not clear current->currentDpy,
so a context that had already been marked for deletion could remain
associated with a display after unbinding.

Fixes: abe6d750e5 ("xlib: fix glXDestroyContext in Gallium frontends")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14947
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 447a1d2e8d)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Xianzhong Li
871a933cac panfrost: Fix GEM handle refcount leak in panfrost_bo_import
panfrost_bo_import() calls drmPrimeFDToHandle() then pan_kmod_bo_import(),
which also calls drmPrimeFDToHandle() internally. This double import causes
GEM handle refcount leaks because each drmPrimeFDToHandle() increments the
kernel's GEM handle refcount, but only one drmCloseBufferHandle() is called
during cleanup by panfrost_kmod_bo_free(or panthor_kmod_bo_free).

Fix by removing the redundant drmPrimeFDToHandle() and using
pan_kmod_bo_import() directly. On re-import of existing buffers, properly
release the extra pan_kmod_bo reference with pan_kmod_bo_put().

This ensures GEM handle refcount, pan_kmod_bo refcount, and panfrost_bo
refcount are all properly balanced.

Fixes: 5089a758df ("panfrost: Back panfrost_bo with pan_kmod_bo object")

Signed-off-by: Xianzhong Li <xianzhong.li@nxp.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
(cherry picked from commit 248b0b47b7)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Faith Ekstrand
e8955066a7 pan/bi: Use bi_half() for texture MS indices
It feeds into a v2i16 so it needs to be 16-bit.

Fixes: ae79f6765a ("pan/bi: Emit Valhall texture instructions")
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
(cherry picked from commit e637130794)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Faith Ekstrand
cb93fe85b9 pan/bi/ra: Allow offsets on tied sources
The only real requirement here is that the destination offset is zero
and that the destination is big enough to hold the source.  The source
offset doesn't matter.

Fixes: bc17288697 ("pan/bi: Lower split/collect before RA")
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
(cherry picked from commit 05c5e52054)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Faith Ekstrand
ddf6c31b8e pan/bi: Delete a few instruction encodings
The non-trivial non-replicate swizzles on IADD.v4x8 and ISUB.v4x8 are
either documented wrong or broken in hardware.  Instead of swizzling
b0101 and b2323, they swizzle b0011 and b2233 on G52.  This is either a
hardware bug or an issue with documentation.  In either case, it's
probably best not to trust it.  Those swizzles aren't all that useful
anyway.  We also weren't using any of them before (or they'd have
broken) so this isn't a performance regression.

Cc: mesa-stable
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
(cherry picked from commit 538b5c411e)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Faith Ekstrand
7cf57ccd9c pan/bi: Support more swizzle aliases in the bifrost pack code
Fixes: 82328a5245 ("pan/bi: Generate instruction packer for new IR")
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
(cherry picked from commit 3fffcf4338)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Natalie Vock
190c65ebae radv/rt: Don't enable midpoint sorting
Midpoint sorting is incompatible with how our traversal works.
Specifically, we change tMax when a hit is committed so we can skip over
BVH nodes that are guaranteed not to produce a closer hit. However,
changing tMax also changes the intersection interval of box nodes with
the ray, and thus, the midpoints of that interval. Stackless traversal
relies on getting nodes back in the exact same order as before, and if
that requirement is not met, traversal may incorrectly skip over nodes.

The likely benefit of midpoint sorting does not make up for the loss of
ability to skip over BVH nodes exceeding tMax, so simply disable
midpoint sorting.

This fixes geometry being visible behind other geometry when it
shouldn't be in various applications, including Half-Life 2 RTX.

Cc: mesa-stable
(cherry picked from commit c1a7680d93)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Job Noorman
28a32fe54b nir/opt_uniform_subgroup: fix ballot_bit_count components
ballot_bit_count_reduce expects the ballot to have 4 components causing
validation failures on targets where 1 < ballot_components < 4. Fix this
by padding the ballot to 4 components.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Fixes: ae66bd1c00 ("nir/opt_uniform_subgroup: use ballot_bit_count")
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
(cherry picked from commit cc6eec79c2)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Karol Herbst
fc45812f74 radeonsi: set valid_buffer_range for CL buffers
Seems like we never set the range for CL buffers which caused spurious
test fails in the CL CTS.

Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit 02679a51fd)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Georg Lehmann
7757ddb8a9 nir/opt_load_skip_helpers: don't skip helpers for store_scratch data
Scratch stores store data for helper lanes that might be used later by an
instruction that cares about helpers, or even by control flow.

Fixes: a65009e808 ("nir: Add a nir_opt_tex_skip_helpers optimization")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/14965
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
(cherry picked from commit fc19ce6c17)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Job Noorman
fa14f8e6d5 ir3: fix handle_partial_const with vectorized src
Signed-off-by: Job Noorman <jnoorman@igalia.com>
Fixes: 50a91fbf87 ("freedreno/ir3: cleanup "partially const" ubo srcs")
(cherry picked from commit c27f0406b0)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Timothy Arceri
7b5ed90bdc radeonsi: add Gun Godz workaround
This is another game based on the old YoYo engine

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15209

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
(cherry picked from commit 27b56314ee)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Job Noorman
7745b46956 nir/gather_info: clear interpolation qualifiers before gathering
Signed-off-by: Job Noorman <jnoorman@igalia.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Fixes: 66740d9c91 ("nir: gather interpolation qualifiers")
(cherry picked from commit a72704d0fb)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Job Noorman
97213d180e nir/opt_varyings: fix alu def cloning
nir_builder_alu_instr_finish_and_insert initialized the def's bit_size
and num_components so we should set them afterwards.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Fixes: c66967b5cb ("nir: add nir_opt_varyings, new pass optimizing and compacting varyings")
(cherry picked from commit 273fd18b89)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Pavel Ondračka
0347549074 st/bitmap: release the temporary bitmap sampler view
st_cb_bitmap appends a temporary bitmap sampler view to the sampler
view array passed to set_sampler_views().

1a5c660ef5 changed this path to only release the extra YUV views
returned by st_get_sampler_views(), but the temporary bitmap view is
created locally and is not part of extra_sampler_views. It therefore
stopped being released so release the temporary bitmap sampler view
explicitly after drawing the bitmap quad.

Fixes: 1a5c660ef5 ("st/bitmap: only release YUV samplerviews")
(cherry picked from commit 33864e569e)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:45 +02:00
Ahmed Hesham
e145579956 rusticl: fix flag validation when creating an image
From the OpenCL specification:
    `CL_MEM_KERNEL_READ_AND_WRITE`: This flag is only used by
    clGetSupportedImageFormats to query image formats that may be both
    read from and written to by the same kernel instance. To create a
    memory object that may be read from and written to use
    CL_MEM_READ_WRITE.

If an application follows the instructions above, i.e. query a list of
supported image formats, using `CL_MEM_KERNEL_READ_AND_WRITE` as
input, and then attempts to create an image using one of the supported
image formats, by calling `clCreateImage` and passing
`CL_MEM_READ_WRITE`, the call to the image creation entry point should
succeed. This instead fails on Mali devices with the error
`CL_IMAGE_FORMAT_NOT_SUPPORTED`.

Rusticl fails when validating the image format against its supported
flags. Formats that support `PIPE_BIND_SHADER_IMAGE` have their
supported flags set as `CL_MEM_WRITE_ONLY` and
`CL_MEM_KERNEL_READ_AND_WRITE`.

This changes the supported CL flags to be `CL_MEM_WRITE_ONLY` for
`PIPE_BIND_SHADER_IMAGE` and `CL_MEM_READ_WRTE |
CL_MEM_KERNEL_READ_AND_WRITE` for `PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_SHADER_IMAGE`.

Fixes: 3386e142 (rusticl: support read_write images)

Fixes OpenCL-CTS test: `test_image_streams` on Mali. Invocation:
```
test_image_streams write 1D CL_RGB CL_SIGNED_INT8
```

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
(cherry picked from commit e77c984cef)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:44 +02:00
Samuel Pitoiset
46aea87a79 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>
(cherry picked from commit 1f8be7bfad)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:44 +02:00
Eric Engestrom
b3b0c9002e .pick_status.json: Mark 4b3bd6b0b5 as denominated
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:44 +02:00
Eric Engestrom
eb6df9c83d .pick_status.json: Mark 9ff879441f as denominated
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:44 +02:00
Eric Engestrom
41ca0dd7c7 .pick_status.json: Update to 7e163fb793
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
2026-04-14 15:27:44 +02:00
Eric Engestrom
bbc23bed47 docs: add sha sum for 26.0.4
Some checks failed
macOS-CI / macOS-CI (dri) (push) Has been cancelled
macOS-CI / macOS-CI (xlib) (push) Has been cancelled
2026-04-03 11:31:41 +02:00
Eric Engestrom
d9e5e36b19 VERSION: bump for 26.0.4
Some checks failed
macOS-CI / macOS-CI (dri) (push) Has been cancelled
macOS-CI / macOS-CI (xlib) (push) Has been cancelled
2026-04-01 19:37:49 +02:00
Eric Engestrom
97c3564810 docs: add release notes for 26.0.4 2026-04-01 19:37:49 +02:00
Juan A. Suarez Romero
ec101645ff vc4: fix unwanted buffer release on uploader
Some checks failed
macOS-CI / macOS-CI (dri) (push) Has been cancelled
macOS-CI / macOS-CI (xlib) (push) Has been cancelled
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>
(cherry picked from commit 48c086cb42)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Samuel Pitoiset
0a9270779f 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>
(cherry picked from commit bf7e29617d)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Pavel Ondračka
dfd0e55b5a r300: split large HiZ clears into multiple packets
R300_PACKET3_3D_CLEAR_HIZ encodes COUNT in 14 bits (COUNT[13:0]), so a
single packet can clear at most 0x3fff dwords.

Large depth surfaces on R5xx can require more HiZ dwords than that.
When we emitted a single packet, COUNT truncated and part of HiZ RAM
remained uncleared, which could show up as HyperZ corruption.

Emit CLEAR_HIZ in chunks of R300_CLEAR_HIZ_COUNT_MAX and reserve enough
atom space for the worst-case packet count derived.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/360
Fixes: 12dcbd5954 ("r300g: enable Hyper-Z by default on r500")
(cherry picked from commit fddc101070)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Pavel Ondračka
2b87cb01b2 r300: add shared HyperZ pipe-count helper
Introduce r300_hyperz_pipe_count and use it in\nr300_setup_hyperz_properties.\n\nRV530 selects pipe topology from NUM_Z_PIPES, while other families use\nNUM_GB_PIPES. Keeping this in one helper avoids duplicated family checks\nand prepares follow-up HiZ clear sizing changes to reuse the same rule.

(cherry picked from commit e97ac38ff3)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Pavel Ondračka
8292cf5563 r300: disable zmask clears for large surfaces
(cherry picked from commit 3fc2627897)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Pavel Ondračka
27fec03660 r300: don't apply odd macroblock rounding to 3D textures
This is intended only for NPOT 2D textures.

Fixes: 0763fb947 ("r300: align macro-tiled stride-addressed textures in X")
(cherry picked from commit 648dfe88f4)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Pavel Ondračka
e06648d86a r300: fix bias presubtract algebraic transformation
One fneg too many.

Fixes: 0508db915 ("r300: implement bias presubtract")
(cherry picked from commit e68e519b91)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Mario Kleiner
af53a9bfbc dri: Fix "cosmetic" undefined behaviour warning for RGB[A]16_UNORM formats.
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>
(cherry picked from commit ab94515b0a)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Eric Guo
58ab5760c1 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>
(cherry picked from commit c1770565f3)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
utzcoz
88cfa8ff29 gfxstream: Fix vkSetDebugUtilsObjectNameEXT crash for unwrapped objects
Mesa's vk_common_SetDebugUtilsObjectNameEXT assumes every Vulkan object
handle is a pointer to a vk_object_base struct. In gfxstream, only a
subset of objects (instance, device, queue, command buffer, command pool,
buffer, fence, semaphore) carry a Mesa wrapper. All other non-dispatchable
handles (shader modules, pipelines, render passes, etc.) are opaque host
handles that are not valid pointers.

Passing such an unwrapped handle to the common path causes it to be cast
to a vk_object_base pointer and dereferenced, resulting in a SIGSEGV
(null-pointer dereference at offset 0x40).

Override the function in the gfxstream driver to store debug names on
vk_object_base for wrapped objects and return VK_SUCCESS for unwrapped
objects.

Fixes: 7b50e62179 ("gfxstream: mega-change to support guest Linux WSI with gfxstream")
Test: Verified with hellovk (with validation layers) on Android Emulator - no crashes.
(cherry picked from commit bf8862b49f)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Yiwei Zhang
4feda37353 vulkan/wsi/win32: respect acquire timeout for sw wsi
When DXGI is not supported, win32 falls back to sw wsi without acquire
timeout ignored.

This change:
1. adds the needed acquire mutex and cond
   - the fail path is intentionally left untouched so that mutex and
     cond are both valid when wsi_win32_swapchain_destroy is called
2. adds wsi_win32_acquire_idle_cpu_image helper to respect timeout
3. adds wsi_win32_set_image_idle helper to properly signal acquire_cond
   for sw wsi case

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/15122
Cc: mesa-stable
(cherry picked from commit af42f0c80f)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Yiwei Zhang
0287336eea vulkan/wsi/win32: add wsi_win32_find_idle_image helper
Prepare to handle timeout for sw wsi (no DXGI).

Cc: mesa-stable
(cherry picked from commit 8ff24c7db3)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Hyunjun Ko
b62216f82d anv: Add dummy workload for AV1 decode on affected platforms (Wa_1508208842)
Implement software workaround for AVP decoder corruption on Gen12
platforms. These platforms require a warmup workload before
the actual AV1 decode to prevent output corruption.

- Gen12: Tiger Lake, DG1, Rocket Lake, Alder Lake

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
(cherry picked from commit 260908cecb)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Rhys Perry
ad17b864cb radv: fix memory leak in radv_rt_nir_to_asm
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Backport-to: 26.0
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 574f577657)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Adam Simpkins
99129b13ce iris: fix a crash in disable_rb_aux_buffer
I have been running into crashes in this function when using blender.
Some of the entries in ice->state.framebuffer.base.cbufs[0] can
apparently have the texture field be null, which was causing a segfault
in this loop.

In my case, nr_cbufs was 3, and the first two cbufs entries had a null
texture and format set to PIPE_FORMAT_NONE. The last entry had format of
PIPE_FORMAT_R16G16_FLOAT and a non-null texture.

Adding this null check before attempting to dereference the texture
fixes the crash for me and allows blender to work normally.

Fixes: ca96f8517c ("iris: remove uses of pipe_surface as a pointer")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
(cherry picked from commit e16c8cc579)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:35 +02:00
Faith Ekstrand
c74811897f pan/buffer: Add the offset to the size for buffer textures
In the attribute model, the size is for the attribute binding and the
offset is an offset into that range.  If we're going to use that to
offset the buffer itself, we need to increase the size accordingly.

Fixes: a21ee564e2 ("pan/bi: Make texel buffers use Attribute Buffers")
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
(cherry picked from commit ce56f49561)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:34 +02:00
Faith Ekstrand
60df6998b4 pan/bi: v2x16 conversions don't replicate
They swizzle just like anything else.  Technically, we could maybe do a
little better than the generic case for these since they only read 8
bits per 16 bits in the destination but the generic case is correct,
even if it isn't optimal.

Fixes: f7d44a46cd ("pan/bi: Optimize replication")
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com>
(cherry picked from commit 8dc458225b)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:34 +02:00
Georg Lehmann
2527900bbc nir/lower_non_uniform_access: fix fusing loops for same index but different array variable
struct nu_handle is hashed and deduplicated using struct nu_handle_key, which ignored
parent_deref. That means all instructions will use the first parent_deref when rewriting
the sources.

Avoid this by not including the parent deref in the struct, and instead querying it
when needed.

Fixes: 4d09cd7fa5 ("nir/lower_non_uniform_access: Group accesses using the same resource")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15173
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
(cherry picked from commit e7077e8f5c)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:34 +02:00
Marek Olšák
b084df3ed6 radeonsi: disable streamout queries for u_blitter
Cc: mesa-stable
Reviewed-by: Pierre-Eric
(cherry picked from commit 918e5764f4)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:34 +02:00
Marek Olšák
a20678b267 radeonsi: fix blits via util_blitter_draw_rectangle
It didn't save states properly. The only correct place to save them is
si_blitter_begin. Unfortunately, we can't skip saving and restoring
those states because we don't know in advance whether the rectangle path
will be used.

Cc: mesa-stable
Reviewed-by: Pierre-Eric
(cherry picked from commit 556ceb1b75)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:34 +02:00
Natalie Vock
5e538b5efd vulkan: Bump MAX_ENCODE_PASSES
RADV needs one more encode pass for a bugfix in the next commit.

Cc: mesa-stable
(cherry picked from commit e713527aa9)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
2026-04-01 11:45:34 +02:00