Skip to content

drm/apple: 14.7 primary plane: offer only ARGB8888 - #1970

Closed
knalekar wants to merge 2 commits into
aurora-silicon:mainfrom
knalekar:drm-apple-14-7-argb8888
Closed

knalekar wants to merge 2 commits into
aurora-silicon:mainfrom
knalekar:drm-apple-14-7-argb8888

Conversation

@knalekar

@knalekar knalekar commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

The 14.x firmware blends the X byte of XRGB8888 as straight alpha and ignores the opaque/premultiplied surface flag, so pure green and blue render black whenever a compositor leaves a zero in the X byte, and saturated colours get dimmed by their own red byte (omacom/linux-aurora #308).

Dropping XRGB8888 from dcp_primary_formats_14_7 leaves ARGB8888 as the only 8-bit format on the 14.x panel primary plane. Compositors write a real alpha of 255, which the blend leaves untouched — mutter walks its default GBM format list and lands on ARGB8888 with no userspace changes.

Tested on the built-in panels of a j516s and a j514s: pure green and blue correct, no red-weighted dimming, whites and greys unchanged, dcpext output and 120 Hz presentation unaffected.

Companion PR for the 120 Hz pacing fix (omacom/linux-aurora #31): #1969

@joshuaswarren

Copy link
Copy Markdown
Contributor

[Joshua's agent] Friendly heads-up from a related fault we just measured: on the M5 internal panel, a primary plane without XRGB8888 makes Hyprland 0.57 show frames two updates late. Hyprland asks for XR24; when the plane does not offer it, the compositor allocates AR24 while its monitor format stays XR24, and ensureBufferPresent then swaps in the next swapchain buffer on every commit. Our proof by buffer read: the plane held the frame from two back 34 of 34 times; after offering XRGB with X opaque, current 2987 of 2987. Details: #1816 (comment). If the 14.7 firmware blends X as alpha (per omacom/linux-aurora #308), the safer fix may be an opaque-X property rather than dropping the format, so compositors that request XR24 keep working. Happy to test either shape on our machines if it helps.

@joshuaswarren

Copy link
Copy Markdown
Contributor

[Joshua's agent] Withdrawing my advice above. On reflection it was wrong for this hardware: if the 14.7 firmware blends X as alpha (per omacom/linux-aurora#308 in your description), keeping XRGB8888 on the plane keeps the broken format, not the working one. Dropping it, as this PR does, matches what the firmware actually scans out. For information only: on a stock Hyprland 0.57 stack, a plane without XR24 fails to start on that output ("GBM: Failed to allocate a GBM buffer: format XR24 isn't supported by primary backend", per hyprwm/aquamarine#496) rather than showing stale frames; the "two frames late" symptom I cited came from our own downstream AR24-fallback patch layered on a different driver gap. The design choice here is yours; sorry for the misdirected advice.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 2.

  1. The commit has no Signed-off-by. Add your own Signed-off-by:.
  2. drivers/gpu/drm/apple/apple_drv.c:1784 sets up the fbdev client with XRGB8888, and apple_drm_fbdev_probe() (apple_drv.c:194-203) only switches the console to a 32-bit-depth (alpha) surface for H17P and firmware 27. After this change the 14.x primary plane (plane.c:864) offers no XRGB8888 at all, so the fbdev console on a 14.x DCP asks for a format no plane offers. Either it fails to find a format, or it gets an XRGB console that has the same black-X problem this PR fixes. Do not add a third firmware case there: make the fbdev probe pick the alpha surface whenever the primary plane's format list has no XRGB8888, which also covers the existing two cases. Then show the console on a 14.x panel at boot (no desktop).

HW row: j514s or j516s on this branch, default cmdline: the boot console is visible and the colours are right before the desktop starts; mutter as in the body; one wlroots-based compositor (sway) that asks for XR24 starts or falls back cleanly; 0 AVC / 0 failed units / 0 new kernel errors. Give the kernel build in the row.

Nit: Assisted-by: GLM 5.3 Flash should be in the form Assisted-by: LLM (<Vendor>:GLM 5.3 Flash).

Assisted-by: LLM (Claude:Opus 5.5)

@knalekar
knalekar force-pushed the drm-apple-14-7-argb8888 branch 2 times, most recently from e18873d to 945943b Compare November 21, 2026 20:21
@RyanTheTide

Copy link
Copy Markdown
Contributor

integration/aurora (110861f) still offers XRGB8888 on the 14.x primary plane, and the current head (945943b) applies cleanly to it. The new head adds the Signed-off-by and picks the console's alpha surface from the primary plane's format list, as asked. One thing to check: the old condition also covered every firmware-27 DCP, and the new one does not, so a firmware-27 DCP whose primary plane still lists XRGB8888 gets an XRGB console again; please confirm that is intended or keep that case. Still needed is the row on a j514s or j516s: boot console visible with correct colours before the desktop, mutter, and one compositor that asks for XR24.

Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches. Host tests (tools/asahi/run-host-tests.py --only) on 110861f plus this change: apple-dcp passes (1/1).

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR review on live head 945943b0d8f87c39688749143e8d952e365d7744 (against live integration/aurora 70a00e583b03, not superseded; live CI host-tests green).

Blockers

  1. Correctness regression in apple_drm_fbdev_probe() (drivers/gpu/drm/apple/apple_drv.c:201-215):
    • Dropping dcp->fw_compat == DCP_FIRMWARE_V_27_0 from apple_drm_fbdev_probe() and switching to !apple_primary_supports_xrgb8888(crtc->primary) || dcp->fw_compat == DCP_FIRMWARE_H17P silently regresses fbcon on firmware-27 DCPs whose primary plane still advertises DRM_FORMAT_XRGB8888.
    • On live integration/aurora (70a00e583b03), drivers/gpu/drm/apple/dcp.c:10173-10220 assigns .firmware_compat = DCP_FIRMWARE_V_27_0 to apple,t6050-dcp, apple,t6050-dcpext, and apple,t8142-dcpext, while drivers/gpu/drm/apple/apple_drv.c:1204-1213 only sets xrgb_is_alpha = true for DCP_IOMFB_METHODS_H17G and V_27_0 on apple,t8142-dcp, apple,t6041-dcp, and apple,t6041-dcpext. On t6050-dcp, t6050-dcpext, and t8142-dcpext, apple_primary_supports_xrgb8888() returns true, flipping fbcon back from ARGB8888 to XRGB8888 (black console when firmware 27 blends X=0 as straight alpha).
    • Keep dcp->fw_compat == DCP_FIRMWARE_V_27_0 in apple_drm_fbdev_probe() alongside !apple_primary_supports_xrgb8888(crtc->primary) || dcp->fw_compat == DCP_FIRMWARE_H17P (unless those firmware-27 planes are verified not to need ARGB8888 fbcon).
  2. §4 Attribution (hard blocker): Commit 945943b0d8f87c39688749143e8d952e365d7744 includes two AI trailers inside the git commit message:
    Git commits must carry human author/committer and a human Signed-off-by: only (zero AI trailers in commit messages). Keep AI disclosure in the PR description only.
  3. §5 Evidence on exact head 945943b0d8f8 (blocker): The test note in the PR body predates the apple_drm_fbdev_probe() rework and lacks the regression tuple. Please post an exact-head hardware row (j514s/j516s, default cmdline, kernel build ID) confirming:
    • boot fbdev console is visible with correct colors before the desktop starts,
    • mutter renders pure green/blue cleanly without red-weighted dimming,
    • a wlroots/XR24-requesting compositor (e.g. sway) starts or falls back cleanly,
    • 0 SELinux denials, 0 failed units, 0 new kernel errors.

Verdict

REQUEST_CHANGES — blocked on the DCP_FIRMWARE_V_27_0 fbcon regression, forbidden Assisted-by: git commit trailers (§4), and missing exact-head §5 hardware/regression evidence.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 945943b0d8f8

Blockers:

  1. drivers/gpu/drm/apple/apple_drv.c:201-215: apple_drm_fbdev_probe() drops the fw_compat == DCP_FIRMWARE_V_27_0 case and now keys on !apple_primary_supports_xrgb8888(…) || fw_compat == DCP_FIRMWARE_H17P. A firmware-27 DCP whose primary plane still offers XRGB8888 changes fbcon format, which regresses the console there. Fix: keep the firmware-27 case, or show that every firmware-27 primary keeps the same format.
  2. The commit carries an attribution trailer; drop it (git commit --amend).

Rows before merging: apple_drv.c and plane.c run on every Mac, so besides the J514s/J516s rows it needs one boot at the new head on another generation with colours unchanged.

Checked: thank you. No Apple material, no gates. The J514s/J516s colour result (pure green and blue correct) is clear.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 25, 2026 00:18

Superseded by the review at 945943b

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merge readiness at d5823b43: not ready yet

Check Detail
CI at head ok 3 checks passed
Review no approved by DjDeveloperr, but GitHub does not count it yet (code owner from Core or Omarchy Mac needed, or approval went stale)
Requested changes ok none
Hardware row at head no no line with the head SHA d5823b43, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:display

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

knalekar and others added 2 commits November 24, 2026 21:15
The 14.x firmware blends the X byte of XRGB8888 as straight alpha and
ignores the opaque/premultiplied surface flag, so pure green and blue
render black whenever a compositor leaves a zero in the X byte, and
saturated colours get dimmed by their own red byte (see
omacom/linux-aurora issue 308). Mechanically: the 14.x swap encodes the
surface as 'BGRA' with s[DCP_V14_SURF_OPAQUE] = (format == XRGB8888),
and this firmware blends straight alpha regardless of the opaque flag.

Drop XRGB8888 from dcp_primary_formats_14_7 so the only 8-bit format
offered on the 14.x panel primary plane is ARGB8888. Compositors write
a real alpha of 255, which the blend then leaves untouched. Mutter
walks its default GBM format list and lands on ARGB8888 with no
userspace changes.

The fbdev client still asks for XRGB8888, which no 14.x primary plane
offers any more, so its setup fails with -EINVAL. Select the 32-bit
alpha surface whenever the primary plane's format list has no
XRGB8888, instead of matching firmware versions. H17P keeps an
explicit case: its planes still advertise XRGB8888 for the opaque-X
property, which fbcon does not set.

Tested on the built-in panels of a j516s and a j514s: pure green and
blue correct, no red-weighted dimming, whites and greys unchanged,
dcpext output and 120 Hz presentation unaffected.

Signed-off-by: Krish Nalekar <53238848+knalekar@users.noreply.github.com>
Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
The primary plane can advertise XRGB8888 even when firmware 27 blends
the stored X byte as alpha. fbcon does not set the opaque-X property,
so keep selecting ARGB for its console on this firmware.

Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com>
@DjDeveloperr
DjDeveloperr force-pushed the drm-apple-14-7-argb8888 branch from 945943b to d5823b4 Compare November 25, 2026 02:18
@DjDeveloperr
DjDeveloperr requested a review from a team as a code owner November 25, 2026 02:18
@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Nov 25, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code approved at d5823b43c2c5. The firmware-27 fbcon path explicitly selects ARGB again, including on planes that also advertise XRGB. Both commits are signed. Thanks for preserving the console behavior. Before merge, record the target panel result at this head and the colour check on a second generation.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 26, 2026 01:15

Superseded by the review at d5823b4

@github-actions github-actions Bot removed the changes-requested A reviewer requested changes (bot) label Nov 26, 2026

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict at d5823b43: approve once the row is at this head. The code is fine.

Checked

  • Dropping XRGB8888 from the 14.x primary plane (dcp_primary_formats_14_7) fixes the X-as-alpha blend: green and blue no longer render black when a compositor leaves X = 0.
  • fbdev picks ARGB whenever the primary plane lacks XRGB8888, so the console stays visible.
  • This uses the existing per-firmware format table, so it adds no new gate.

Before merge

  1. A row at this head, d5823b43: the body names J516s and J514s but no SHA.
  2. Legacy XRGB clients. Without XRGB8888 on the primary plane, drmModeAddFB at depth 24 / bpp 32 (XRGB) followed by SetCrtc is refused. That's what plymouth's DRM renderer and X modesetting at the default depth use. Please check that the boot splash (plymouth) still shows on a 14.x J516s/J514s, or say what it falls back to. GNOME and KDE pick ARGB from IN_FORMATS, so the desktop is fine.

@RyanTheTide

Copy link
Copy Markdown
Contributor

@knalekar Merge-train: the code is approved and CI is green. What's left is a row at d5823b43 on a J514s/J516s with DCP 14.7 (your earlier test boards). Please cover the boot console (fbcon visible), GNOME/Mutter colours correct, and one compositor that asks for XRGB8888 first, such as plymouth's splash or a wlroots compositor. Note what it falls back to if XRGB8888 is refused. We don't have a working 14.7 panel in the lab.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train review at d5823b43: Verdict: FINISH, then merge. The code is correct. The fbdev side now picks ARGB whenever the primary plane lacks XRGB8888, which is the right condition, and it only affects 14.7 (T6030) primaries. The concern is userspace: a primary plane without XRGB8888 is unusual. Generic KMS clients often hard-code XRGB8888 for the primary plane: boot splashes (plymouth), simple compositors (weston's drm backend, kmscon), and some X modesetting setups. On a 14.7 Mac they'd fail the modeset instead of showing a wrong colour. Before merge, one J514s/J516s (14.7) row at this head showing: fbcon visible, the GNOME greeter and session (Mutter), plymouth boot splash, and weston --backend=drm (or kmscube) all show correct colours (green and blue patches not black). If any of them can't run ARGB-only, keep XRGB8888 listed and fix the blend another way. No other blocking finding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants