Skip to content

Let mpv draw on llvmpipe or softpipe where the GPU has no driver yet - #32

Merged
maralcbr merged 9 commits into
mainfrom
mpv-allow-software-renderer
Oct 24, 2026
Merged

maralcbr merged 9 commits into
mainfrom
mpv-allow-software-renderer

Conversation

@malik-na

@malik-na malik-na commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

On a Mac without a working GPU driver (here an M3 Max, J516C), every windowed mpv aborts before the first frame, using the vo=gpu / gpu-api=opengl default this package ships:

mpv: ../mpv/video/out/x11_common.c:679: vo_x11_init: Assertion `!vo->x11' failed.

Cause: mpv tries Wayland EGL first. It comes up on llvmpipe (or softpipe, where Mesa is built without LLVM) and is rejected as a software renderer, but the failed init leaves vo->wl set. vo->wl shares a union with vo->x11, so the X11 EGL context tried next fails its assertion. Fixed upstream in mpv-player/mpv@a58dd8ac41, which isn't in any release; Arch ships 0.41.0.

Change: gpu-sw=yes, so Wayland EGL is kept and the faulty fallback is never reached. mpv only consults this option after detecting a software renderer, so Macs with a working GPU keep their hardware renderer.

Verified on the M3 Max with mpv 0.41.0-6 and Mesa 26.2.3: the shipped config aborts every time, and with gpu-sw it plays. omarchy-mac/test/all passes.

For reviewers:

  • Existing installs keep their /etc/mpv/mpv.conf, because the tmpfiles rule never overwrites it. Only new installs get the line. Should a setup step add it to existing installs?
  • On a supported Mac whose GPU breaks, mpv now plays slowly on llvmpipe or softpipe instead of crashing. That makes a broken GPU harder to notice.

On a Mac without a working GPU driver, such as an M3 Max, mpv aborts before
showing a frame. The shipped vo=gpu with gpu-api=opengl probes Wayland EGL,
which comes up on llvmpipe and is rejected as a software renderer. That
context's init does not clean up vo->wl on failure, and vo->wl shares a
union with vo->x11, so the X11 EGL context tried next fails
vo_x11_init: Assertion '!vo->x11' and mpv aborts with SIGABRT.

mpv fixed the leak in a58dd8ac41 ("cleanup vo when egl fails to init"),
39 commits after v0.41.0 and in no tagged release; Arch ships 0.41.0.

gpu-sw=yes stops mpv rejecting the software renderer, so Wayland EGL is
kept and the faulty fallback is never reached. mpv only consults it once a
renderer is detected as software, so a Mac with a working GPU keeps its
hardware renderer. Reproduced and verified on an M3 Max (J516C) with
mpv 0.41.0-6 and Mesa 26.2.3: the shipped config aborts, with gpu-sw it plays.

Existing installs keep their /etc/mpv/mpv.conf, as the tmpfiles rule never
overwrites it; only new installs get the line.

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @malik-na, the diagnosis and the choice of gpu-sw look right to me. In mpv 0.41, gpu-sw is only read in ra_gl_ctx_init once the context's renderer string reads as software and mpv is auto-probing. A Mac whose Wayland EGL context gets the Asahi driver never reaches it, and a user's ~/.config/mpv/mpv.conf still wins (gpu-sw=no brings back the old behaviour). Using mpv's own renderer check, rather than the render-node test the Electron wrappers use, also seems right: it follows the machine at runtime the same way and needs no wrapper.

  • Blocking, to answer your first question: yes, existing installs need it. A Mac that took 0.1.3 has the vendor copy without gpu-sw, so an M3 that upgrades still aborts. Could omarchy-mac-setup-system replace /etc/mpv/mpv.conf with the new vendor copy only when it's a regular file that's byte-identical to the 0.1.3 copy (by its hash, or a shipped copy of it)? That's the same exact-match approach as the brcmfmac cleanup there. An edited file or a link stays as it is. In mpv-test.sh, could you add fixtures for an untouched 0.1.3 file (gets gpu-sw=yes), an edited one, a link, and a second setup run? The current "upgraded" case only starts from an existing scripts/ directory. Then the "never overwrites it" wording in the mpv.conf header and README, and the edit-don't-delete line in mac-manual/content/12-hardware.md:46, need to describe that one exception.
  • On your second question: mpv still logs "Suspected software renderer", and before this the same machine aborted. I wouldn't hold the change back for it.
  • nit: README:47 says the hardware renderer "is accepted before any software one is considered". mpv takes the first context that comes up, so I'd go with something narrower, e.g. "it changes nothing where the context mpv picks has a hardware renderer".
  • nit: could you add a 1080p (and ideally 4K) number for the M3 Max to the README, like the M2 Max figures above it: codec, CPU, dropped frames, and whether decode actually went through AVD or fell back to software? That sets expectations for llvmpipe playback.
  • nit: #21 and #33 also bump to 0.1.4, and #30 would move bumps into release PRs, so the version change will need rebasing whichever lands first.

malik-na and others added 2 commits October 12, 2026 16:53
tmpfiles never overwrites /etc/mpv/mpv.conf, so a Mac that took the default
before gpu-sw=yes keeps the copy without it, and an M3 that upgrades still
aborts in mpv. omarchy-mac-setup-system now replaces that file with the current
default when it is a regular file whose sha256 matches the shipped copy; an
edited file or a link stays, as with the brcmfmac cleanup.

Every omarchy-mac the recipes have pinned (0.1.0-11 at 4399105, 0.1.0-12 at
2a3ed89, 0.1.2 at 5b2c815, 0.1.3 at d8100ec) shipped the same mpv.conf,
9e186dd8, so one hash covers every existing install. The replacement keeps the
file's owner and mode and goes through a temporary file in /etc/mpv.

mpv-test.sh adds an untouched 0.1.3 copy beside mpv-mpris's scripts (replaced,
reported, mode kept), a second setup run (no change), an edited copy, a copy
one byte longer, a link, a machine that is not a Mac and a missing file. The
mpv.conf header, the README and the manual describe the exception.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mpv takes the first context that comes up rather than preferring a hardware
renderer, so the README and mpv.conf now say gpu-sw changes nothing where the
context mpv picks has a hardware renderer.

The M3 Max figures come from 30-second 30 fps synthetic clips (testsrc2 with
noise; H.264 at 8 and 25 Mb/s, HEVC at 20 Mb/s) played fullscreen on the
3456x2160 panel with mpv 0.41.0-6, Mesa 26.2.3 and llvmpipe. CPU is user plus
system time over wall time; drops are mpv's frame-drop-count.

  clip        decode            cores  dropped/900
  1080p H.264 software (default) 10.7   350
  1080p H.264 AVD (forced)       10.6   353
  4K HEVC     software (default) 12.1   526
  4K HEVC     AVD (forced)       11.4   539
  4K H.264    software (default) 11.8   526
  4K H.264    AVD (forced)       11.2   536

With no GPU driver the only DRM node is simple-framebuffer's card0, so libva's
vaGetDriverNames fails and vaapi-copy falls back to software. With
LIBVA_DRIVER_NAME=v4l2_request, mpv reports hardware decoding (vaapi-copy) on
AVD. Decode alone (--vo=null) costs 0.23 vs 0.08 cores at 1080p H.264 and 1.13
vs 0.24 at 4K HEVC, so llvmpipe's drawing is what drops frames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malik-na

Copy link
Copy Markdown
Member Author

Thanks @maralcbr. Done in 2de2db0 and be7ee58. omarchy-mac-setup-system now replaces /etc/mpv/mpv.conf only when it's a regular file whose sha256 matches the shipped copy. Every pinned release (0.1.0-11 through 0.1.3) shipped the same file, so one hash covers them all. Fixtures cover untouched, edited, one byte added, link, non-Mac, missing, and a second run. The header, README and manual describe the exception. Wording narrowed as suggested. M3 Max figures are in the README: llvmpipe drops 350/900 frames at 1080p and about 530/900 at 4K, using 11–12 cores. Decode is in software by default because libva can't name a driver without a GPU render node; forcing LIBVA_DRIVER_NAME=v4l2_request uses AVD but doesn't help, since drawing is the cost. I'll handle the libva part separately.

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Naeem, this is a really nice follow-up. The sha256-gated replace does exactly what Marcelo asked for: it only touches a regular file whose hash matches the shipped copy, and the fixtures cover an untouched file, an edited one, one byte added, a link, a non-Mac, a missing file and a second run. With the PR merged onto current main, mpv-test.sh gives 5 ok and omarchy-mac/test/all gives 94 ok. The M3 Max figures are a big help for setting expectations too.

I think this should merge for fresh installs, since mpv aborts outright on a Mac with no GPU driver. The upgrade path is a separate question, and it's Marcelo's call.

Upgrades, for @maralcbr

Nothing runs omarchy-mac-setup-system on omarchy update or a pacman upgrade. The only way in is omarchy-lifecycle-dispatch setup-system, from install/hardware/platform-setup.sh under omarchy-apply-hardware. That runs at install (omarchy-apply-system), at first-boot provisioning (omarchy-provision-hardware), or when someone reruns omarchy-apply-hardware by hand. omarchy-update and its migrations never get there, and omarchy-mac has no install scriptlet or alpm hook that does. So a Mac already on 0.1.3, or on 0.1.4 since it shipped on the 12th, keeps the old file until hardware setup is rerun.

Marcelo, two ways I can see:

  • (a) Accept "rerun hardware setup". That fits your reasoning in e01ca10 on #34 that only lab Macs run 0.1.3.
  • (b) A one-shot migration in omacom/omarchy, gated on omarchy-hw-aarch64-apple, that runs omarchy-lifecycle-dispatch setup-system, as its own PR after the release. Migrations already check that predicate (1786391100 uses it to skip Macs).

Either way it doesn't need to hold this PR.

Docs

omarchy-mac/README.md:43 and mac-manual/content/12-hardware.md:46 should say outright that an upgrade alone doesn't apply this, and rerunning hardware setup does.

Before I approve

  1. Wording after #34. 0.1.4 shipped with the old mpv.conf: main's copy hashes to 9e186dd8..., the same as released_mpv_sum at omarchy-mac-setup-system:58, so the code already catches it. The text just needs "0.1.4 and earlier" in place of "0.1.3 and earlier" in omarchy-mac/README.md:15 and :43, the mpv.conf header (line 12), the comment at omarchy-mac-setup-system:54, 12-hardware.md:46, and the test names and comment in mpv-test.sh.
  2. Version. Main is already at 0.1.4, so the bump here now lands as no change. Under CONTRIBUTING.md:64 this needs 0.1.5, in omarchy-mac/version and README.md:3. If my #30 merges first, drop the bump and the release PR takes care of it.

With those two sorted I'm happy to approve.

malik-na and others added 2 commits October 23, 2026 00:15
0.1.4 shipped the same mpv.conf, so the hash gate already catches it;
only the wording moves. Say that an upgrade alone does not run setup,
and how to apply the new default on an installed Mac.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malik-na

Copy link
Copy Markdown
Member Author

Thanks @scottjones. Merged main and addressed both points in 3ecb950.

  1. Wording after Keep the Mac microphone mapping current after upgrades and at login #34. I confirmed 0.1.4's mpv.conf (from 2d0c5b2 and current main) hashes to 9e186dd8..., the same as released_mpv_sum, so the gate needed no code change. "0.1.3" now reads "0.1.4" in README.md:15 and :43, the mpv.conf header, the comment in omarchy-mac-setup-system, 12-hardware.md:46, and the test names and comment in mpv-test.sh. The test fixture still hashes to the gated value.
  2. Version. Bumped to 0.1.5 in omarchy-mac/version and README.md:3. If Bump omarchy-mac's version only in a release's own pull request #30 lands first I'll drop the bump.

Docs: README.md:43 and 12-hardware.md:46 now say outright that an upgrade alone doesn't apply this, because neither omarchy update nor a pacman upgrade runs setup. To apply it, run sudo omarchy-mac-setup-system or rerun hardware setup.

Validated on the merged branch: mpv-test.sh gives 5 ok and omarchy-mac/test/all gives 94 ok, exit 0.

@maralcbr, the upgrade path (a) vs (b) is still your call. If you want (b), I can open the omacom/omarchy migration after the release.

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Lets mpv use software rendering when the GPU has no working driver.

  • mpv can play when a Mac has no GPU driver.

Reviews (5) · Last reviewed commit: "Merge origin/main into mpv-allow-softwar..." · Reviewed by Greptile

Comment thread omarchy-mac/test/mpv-test.sh Resolved
The check appended a newline to the already-edited copy, so it repeated
the edited-file case and would pass if setup ignored trailing whitespace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scottjones

Copy link
Copy Markdown
Collaborator

Thanks Naeem, both points are sorted, and I re-checked the gate. Every released omarchy-mac that shipped mpv.conf has 9e186dd8… (0.1.0-6 in the old omacom/omarchy-mac repo, then 0.1.0-11, 0.1.0-12, 0.1.2, 0.1.3 and 0.1.4). The earlier ad480e… copy was never pinned. On a 13" M3 Air (J613) running Linux, mpv-test.sh gives 5 ok and test/all gives 94 ok, and removing the hash check makes the second-run test fail.

One thing changed under this PR: since omarchy-pkgs 32ae19d8 (Oct 15), mesa-aurora is built without LLVM, so a Mac with no GPU driver gets softpipe, not llvmpipe (omacom/omarchy-pkgs#1474). mpv 0.41 counts softpipe as software too (is_software_gl), so the crash and this fix still apply. I reproduced the abort on the Air with mpv 0.41.0-6 and mesa-aurora 26.3.0-devel, and gpu-sw=yes avoids it. But softpipe barely draws. Fullscreen on the 2560×1664 panel, a 1080p 30 fps test clip got 9 frames in 40 s, and 720p got 7, so about 0.2 fps.

Could the README, the mpv.conf comment and the title say "llvmpipe or softpipe", and say that the M3 Max figures assume an llvmpipe Mesa (Arch's 26.2.3), while current mesa-aurora gives softpipe at a fraction of a frame per second until #1474 is resolved? I'd still take this over an abort, so with that wording I'm happy to approve.

mesa-aurora is now built without LLVM, so a Mac with no GPU driver gets
softpipe, which mpv 0.41 also rejects. Say the M3 Max figures assume an
LLVM Mesa, and that softpipe draws a fraction of a frame per second.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malik-na malik-na changed the title Let mpv draw on llvmpipe where the GPU has no driver yet Let mpv draw on llvmpipe or softpipe where the GPU has no driver yet Oct 23, 2026
@malik-na

Copy link
Copy Markdown
Member Author

Thanks @scottjones, and thanks for checking softpipe on the Air. Done in a3f2604:

  • The mpv.conf comment, the README and the PR title now say "llvmpipe or softpipe".
  • The README says the M3 Max figures assume a Mesa built with LLVM (Arch's 26.2.3). Until mesa-aurora: without a GPU the desktop falls back to softpipe, not llvmpipe omarchy-pkgs#1474 is resolved, current mesa-aurora gives softpipe at a fraction of a frame per second; I quoted your M3 Air figure of about 0.2 fps at 1080p and 720p. It also says that mpv still plays rather than aborting.

mpv-test.sh gives 5 ok and omarchy-mac/test/all passes.

maralcbr and others added 2 commits October 24, 2026 10:35
…nderer

# Conflicts:
#	omarchy-mac/README.md
#	omarchy-mac/version
Main is at 0.2.2, and 0.2.0 through 0.2.2 still ship the mpv default
without gpu-sw (the same sha256 setup already matches), so this bumps to
0.2.3 and names 0.2.2 as the last release with the old copy. The README
keeps main's MONO-port microphone wording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malik-na

Copy link
Copy Markdown
Member Author

Merged main again in 1e3e95c to clear the conflicts in omarchy-mac/version and README.md. Main is at 0.2.2 now, and 0.2.0, 0.2.1 and 0.2.2 all still ship the mpv.conf that hashes to 9e186dd8…, so the setup gate already covers them. Following CONTRIBUTING.md:64, this bumps to 0.2.3. The README, the mpv.conf header, the setup comment, the manual and the test names now say "0.2.2 and earlier" (and "installed before 0.2.3") in place of 0.1.4 / 0.1.5. The README keeps main's MONO-port microphone wording. mpv-test.sh gives 5 ok and omarchy-mac/test/all gives 112 ok.

@greptile-apps

greptile-apps Bot commented Oct 24, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

@maralcbr maralcbr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @malik-na, everything I asked for is in. Every released copy hashes to 9e186dd8…, gpu-sw is only read during auto-probe, and the fixtures cover what I asked for. On the upgrade path: (a). Only edge testers run it, and the docs now say to run sudo omarchy-mac-setup-system. If we need it to happen automatically later, I'd add a narrow alpm hook here rather than an omarchy migration that reruns all of setup.

@maralcbr
maralcbr merged commit 60d03b7 into main Oct 24, 2026
10 of 12 checks passed
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