Repository navigation
omarchy-mac: switch mpv default to gpu-next over OpenGL and sync untouched defaults on upgrade - #227
Conversation
[Medium impact] The current changes appear safe to merge, with no actionable new issue found. SummarySwitches mpv to
The current changes do not include the J604 Hyprland drop-in described in the PR description.
|
scottjones
left a comment
There was a problem hiding this comment.
Thanks for this, and for chasing HDR on the J604. The mpv sync approach is careful work: mpv-default-sync only replaces an untouched default, leaves edited files and symlinks alone, and keeps owner and mode. The mpv tests catch real breakage too. The J604 gate is also right. It does a NUL-bounded match against the compatible list, so apple,j604 turns it on, while j604s, j604c, j614s, prefixes and a missing file all stay off. I checked that against fixtures with Lua 5.5.
There are two things I'd like changed before this goes in, plus a few smaller ones.
1. The Hyprland drop-in doesn't load on 4.6, and it's the wrong place for it
omarchy-mac/share/omarchy/default/hypr/apps/omarchy-mac-hdr.lua relies on default/hypr/apps.lua loading every file in the directory. Since omacom/omarchy#20131 (c8217b831), it loads a fixed list of modules instead. That change is in v4.6.0-rc1, rc2 and main, so on 4.6 the drop-in is silently never loaded. It only works on v4.5.0.
It also goes against the package's rule of not staging files into Omarchy's tree (d76e385, and README.md:23 "ships no Hyprland files", README.md:34). The PR loosens desktop-setup-test.sh:32 to let its own file through, which I'd rather not do.
And render.cm_auto_hdr is a global Hyprland option. A J604 with an external HDR monitor would get back the washed-out HDR flip that omacom/omarchy#17157 turned off ("No HDR for now").
To be fair, there isn't an upstream route ready for this yet. Your omacom/omarchy#18582 has been waiting for review since Nov 17, and omarchy may decide against auto-HDR given #17157. So I'd suggest splitting this up:
- Land the mpv sync work now, including gpu-next, since the numbers look fine (see below).
- Take the HDR switch to omarchy as its own decision.
2. setup-test.sh runs against the host's real /etc/mpv/mpv.conf
omarchy-mac-setup-system:57 passes "${root:-/}" to mpv-default-sync, but the live-setup sed in setup-test.sh:176 only rewrites "$root/". On an Apple Silicon machine, test/all runs the helper against the host's real /etc/mpv/mpv.conf. As a normal user setup-test.sh fails (mktemp is denied). As root it would overwrite the host file. Off Apple Silicon the helper exits early, which is why a container run passes. omarchy-pkgs' check() runs test/all, so an aarch64 Mac build host would fail too. It passes at the base, fc077db.
The fix is small: add the ${root:-/} substitution to the test's sed, or pass $root explicitly.
gpu-next: I measured it, and it's not a blocker
I was worried about vo=gpu-next going to every Mac with evidence from one, so I measured it on my 16-inch M4 Pro (J616s) with mpv 0.42.0. Both configs used OpenGL (gpu-api=opengl), fullscreen at 3456x2234, median of 3 runs of 30 s each. The numbers are mpv's CPU as % of one core, current 0.2.11/0.2.12 default (vo=gpu) vs this PR's config (vo=gpu-next plus the colorspace hints):
| Clip | vo=gpu |
PR config |
|---|---|---|
| H.264 1080p30 (hardware decode, vaapi-copy) | 1.9 | 2.2 |
| H.264 2160p60 (hardware decode) | 7.2 | 6.9 |
| HEVC 1080p60 | 19.5 | 17.2 |
| HEVC 2160p60 | 72.9 | 69.0 |
| HEVC 2160p30 PQ (HDR10-tagged, 8-bit) | 45.4 | 43.5 |
No dropped frames in any run with either config, and the PR config did tag the surface bt.2020/PQ on the HDR clip. So gpu-next over OpenGL costs about the same as vo=gpu here, and the 3x figure in README.md:22 doesn't hold for it on this Mac (it may have been Vulkan).
Two caveats. The session was locked with the screen off, so this covers mpv's own decode, copy, upload and render cost (frames were still rendered at full rate), not compositor or scan-out cost. And I haven't run it on an M1 or M2 or with gpu-sw on llvmpipe, so a quick check there would still be nice. Could you also update README.md:22 and the mpv.conf comment about 3x with these numbers, rather than just deleting them?
Not this PR's fault, but worth knowing: on M4, HEVC isn't hardware-decoded at all. The VA driver rejects HEVC and mpv falls back to software, so HDR10 HEVC on M4 currently runs on software-decoded frames, and 4K60 HEVC uses about 70% of a core either way.
Smaller things
mpv-default-sync:16: the hash list misses the 0.2.3-1 mpv.conf (omarchy-pkgs fccc4321 pinned_commit60d03b7). It hashes to0822424277cfdecb4cacae13840a4f1d857602248dfaddf4e09246d6b81c891d. Without it, Macs installed around Oct 24 to 31 keepvo=gpu. It's a one-line fix. Also, the "0.2.2" label on the 9e186 hash actually covers 0.1.0 through 0.2.2.hdr-defaults-test.shonly greps for strings. Inverting the J604 check, or replacing the file with invalid Lua that keeps the strings in a comment, still passes. A small Lua run againstOMARCHY_MAC_DT_COMPATIBLEfixtures would cover it.- README.md:20, :22 and :23 and
mac-manual/content/12-hardware.md:65now contradict the PR. AGENTS.md:19 asks for the manual to be updated in the same commit.
Tested: at c48178c on an Apple Silicon dev Mac, omarchy-mac/test/all fails only in setup-test.sh (the other tests pass individually). check-scope and check-architecture-gates pass. The mutation checks are as described above. On my 16-inch M4 Pro I measured the PR's mpv config at c48178c against the current default, with the numbers above. I haven't run this on J604 hardware.
Thanks again. The mpv part is close, and I'd be happy to see it land on its own.
…uched defaults on upgrade /usr/share/omarchy-mac/mpv/mpv.conf used vo=gpu, which has no Wayland wp_color_management_v1 signaling for HDR surfaces. Switch to vo=gpu-next with gpu-api=opengl, target-colorspace-hint=yes, and target-colorspace-hint-mode=source while keeping hwdec=vaapi-copy, hwdec-codecs=h264,hevc,vp9, and gpu-sw=yes. Over OpenGL, gpu-next matches vo=gpu in CPU cost on Apple Silicon while tagging HDR surfaces with source colorspace metadata. Extract lib/mpv-default-sync so omarchy-mac-setup-system and a new 92-omarchy-mac-mpv-default.hook PostTransaction pacman hook share one allowlist of earlier released defaults (0.1.0-0.2.2, 0.2.3-1 from 60d03b7, and 0.2.3-2 through 0.2.12). Untouched copies update atomically preserving mode and ownership; administrator edits and symlinks stay untouched. The hook skips chroots and unbooted roots and never fails a transaction. Update omarchy-mac/README.md and mac-manual/content/12-hardware.md to document the OpenGL gpu-next measurements and automatic upgrade sync. Fix setup-test.sh so live-setup substitutes ${root:-/} to the staged root instead of calling mpv-default-sync against host /etc/mpv/mpv.conf.
c48178c to
1a50a22
Compare
|
Thanks for the thorough review and the J616s measurements, @scottjones. Pushed
Offline verification on
|
scottjones
left a comment
There was a problem hiding this comment.
Thanks for turning this around. Everything from my last review is fixed at 1a50a22, and I'm happy for this to go in.
Earlier points
- Hyprland drop-in: gone. Nothing is staged under
/usr/share/omarchyany more, anddesktop-setup-test.shis strict again. setup-test.shand the host's/etc/mpv/mpv.conf: fixed by the${root:-/}substitution atsetup-test.sh:176. I checked it on the case that broke before: an Apple Silicon Mac (16" M2 Max) whose real/etc/mpv/mpv.confis an untouched 0.2.12 copy.test/allnow passes as a normal user and the host file's sha256 is the same before and after. Taking the fix back out makessetup-test.shfail again.- Hash list:
mpv-default-sync:16now covers every released default. I hashedmpv.confat the_commitof every omarchy-mac release in omarchy-pkgs from 0.1.0-5 to 0.2.12-1. There are only three distinct files (9e186 for 0.1.0 to 0.2.2, 0822 for 0.2.3-1, 3875 for 0.2.3-2 to 0.2.12), and all three are in the list. The 0.1.0-5 and -6 builds had no mpv.conf. - Docs: README.md:44 and :46 and
mac-manual/content/12-hardware.md:65match the new behavior and keep the measurements.
gpu-next on M2
I asked last time for a check on M1 or M2 and on gpu-sw. On my 16" M2 Max (mesa-aurora 26.3 devel, mpv 0.42.0, libplacebo 7.387) I played short H.264 1080p and HEVC Main10 PQ clips with this PR's mpv.conf and nothing else. It ran on the Apple GPU with vaapi-copy and no errors. With LIBGL_ALWAYS_SOFTWARE=1 it ran on llvmpipe, and gpu-sw=yes let gpu-next carry on as intended. I didn't measure CPU on M2 or check HDR output there. M1 and J604 are still untested by me.
One small thing, not blocking
test/mpv-test.sh:152-158 checks the hook by grepping for strings. If the Exec = line is broken but the strings are still in the file (in a comment, say), or if the trailing || true is dropped, the test still passes. I tried both. Running the Exec command with stubbed systemd-detect-virt and systemd-notify would cover it, but the line matches the existing 91-omarchy-mac-touchid-pam.hook, so this can be a follow-up.
Also minor, and the old inline code did the same: in mpv-default-sync:20-21, if chown or chmod fails, set -e exits 1 and leaves /etc/mpv/.mpv.conf.XXXXXX (mode 600) behind. Only a cp failure cleans up. I reproduced it with a chown that fails. The hook swallows the error, but omarchy-mac-setup-system:57 stops there and skips the Wi-Fi and speaker setup after it. A trap 'rm -f -- "$updated"' EXIT, or || true at the call site, would cover it. The tests for the two new hashes also don't check mode, symlinks or a second run the way the 0.2.2 hash tests do. They use the same code path, so that's only a gap.
The rest of the sync logic is careful. Taking out any of the hashes, the Apple Silicon gate, the symlink check, the chown/chmod, the hook's chroot guard or the call from omarchy-mac-setup-system makes mpv-test.sh fail. On a fresh install the tmpfiles copy is already the current default, so the hook does nothing. On an upgrade it only touches a byte-identical released copy, and ~/.config/mpv/mpv.conf is never touched.
Tested at 1a50a22 on a 16" M2 Max (J414c): omarchy-mac/test/all gives 155 ok and 0 not ok, with the host /etc/mpv/mpv.conf unchanged. Plus the mutation checks and the GPU and llvmpipe playback above.
What
Switch Apple Silicon's default
/usr/share/omarchy-mac/mpv/mpv.conffromvo=gputovo=gpu-nextover OpenGL with Wayland source colorspace hints, and automatically sync untouched copies of earlier released defaults on install and upgrade:/usr/share/omarchy-mac/mpv/mpv.conftovo=gpu-next,gpu-api=opengl,target-colorspace-hint=yes, andtarget-colorspace-hint-mode=sourcewhile retaininghwdec=vaapi-copy,hwdec-codecs=h264,hevc,vp9, andgpu-sw=yes. Keepinggpu-api=openglavoids Vulkan chroma-plane import issues on Asahi while allowing libplacebo to emit Waylandwp_color_management_v1HDR10/PQ image descriptions when the compositor has auto-HDR enabled.lib/mpv-default-sync(shared betweenomarchy-mac-setup-systemand a new92-omarchy-mac-mpv-default.hookPostTransaction pacman hook) so untouched copies of earlier released defaults (0.1.0–0.2.2,0.2.3-1from60d03b7, and0.2.3-2–0.2.12) update atomically on Apple Silicon while administrator edits and symlinks are preserved. The hook skips chroots and unbooted roots and never fails a transaction.omarchy-mac/README.mdandmac-manual/content/12-hardware.mdto document the OpenGLgpu-nextmeasurements and automatic default sync on upgrade.omarchy-mac/test/setup-test.shsolive-setuprewrites${root:-/}to the staged root instead of invokingmpv-default-syncagainst the host's/etc/mpv/mpv.conf, and extendomarchy-mac/test/mpv-test.shwith fixtures for0.2.3-1and0.2.12plus hook and helper tests.Per review, the Hyprland
render.cm_auto_hdrswitch has been split out of this PR and will be taken toomacom/omarchyseparately soomarchy-maccontinues to stage nothing under/usr/share/omarchy.Testing
linux-aurora 1.1661, stockmpv --fs,n=10/10with compositorcm_auto_hdr=1): PQ/SDR luminance headroom7.139x,pq=250/250ticks, fullscreen SDR control1.000,0kernel/GPU faults.mpv 0.42.0, fullscreen3456x2234, median of 3x30 s runs, measured by@scottjones):vo=gpu-nextover OpenGL matchedvo=gpuCPU across H.264 1080p30/4K60 and HEVC 1080p60/4K60/4K30 PQ with zero dropped frames and BT.2020/PQ Wayland surface tagging.mainfc077db, non-root user with a root-owned untouched0.2.12/etc/mpv/mpv.confpresent on the host):omarchy-mac/test/all:155 ok, 0 not ok(host/etc/mpv/mpv.confsha256 verified unchanged)..github/scripts/check-scope: pass..github/scripts/check-architecture-gates: pass.shellcheck -S warningon all modified/added scripts: pass.