Skip to content

omarchy-mac: switch mpv default to gpu-next over OpenGL and sync untouched defaults on upgrade - #227

Merged
scottjones merged 1 commit into
omacom:mainfrom
IronsideXXVI:j604-hdr-defaults
Dec 2, 2026
Merged

scottjones merged 1 commit into
omacom:mainfrom
IronsideXXVI:j604-hdr-defaults

Conversation

@IronsideXXVI

@IronsideXXVI IronsideXXVI commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What

Switch Apple Silicon's default /usr/share/omarchy-mac/mpv/mpv.conf from vo=gpu to vo=gpu-next over OpenGL with Wayland source colorspace hints, and automatically sync untouched copies of earlier released defaults on install and upgrade:

  • Update /usr/share/omarchy-mac/mpv/mpv.conf to vo=gpu-next, gpu-api=opengl, target-colorspace-hint=yes, and target-colorspace-hint-mode=source while retaining hwdec=vaapi-copy, hwdec-codecs=h264,hevc,vp9, and gpu-sw=yes. Keeping gpu-api=opengl avoids Vulkan chroma-plane import issues on Asahi while allowing libplacebo to emit Wayland wp_color_management_v1 HDR10/PQ image descriptions when the compositor has auto-HDR enabled.
  • Extract lib/mpv-default-sync (shared between omarchy-mac-setup-system and a new 92-omarchy-mac-mpv-default.hook PostTransaction pacman hook) so untouched copies of earlier released defaults (0.1.0–0.2.2, 0.2.3-1 from 60d03b7, and 0.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.
  • Update omarchy-mac/README.md and mac-manual/content/12-hardware.md to document the OpenGL gpu-next measurements and automatic default sync on upgrade.
  • Fix omarchy-mac/test/setup-test.sh so live-setup rewrites ${root:-/} to the staged root instead of invoking mpv-default-sync against the host's /etc/mpv/mpv.conf, and extend omarchy-mac/test/mpv-test.sh with fixtures for 0.2.3-1 and 0.2.12 plus hook and helper tests.

Per review, the Hyprland render.cm_auto_hdr switch has been split out of this PR and will be taken to omacom/omarchy separately so omarchy-mac continues to stage nothing under /usr/share/omarchy.

Testing

  • Hardware:
    • 14-inch MacBook Pro M4 (J604, linux-aurora 1.1661, stock mpv --fs, n=10/10 with compositor cm_auto_hdr=1): PQ/SDR luminance headroom 7.139x, pq=250/250 ticks, fullscreen SDR control 1.000, 0 kernel/GPU faults.
    • 16-inch MacBook Pro M4 Pro (J616s, mpv 0.42.0, fullscreen 3456x2234, median of 3x30 s runs, measured by @scottjones): vo=gpu-next over OpenGL matched vo=gpu CPU across H.264 1080p30/4K60 and HEVC 1080p60/4K60/4K30 PQ with zero dropped frames and BT.2020/PQ Wayland surface tagging.
  • Automated suite (Arch Linux container on main fc077db, non-root user with a root-owned untouched 0.2.12 /etc/mpv/mpv.conf present on the host):
    • omarchy-mac/test/all: 155 ok, 0 not ok (host /etc/mpv/mpv.conf sha256 verified unchanged).
    • .github/scripts/check-scope: pass.
    • .github/scripts/check-architecture-gates: pass.
    • shellcheck -S warning on all modified/added scripts: pass.

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The current changes appear safe to merge, with no actionable new issue found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The current changes appear safe to merge, with no actionable new issue found.

Summary

Switches mpv to gpu-next over OpenGL and enables source colorspace hints.

  • mpv uses HDR-aware defaults, and old managed configs catch up automatically.

The current changes do not include the J604 Hyprland drop-in described in the PR description.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[System setup] --> C[mpv-default-sync]
    B[Package install or upgrade] --> G{Booted outside chroot?}
    G -->|Yes| C
    C --> D{Regular file matching an earlier default?}
    D -->|Yes| E[Replace with current default]
    D -->|No| F[Leave unchanged]
Loading

Reviews (2) · Last reviewed commit: "omarchy-mac: switch mpv default to gpu-n..." · Reviewed by Greptile

Comment thread omarchy-mac/test/hdr-defaults-test.sh Resolved

@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 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 _commit 60d03b7). It hashes to 0822424277cfdecb4cacae13840a4f1d857602248dfaddf4e09246d6b81c891d. Without it, Macs installed around Oct 24 to 31 keep vo=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.sh only 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 against OMARCHY_MAC_DT_COMPATIBLE fixtures would cover it.
  • README.md:20, :22 and :23 and mac-manual/content/12-hardware.md:65 now 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.
@IronsideXXVI IronsideXXVI changed the title omarchy-mac: enable fullscreen HDR video at defaults on J604 omarchy-mac: switch mpv default to gpu-next over OpenGL and sync untouched defaults on upgrade Dec 1, 2026
@IronsideXXVI

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review and the J616s measurements, @scottjones. Pushed 1a50a22 addressing all requested changes:

  1. Split out the Hyprland drop-in: Removed omarchy-mac/share/omarchy/default/hypr/apps/omarchy-mac-hdr.lua and hdr-defaults-test.sh, and restored desktop-setup-test.sh's strict check that nothing is staged under /usr/share/omarchy. Good catch on omacom/omarchy#20131 (apps.lua fixed module list) and the global cm_auto_hdr boundary — I'll take the auto-HDR decision to omacom/omarchy separately.
  2. Fixed setup-test.sh touching host /etc/mpv/mpv.conf: Added -e "s|\${root:-/}|$stage|g" to the live-setup sed in omarchy-mac/test/setup-test.sh:176 so mpv-default-sync receives $stage rather than /.
  3. Added the missing 0.2.3-1 (60d03b7) hash: Added 0822424277cfdecb4cacae13840a4f1d857602248dfaddf4e09246d6b81c891d to lib/mpv-default-sync, updated the 0.1.0–0.2.2 comment, added the ! systemd-notify --booted guard to 92-omarchy-mac-mpv-default.hook (matching 91-omarchy-mac-touchid-pam.hook), and added test/mpv-0.2.3-1.conf + hook/helper coverage in test/mpv-test.sh.
  4. Updated docs and comments: Updated omarchy-mac/share/omarchy-mac/mpv/mpv.conf, omarchy-mac/README.md, and mac-manual/content/12-hardware.md with the J616s OpenGL gpu-next numbers alongside the earlier Vulkan 3x note, and updated the upgrade guidance to reflect automatic sync via 92-omarchy-mac-mpv-default.hook (and how editing /etc/mpv/mpv.conf or setting vo=gpu in ~/.config/mpv/mpv.conf keeps the legacy renderer).

Offline verification on 1a50a22 (Arch container, non-root user with a root-owned untouched 0.2.12 /etc/mpv/mpv.conf on the host):

  • omarchy-mac/test/all: 155 ok, 0 not ok (host /etc/mpv/mpv.conf sha256 verified unchanged before/after)
  • .github/scripts/check-scope, .github/scripts/check-architecture-gates, shellcheck -S warning: all pass.

@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 for turning this around. Everything from my last review is fixed at 1a50a22, and I'm happy for this to go in.

Earlier points

  1. Hyprland drop-in: gone. Nothing is staged under /usr/share/omarchy any more, and desktop-setup-test.sh is strict again.
  2. setup-test.sh and the host's /etc/mpv/mpv.conf: fixed by the ${root:-/} substitution at setup-test.sh:176. I checked it on the case that broke before: an Apple Silicon Mac (16" M2 Max) whose real /etc/mpv/mpv.conf is an untouched 0.2.12 copy. test/all now passes as a normal user and the host file's sha256 is the same before and after. Taking the fix back out makes setup-test.sh fail again.
  3. Hash list: mpv-default-sync:16 now covers every released default. I hashed mpv.conf at the _commit of 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.
  4. Docs: README.md:44 and :46 and mac-manual/content/12-hardware.md:65 match 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.

@scottjones
scottjones merged commit 05b30d2 into omacom:main Dec 2, 2026
6 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.

2 participants