Skip to content

drm/apple: accept ADT panel serials longer than 256 bytes - #3502

Merged
RyanTheTide merged 3 commits into
mainfrom
fix/dcp-fw27-panel-serial
Nov 29, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
fix/dcp-fw27-panel-serial

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What

The K114s (T6050) internal panel publishes an EDID with serial unspecified. The J616s (M4 Pro), our reference, publishes 544655bb, the hash of its ADT panel serial.

Both get the internal panel's identity from the ADT (dcp_panel_read_adt()): /product/raw-panel-serial-number is hashed into the EDID serial. The K114s property is 362 bytes (a string of serials). dcp_adt_panel_property() only took serial properties up to 256 bytes, so the K114s got none. The J616s one is 170 bytes and was already taken.

Accept serial properties up to 1024 bytes. Only the hash is used, so the limit is a sanity bound. Panels whose serial was already read (J616s) keep the same value.

The first commit here (e9bde48, a firmware-metadata merge fill) was based on a wrong reading. On the K114s the EDID comes straight from the ADT identity (connection generation 0, no ProductAttributes replace), so that path never runs. It is reverted in 85b11c7; the net change is the parser bound only.

Tested

Tested: KUnit at a094059 (arm64 QEMU, 344/345, 1 unrelated skip). New parser_adt_long_serial (synthetic 170/362/1024/1025-byte /product serials: nonzero distinct serials up to 1024, ignored above) fails without the dcp-panel-adt.c change (Expected seen[1] != 0U). K114s row at this head follows.

  • Why it failed on the hardware (read-only, 11-28): bridge4 (7.3.0-k114sstack3, carried e9bde48) still published unspecified with using firmware-derived EDID metadata for connection 0 (generation 0 = ADT identity, never replaced). Walking the K114s runtime ADT (/dev/mtd2 "adt") with the parser's rules: /product is at depth 1, raw-panel-serial-number is 362 bytes, identical to the 11-27 dump (stable across boots). J616s runtime ADT: 170 bytes.
  • J616s: unchanged by construction (170 <= 256 was already accepted; 544655bb is that hash).

Risk: one-way · internal panels whose ADT panel serial is 257-1024 bytes (K114s; likely other T6050 K-boards): the EDID gains the ADT-derived serial (an FNV hash, the raw serial is never published). On an existing install the internal panel's identity changes once (serial unspecified -> hash): a new colord device id and a new GNOME monitors.xml key, so saved scale/refresh for the built-in panel resets once after the update. Panels already reporting a serial are unchanged.

Not yet

  • K114s row at this head: EDID serial = 8 hex digits (not unspecified), 0 DCP crashes, panel + brightness as before.

Firmware 27 sends the internal panel's ProductAttributes without a
serial number.  dcp_panel_metadata_replace() took that record as the
whole identity, so the serial hashed from the ADT's
raw-panel-serial-number was dropped. The K114s (T6050) EDID then read
model 0, serial "unspecified".  On desktop 26.6 (J616s) the firmware
reports its own serial, so it never showed there.

Fill a missing serial from the ADT identity when the firmware names the
same manufacturer and product and gives no text serial either.  A
serial the firmware does report still wins.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide requested review from a team as code owners November 28, 2026 08:15

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

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 e9bde48b0789. The code is right; the two hardware rows from "Not yet" are what's left.

Before merge:

  1. K114s row at this head: edid-decode on eDP-1 shows the ADT-hash serial instead of unspecified, 0 DCP crashes, panel + brightness as before. Please record the Stage 2 sha with it.
  2. J616s inert row: serial stays 544655bb (the desktop 26.6 path returns before the ADT fill because the firmware gives a serial).
  3. CI green at this head (all pending at 19:30).

Worth one line in Risk, not blocking: for an existing K114s/T6041 install the internal panel's identity changes once (serial unspecified -> hash). That means a new colord device id and a new GNOME monitors.xml key, so a user's saved scale/refresh for the built-in panel resets once after the update. That's expected and harmless, but users will notice it.

Checked:

  • Match condition on the real machine: ProductID is parsed into a u16 (parse_metadata_number(..., 0, U16_MAX)), and on non-desktop firmware dcp_panel_read_adt() seeds identity.product = 0. The K114s EDID shows Model: 0, so merged.product == id->adt.product (0 == 0) and APP == APP hold there, and the fill runs. A laptop panel whose firmware does send a nonzero ProductID gets no ADT serial, which is the old behaviour.
  • ADT source: dcp-panel-adt.c reads raw-panel-serial-number from /product (machines without /panel) and stores dcp_adt_serial() (a hash, not the raw serial). It is not a hard-coded value.
  • Precedence and stability: a firmware numeric or text serial wins (!merged.serial && !merged.serial_text[0]). After the first fill, old->serial is the ADT hash, so a later serial-less ProductAttributes keeps it through the existing same_serial merge, with no flip-flop and no repeated hotplug. Hotplug is still queued only when the metadata really changes and no raw EDID exists.
  • KUnit reproduced locally (arm64 QEMU, display.kunitconfig + parser bounds, at e9bde48): 210 run, 209 passed, 1 skipped, parser_panel_identity_adt_serial passes. With dcp.c reverted to its parent and the test kept, it fails at parser-test.c:1771 (Expected id->metadata.serial == 0x1234abcdU), so the test covers the fix.
  • No per-board gating, no binding/DT change, no attribution.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Thanks. Per item:

  1. K114s row: K114S-STACK is rebuilding its bridge v2 kernel (main + the open K PRs + this one) for its next K114s one-shot. I read eDP-1's EDID, DCP crash count, backlight and the Stage 2 sha there and post the row here.
  2. J616s: the fill only runs when the merged serial is 0. The J616s EDID on today's fleet89 kernel already carries 544655bb (read-only edid-decode /sys/class/drm/card*-eDP-1/edid, 11-28 19:1x), so whichever source supplies it (firmware SerialNumber, or the ADT identity when no firmware record arrives), the new branch isn't reached. I'll still post a J616s row at this head when a J616s kernel carrying it boots (K114S-STACK's bridge is K114s-only). If you'd accept the above as the inert evidence instead, say so.
  3. CI: queued; I'll watch it.

Risk: added the one-time identity change (colord id / monitors.xml key) as you suggested.

@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) blast:m4 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:one-way Revertible or not, from Merge risk (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) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at a094059f: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at a094059f
Conflicts ok none
PR text ok Risk: one-way · internal panels whose ADT panel serial is 257-1024 bytes (K114s; likely other T6050 K-boards): the EDID gains the ADT-derived serial (an FNV hash, the raw serial is never published). On an existing install the internal panel's identity changes once (serial unspecified -> hash): a new colord device id and a new GNOME monitors.xml key, so saved scale/refresh for the built-in panel resets once after the update. Panels already reporting a serial are unchanged. Not yet - K114s row at this head: EDID serial = 8 hex digits (not unspecified), 0 DCP crashes, panel + brightness as before.

Areas: area:display

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

@github-actions github-actions Bot removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 28, 2026
This reverts commit e9bde48.

On the K114s the panel identity never takes the firmware-metadata merge
this changed: its EDID comes from the ADT identity directly (generation
0, no ProductAttributes replace), so the ADT serial was already the one
used.  The serial was missing because the ADT parser rejected the
property itself; the next commit fixes that.

Signed-off-by: Ryan Murray <[email protected]>
The K114s (T6050) /product raw-panel-serial-number property is 362
bytes, a string of serials.  dcp_adt_panel_property() only took serial
properties up to 256 bytes, so the K114s panel got no serial and its
EDID read serial "unspecified".  The J616s property is 170 bytes and
was already taken.

Accept serial properties up to 1024 bytes.  Only their hash is used, so
the size limit is a sanity bound.  Panels whose serial was already read
keep the same serial.

Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide RyanTheTide changed the title drm/apple: keep the ADT panel serial on firmware 27 drm/apple: accept ADT panel serials longer than 256 bytes Nov 28, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Correction, and a new head (a094059). The K114s row on bridge4 (7.3.0-k114sstack3, carrying e9bde48) FAILED: EDID still unspecified, with using firmware-derived EDID metadata for connection 0, i.e. the ADT identity at generation 0, never replaced by firmware metadata. So the merge fill I added doesn't run on the K114s. The real cause: the K114s /product/raw-panel-serial-number is 362 bytes and the parser only took up to 256 (the J616s one is 170). e9bde48 is reverted (85b11c7). The fix is now just the bound (a094059), with a KUnit case that fails without it. Body and title updated. Item 2 (J616s) is now inert by construction: 170 bytes was already accepted, so 544655bb is that same hash. K114s row at the new head follows. Bridge4 rows for the record: VRR 24-120 / vrr_capable 1 / 0 DCP crashes (that part is #3369's).

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

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 a094059f

Blockers:

  1. Missing exact-head K114s hardware row at a094059f (edid-decode on eDP-1 showing the 8-hex-digit ADT-hash serial instead of unspecified, 0 DCP crashes, panel + brightness unchanged, and Stage 2 SHA).
  2. Wait for queued CI (kunit, apple-build, host-tests, pr-text, KUnit matrix) and pr-readiness to complete green.

Checked:

  • Code is clean and minimal (+56/-1 net after 85b11c70 reverts e9bde48b): raising the serial-property length bound in drivers/gpu/drm/apple/dcp-panel-adt.c:109-115 from 256 to DCP_ADT_SERIAL_MAX (1024) is safe — dcp_adt_serial() streams over size bytes with no fixed buffer and dcp_adt_bytes() already bounds-checks against the ADT size.
  • Panels with <= 256-byte serial properties (e.g. J616s at 170 B) take the identical code path and hash unchanged.
  • parser_adt_long_serial KUnit test (drivers/gpu/drm/apple/parser-test.c:1777-1822) covers 170, 362, 1024 (accepted, nonzero, distinct) and 1025 (ignored = 0) and was shown to fail without the driver change.
  • No per-board/chip gating, no cmdline/module params, no Apple material, no AI attribution, no private serials, human Signed-off-by on all commits, and Risk: documents the one-way colord/monitors.xml identity transition.
Evidence
  • Head: a094059f7ef6 (base: main, mergeable: MERGEABLE, +56/-1 across drivers/gpu/drm/apple/dcp-panel-adt.c and drivers/gpu/drm/apple/parser-test.c).
  • Inspected dcp_adt_serial() and dcp_adt_bytes() in drivers/gpu/drm/apple/dcp-panel-adt.c on main to confirm streaming FNV-1a with no 256-byte stack/buffer assumption.
  • Author reported KUnit 344/345 pass (1 unrelated skip) at a094059f with parser_adt_long_serial failing when the dcp-panel-adt.c change is reverted.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

K114s row at a094059's change: PASS. 2026-11-28 23:47, K114s (T6050), kernel 7.3.0-k114sstack (Ryan's v4) with a one-shot appledrm built from v4 + a094059's dcp-panel-adt.c change. The module also carries two lab knobs for an unrelated SDR measurement; they were at their inert default (-1) for this read. Stage 2 1.0.0b17-ge2a8cf96. eDP-1 EDID serial is now an 8-hex-digit ADT hash (both the numeric serial and the serial descriptor; previously unspecified). Live appledrm build-id matched the test build. 0 DCP has crashed, backlight apple-panel-bl present, 0 failed units. J616s is inert by construction (its 170-byte serial was already accepted; 544655bb unchanged). Our trace: traces/display/20261128-k114s-3502-row/.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Re blocker 1: the K114s row at a094059's change is posted above (2026-11-28 23:47): EDID serial = 8-hex-digit ADT hash on both the numeric serial and the descriptor (was unspecified), 0 DCP crashes, backlight apple-panel-bl present and unchanged, 0 failed units. Stage 2 = K114S-STACK v4 1bbbc2bb (aura 1.0.0b17-ge2a8cf96). Kernel: Ryan's v4 7.3.0-k114sstack with a one-shot appledrm = v4 source + exactly a094059's dcp-panel-adt.c hunk, plus two lab module params left at their inert default -1 (unrelated measurement, not in this PR). Live build-id matched the test module. Blocker 2 (CI) is queued; I'll watch it.

@github-actions github-actions Bot removed the blast:m4 Macs affected, from Merge risk (bot) label Nov 28, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at a094059f. Both blockers in the App's FINISH verdict are met: the K114s row at this change (EDID serial is now the 8-hex-digit ADT hash, 0 DCP crashes) and all 20 hosted checks green. Panels with serials of 256 bytes or less take the unchanged path (the J616s's is 170 B). Merges 1 h from now under the 6-point rule once the App re-approves at this head, unless you object.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: MERGE at a094059f

Blockers: none. Both items from my FINISH verdict are met: the K114s row at this change and green hosted CI (apple-build, host-tests, kunit and pr-text all SUCCESS at a094059f).

Checked:

  • The net diff is the bound only. e9bde48b is reverted by 85b11c70, so dcp.c is unchanged against main. The fix raises the /product raw-panel-serial-number / serial-number limit from 256 to 1024 bytes (DCP_ADT_SERIAL_MAX).
  • Memory safety at the larger bound: dcp_adt_node() validates every property extent in its first pass (dcp_adt_bytes(c, ALIGN(size, 4)) against c->size) before the second pass hands prop + 36 to dcp_adt_panel_property(). So 1024 bytes can't read past the ADT buffer. There is no fixed-size copy: the bytes only go through the FNV hash, and the raw serial is never stored or logged.
  • No hard-coded hardware value: the 1024 bound is a sanity cap. The serial comes from the ADT (/product/raw-panel-serial-number), and the 362/170-byte sizes appear only in a comment.
  • Regression: panels at 256 bytes or less take the identical path with the same hash (J616s 170 B, 544655bb: traces/display/20261128-k114s-3502-row/j616s-fleet89-before.txt). Properties above 1024 bytes are still ignored, as the test asserts. No per-board gating, no DT/binding change.
  • Test: parser_adt_long_serial covers 170/362/1024/1025 bytes, and the author reports it fails without the bound (seen[1] != 0). The 362 B case would be 0 under the old <= 256 check, so the test does discriminate.
  • K114s row (traces/display/20261128-k114s-3502-row/k114s-v4-sdrlab-a094059f.txt): v4 + a one-shot appledrm carrying exactly this hunk (lab params at the inert -1, build-id matched). The EDID serial is the 8-hex-digit ADT hash on both the numeric serial and the descriptor, 0 DCP crashes, backlight 1000/1000, 0 failed units. The before file shows unspecified.
  • Risk line present: the one-time colord / monitors.xml identity change on existing K-board installs.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging under the 6-point rule (Ryan 09:29, permanent), at a094059f. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: K114s-row;<=256B-path-unchanged. (5) There's no blocking review. (6) Dj was pinged here 387 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit 1957bb7 into main Nov 29, 2026
21 of 25 checks passed
@RyanTheTide
RyanTheTide deleted the fix/dcp-fw27-panel-serial branch November 29, 2026 05:00
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) blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:one-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant