Repository navigation
drm: use alpha variant when scanout plane lacks opaque variant - #496
joshuaswarren wants to merge 1 commit into
Conversation
Some scanout planes (Apple M5 internal panel) offer only ARGB8888 and ABGR8888 for 8 bpc, not XRGB8888 or XBGR8888. A compositor that asks for XRGB8888 gets "format XR24 isn't supported by primary backend". Allocate the alpha variant in that case, and let the three commit-time format checks (setFormat validation, mismatch detection, async commit) treat it as equal to the requested opaque format, so no modeset is forced.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Hi @joshuaswarren, Thanks for your contribution! Unfortunately, Hyprland and hypr* no longer To get vouched, please see our contributing guide at wiki.hypr.land/Contributing-and-Debugging This PR has been closed automatically and will not be re-opened. |
|
CHANGES on 8fb4fab P2 — The commit-side exception is not conditional on the plane lacking the opaque format. GBM.cpp correctly preserves XRGB/XBGR allocation when offered, but DRM.cpp's mismatch and async predicates accept ARGB/ABGR for the opaque state on every plane. For a normal plane advertising both XRGB8888 and ARGB8888, an ARGB buffer with XRGB state previously triggered the format-update/modeset path (and async ENOTSUP); it now skips both. Thus the stated “opaque-capable displays unaffected” invariant does not hold when the consumer supplies a different format. Gate alias acceptance on the same per-output fallback condition, preserving ordinary mismatch handling; add both-format and alpha-only tests for all three checks. Read allocator selection, renderable-modifier clipping and downstream DRM commit handling. Compiled the actual helper and checked mappings; a predicate witness confirms the normal-plane behavior change. Allocation uses the selected alpha format's own modifier list, not the opaque list. Not checked: full dependency build, physical scanout, camera/readback receipts or greeter. The corrected PR text appropriately says greeter startup is unverified. |
Some primary planes offer only the alpha variant of an 8 bpc format (ARGB8888/ABGR8888, no XRGB8888/XBGR8888), for example the internal panel on Apple M5 and on M4 Max with macOS 27 firmware. Compositors asking for XRGB8888 then fail to allocate and abort at startup. Allocate the alpha variant for scanout buffers when the plane lacks the opaque format but offers the alpha one, and accept that alias in the commit-time format checks only under the same condition, so planes that offer both formats keep their current behavior. Adds tests/ScanoutAlias.cpp. Taken from omacom/omarchy-pkgs#2739 (patch 0005), based on hyprwm#496. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Some primary planes offer only the alpha variant of an 8 bpc format (ARGB8888/ABGR8888, no XRGB8888/XBGR8888), for example the internal panel on Apple M5 and on M4 Max with macOS 27 firmware. Compositors asking for XRGB8888 then fail to allocate and abort at startup. Allocate the alpha variant for scanout buffers when the plane lacks the opaque format but offers the alpha one, and accept that alias in the commit-time format checks only under the same condition, so planes that offer both formats keep their current behavior. Adds tests/ScanoutAlias.cpp. Taken from omacom/omarchy-pkgs#2739 (patch 0005), based on hyprwm#496.
On the M5 and the M4 Max with macOS 27 firmware, the screen plane lists ARGB8888 and does not list XRGB8888. Hyprland asks for XRGB8888, aquamarine refuses to create the buffer, and Hyprland quits at startup. Create the screen buffer as ARGB8888 when the plane does not offer XRGB8888 (but offers ARGB8888). Taken from omacom/omarchy-pkgs#2739 (patch 0005), based on hyprwm#496.
[Joshua's agent]
Some display hardware offers only
ARGB8888andABGR8888for 8 bpc scanout, notXRGB8888orXBGR8888. The internal display pipeline on a 14-inch M5 Max MacBook Pro is one example. Compositors that requestXRGB8888fail at startup with:GBM: Failed to allocate a GBM buffer: format XR24 isn't supported by primary backendThis change allows those displays to function:
CGBMBufferallocates the alpha format (ARGB8888orABGR8888) when the opaque format is requested for scanout, the scanout plane lacks the opaque format, and the scanout plane offers the alpha format.DRM.cpp(setFormatvalidation, mismatch detection, async commit) accept the alpha format when the output state specifies the matching opaque format. This prevents spurious format-mismatch modesets and keeps async commits working.Displays that offer the opaque format are unaffected.
Verified on hardware (a 14-inch M5 Max MacBook Pro), in user compositor sessions:
Not yet verified: startup through the display-manager greeter. The library was loaded per-session, so greeter startup with this build remains untested.