Skip to content

drm/apple: offer only alpha formats on the T6050 internal primary plane - #1873

Closed
joshuaswarren wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
joshuaswarren:w88/t6050-xrgb-alpha
Closed

joshuaswarren wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
joshuaswarren:w88/t6050-xrgb-alpha

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

[Joshua's agent]

On the M5 Max (T6050) internal panel, the firmware reads the X byte of XRGB8888 as alpha. The same defect is already handled for the T8142 on firmware 27 (43f8980).

Measured by filling the primary plane with pure green and varying X: X=0x00 shows black for every colour, X=0x10 about half brightness, X=0x80 and X=0xff the correct colour. Green and blue also looked wrong while red was zero. The cause fits apple_plane_atomic_update forcing is_premultiplied for XRGB8888, and iomfb_enqueue_opaque_x skipping the opaque-X property on firmware 27.

Change: add a hardware flag xrgb_is_alpha, set in apple_dcp_hw_t6050, and OR it into the xrgb_is_alpha argument of the primary-plane apple_plane_init call. The T6050 internal primary plane then offers only formats that carry alpha (dcp_overlay_formats), so compositors write the alpha byte. The T6050 dcpext nodes are not changed: their firmware was not measured.

Effect on userspace: XRGB8888 is no longer advertised on that plane. An XR24 framebuffer is rejected at atomic check; ARGB8888 with alpha 0xff shows the colour.

Not verified yet: the boot check on the M5 (IN_FORMATS of the internal primary plane, ARGB8888 fill with alpha 0xff lights, fbcon still shows text). No KUnit covers apple_probe_per_dcp.

Validated on, and reach

Validated on: Measurement on a 14-inch M5 Max MacBook Pro (K114c, T6050): filling the primary plane with pure green and varying X gave black at X=0x00, half brightness at 0x10, correct colour at 0x80 and 0xff. The change itself (formats offered) has not been booted.

Applies beyond the M4: The same defect is already handled for the T8142 (M4) on firmware 27 (43f8980). This PR sets the hardware flag for T6050 only; the T6050 dcpext nodes are not changed because their firmware was not measured.

m tester run (omarchy-m-testing.org): feature rows Built-in display. The tester needs the hardware; no tester run is linked to this change.

Rebased onto integration/aurora 514ae1f (head 1021d1a)

The branch conflicted with the base in two places, both adjacent additions: the new xrgb_is_alpha field in dcp-internal.h sits next to the base's new only_120hz_modes and v27_sleep_* fields, and the .xrgb_is_alpha = true initialiser in apple_dcp_hw_t6050 sits next to .only_120hz_modes = true. I kept both sides in each place. The commit message and author are unchanged. dcp.o and apple_drv.o build on the 13-inch M1 MacBook at this head (gcc 16.1.1, W=1); the only warnings are two kernel-doc ones at dcp.c:715, which this change does not touch. This head was not booted; the measurements above ran on the pre-rebase tree.

The T6050 internal DCP blends the X byte of XRGB8888 as alpha, as the T8142 does on firmware 27 (43f8980). A fill with X=0 shows black and X=0x10 about half. Offer alpha formats only, selected by a hardware flag set for apple,t6050-dcp.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T01:40:48.513131Z e2ebdd7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@joshuaswarren
joshuaswarren marked this pull request as draft November 14, 2026 01:35
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Test result for this PR on a 14-inch M5 Max MacBook Pro (internal panel, Hyprland session).

Problem before the PR (kernel without it, XR24 primary plane): the panel lights only where the pixel has red. Direct DRM fills of XR24 with the X byte at 00 stay dark, even for white. With the X byte at ff they light fully. AR24, AR30 and XR30 with alpha ff light correctly. So the display controller firmware reads the fourth byte of an XRGB8888 pixel as alpha. On a Hyprland desktop that byte is not written as ff: a read of the scanout buffer shows it copies the third byte of the pixel.

With this PR (alpha-only primary plane) and a user-local Aquamarine build that allocates AR24, the panel lights for every colour. The camera is the built-in one. It sees the room, so the numbers are the tint the panel throws on the room: whole-frame mean minus the black frame, R/G/B.

Pattern on screen Camera change
white +26.5 / +24.1 / +24.3
red +17.9 / -0.3 / +0.7
green +2.7 / +23.4 / +7.3
blue +8.7 / +0.9 / +31.6
8 colour bars +16.7 / +15.4 / +15.6

Green and blue with no red light fully. Those were the two dark cases before. The compositor screenshot shows the intended colour for each pattern. A foot terminal at alpha 0.5 over the wallpaper is see-through (screenshot pixel (211,70,116) becomes (107,36,59)).

Not measured: absolute brightness, colour accuracy, XR24 clients (Xorg, fbcon) on this plane. With only alpha formats on the plane, a compositor that insists on XR24 fails: Hyprland with stock Aquamarine aborts in Render::IFramebuffer::alloc on this kernel. Distros need the AR24 swapchain change in the compositor, or a driver blit for XR24.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on 1021d1a
Model: zai/glm-5.3

Rebase verified three-way in both conflicted files. In dcp-internal.h, base-to-head is exactly the PR's two lines (the xrgb_is_alpha comment and field) placed after the base's new fields - the old-head comparison shows every other delta is base content the old head predates. In dcp.c, base-to-head is exactly one line, .xrgb_is_alpha = true, sitting inside apple_dcp_hw_t6050 next to .only_120hz_modes with the base's v27 fields intact above it - both sides kept in each place, commit message and author unchanged. The appended body section matches the trees, including the build scope with the two kernel-doc warnings attributed to a line this change does not touch, and the measurements correctly scoped to the pre-rebase tree with this head not booted.

Model: zai/glm-5.3 (live from lane_models.py this turn).

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] This draft is superseded and should be closed, not merged. It adds .xrgb_is_alpha = true to the T6050 internal primary with no firmware-version gate, which is the exact change that produced the Hyprland stale-frame fault on our K114c test machine: without XRGB8888 on the plane, Hyprland 0.57 allocates AR24 while its monitor format stays XR24, and ensureBufferPresent then presents the frame from two updates back on every commit (buffer read 34 of 34 two-back before the fix, 2987 of 2987 current after). The fix that replaces it is described at #1816 (comment): on 27.3 the panel keeps XRGB8888/XR30/XB24 with the opaque-X property sent as id 0x4f (enableGPAlphaDiv per the 27.3 kernelcache table; 0x49 there is enableSBIM). Older firmware keeps this draft's behavior. No action needed on this PR beyond closing.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Closing as superseded: see the comment above for the replacement fix on PR 1816.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Correction to my close-out comment above (PR closed, leaving this for the record). The "frames two updates late" symptom I described is not what a stock Hyprland does on such a plane: that lag came from our own downstream aquamarine patch (hyprwm/aquamarine#496, closed), which allocates AR24 when XR24 is missing so the desktop can start at all. Hyprland 0.57.2's ensureBufferPresent then assumes buffer format == monitor format and substitutes the next swapchain buffer on every commit. On a stock stack, a primary plane without XRGB8888 means Hyprland fails to start on that output ("GBM: Failed to allocate a GBM buffer: format XR24 isn't supported by primary backend"), not a two-frame lag. What stays valid: keep XRGB8888 on the primary (the 1816 fix does this with X opaque on 27.3), since without it the output either fails or needs a fallback like ours. Sorry for the wrong symptom description.

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.

1 participant