Repository navigation
Let mpv draw on llvmpipe or softpipe where the GPU has no driver yet - #32
Conversation
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
left a comment
There was a problem hiding this comment.
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. Couldomarchy-mac-setup-systemreplace/etc/mpv/mpv.confwith 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. Inmpv-test.sh, could you add fixtures for an untouched 0.1.3 file (getsgpu-sw=yes), an edited one, a link, and a second setup run? The current "upgraded" case only starts from an existingscripts/directory. Then the "never overwrites it" wording in thempv.confheader and README, and the edit-don't-delete line inmac-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
versionchange will need rebasing whichever lands first.
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>
|
Thanks @maralcbr. Done in 2de2db0 and be7ee58. |
scottjones
left a comment
There was a problem hiding this comment.
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 runsomarchy-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
- Wording after #34. 0.1.4 shipped with the old
mpv.conf: main's copy hashes to9e186dd8..., the same asreleased_mpv_sumatomarchy-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" inomarchy-mac/README.md:15and:43, thempv.confheader (line 12), the comment atomarchy-mac-setup-system:54,12-hardware.md:46, and the test names and comment inmpv-test.sh. - Version. Main is already at 0.1.4, so the bump here now lands as no change. Under
CONTRIBUTING.md:64this needs 0.1.5, inomarchy-mac/versionandREADME.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.
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>
|
Thanks @scottjones. Merged main and addressed both points in 3ecb950.
Docs: Validated on the merged branch: @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. |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryLets mpv use software rendering when the GPU has no working driver.
Reviews (5) · Last reviewed commit: "Merge origin/main into mpv-allow-softwar..." · Reviewed by Greptile |
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>
|
Thanks Naeem, both points are sorted, and I re-checked the gate. Every released omarchy-mac that shipped One thing changed under this PR: since omarchy-pkgs Could the README, the |
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>
|
Thanks @scottjones, and thanks for checking softpipe on the Air. Done in a3f2604:
|
…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>
|
Merged main again in 1e3e95c to clear the conflicts in |
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
maralcbr
left a comment
There was a problem hiding this comment.
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.
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=opengldefault this package ships: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->wlset.vo->wlshares a union withvo->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-swit plays.omarchy-mac/test/allpasses.For reviewers:
/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?