Commit graph

223897 commits

Author SHA1 Message Date
squidbus
43b110dd62 kk: Fix divide by 0 in non-indexed draw unroll
For non-indexed draws, `index_buffer_el_size_B` is 0.

Reviewed-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42071>
2026-06-08 10:29:35 +00:00
squidbus
70caf135d2 kk: Do not force render image view to all subresources
If the view type is not an array and the image has multiple layers,
this is invalid and leads to Metal asserts. The current approach also
probably won't work for block texel views since they create a single
layer alias at the subresource. Instead we can just skip setting the
attachment descriptor levels and slices if we created a view.

Reviewed-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42071>
2026-06-08 10:29:35 +00:00
squidbus
de54167661 kk: Perform sink-and-move of instructions
This seems to fix some compiler crashes encountered on complex shaders,
possibly some attempted optimizations across blocks are going wrong.

Reviewed-by: Aitor Camacho <aitor@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42071>
2026-06-08 10:29:35 +00:00
Timothy Arceri
14a6aa3c15 nir: use the correct induction var when guessing loop iterations
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Previously when loop analyze was guessing loop iterations based
on array/sample access, we incorrectly used the induction variable of
the loop terminator to calculate loop iterations, rather than
the induction variable that accesses the array/sample.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15550
Fixes: de30bfd5b8 ("nir/loop_analyze: ignore terminating induction variable in guess_loop_limit()")

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42038>
2026-06-08 09:13:26 +00:00
Jose Maria Casanova Crespo
1160606074 broadcom/compiler: fix payload-register liveness condition
vir_setup_def_use() pins a temp's live-interval start to ip 0 when it is
initialised from a payload register (W, centroid W, Z), which the hardware
sets up before the program runs. The range check is mis-coded with '||'
instead of '&&', so it matches every index and pins any QFILE_REG read,
not just payload reads.

On V3D 7.x the per-varying C coefficient lands in rf0 (QFILE_REG 0), so
every flat varying gets pinned live-from-start; a shader reading many
varyings then keeps them all live at once, inflating register pressure to
roughly the varying count and failing register allocation.

This fixes spec@glsl-1.30@execution@varying-packing-mixed-types on rpi5
(previously crashing on RA failure).

Fixes: ce66c9aead ("broadcom/compiler: update payload registers handling when computing live intervals")
Assisted-by: Claude Opus 4.8
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42072>
2026-06-08 08:48:23 +00:00
Lei Huang
f29b92a46d amd/virtio: enable Android amdgpu-virtio build option
Android builds need to pass the Meson amdgpu-virtio option explicitly.
Add BOARD_MESA3D_AMDGPU_VIRTIO handling and forward it to Meson,
defaulting to false when the board flag is not set.

Use the same quoted amdgpu.h include style as the other AMD virtio
headers so the Android build resolves the header through Mesa's
configured include paths.

Signed-off-by: Lei Huang <Lei.Huang@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41957>
2026-06-08 08:29:43 +00:00
Ahmed Hesham
2a0bacd012 pan: report async CSF group faults via context reset status
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
A long-running job can trip the Panfrost watchdog, resulting
in the job timing out. However, GROUP_SUBMIT does not report
that through the normal submission/fence path. GROUP_SUBMIT
has already returned, and the syncobj is signalled, without
checking the group state, making any "completion" seem like
a success.

Poll the Panthor group state from get_device_reset_status()
and surface fatal faults and timeouts as a context reset.

This was observed when running the OpenCL-CTS test
test_allocations image2d_read on Mali, which is a very
long-running compute job. Rusticl already checks the device
reset status when flushing events, so following this change,
the timeout propagates as an execution failure instead of
being silently ignored, and the subsequent read observing
partial writes, with the test ultimately failing at the
verification step.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41995>
2026-06-08 07:30:45 +00:00
Valentine Burley
76e600a868 tu/ci: Add coverage for emulated second graphics queue
The runtime impact is negligible with fraction=20 for the regular jobs,
and the virtio job (a618-android) gets fraction=100.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41924>
2026-06-08 07:00:00 +00:00
Valentine Burley
57c69c9912 tu: Emulate second graphics queue for skiavk on Android
Use the new common queue emulation infrastructure to advertise 2 graphics
queues when the engine name is "android framework". The second queue is
emulated: submissions to it are redirected to the real queue by the
common runtime. No kernel submitqueue is created for the emulated queue.

This mirrors the approach used by Venus and enables skiavk, which
requires multiple graphics queues to avoid racing between webview and the
Skia Vulkan renderer.

Queue teardown iterates in reverse order so emulated aliases are finished
before the real queue that owns the lock.

Test: boot to UI with skiavk using ANGLE-on-Turnip in Cuttlefish
      full VK CTS run with tu_emulate_second_queue=true in CI
      few relevant VK CTS tests with tu_emulate_second_queue=true on KGSL

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41924>
2026-06-08 07:00:00 +00:00
Valentine Burley
07829aecd1 vulkan/queue: Add common queue emulation support
A driver can call vk_queue_set_emulated() to mark a queue as an emulated
alias of another queue. Submissions to the emulated queue are redirected
to the real queue's driver_submit(), so the driver always sees the queue
with actual hardware resources. All submissions (from both the real and
emulated queues) are serialized through a shared mutex (real_queue->lock)
to prevent concurrent hardware access.

The emulated queue does not need driver_submit set, it will use the real
queue's driver_submit and hardware resources.

Must be called from device-init context (single-threaded). The real queue
must outlive all of its emulated aliases, since vk_queue_finish() on the
real queue destroys the lock.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Acked-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41924>
2026-06-08 07:00:00 +00:00
Valentine Burley
efe6f086c8 tu: Fix vk_queue leak on submitqueue creation failure
tu_queue_init() calls vk_queue_init() before tu_drm_submitqueue_new().
If the DRM submitqueue creation fails, the function returns without
calling vk_queue_finish(), leaking the vk_queue resources.

Cc: mesa-stable
Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41924>
2026-06-08 07:00:00 +00:00
Martin Roukala (né Peres)
d2eb5f8188 ci: disable the valve-kws farm
It seems like they are experiencing a network outtage, so let's disable
the farm until this gets addressed.

Reported-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42077>
2026-06-08 09:52:10 +03:00
Yiwei Zhang
2cf1f6cb50 venus: fix unbound malloc leak in vn_ring_get_submits
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Credits to Toshinari Morikawa, and this supersedes
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41904.

ring->free_submits can go unbound for heavy scenes that use 3 or more
shm pool allocs for CS storage. This change fixes to loop through the
free list for a cached entry, which is good enough in practice since
the most recently retired submit is cached at the list head.

Cc: mesa-stable
Reported-by: Toshinari Morikawa <morikawa.toshinari@jp.panasonic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41917>
2026-06-08 03:32:20 +00:00
Christian Gmeiner
9ec5e9a34e etnaviv: blt: Don't sRGB-roundtrip same-encoding copies
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
etna_try_blt_blit(..) derived the BLT sRGB decode (on read) and encode
(on write) flags independently from the source and destination formats.
A copy between two sRGB formats - such as the glReadPixels resolve of an
SRGB8_ALPHA8 framebuffer - therefore decoded to linear and re-encoded.
That roundtrip through the hardware is not bit-preserving and loses up
to 2/255 at low values, corrupting the readback of the conversions
r32f, rg32f and rgba32f to srgb8_alpha8.

Apply the sRGB conversion only when the copy crosses the sRGB/linear
boundary. Same-encoding copies stay a plain bit copy.

Fixes dEQP-GLES3.functional.fbo.blit.conversion.{r32f,rg32f,rgba32f}_to_srgb8_alpha8

Fixes: 99400f272d ("etnaviv: blt: Add BLT format conversion support")
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41892>
2026-06-07 21:52:43 +00:00
Gert Wollny
08f801d6db r600/sfn: Pin alu sources as well when registers are pinned
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:58 +00:00
Gert Wollny
2643e12396 r600/sfn: rename pin_dest_to_chan to pin_registers
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:58 +00:00
Gert Wollny
d49e0074c2 r600/sfn: Add pin_to_chan method to Register and use it
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:58 +00:00
Gert Wollny
3a8a224a74 r600/sfn: Drop unused AssemblerVisitor members
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:58 +00:00
Gert Wollny
a1ba561c6b r600/sfn: Move ds_opcode_map ownership to fill_bytecode
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:58 +00:00
Gert Wollny
1d7068df22 r600/sfn: Move opcode_map to fill_bytecode, pass EAluOp to emit_bytecode_alu
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:58 +00:00
Gert Wollny
3c0dc36453 r600/sfn: Make emit_alu_op return success status
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:58 +00:00
Gert Wollny
072ddf18d8 r600/sfn: Move LDS ALU emission to fill_bytecode
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
3f61b19b01 r600/sfn: Extract ALU dst state update into AssemblerVisitor
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
800d4d0934 r600/sfn: Handle dst write checks before mova setup split
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
b6c1e1319a r600/sfn: Extract ALU bytecode emission helper
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
3c2e75573e r600/sfn: Validate ALU dst writes in emit_alu_op
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
021cbaba7d r600/sfn: Simplify m_last_addr tracking in emit_alu_op
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
e55dbc7882 r600/sfn: Move last_addr handling out of fill_alu_dst
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
685c01b112 r600/sfn: minor reordering of operations in assembler
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
c11c704f8a r600/sfn: drop unused literals tracking in assembler
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
0a209a9723 r600/sfn: Move prepare_alu_dst/copy_dst to sfn_fill_bytecode.cpp, rename to fill_alu_dst
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
f3cfcdae45 r600/sfn: Move prepare_alu_src to sfn_fill_bytecode.cpp, rename to fill_alu_src_operands
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
dfc387eb4e r600/sfn: Move copy_src to sfn_fill_bytecode.cpp, rename to fill_alu_src
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
b03343c7ec r600/sfn: Move lds_queue_read decrement out of prepare_alu_src to caller
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
4f38659f9e r600/sfn: use local opcode consistently in emit_alu_op
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
d0fe966735 r600/sfn: use opcode switch in ALU post-emit update
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
f2b8ebdc11 r600/sfn: return LDS opcode properties as tuple
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
7861687c1f r600/sfn: extract and decouple ALU post-emit state update
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
e6c6319e44 r600/sfn: extract emitting the bytecode of Rat Instr too
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
71533bd54f r600/sfn: simplify fill bytecode
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
f44ed15a9d r600/sfn: Drop index register handler in assembler
It is no longer used.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
563833962f r600/sfn: extract some byte code emission from assembler
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
79820b61e2 r600/sfn: use c++ pattern for zero-init of structs
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
dbad0340f3 r600/sfn: de-duplicate emit_wait_ack
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
e802668037 r600/sfn: Refactor AssemblerVisitor emit_alu_op
Move some parts out to helper methods and reorder some
instructions.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
68bab95e6a r600/sfn: Make some member variables references
They should never be nullptr.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
7bab7c95f3 r600/sfn: Fix typo with AssemberVisitor
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
8496727a74 r600/sfn: refactor CopyPropBackVisitor::visit(AluInstr*)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
dc726457e2 r600/sfn: extract logging from CopyPropFwdVisitor::visit(AluInstr*)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00
Gert Wollny
5bef7e168a r600/sfn: refactor CopyPropFwdVisitor::visit(AluInsr*)
v2: drop now unused local variable

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Assisted-by: Copilot (auto mode)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41945>
2026-06-07 21:36:57 +00:00