Skip to content

pvr/g3, zink: the A7 desktop: transfers, render paths, two-image swapchains, zink as G5P - #25

Merged
henrikklee merged 27 commits into
OrchardLinux:mainfrom
ricktav:a7/desktop
Dec 2, 2026
Merged

henrikklee merged 27 commits into
OrchardLinux:mainfrom
ricktav:a7/desktop

Conversation

@ricktav

@ricktav ricktav commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Draft, to let others know: the A7 work since #23 that makes the Omarchy GPU desktop on the iPad Air (J71) usable. Not ready to merge; installed and in daily testing on the J71.

What it does

Rendering and transfers on the A7 (pvr/g3, pco)

  • Transfers as compute copies, then separate copy and fill kernels, byte-granular transfers (8/16-bit formats, sub-rectangles), linear images.
  • Depth/stencil attachments, colour LOAD and blending, the load op's texture state, F16-per-channel clears (sRGB, 10-bit), DONT_CARE renders, the full render path by default.
  • vkCmdClearAttachments as an ordinary draw, scaling blits and mip chains, a fix that let Firefox start (no fs_meta register).
  • pvr: the load-op PDS staging buffer aligned by hand.

Desktop memory and speed (the last three commits)

  • pvr/wsi: two-image Wayland swapchains on the A7 (a WSI override of the minimum image count; without the compositor's FIFO protocol it was 4).
  • pvr/g3: 2D copies split over up to 64 workgroups (one 32-lane workgroup took ~350 ms per full-screen copy; now 128-197 ms worst case, a 700x900 region 60 -> 21 ms).
  • zink: the A7's driver ("Mesa PowerVR G3") gets G5P's handling: lost-device path (a client keeps running after a GPU reset), staging limit and trim, precise sync, the G5P driconf, and two swapchain images by default. zink otherwise asked for frames_in_flight + 2 = 4 images per window; the shell's three full-screen surfaces held 149 MB.

Browsers on the GPU (the seven newest commits)

  • pvr/g3: one sample on the A7. Multisampled renders are refused there, so the driver no longer advertises 4x; GL shows no MSAA (ES 3.0 kept) and WebKit/Skia stop asking for it.
  • zink: no EXT_multisampled_render_to_texture without multisampled attachments, and a draw is skipped instead of crashing (SIGSEGV in zink_batch_rp) when a transient image cannot be made.
  • pvr/g3: no dual-source blending on the A7: there a draw with a second colour output writes nothing (a GL_EXT_blend_func_extended quad with ONE, ONE_MINUS_SRC1_COLOR or SRC1_COLOR, ZERO leaves the target at its cleared colour; llvmpipe gives the expected values). The reason is next to the opt-out since 45d17e9.
  • pco/usclib: textureSize, textureQueryLevels and the LOD base level of a linear (STRIDE) texture state. usclib read every state as IMAGE_WORD1, where a STRIDE state keeps its level count in the base-level bits, so a one-level 256x64 linear texture reported 128x32. Firefox's WebRender normalizes glyph-cache coordinates with textureSize and drew text in fragments. This one is not A7-specific: any pco device sampling a linear texture's size hits it.
  • pvr/g3: the clear quad's vertex buffer gets its size. On the A7 vkCmdClearAttachments goes through the Rogue draw, which bounds the vertex index by the buffer's size; with size 0 all three vertices were vertex 0 and every scissored clear was dropped (Firefox's window was black from x = 1024).
  • pvr/g3: maxTexelBufferElements 4096 on the A7. Its buffer views are the A8's 4096-wide linear image but pco folds the index by 8192, so Mesa's PBO uploads (by texel buffer) stopped after 4096 texels and large glyphs and images lost rows. Folding by 4096 in pco broke even small uploads on the A7, so the limit is the fix for now.

Results on the J71 (1 GB)

  • All 36 a7-vk-smoke rungs pass (compute, gclear, gtri, gcopy, tcopyfmt, tbig, gblit, gmip).
  • Quickshell's GPU memory ~200 -> ~150 MB (swapchains 149 -> 74 MB), labwc 161 -> 124 MB.
  • GPU probe passes; the desktop runs on the installed build.
  • Firefox and Epiphany render Wikipedia correctly on the GPU (text, headings, images, full window width); before these commits Firefox drew text in fragments with the right third black.
  • New GL probes (texture size and fetch, sub-rectangle and PBO uploads, rectangles/viewports/scissored clears, shader shifts) pass on the A7 and on llvmpipe. Epiphany needs GSK_RENDERER=vulkan in the session: GTK 4.24 only picks its Vulkan renderer when the driver offers a non-LINEAR dmabuf modifier, and the A7 has only LINEAR.

Testing notes

Built by hand (the Vulkan driver in the a7-mesa-build container, the GL stack natively on aarch64 Arch with LLVM 23, lmsensors off), not through orchard build yet. The GPU hangs seen while testing are a kernel issue: OrchardLinux/linux#30.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP

ricktav and others added 25 commits November 29, 2026 21:21
The A8's transfer programs are Apple-agx1 code, so Zink's glClear and
glReadPixels had nothing to run on the A7: their copies and clears were
refused. On the A7 every transfer is now a compute job of one kernel,
g3_build_copy() (g3_pco.c). It is one workgroup of 32 lanes that copies
or fills a 2D region of dwords, lane l taking dwords l, l + 32, .. of
each row. It uses only forms that ran on the J71: ld/st with a wdf,
loops on tst ge, imadd, movc. Its ten parameters (addresses, width,
height, pitches, fill value, mode) are leading pool entries
(g3_program.num_params), which each dispatch's PDS writes, so one
uploaded program serves every transfer.

- vkCmdCopyImageToBuffer2, vkCmdCopyBufferToImage2, vkCmdCopyImage2,
  vkCmdCopyBuffer2, vkCmdFillBuffer, vkCmdUpdateBuffer and
  vkCmdClearColorImage (32-bit formats) take it. So does vkCmdBlitImage2
  without scaling or format change; other blits are refused.
- Every image on the A7 is linear (pvr_image.c), so a region is rows at
  the image's pitch. Rows that are not whole dwords, compressed and
  depth/stencil images are refused.
- An event barrier before each copy waits for every earlier job, and
  one after it makes later jobs wait for it. Zink's transfer-stage
  barriers name a stage no A7 job has.

Under the A7 drm-shim, Zink's glclear and gltri (a7-gl-smoke) record
and submit with no refusal, and a7dec decodes the copy kernel with the
A7 rules holding. Not run on the A7.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
On the J71 (overlay 12) gcopy's copy kernel wrote zeros: the image was
right (0xff0033ff x4096), the buffer after the copy was all 0 (it was
0xdeadbeef before), and there was no firmware fault. Zink's
glClear/glReadPixels read back zeros the same way. Switches for one
device run:

- PVR_G3_COPY_IMM=1: the kernel compiled per copy with its parameters
  as constants, emitted as movi32 immediates instead of the constant
  pool (g3_program.movi_consts);
- PVR_G3_COPY_BYPASS=1: its ld skips the MCU cache (ACCESS_COHERENT);
- PVR_G3_COPY_NOBARRIER=1: no event barriers around the copy job.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
A conservative rule, not a measured fix. While chasing the A7 transfer
kernel's zero loads (a7test overlays 12 and 13), the kernel that failed
had its ld at r4 <- [r4:r5] and the one that worked at r4 <- [r5:r6], so
the overlap was suspected. Overlay 14 ran with this change (the ld at
r6 <- [r4:r5]) and still stored zeros. The cause was the kernel's
mode != 0 select: tst ne is wrong on the A7 (see "pvr/g3: separate copy and
fill transfer kernels on the A7" and "pco, pvr/g3: no notequal test on
the A7").

pco_a7_ld_addr_live() keeps each SSA ld address live past its ld with a
move, so RA never gives the result the address's register. It costs one
move per ld. Nothing on the A7 is known to need it, so it can be
dropped.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Overlay 14 showed the ld fix (122a999) was in the kernel, ld r6 <- [r4:r5],
and the copy still stored zeros. What the default kernel (zeros) and the
constants kernel (right) really differ in is the copy/fill select. With
the mode in a register, v = mode != 0 ? fill : loaded compiles to a
tst ne plus movc; with a constant mode it folds away. A copy has
fill = 0, so storing the fill value instead of the loaded one gives
exactly the zeros seen. No tst ne has run on the A7 so far: the selects
that ran tested ge, g and z.

The fill and copy kernels are now two programs, with no select. They
are cached separately, and the parameters still come from registers.
The a7vk smoke gains dne (a != test) and dsel0 (the old kernel's select
on its own) to confirm this on the device.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
On the J71 (overlay 15) dne, b = a != 50 ? 1000 : 2000, was wrong in 33
of 64 lanes. The transfer kernel's mode != 0 select had stored its fill
value before ae43ab9 split it. The tests that have run on the A7 are ge,
g, z and gz.

g3_nir_lower_ne() lowers integer a != b to (a ^ b) > 0 unsigned (an
xor, then tst g after trans_cmp's swap), and float a != b to a < b ||
b < a. A NaN operand then gives false, not true. It runs on A7 compute
shaders (g3_pco.c) and on graphics shaders through upstream's path
(pvr_arch_pipeline.c), after pco's NIR passes. g3_pco_check() refuses a
notequal test that remains. dne now compiles to xor, tst g and tst z.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
With PVR_G3_GFX=tri a render may now have a depth/stencil attachment.
Its ZLS words and background depth are the G5P ones
(pvr_arch_g5p_ds_pass()), and they have not run on the A7 yet (Zink
gldepth rung, a7test overlay 17). Without tri the A7 clear render still
refuses one.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
A compositor redraws damaged areas over the previous frame, so its
passes start with LOAD and blend. With PVR_G3_GFX=tri, a render whose
one colour target is LOADed now takes upstream's Rogue load-op
background: pvr_uscgen_loadop() samples the attachment into the output
registers, and its PDS programs come from the render pass (the G5P
skips in pvr_arch_pass.c and pvr_arch_mrt.c are lifted for this path).
Its BGRND0/1/3 words go into the G5P background words
(g5p_a7_clear(), pvr_arch_cmd_buffer.c).

As with the clear and the draws, an 8-bit UNORM target takes F16 per
channel on the A7. So the load op writes F16 into two output registers,
and nir_lower_blend reads the tile as F16
(g3_fs_outputs_f16() also updates the blend format).

Under the A7 drm-shim, Zink's glload (frame 1: clear and a draw; frame 2:
LOAD and a blended full-screen quad) records and submits. a7dec decodes
the load-op and blending programs with the A7 rules holding. Not run on
the A7.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
On the J71 (overlay 18) Zink's glload, a LOAD render with a blended
draw, locked the 3D (one firmware fault) and left the target unchanged.
The kernel's 3D record takes the background words at +0xb0 (BGRND0) and
+0xc0/+0xc8 (BGRND2, BGRND3), and BGRND1, the texture state's data,
from the stream's own PDS_BGRND1_BASE field (+0xb8). Words 2-3 of the
G5P background, where the A7 path had put BGRND1, are not read. So the
load program's texture DMA ran without its data. BGRND1 now goes into
PDS_BGRND1_BASE.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
The A7's upstream draw path (PVR_G3_GFX=tri) is now the default; the
J71 ran it in a7test overlays 8-19: clears, draws, textures, depth,
LOAD, blending, Zink GLES2 and an on-screen demo. PVR_G3_GFX=off makes
the A7 compute only again, and ta/clear keep the earlier rungs.

A render whose colour target is neither CLEARed nor LOADed (DONT_CARE,
upstream's color_init_count 0) now clears it to zero. labwc's wlroots
passes hit this: overlay 20 refused them, and its screenshot came out
black. The refusal now names the render's shape.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
The A7's compute transfers moved whole aligned dwords only, so Qt Quick's
texture uploads (R8/RG8 glyph atlases, odd sub-rectangles) were refused
with VK_ERROR_FEATURE_NOT_PRESENT. Rows that are not whole aligned dwords
now go through a second kernel, g3_build_copy_bytes(): each lane builds a
destination dword from the source bytes with shifts (funnel of two aligned
loads, reads clamped to the source row) and merges it into the old dword
under a byte mask (old - (old & m) + (v & m): no and-not, few 32-bit
constants). Rows that could share an edge dword are split over dispatches
(every k-th row) so no two lanes read-modify-write the same dword at once.
Fills and image clears take 8- and 16-bit texels (the pattern replicated).
A refused buffer/image copy now logs its format and extent, and a kernel
that does not compile logs why.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
…oat)

The A7 clear refused every target whose PBE accumulation format is not
32 bits. Without usc_f16sop_u8 an sRGB, 10-bit UNORM or small float target
takes the same F16 pairs as an 8-bit one (the draws already give pco F16
outputs for them, g3_fs_outputs_f16()), and the PBE packs them and adds the
gamma for sRGB.

On the Omarchy desktop es2gears took Zink's A2B10G10R10 EGL config and
vkgears a B8G8R8A8_SRGB swapchain: every render was refused and both
windows stayed black. Both draw now (about 20 fps fullscreen), Zink keeps
GLES 3.0, and the compute, render, copy and Zink GL rungs still pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
pvr_pds_pixel_shader_uniform_texture_code() asserts a 16-byte aligned
buffer, but pvr_arch_pds_unitex_state_program_create_and_upload() asked
for 8 and the default allocator is plain malloc(), which ignores the
alignment anyway. Under jemalloc a small block is 8-byte aligned:
Quickshell (the Omarchy shell, built with jemalloc) aborted in its first
render on the A7 GPU desktop, every boot. Over-allocate and align the
pointer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
Two assertions Firefox hit on the A7 GPU desktop (Zink):

- pco_trans_nir.c, fs_is_single_sampled_meta(): the A7 has no fs_meta
  shared register (pvr_arch_pipeline.c, g3_fs_meta_const()); it renders
  single-sampled without sample shading, so the meta word is 0 there.
- vk_pipeline_shader_stage_to_nir(): the A7 compiles g5p_clear_pipeline()'s
  NIR through upstream's pipeline path, which takes a driver's own NIR only
  without options or with pco's; the stages carried the A9's g5p_options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
The A7 compiles g5p_clear_pipeline()'s quad through upstream's pipeline
path, so the pipeline has no G5P programs and g5p_cmd_draw() refused
every clear inside a render pass (Epiphany's WebKit through Zink). Draw
the quad with vkCmdDraw on the A7 (pvr_g3_tri()), marking the state a
Rogue draw re-emits dirty for it and again for the application's state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
The A7 refused every blit that was not a plain copy, so the command
buffer failed and Zink lost the context: Omarchy's shell (Qt Quick)
stopped drawing after a top-bar popup closed (a layer downscale), and
again on glGenerateMipmap.

- A scaling or converting blit is vk_meta's rectangle render, as on the
  A9 (pvr_arch_g5p_meta.c). The A8's explicit-LOD exclusion does not
  apply: the A7 carries apple_g4p but compiles through pco.
- What the meta blit does not take (mip chains: the A7's images are
  linear, and linear images have no mip views) is a transfer
  sub-command, run on the CPU at submit as on the A9
  (pvr_process_transfer_cmds()); the A7 no longer refuses transfer
  sub-commands.

New smoke rungs: gblit (64x64 -> 32x32, every texel) and gmip (a 3-level
chain by linear blits), both pass; the compute, render, copy and Zink GL
rungs still pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
One line per job as it is recorded, so the job a GPU hang names can be
matched to what the application asked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
The A7 has 1 GB of RAM and GPU memory is pinned shmem. Without the
compositor's FIFO protocol the Wayland WSI asks for 4 images per
swapchain; Quickshell's four full-screen surfaces then held 192 MB of
swapchain images alone, and the desktop thrashed. Add a WSI override
for the minimum image count and set it to 2 on apple_g5p
(PVR_WSI_WL_IMAGES=2..4 changes it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
A copy ran as one workgroup of 32 lanes: a full-screen copy took about
350 ms. Split the rows into bands, one workgroup each, with the source,
destination and height rebased per workgroup (PVR_G3_COPY_WGS limits
the count). The byte kernel stays on one workgroup. tbig worst case
343 -> 128-197 ms, a 700x900 region 60 -> 21 ms; all smoke rungs pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
The A7's Vulkan driver names itself "Mesa PowerVR G3 (A7, compute
only)", so zink gave it none of G5P's handling: its lost-device path
(a client kept running after a GPU reset), the staging limit and trim,
precise sync, the G5P driconf (S3TC as ETC2), and the swapchain image
knob. Without the knob zink asks for frames_in_flight + 2 = 4 images
per window; on the A7's 1 GB, where GPU memory is pinned RAM, the
desktop shell's three full-screen surfaces then held 149 MB of
swapchain images.

Treat the G3 driver as G5P, and give it two swapchain images unless
PVR_G5P_SWAPCHAIN_IMAGES says otherwise. On the J71 the shell's shared
GPU memory goes from 149 to 74 MB, with two frames still in flight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
The A7 path renders no multisampled targets: such renders are refused
and skipped. It still offered 1 and 4 samples (the G5P limits), so GL
exposed GL_MAX_SAMPLES 4 and EXT_multisampled_render_to_texture, and
WebKit's Skia drew through them: its multisampled renders were lost,
and zink failed to create the transient image and crashed in the next
draw (WebKitWebProcess SIGSEGV in zink_batch_rp).

Offer one sample on the A7, in the device limits and per image format.
GL keeps ES 3.0 and reports GL_MAX_SAMPLES 0; Epiphany then renders
Wikipedia on the GPU without WebKit MSAA settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
EXT_multisampled_render_to_texture is emulated with transient
multisampled images. Offer it only when the device has multisampled
colour attachments, and when a transient image cannot be created (out
of memory, or samples the driver cannot make) start no render pass, so
the draw is skipped as for a dead swapchain instead of rendering into a
null image view (a SIGSEGV in zink_batch_rp).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFMaVcR5gEPcdDR8wQfiDP
Assisted-by: LLM
Dual-source blending (source 1 in output halves 8..11) was enabled for every
G5P device but is qualified on the A9 only. Do not advertise it on the A7
until it is.

Assisted-by: LLM
A linear (STRIDE) texture state's second word is STRIDE_IMAGE_WORD1: the
level count sits where IMAGE_WORD1 keeps the base level and the stride where
it keeps the depth. usclib read every state as IMAGE_WORD1, so textureSize()
on a linear texture shifted the size right by its level count (a one-level
256x64 texture reported 128x32), and textureQueryLevels/the LOD base level
were wrong too. Linear states are one 2D level with base level 0.

On the A7, which samples linear textures through pco, Firefox's WebRender
normalizes its glyph cache coordinates with textureSize() and drew text in
fragments; with this it draws text correctly.

Assisted-by: LLM
On the A7, vkCmdClearAttachments draws its clear quad through the Rogue
draw path, which bounds the vertex index by the bound buffer's size. The
quad's buffer had only an address, size 0, so all three vertices fetched
vertex 0 and the triangle covered nothing: every partial (scissored) clear
was dropped. Give the buffer the size of its three vertices.

Assisted-by: LLM
The A7 takes the A8's buffer views, a linear image PVR_G5P_TBO_WIDTH (4096)
texels wide, but reads them through pco, which folds the element index by
PVR_BUFFER_VIEW_WIDTH (8192): elements from 4096 on fall outside the image
and read 0. Mesa's GL uploads from a pixel buffer object by texel buffer,
so every PBO upload stopped after 4096 texels; Firefox's WebRender uploads
its glyphs and images that way, and large glyphs and images lost their
lower rows.

Advertise maxTexelBufferElements = 4096 on the A7, so that larger uploads
take Mesa's other paths. Folding by 4096 in pco instead broke even small
uploads on the A7, which needs looking into before the limit can rise.

Assisted-by: LLM
The A7 stopped advertising dual-source blending because it was qualified
on the A9 only; untested is no reason for an opt-out. It does break on
the A7: a draw with a second colour output writes nothing. With
GL_EXT_blend_func_extended, a full-target quad blended with ONE,
ONE_MINUS_SRC1_COLOR (WebRender's subpixel text) or SRC1_COLOR, ZERO
leaves every pixel of a 64x64 RGBA8 target at the cleared colour, where
llvmpipe gives the expected values. Put that next to the opt-out.

Assisted-by: LLM
henrikklee pushed a commit to OrchardLinux/orchard that referenced this pull request Dec 1, 2026
Bring the A7 GPU bring-up page up to date: the GPU desktop of
OrchardLinux/mesa#25 (Omarchy, Web and Firefox on the GPU, and the
driver fixes found on the way), the compute-record fix of
OrchardLinux/linux#30, what a J71 did under browser load (silent freezes
confounded by a near-empty battery on a 500 mA host port, recoverable 3D
lockups, about 220 MB of GPU memory that no eviction can free on the A7),
what exists outside Orchard, and the open work.

Assisted-by: LLM
@henrikklee

Copy link
Copy Markdown
Contributor

Thank you, this is impressive work: the GPU desktop with Firefox and Web on the A7! Holding it as you asked in the description ("not ready to merge"). When you consider it ready, please mark it so and we'll review it then, with a particular eye on the shared paths (pco's tex.cl and pco_trans_nir, pvr_arch_mrt/pass, zink) so the A9 and A10 keep rendering. Note that #27 (G5P small levels, 3D slices) has just landed and touches pvr_arch_g5p.c and pvr_g5p.h, so a merge of main will be needed.

@theChristopher16

Copy link
Copy Markdown

J85 (iPad mini 2 Wi-Fi) cross-board check on this PR's 45d17e9 head: orchard build --platform apple-4k linked an AArch64 PowerVR Vulkan library (SHA-256 39e8c3fc9f816875594e6a2c097c8bee8e3d35b93b72ab60bc2bf3fda355c46d). I staged that library only in /tmp on the running J85; the installed Mesa package was not replaced.

The J85 PowerVR graphics queue rendered our 64x64 offscreen gradient triangle. A separate CPU checker verified all 4,096 pixels (1,152 interior within one channel value, 2,944 background exact; image SHA-256 44a72219910ead89851ca49554ba97a11a251670f45799c40ee13756fd65e6d5). With the same temporary Vulkan ICD and the tablet's existing Zink/EGL libraries, gpu-probe passed one full-screen draw/readback, then six colors with exact requested/observed RGBA and gl_error=0 on all six. PVR_G3_LOG_COPY=1 recorded six A7 copy jobs. The old PVR_G3_DESKTOP_PROBE CPU-readback workaround was absent. SSH and /dev/dri/renderD128 stayed available; the recent kernel log showed no new GPU fault.

This is a narrow mixed-version J85 triangle and transfer-path result, not a test of the completed PR #25 package, GPU desktop, or long-run stability. The installed J85 kernel's exact inclusion of linux#30 is unverified. The GL/Zink package stage is still building through Orchard; I'll follow up with a bounded full-package J85 check when it finishes.

@theChristopher16

Copy link
Copy Markdown

Follow-up to my interim J85 check: the complete orchard build Mesa package from this unchanged 45d17e9 head finished for AArch64 (1:27.0.0.4.20261201-1, archive SHA-256 6390c61778b9f68a8d40ea63da6a989d1293d3b837017a53f7ac8100c38f1ffe). I checksum-verified and extracted it only in the running J85's /tmp, then pointed individual test processes at the package's PowerVR ICD, EGL vendor library, GBM backend, DRI driver, and Zink/Gallium libraries. The installed Mesa package and desktop were not changed.

With this matched package, the J85 PowerVR triangle again passed an independent CPU check of all 4,096 pixels (1,152 interior within one channel value; 2,944 background exact). The package's own gpu-probe passed one full-screen frame and six successive colors; each observed RGBA matched the request exactly with gl_error=0, with PVR_G3_DESKTOP_PROBE explicitly unset. The driver logged six A7 copy jobs. SSH and the render node stayed available, and the recent kernel log showed no new GPU fault.

This validates the tested offscreen render/readback path on J85, not an accelerated or sustained desktop. The exact installed J85 kernel's inclusion of linux#30 remains unverified, so that is the next prerequisite before a longer compositor session.

@theChristopher16

Copy link
Copy Markdown

J85 follow-up to my package-only result: I installed the same pinned Mesa #25 head 45d17e96 as 1:27.0.0.4.20261201-1 on the iPad mini 2 Wi-Fi's internal Linux root, alongside a separately packaged j85gpu2 kernel. The running kernel is still the older local j85gpu1, so this does not validate the new kernel or linux#30 on-device yet.

After a normal login-session restart, Labwc selected WLR_RENDERER=gles2 with Zink/PowerVR A7, mapped the installed PowerVR Vulkan library, and held /dev/dri/renderD128 plus the simple-framebuffer display card at 1536x2048. The Omarchy Qt shell also mapped PowerVR and held the render node. A fullscreen blue Wayland test window requested RGB (26,101,168); a compositor readback of a 128x128 physical-pixel center crop matched that value in 16,384/16,384 pixels. The user confirmed the desktop and touch respond after PIN unlock, but was away during the blue pulse, so physical sight of that window is not claimed.

The user reports that the desktop feels quite slow. A snapshot had ~282 MB MemAvailable, no observed swap traffic, low CPU load and ~31 C battery temperature. The display still uses simple-framebuffer, which cannot directly scan out the GPU buffer. The J85 kernel log also has repeated Fender power state ... not reached / devfreq ... dvfs failed (-110) during this session; I found no MMU-fault or firmware-lockup line in the filtered window. I have not measured J85 frame latency or isolated the share due to copies versus DVFS, and this is not a 60 Hz/stability/browser claim. I am measuring that next before proposing any clock-policy change.

@theChristopher16

Copy link
Copy Markdown

Correction/follow-up to my installed-desktop report: during a short normal-use interaction on the J85, the user reported that the screen froze after feeling slow across wake/PIN, touch gestures and app opening. The kernel logged repeated Fender power state ... not reached / devfreq ... dvfs failed (-110) before two Apple GPU job timeouts (compute and fragment) at 20:06:21 local time, then resetting the GPU. The firmware posted no fault. This is a real J85 GPU-session failure, so the earlier passing compositor readback must not be taken as a stability result.

The running kernel is the older local 7.3.0-rc1-j85gpu1-orchard-apple-4k, which lacks linux#30's A7 compute-retirement fix. A j85gpu2 package containing that fix is installed but has not been booted or tested; I cannot attribute the hang to Mesa #25 or claim the fix resolves it. SSH and the render node survived. Labwc initially answered Wayland queries despite the frozen panel; after I restarted that session, a crash dump caused temporary internal-storage I/O pressure, then a new Labwc and Qt shell started. Physical post-restart touch/display recovery is awaiting user confirmation. I stopped additional GPU stress tests.

The bounded offscreen triangle and exact-color frame results still stand for those tests. The normal installed J85 GPU desktop is currently experimental and not qualified as stable. I am retaining the filtered timestamps and version boundary in our J85 lab record rather than posting raw device logs or addresses here.

@theChristopher16

Copy link
Copy Markdown

J85 installed-system follow-up, after the earlier GPU-session hang: I booted the separately packaged local 7.3.0-rc1-j85gpu2-orchard-apple-4k kernel (J85 enablement plus linux#30) from the internal Omarchy install, with this PR's unchanged Mesa head 45d17e96 installed. This boot also set the driver's existing apple_perf_state=1 option, which selects this J85's measured 330 MHz / 937 mV row and disables devfreq; exp_hw_support=1 let the experimental GPU bind automatically. Because kernel revision and clock policy changed together, this is not an A/B test of either change alone.

On-device checks: /dev/dri/renderD128 bound; Labwc ran GLES2/Zink and mapped PowerVR; Quickshell ran; the normal login probe passed on the 1536x2048 display. A separate bounded six-frame color probe returned the exact requested RGBA8 center pixel each time (green, red, blue, 17/85/238/255, yellow, green; all gl_error=0). The user confirmed the unlocked desktop and touch worked. At about 11 minutes of uptime, Labwc and Quickshell remained up and the boot journal had zero GPU job timeout, dvfs failed, or GPU reset-failed lines. This is a short functional result, not long-run stability.

The user reports that ordinary touch gestures and app opening still feel about as slow as in the previous session. Three full-screen Wayland screencopy requests, discarded locally without retaining screen pixels, took 0.313, 0.349 and 0.235 s. That measures capture/protocol/transfer overhead, not presentation time or FPS. Correct GPU pixels and a running GPU compositor therefore still do not establish a responsive J85 desktop. I am investigating the GPU-to-simple-framebuffer presentation path next; no broad Mesa regression or PR #25 speedup is claimed from this test.

@Etienne-T

Copy link
Copy Markdown

Offscreen triangle on a third J85 (iPad mini 2 Wi-Fi) with this PR's head 45d17e96, in a RAM boot. The kernel was built with both patches from linux#38 applied to 218ceb9cbb7f, which includes linux#30, with devfreq on and no apple_perf_state override. Details are on linux#38.

Build: I cross-built Mesa on an x86-64 host in a rootless Debian 13 container with GCC 14 for aarch64. The AArch64 options included -Dvulkan-drivers=imagination -Dgallium-drivers= -Dplatforms= -Dllvm=disabled. The host tools (mesa_clc, vtn_bindgen2, pco_clc, pdsc_precomp) were built natively first and passed in with mesa-clc=system and precomp-compiler=system. The source needed no patches. The ICD, the Vulkan loader 1.4.309 and the glibc/libdrm dependencies were bundled into a BusyBox initramfs. VK_DRIVER_FILES selected the PowerVR ICD.

Test: a small Vulkan 1.1 program adapted from Orchard's A8 smoke test. It renders a 64x64 B8G8R8A8_UNORM image, one sample and one mip level, with a clear of 33 00 00 ff. The triangle has vertices (8,8), (56,8) and (32,56), with red, green and blue interpolated. The program copies the image to a host-visible buffer and checks all 4,096 pixels. Interior pixels must match the barycentric colour at each pixel centre within ±1 per channel. Background pixels must match the clear colour exactly.

probe: device "PowerVR Apple A7" vendor=0x1010 device=0x8960 api=1.2.366 driver=0x6863063
MESA: warning: ../mesa/src/imagination/vulkan/pvr_arch_border.c:244: FINISHME: Devices without tpu_border_colour_enhanced require entries for compressed formats to be stored in the table pre-compressed.
probe: graphics queue family 0
triangle: interior 1152/1152 background 2944/2944 centre BGRA=82413bff

Lavapipe gives 82413cff for the centre on the same scene. The kernel log was continuous from the powervr probe to the end of the run, with no GPU fault, job timeout or reset logged. Afterwards runtime_status returned to suspended with devfreq at 165 MHz.

This was one boot, one draw and one readback. It doesn't test stability, the desktop or GLES/Zink.

Brings the A7 desktop branch up to date with jeroentrappers' A8/A9 fixes
(OrchardLinux#34-OrchardLinux#43), including OrchardLinux#40's Zink behaviour (a batch whose recording failed is
dropped without losing the context).

pvr_arch_g5p_gfx.c: both sides added helpers before
g5p_clear_attachments(): the A7's g5p_a7_clear_dirty() and main's
g5p_attachment_format()/g5p_render_extent() for secondaries. Both are kept;
the A7's clear quad now uses the render extent main computes.

pvr_arch_cmd_buffer.c: main skips Rogue's transparent object on every
apple_g5p device because it hangs the A9. The A7 also sets apple_g5p but
draws through upstream's Rogue path, so it keeps the transparent object as
before this merge; the A8 and A9 skip it as on main.

Assisted-by: LLM
Signed-off-by: Henrik Klee <henrik@goat-code.com>
@henrikklee henrikklee closed this Dec 2, 2026
@henrikklee henrikklee reopened this Dec 2, 2026
@henrikklee
henrikklee merged commit 5dfb49b into OrchardLinux:main Dec 2, 2026
2 checks passed
henrikklee added a commit to thisiscamk/orchard that referenced this pull request Dec 2, 2026
The GPU desktop renders correctly with OrchardLinux/mesa#25, but it takes
about 190 MB more memory than the software desktop, so it stays off on the
A7 until orchard#461 is solved: gpu_desktop stays missing, with the test in
its comment. Matrix regenerated.

Assisted-by: LLM
Signed-off-by: Henrik Klee <henrik@goat-code.com>
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.

4 participants