Skip to content

Desktop: GPU or software per boot, decided by a test frame, on every board - #54

Merged
henrikklee merged 3 commits into
mainfrom
gpu-probe
Nov 14, 2026
Merged

henrikklee merged 3 commits into
mainfrom
gpu-probe

Conversation

@henrikklee

Copy link
Copy Markdown
Contributor

At every login the desktop now draws one test frame on the GPU before it decides how to draw. If the frame comes out right, the desktop runs on the GPU; if not, it runs in software, as on a board without a GPU. There is no board or chip name in the decision, so the iPad 5 (A9) takes the same path as the iPad 6/7 (A10): the system Mesa, Zink on the powervr Vulkan driver.

Not run on any tablet. Per Henrik's decision this is merged untested; Berkay tests main on his iPad 5 afterwards.

What changes

iPad 6 / iPad 7 (A10). The desktop draws on the GPU as before, with the same settings as before. New: the login first spends the time of the test frame (expected well under a second or two; not measured), and a boot in which the GPU does not draw ends on the software desktop instead of a desktop that does not come up.

iPad 5 (A9). Nothing yet with today's kernel and Mesa: no GPU device, software desktop, no test frame. Once orchard#138 (the A9 in the powervr kernel driver) is merged, the kernel offers a GPU, the login tries the test frame, and:

  • with the current Mesa pin, which does not know the A9's job format, the frame fails and the desktop stays in software;
  • with the A9 Mesa port pinned (see "Mesa pin" below), the frame decides: GPU desktop if it draws and the display takes the GPU's buffer, software desktop otherwise.

Boards without a GPU driver (everything else, and any board booted with modprobe.blacklist=powervr): unchanged. No test frame is run, nothing is logged, the login takes as long as before.

USB serial and SSH are not touched; the decision happens only in the graphical login on the tablet's own screen.

The test frame

gpu-probe does for one frame what Labwc does: it opens EGL on the GPU, allocates a buffer of the panel's size on the GPU, clears it, draws a quad through a shader, reads a pixel back, and hands the buffer to the display controller as a framebuffer (no mode is set, the screen is not touched). It refuses a software renderer, so a silent fallback to llvmpipe counts as a failure.

The login waits at most 10 s. It polls the probe rather than waiting for it to end, so a probe stuck inside the kernel is left behind and the login goes on in software. A probe that crashes counts as failed.

Each login on a board with a GPU driver writes one line to the journal, the decision and the reason:

journalctl -t omarchy-gpu-probe
GPU desktop after 0.8 s: GPU-PROBE PASS renderer=zink Vulkan ... egl=device size=1536x2048 ...
software desktop: GPU-PROBE FAIL: the display controller cannot import a GPU buffer: Invalid argument
software desktop: the GPU probe did not finish within 10 s

The probe's full output of the last login is in $XDG_RUNTIME_DIR/omarchy-gpu-probe.log.

Where it is

  • desktop/configuration/login-session: the decision (the block "A board with a GPU ...").
  • desktop/packages/vulkan-powervr-orchard/gpu-probe.c: the probe, built and shipped with the Vulkan driver package as /usr/lib/omarchy-a/gpu-probe. One binary for all boards, linked to the system's EGL, GLES, GBM and libdrm.
  • tests/test_gpu_video_session.py: the decisions with a mocked probe.

Provenance

The probe is Berkay Kösebay's, from omarchy-a PR #44 (commit 3c13c74, desktop/packages/mesa-g5p-orchard/gpu-probe.c), committed here under his authorship and adapted: #44 ran it for a separate Mesa in /opt/orchard/g5p; here it tests the one system Mesa path. The adaptations are listed in that commit's message. The separate Mesa, the LD_LIBRARY_PATH switch and the other parts of #44 are not in this PR.

Mesa pin

The pin is unchanged (OrchardLinux/mesa 7446eebebec). The A9 port (a9-powervr in OrchardLinux/mesa) did not exist when this was written. The iPad 5 draws on the GPU only after a follow-up moves the pin (desktop/arm64/sources.json and the PKGBUILD's _commit and checksum) to the merged Mesa commit. Order: orchard#138 and the Mesa PR, then the pin. This PR can merge before or after them; until all three are in, the iPad 5 stays on the software desktop.

Tested

  • tests/test_gpu_video_session.py (10 tests, macOS bash 3.2 and Arch bash 5.3): probe passes, fails with a reason, crashes, never ends, is missing; no display card; no Vulkan driver; boards without the GPU driver run no probe; video decoder settings follow the decision.
  • The probe compiles without warnings with the package's flags in the desktop builder image, and there refuses llvmpipe.

Not proven

  • The probe has not run on a GPU. If it fails wrongly on an A10, that tablet gets the software desktop; the journal line names the step.
  • Whether the A9's display controller takes buffers allocated on the GPU. It accepts only physically contiguous memory; Desktop: matched G5P Vulkan and GL, hardware desktop after a probe #44 went the other way round (display-allocated buffers, imported into the GPU) for that reason. If the import fails on the iPad 5, the probe reports it and the desktop stays in software; the fix would then be in the kernel driver or Mesa, not here.
  • The time the test frame adds to a login, and whether 10 s is enough on a cold start.
  • The package build with the probe added (a full Mesa build) was not run locally; CI builds it only on tags and manual runs.
  • A passing frame does not prove a whole desktop session: it covers EGL start, one buffer, a clear, one shader draw, a readback and the display import.

No changelog entry in this PR.

Assisted-by: LLM

brkosebay and others added 3 commits November 15, 2026 00:25
A small program the login session can run before it starts Labwc on the
GPU: it opens EGL on the GPU's render node, draws into a buffer and
reads it back, and exits 0 only if that worked.

Taken from the probe of omarchy-a PR #44 (commit 3c13c74,
"Desktop: matched G5P Vulkan and GL, hardware desktop after a probe",
desktop/packages/mesa-g5p-orchard/gpu-probe.c) and adapted to the one
GPU path every board takes, the system Mesa with Zink on the powervr
Vulkan driver:

- It follows that path's buffer flow: the output buffer is allocated on
  the GPU and handed to the display controller (prime import, AddFB2),
  as wlroots does, and has the panel's size instead of 32x32, because
  the display controller's import depends on how the memory is laid
  out. The original allocated on the display card and imported into
  the GPU, the flow of the separate Mesa in /opt.
- EGL is opened as wlroots opens it (the EGL device of the render node,
  then GBM), with no EGL config.
- It draws a quad through a shader after the clear, and refuses a
  software renderer by name instead of requiring "PowerVR".
- It gives up DRM master on the display card at once, so that a stuck
  probe cannot keep Labwc from the display.
- It lives next to the Vulkan driver's recipe; nothing builds it yet.

Compiled in the desktop builder image; not run on a GPU.

Assisted-by: LLM
…board

The login session chose the GPU desktop wherever the powervr kernel
driver had a render node and the image had the Vulkan driver. That was
safe while only the A10 had the kernel driver. With the A9 in the same
kernel driver (orchard PR #138) a bound driver no longer says that the
desktop can draw: Mesa has to speak the chip's job format and the
display controller has to take the GPU's buffers.

The session now runs gpu-probe first, with the environment the desktop
would get (Zink on the powervr Vulkan driver, the system Mesa). If the
probe draws its frame, the session exports exactly what it exported
before; an A10 board ends up as it did. If the probe fails, crashes or
has not ended after 10 s, the desktop starts in software. The session
polls the probe instead of waiting on it, so a probe stuck in the kernel
cannot hold the login. One line per login goes to the journal
(journalctl -t omarchy-gpu-probe): the decision and the probe's reason.

There is no board or chip name in this: the A9 takes the A10's path as
soon as kernel and Mesa carry it. A board without a powervr render node
runs no probe and logs nothing.

The probe is built and shipped with the Vulkan driver package
(/usr/lib/omarchy-a/gpu-probe), one binary for all boards, linked to
the system's EGL, GLES, GBM and libdrm.

Tested: the session's decisions with a mocked probe (pass, fail, crash,
never ending, no probe, no display card); the probe compiles with the
package's flags in the desktop builder image and refuses llvmpipe
there. Not built as a package, not run on a GPU.

Assisted-by: LLM
Mesa fork 2c1aa767d8d (OrchardLinux/mesa #8): Berkay Kösebay's A9
driver on the powervr kernel interface (orchard #138), next to the A10
one. The iPad 6/7 path is unchanged.
@henrikklee
henrikklee merged commit fbe4138 into main Nov 14, 2026
7 checks passed
@henrikklee
henrikklee deleted the gpu-probe branch November 14, 2026 17:37
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.

2 participants