Skip to content

A9 GPU stack: device loss, A9 correctness, memory, Zink fixes, frames in flight, pre-rotated WSI - #15

Merged
henrikklee merged 111 commits into
mainfrom
a9-gpu-integration
Nov 17, 2026
Merged

henrikklee merged 111 commits into
mainfrom
a9-gpu-integration

Conversation

@henrikklee

Copy link
Copy Markdown
Contributor

Lands brkosebay's #9, #10 (including its two later vertex-compiler commits), #11, #12, #13 and #14 as one merge. Each PR's head is merged unchanged, so the PRs show as merged.

Integration:

Tested on the J71b (iPad 6, A10) as a local package build together with the orchard kernel stack (OrchardLinux/orchard#159):

  • desktop on the GPU through Zink, about 42k GPU jobs, 0 faults
  • a 6 min suspend and wake
    The A9 parts were tested by brkosebay on the iPad 5.

Generated-by: LLM

The powervr kernel marks a context faulty after a GPU timeout, and
every later SUBMIT_JOBS on it returns -EIO (pvr_queue.c). Nothing
before the next submission noticed, and every later submission failed
again.

The powervr winsys now keeps a terminal, atomic "lost" state. The first
SUBMIT_JOBS that returns EIO sets it and prints, once, the errno and the
job type (render, compute, transfer, null). The line starts with "G5P"
on the A9, whose logs already use that prefix, and with "pvr"
elsewhere. Every submit path goes through one helper. A new winsys op,
is_lost, reports the state; pvrsrvkm's always answers false.

Assisted-by: LLM
…y allocations

vkAllocateMemory may not return DEVICE_LOST; report OUT_OF_DEVICE_MEMORY
on a lost device instead. Internal BOs keep allocating so that pipeline
creation does not fail into Zink's device-memory retry loop. Waits and
submits report loss from the logical device's winsys.

Assisted-by: LLM
The base already releases the mapping, CPU map and GEM object regardless
of VM_UNMAP's result. Keep that unconditional release and stop repeating
the failure log after a device loss.

Assisted-by: LLM
vkBindBufferMemory and vkBindImageMemory permit the out-of-memory codes,
but not MEMORY_MAP_FAILED or DEVICE_LOST. Map EIO to host-memory exhaustion
so Zink, which retries only device-memory exhaustion, does not sleep on a
lost device. Other mapping failures return OUT_OF_DEVICE_MEMORY.

Assisted-by: LLM
Use a driver-owned physical-device sync type to inspect tagged binary job
fences after blocking completion waits. The wrapper uses the logical
device's winsys so waits and submissions observe the same terminal loss.
Keep the native sync type in the winsys and rebuild the services timeline
wrapper on the driver-owned type. Polls and availability waits do not
export sync files.

Assisted-by: LLM
The deferred-submit path still has to signal submissions that cannot run
after a loss. Signal unsubmitted payloads so exports and waiters can
finish, while retaining the device-lost result for the caller.

Assisted-by: LLM
A driver_submit failure makes the worker mark its queue lost and exit with
runtime-owned submits still listed. Drain returns on loss; thread shutdown
must allow the pending list so queue finish can perform its existing cleanup.

A forced-thread lavapipe empty-submit repro with an injected driver_submit
out-of-device-memory failure hits the pending-list assertion before this
change. Afterwards it reports DEVICE_LOST and destroys the device cleanly.
Healthy queues still require an empty list. Release builds are unchanged.
A worker blocked on a never-signalled wait can still block thread join;
that pre-existing problem is separate from this teardown assertion.

Assisted-by: LLM
Use the runtime's per-instance debug logging switch so every vk_error
names its origin. No runtime hook or process-global callback is needed.

Assisted-by: LLM
Any refusal in the A9's CPU transfer path (no CPU mapping, an element
past the binding, an unsupported conversion, a multisample depth plane)
returned VK_ERROR_DEVICE_LOST from the queue submit under one message.

Each refusal now records why, and the submit logs one rate-limited line
per refused command: the reason, fill or copy, the scissor, and every
surface (format, size, stride, layout, samples, z, address; the image's
format, extent, levels, layers, samples and the surface's offset in
it). The command is skipped, its destination keeps what it held, and the
queue continues.

Assisted-by: LLM
The A9's transfer-slice hook turned a slice of a 3D image into a 2D
twiddled surface and added depthPitch * z. pvr_setup_transfer_surface()
then took the non-3D branch for that surface and added depthPitch * z
again, so slice z of every copy went to slice 2z: slices past the
middle fell off the image and were refused, and the rest landed on the
wrong slices. The hook now only retypes the surface. A 64x64x16 image
with 7 levels now copies exactly.

Assisted-by: LLM
WebGPU's core limits want 256 invocations per workgroup and 256 in X
and Y; the A9 reported 128. Apple's A9 driver allows 512 threads per
threadgroup in each dimension, lowered per pipeline by its resources,
and Rogue's model agrees (32 lanes x 16 tasks per USC).

The dispatch takes up to 512 lanes, and the A9 compiler emits Apple's
software barrier above 32 lanes. That barrier waits for every task of
the workgroup, so all of them must be resident: a pipeline whose
temporaries per lane exceed rogue_max_wg_temps() for its workgroup is
refused by name. maxComputeWorkGroupInvocations and
maxComputeWorkGroupSize X/Y go from 128 to 256 on the A9.

Tested on the A9 before the powervr interface: 256-lane exchange
through shared memory across a barrier, and a 256-lane tree sum with
nine barriers, 64 workgroups each.

Assisted-by: LLM
textureSampleLevel, textureLoad, textureDimensions and
textureNumLevels in a compute shader were refused, and WebGPU turns a
failed pipeline into a lost device.

Apple's A9 kernels (Metal sample(s, uv, level(l)), gradient2d() and
read(g, lod), compiled for the A9) use the coupled operand tuples of
the vertex sample, byte for byte. g9p_a9_tex.h emits them for 2D float
textures: coordinates copied to a fresh block, the level converted to
f16 (a u32 level for a read, which uses the fetch sampler), and a wait
after each sample. A9 compute no longer lowers texelFetch to a sample,
so textureLoad takes the exact read form. Sizes come from a block the
CPU computes, as on the fragment path. Arrays, cubes, 3D, compares,
offsets, integer textures and implicit-LOD samples are refused by name.

The descriptor words go to fixed common-store dwords inside the 64 the
dispatch already loads, copied from the bound sets as the fragment path
does. A refused compute shader now records and prints its reason.

Assisted-by: LLM
On the A9 the CDM kernel record's register field (word 0, bits 12 and
up) and the DOUTU temps size different banks. Apple's compute variant
builds the field from its kernels' bank-1 count and the DOUTU temps
from the bank-0 count. In all 164 A9 kernels compiled with Apple's
offline compiler, the field is 8 registers (iOS's captured 0x2100),
while the bank-0 count runs from 8 to 64.

An A9 kernel now records its bank-1 count (at most 32) in
g9p_shader::a9_bank1_regs, and the kernel record's field uses it. The
DOUTU temps keep 32 + homes. The instruction stream is unchanged, and so
is every kernel without homes.

Assisted-by: LLM
…ion only

G9P's mask-stack pops set the stack register's last-read bit (source
word bit 7) on every pop. Apple's A9 compiler sets it only on the
program's last stack operation; the A9 fragment backend already follows
Apple. In Apple's divergent loop the loop's pop leaves the bit clear
and the last pop sets it; ours marked an intermediate pop's counter
register dead while lanes still waited on it.

On the A9, kernels whose lanes leave a loop at different iterations
lost the GPU before almost any store; uniform loops ran. A9 compute now
pops without the bit, and the program's final pop keeps it. The A10 sets
the bit on every pop and works, so its code is unchanged.

Assisted-by: LLM
Apple's A9 driver caps each compute pipeline's threads per threadgroup
by its register allocation. With t bank-0 registers (DOUTU temps) and f
bank-1 registers (the record's field):
  min(32 * floor((3329 - a) / a), 393216 / b), at most 512, a multiple of 32,
  a = (4t + 28) & ~31, b = (64f + 448) & ~511.
For a kernel with t = 64 and f = 8 this gives 384, the limit Metal
reported for the same kernel on iOS.

Vulkan has no per-pipeline limit, so an A9 compute pipeline whose
workgroup exceeds its allocation's limit is now refused by name at
creation: the USC cannot hold it.

Assisted-by: LLM
…ts and sizes

The A9 compute compiler emits G9P_NUM_WORKGROUPS slots, array-element
bits in a buffer slot's binding and the G9P_BINDING_SIZE flag
(arrayLength()), but the A9 bind loop took every slot as a plain (set,
binding). A NumWorkGroups slot indexed the sets out of range, and so did
an element or size slot's binding. Handle them as G9P's bind loop does
(496e447, 1d51ff5): the dispatch's counts go in the slot
(refused for an indirect dispatch, whose counts only the GPU holds),
elements step by the binding's stride, and the size flag reads the
descriptor's size word. A slot past the layout is an error instead of an
out-of-range read.

Assisted-by: LLM
Apple's per-pipeline limit for a bank-1 allocation of f registers is
393216 / ((64f + 448) & ~511) lanes: 768 at 8, 384 at 16, 256 at 24,
192 at 32. With 24 bank-1 registers one 256-lane group fills it, with no
room for another group's first task. On the A9 every such kernel lost
the GPU at 64 groups before its stores, while a single group ran.
Apple's bank-0 term reserves one task, and Apple's kernels ask for only
8 registers in bank 1.

A9 compute now caps its bank-1 registers (values and the mask stack) by
workgroup size, so one task of that capacity stays free: 16 at 256
lanes, 24 up to 224, 32 up to 160. Values past the cap go to bank-0
homes. The per-pipeline refusal reserves the same task. Kernels already
within the cap are unchanged.

Assisted-by: LLM
Apple's per-pipeline limit for t DOUTU temps is
32 * floor((3329 - a) / a) lanes, a = (4t + 28) & ~31. With up to 64
homes a kernel could compile and then be refused at pipeline creation.
The compiler now caps the homes by the workgroup's bank-0 limit (64 up
to 192 lanes, 56 at 256, 32 at 384, 16 at 512) and refuses by name a
kernel that needs more. The per-pipeline check stays as the guard.

Assisted-by: LLM
The bank-1 cap applied to the main allocator only. The low-register
range, pair and window allocators could still hand out registers past
it, and kernels compiled that way broke the one-free-task rule. Bound
every low-register allocator by the cap, keep high-bank eviction inside
it, and refuse by name a mask stack that would exceed it.

Assisted-by: LLM
g9p reads the workgroup ID z from threadgroup word 2, which the A10
kernel PDS program writes. The A9 PDS program only writes x and y
(words 0-1), and on the A9 word 2 is the software barrier counter. An
A9 kernel that reads gl_WorkGroupID.z or gl_GlobalInvocationID.z
therefore read the barrier counter in a kernel with barriers and an
unwritten word otherwise. Its z was wrong for any grid with more than
one group in z, and right for one group only by chance.

That includes the driver's own spill of large workgroup memory, which
indexes each group's slot by x + nx * (y + ny * z). A nonzero value in
that word put a group's slot outside the spill buffer.

Apple's A9 Metal driver (AGXMetalA9
PDSEncoderGen1::EncodeComputePDSProgram) writes z only for a kernel that
uses it: after the x/y DOUTW, whose control word then drops its last
bit, it adds a DOUTW of temps q1's upper half whose control word has
the last bit, bit 28, BSIZE 1 and the destination word at bit 13. That
is the same form g9p already uses on the
A10, so the hardware question is settled by Apple's binary and by the
A10 runs.

Place z in threadgroup word 3. Words 0-1 hold x and y, word 2 is the
barrier counter, word 3 was otherwise unused, and shared variables
start at word 4. The compiler records that a kernel reads z, and the
dispatch adds the DOUTW for it after the barrier zero pair when there
is one. Kernels that do not read z keep the same PDS and USC code.

The dispatch no longer refuses a kernel specialized for one Z group:
nothing sets that flag since the specialization was removed.

This has not yet run on A9 hardware.

Assisted-by: LLM
Use shader_dump with PVR_SHADER_DUMP_DIR, and capture_stub for the
explicit opt-in that replaces refused shaders with incorrect pictures.

Assisted-by: LLM
… request

Fail a command buffer with an allowed host-memory error when a draw is
unsupported. Applications may opt into skipping unsupported work through
pvr_skip_refused_work, at the cost of incorrect pixels.

Assisted-by: LLM
…urvive a refusal

Pipeline creation and render-pass recording fail by default with an
allowed host-memory error. Per-application driconf can skip refused work
instead, with a warning for each skipped pipeline and incorrect pixels.
Internal pipelines are always required to compile.

Assisted-by: LLM
Generate device-level VkResult wrappers at build time. Save original
entrypoints per device so multiple architectures can coexist in a process.
Install wrappers only with PVR_DEBUG=errors; the origin-logging change is
independent and remains useful if these result wrappers are dropped.

Assisted-by: LLM
…ertex loads

WebGPU's core limits want 8 storage buffers per shader stage; wgpu
derives the count as maxDescriptorSetStorageBuffers / 2.

The graphics backend took two storage buffers (Apple's fixed-load bases
common0/common2), loaded them only at a constant element index, refused
vertex-stage loads, and refused blend constants with storage buffers.
- Up to 16 storage buffers per stage. Two or fewer without blend
  constants keep today's layout and bytes; otherwise the pointer pairs
  follow the stage's other common dwords.
- Loads the fixed form cannot encode (a register offset, a pointer
  above common2, any vertex load) use addr.add_shift and the addressed
  4/16-byte load of the register-indexed UBO path. A bank-0 vertex
  offset is copied into bank 1 first. addr.add_shift takes a pointer
  pair at any even common dword below 256.
- Storage loads split into scalars or 16-byte-aligned vec4 loads, and
  stores into scalar stores (WGSL vec2/vec3 members).
- The vertex upload loader takes 24 uploads.
- maxDescriptorSetStorageBuffers goes from 12 to 16.
The G9P liveness loop limit is spelled per backend (A9: G9P_MAX_LOOPS,
A10: 64), so the A9's can be raised alone.

Every shader of a 578-shader differential corpus is byte-identical.

Assisted-by: LLM
WebGPU's maxUniformBufferBindingSize is 64 KiB; the A9 reported 16 KiB.
Nothing in the A9 paths depends on 16 KiB: a UBO range that does not
fit the 256-dword common store is read through its pointer at any 32-bit
offset, and a register-indexed read adds the index to the pointer. So
maxUniformBufferRange goes from 16 to 64 KiB.

WGSL reads vec2/vec3 members of UBO arrays at a register index, which
the backend refused. A vec2/vec3 at the start of a 16-byte element now
loads the whole element with the 16-byte form and frees the unused
registers after the wait. Any other register-indexed vec2/vec3 UBO load
is split into scalars after constant folding.

Assisted-by: LLM
The driver reports 13 UBOs per stage and WebGPU wants 12, but the plan
refused more than 8, and the compiler tracked at most 8 uniform ranges.
Thirteen spilled UBO pointers plus four dwords of blend constants still
fit the 32 dwords that addr.add_shift's low pointers use
(4 + 2 * 13 = 30). A plan that does not fit is still refused by name.

Assisted-by: LLM
Each fragment register UBO index is wrapped in umin(i, last). When the
index is already provably at most `last` (u[x & 3] in uvec4[4], a common
WGSL shape), nir_opt_algebraic drops the umin, and the backend then
refused the load as unclamped. Accept an index that
nir_unsigned_upper_bound() proves below 4096, the 16-byte elements of a
64 KiB block. An index without a proven bound is still refused.

Assisted-by: LLM
brkosebay and others added 27 commits November 16, 2026 13:46
…om 3.0

The EXT_external_objects and _fd entry points were put in the GLES
dispatch only from ES 3.2 (es2="3.2"), while extensions_table.h
advertises GL_EXT_semaphore(_fd) and GL_EXT_memory_object(_fd) on any
ES 2 context. On a GLES 3.1 context the extensions were listed, but
glGenSemaphoresEXT, glImportSemaphoreFdEXT and glWaitSemaphoreEXT
reached the no-op stub and raised GL_INVALID_OPERATION: Firefox's
WebRender could not wait for WebGPU canvas frames
("glImportSemaphoreFdEXT failed: 1282").

The specifications don't ask for ES 3.2: GL_EXT_semaphore requires
OpenGL 1.0, and GL_EXT_memory_object requires texture storage (ES 3.0).
Install the semaphore entry points (and GetUnsignedBytev*) from ES 2.0
and the memory object ones from ES 3.0.

Assisted-by: LLM
A wallpaper that stops drawing can retain an extra surface-sized buffer
while its compositor holds two. Allow such clients to request two to four
colour buffers, defaulting to four. Driconf options can also be set from
the environment under the option name.

Assisted-by: LLM
…rror colour

The Khronos Data Format specification requires the reserved bits [11:10]
of an ASTC void-extent block to be 11. Reject other values as an error
block, matching astcenc. Found on Apple A9 hardware.

Assisted-by: LLM
The A9 reports 112 output components: 112/8 gives 14 varyings, below the
ES 3.0 minimum of 15. Limit this exception to Imagination without geometry
or tessellation shaders and strictly between 64 and 120 components. The
A10 at 120 and Turnip keep their existing values.

Zink inlines each transform-feedback output into an existing output in
update_so_info(). The GLSL linker checks all vertex outputs against
maxVertexOutputComponents in check_against_output_limit(), so a program
that exceeds the device's output limit fails to link.

Assisted-by: LLM
WebGPU core wants 16 inter-stage variables, and wgpu derives them as
components / 4 - 1, so the A9's 64 gave 15. The fragment compiler takes
28 locations, and the A9 interpolates 124 components exactly.
maxVertexOutputComponents and maxFragmentInputComponents go from 64 to
112 on the A9: 4 + 112 + 1 + 8 = 125 of the TA's 128-dword vertex, with
the position, a point size and 8 clip distances. GL on Zink keeps 16
varyings.

Assisted-by: LLM
A reordered command buffer follows earlier batches in submission order,
but submission order alone does not synchronize their reads.
Check unfinished earlier reads before reordering a buffer update.
Carry current reads into ordered history for the next batch, and preserve
unfinished unordered history before the first barrier of a new batch,
ordered or unordered.

The image path applies to images taking zink_resource_memory_barrier(),
i.e. GENERAL-layout images (driver_workarounds.general_layout).

Host sync-validation and conformance results are recorded in the PR body.
A9 GPU-time A/B evidence remains pending a hardware run.

Assisted-by: LLM
GL renderbuffers carry PIPE_BIND_SAMPLER_VIEW, but their format and
GL_MAX_SAMPLES are chosen without it, and get_image_usage_for_feats()
adds SAMPLED to every image. Vulkan allows sampledImageDepthSampleCounts
(and the other sampled-image limits) to be a subset of the framebuffer
sample counts, so on such a device no usage candidate of a multisampled
depth/stencil renderbuffer supports the requested count:
glRenderbufferStorageMultisample(4) leaves GL_RENDERBUFFER_SAMPLES at 0
and the framebuffer incomplete, and WebGL contexts that ask for
antialiasing are lost.

When the sampled-image limits exclude the sample count, add a candidate
without SAMPLED. zink_is_format_supported() already reports
PIPE_BIND_SAMPLER_VIEW unsupported for that count, so nothing samples
the image.

Found on the Imagination A9 (iPad 5), which renders, loads and stores 4x
depth/stencil but does not sample it.

Assisted-by: LLM
a batch flush copies the recording rp info into the next batch. if that
info already ended, the driver advances past it only at the end_call and
stays one info behind. a following pass then inherits stale has_resolve
and resolve targets

affected tests:

tc-renderpass-info-continue-clear

Fixes: 2c5a2d8 ("util/tc: iterate the rp info more accurately during batch execution")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit a7754e6cf1785b2562830e4369bcdb523c445a41)
a blit that overflows the batch on an info that already ended sees the
ended flag change when the flush starts a fresh info. it then puts
end_call on that info. only set it when the blit itself ended the info

Fixes: 2c5a2d8 ("util/tc: iterate the rp info more accurately during batch execution")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit 7adb6c6c0139f4df34c48c5134ea35477ccdd163)
batch_execute advanced the rp info after executing the first draw or
clear that follows an end_call. that call ran on the info of the ended
pass, but recording advances before it. hoist the advance ahead of the
call switch

affected tests:

tc-renderpass-info-continue-draw

Fixes: 2c5a2d8 ("util/tc: iterate the rp info more accurately during batch execution")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit c901b964a7348b2002dd0c048dd86be4003bb12e)
recording advances the rp info for indirect and single vertex-state
draws, but the driver side list lacks their call ids. the driver never
advances for them

affected tests:

tc-renderpass-info-continue-draw-indirect
tc-renderpass-info-continue-draw-list

Fixes: 2c5a2d8 ("util/tc: iterate the rp info more accurately during batch execution")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit 01f5bd5d1c762be6acf0f2d8e8e3429d7a547cde)
the calls the driver advances its rp info for must mirror the recording
side callers of tc_parse_draw and the clear handling. keep the list next
to tc_parse_draw

no functional changes

Fixes: 2c5a2d8 ("util/tc: iterate the rp info more accurately during batch execution")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit 941404c60357beb694259dd497ac682f5ce21d64)
tc_blit_enqueue can flush the batch. if the info already ended, the
flush starts a fresh info and the geometry lands there while has_resolve
and resolve[] stay on the old one. only reachable by repeated blits to
the window system resolve target. there is no test for it

Fixes: 4f79fe3 ("util/tc: store resolve geometry to rp info")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit d2a56c6bca316401ae6a8d9281d9addc7550e16c)
tc_blit merges one color and one depth resolve into the rp info. a
second resolve of the same source into another target hits an assert, and
in a release build overwrites resolve[] and loses the first resolve. only
merge into an unset or identical target

a color resolve is not merged either when the framebuffer has a window
system resolve target. zink resolves into that target first and ignores
the merged resolve[0]

affected tests:

tc-renderpass-info-resolve-twice

Fixes: a71b6ac ("tc: also inline depth resolves")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit 4104830703b8e4b1d965c3741aa04909f004c69d)
tc_draw_mesh_tasks never calls tc_parse_draw. a mesh draw after a
resolve does not start a new recording info and the driver does not
advance for it. the draw then resolves into the previous pass's target

affected tests:

ext_mesh_shader-continue-after-resolve

Fixes: 2c5a2d8 ("util/tc: iterate the rp info more accurately during batch execution")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit 6243b56474dea3c5d9c7132eee99cdddf74f4c08)
the driver advances its info at set_framebuffer_state, a flush call, and
an end_call. an internal unsynchronized tc_texture_map, a large
tc_texture_subdata that went unsynchronized, and a deferred flush
without a fence ended the info with none of these. the driver stays one
info behind

skip the framebuffer access check for an unsynchronized map. sync a
subdata that ended the info so that tc_sync resets it. make the deferred
flush the end_call of the info it ends

Fixes: 2c5a2d8 ("util/tc: iterate the rp info more accurately during batch execution")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit 543a8fbb88b9cc8c5de174dce815caedfdf30edb)
tc_batch_increment_renderpass_info signals the old info before it resets
the ready fence of the new one. in between, the driver follows old->next
to the new info and sees the fence still signaled from its previous use.
it reads the info while recording still writes it. a resolve merged
after a flush can then be lost

reset the fence before the full_copy block

affected tests:

tc-renderpass-info-continue-depth-resolve was flaky before

Fixes: 07017aa ("util/tc: implement renderpass tracking")
Generated-by: LLM
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/45852>
(cherry picked from commit 2a8ee7ba4a88dc7955518fc62d1f394007e8db73)
Add a screen capability for the number of frames retained by the swap
throttle. Keep a bounded ring of fences in the DRI frontend and share
the throttle helper with kopper.

Default to one frame, preserving the previous-fence wait for every
driver. Drivers can opt into a deeper queue without changing the
frontend's fence ownership or disabling throttling.

Assisted-by: LLM
Let the swap throttle retain two frames on the open-source Imagination
Vulkan driver. Tile-based GPUs can overlap one frame's geometry phase
with the previous frame's fragment phase when both are queued. Keep
other drivers at one frame and use a driver-ID table for future tuning.

Add zink_frames_in_flight as a driconf option: 0 selects the driver
default and 1..3 select an explicit depth. The same-named environment
variable provides an override, including depth 1 for latency-sensitive
applications.

Request enough kopper swapchain images for the extra queued frames,
within the surface's maximum image count. This costs one extra image
and can add a frame of latency when GPU-bound at the new default.

Assisted-by: LLM
Track output transforms and expose the single output orientation in surface capabilities. Apply the selected pre-transform when presenting, including when a replacement swapchain returns to identity.

Assisted-by: LLM
Prefer the identity transform because GL rendering is not pre-rotated.

Assisted-by: LLM
Prefer formats with 8-bit color channels while preserving the compositor's
order within each group. Clients choosing the first surface format can
otherwise select a float swapchain that costs twice the memory and may
not scan out.

Share the ordering between both surface format queries, applying the
BGRA8_UNORM preference afterward without changing the advertised formats.

Assisted-by: LLM
A vertex program that allocates its temps in bank 0 (one with control
flow, or the bank-0 retry under register pressure) refused every
constant-offset load from a UBO range outside the common store: the
load's destination came from the bank-0 allocator, and only the
all-bank-1 vertex address load is witnessed. Its scratch offset could
also land in bank 0, which the vertex addr.add_shift does not read.

Allocate both in bank 1, as the vertex storage-buffer load already
does. No new encoding: the emitted form is the witnessed one.

Assisted-by: LLM
…need room

A vertex program whose fetched attributes fill bank 1 (r0..r31) refused
every addressed UBO load issued before those attributes were read: the
load's data, its offset and its address pair must be in bank 1, the
witnessed vertex form. A translated D3D9-style skinning vertex shader of
a WebGPU game is one: eight vec4 attributes are each masked by a word of
a UBO outside the common store, so the first instruction that could free
an attribute is itself such a load. Every retry of the pressure ladder
refused it ("memory UBO load needs 1 dword(s), 32 of 32 in use").

Add one last vertex retry. A vertex compile that every retry refused for
register pressure is compiled again from a clone of its input, in its own
instruction order (the scheduling retries hoist products far ahead of
their use), with temps in bank 0. Before each instruction it keeps one
aligned run of eight bank-1 registers free by moving held values into
bank 0, the run needing the fewest moves. Eight registers hold every
bank-1 demand of one instruction in the allocator's first-fit order.
Like the other between-instruction mover (compact_vs), the retry takes
only straight-line programs without stores.

Apple's vertex programs keep their temps in bank 0 and read each
attribute once into one; Apple's offline compiler does the same for this
shape (12 float4 attributes and a 4 KiB constant buffer). The move is the
class-98 move with destination bank 0 and source A in bank 1 that
cf_operand() and the vertex texture-result park already emit. No new
encoding.

Programs that compile today keep their bytes: the first compile is
unchanged, and only a vertex compile refused for register pressure
reaches the retry. Offline replay of the game's 80 captured compiles:
80 admitted (was 79), the 79 admitted before byte-identical.

Assisted-by: LLM
Resolve zink_kopper.c against #13: keep the frames-in-flight image count
and present unrotated (IDENTITY) swapchains where the surface supports it.

Generated-by: LLM
The only workflow was upstream's macOS-CI, which asks for the retired
macos-11 runner: every push queued it for 24 hours and then cancelled it,
and nothing ever compiled a pull request.

The new workflow runs the build() and package() of OrchardLinux/packages'
mesa PKGBUILD on the checkout, in the Arch Linux ARM image that
repository pins and prepares the same way, on an arm64 runner: the
Imagination PowerVR Vulkan driver and OpenGL through Zink, llvmpipe and
softpipe, with the package's exact meson options, and package()'s check
that the drivers the image needs are present. main saves a compiler
cache, pull requests only read it. macos.yml is removed.

Generated-by: LLM
@henrikklee
henrikklee merged commit 5e7a998 into main Nov 17, 2026
1 check passed
@henrikklee
henrikklee deleted the a9-gpu-integration branch November 17, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants