Skip to content

drm/apple: T8140 (J700) internal display support for the Apple DCP driver - #172

Merged
RyanTheTide merged 67 commits into
aurora-wipfrom
j700-dcp-foundation
Oct 8, 2026
Merged

RyanTheTide merged 67 commits into
aurora-wipfrom
j700-dcp-foundation

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

This series extends the existing Apple DRM/DCP driver to the T8140 (MacBook Neo, J700) display coprocessor. It fixes bugs in the existing DCP, RTKit and DART code, adds the H17P firmware interface needed by the internal panel, and adds DT bindings plus disabled T8140 display resources. It extends the existing driver; no parallel driver is introduced.

Status: with a loader that hands over the internal display, this series now brings up the Neo's internal panel in testing: GNOME runs on the 2408×1506 eDP output, and brightness changes work. It is not yet qualified for daily use: lifecycle, suspend and soak testing are still open (see below). Nothing new is switched on by default. Every added T8140 DT node is status = "disabled", and existing M1/M2 behaviour is meant to be unchanged.

What's included (65 commits)

  • DART (iommu/apple-dart):
    • import firmware translations on T8140;
    • defer early publication until locked roots are known;
    • validate later software mappings against inherited slots (address, permission, cache and sub-page coverage);
    • retain inherited translations before the core sets up reservation mappings;
    • keep translated reservations visible to RTKit lookups.
  • RTKit / AFK:
    • map firmware-provided buffers write-combined;
    • recognise an initial crash log in adopted sessions;
    • derive the ring header stride from INITRB, and reject incompatible rings (with KUnit coverage);
    • drop messages for endpoints that have no handler.
  • Framebuffer lifetime and allocation:
    • prepare retirement before the irreversible commit;
    • retain displaced framebuffers until completion is confirmed;
    • keep timeout ownership across component rebind;
    • copy cached scanout geometry into duplicated plane state;
    • unwind failed firmware buffer allocations;
    • on H17P, keep the adopted component and its DMA buffers allocated through system shutdown AND ordinary component/master teardown, since the firmware keeps scanning and has no qualified stop sequence (rebind is refused until reset);
    • retry a rejected brightness present with a bounded retry instead of leaving it pending.
  • Component and piodma:
    • balance adopted-child references across failed and deferred binds;
    • look up display register windows by reg-names, keeping the positional fallback.
  • Mode parser:
    • initialise each parsed mode;
    • roll back a rejected timing entry before moving to the next;
    • read packed dictionary integers without aligned pointers;
    • reject truncated firmware dictionary values;
    • validate firmware timings before creating modes.
  • H17P firmware interface:
    • startup and client open:
      • select the internal T8140 H17P method profile;
      • validate compact receive message lengths;
      • qualify firmware buffer allocation replies, and bound their secondary piodma mappings;
      • answer the measured late-init, integer-query and luma-range startup callbacks;
      • acknowledge bounded unknown callbacks;
    • provider data:
      • transfer the firmware power tables;
      • keep working with existing loaders that predate the new power-table properties;
      • describe the firmware clock aperture used for bandwidth requests;
    • presentation:
      • one serialized queue for command and present transactions;
      • present records serialized at the measured boundary;
      • accepted present IDs required before framebuffer retirement;
      • pin the last completed scanout;
      • preserve unknown background state on replay;
      • register the internal default surface;
      • accept the existing J700 loader's primary-surface selection;
    • pixel formats: ARGB for fbdev, and opaque XRGB through property 0x49, since H17P blends the stored X byte as alpha;
    • analytics: an empty-dictionary reply.
  • Backlight:
    • balance modeset locking and retry atomic contention cleanly;
    • keep scanout in brightness-only commits;
    • an opt-in, present-coupled H17P nits policy covering:
      • no-jump takeover from the loader;
      • soft DPMS (backlight to zero with the pipe kept up, restored on resume);
      • suspend restore;
    • commanded nits encoded without floating point;
    • activation bytes and panel ceilings;
    • one pipe enable before soft DPMS;
    • 8 KUnit cases, a generic native replay checker (tools/testing/apple/check-backlight.py), and documentation in Documentation/gpu/apple-dcp-backlight.rst.
  • DT:
    • bindings for:
      • the DCP and display subsystem;
      • named handoff resources;
      • bandwidth argument tuples;
      • firmware power tables;
      • the legacy J700 surface selection;
      • the apple,dcp-rtkit-quiesced chosen marker;
    • disabled T8140 display power domains, plus internal and external display DARTs.

Testing

  • Builds:
    • Every commit builds the Apple DRM and DART objects with zero warnings.
    • The full head builds Image, the modules and all DTBs with zero warnings.
    • checkpatch.pl --strict reports only the Assisted-by: format warning and the new-file MAINTAINERS reminders.
  • KUnit on arm64 QEMU: AFK ring geometry 1/1, backlight policy 8/8.
  • Native replay:
    • The backlight checker passes 42 captured fragments and 1,020 encoder range cases, plus controlled completion and 20 DPMS cycles.
    • Sanitizer (ASan/UBSan) fixtures cover the DART, parser, power-reply and late-bind paths:
      • translated PA/DVA queries;
      • permission, cache and sub-page mismatches;
      • 1,000 injected late-bind failures;
      • 19 real parser dictionaries, plus 61 mode/notch fixtures and 25 bounds checks.
  • DT: dt_binding_check passes for the touched schemas, and all Apple DTBs compile with every added J700 node disabled.
  • Hardware (J700): a test kernel combining this series with the Neo's non-display base, and the existing loader's DT:
    • firmware startup and client open complete, with one connected mode;
    • GNOME runs on an active eDP-1 primary plane at 2408×1506, 59.98 Hz;
    • brightness 240 → 120 is reached in 12/12 samples;
    • a five-second ARGB dumb-buffer modeset passes;
    • no GPU fault or submit failure during the session.
  • Not yet tested:
    • nobody observed the physical panel; results come from the kernel and compositor;
    • no M1/M2 runtime regression test has been run on this revision.

Still to do

  • Qualification:
    • blend-CRC, framebuffer-lifetime, session, hotplug, DPMS, suspend and console checks against the existing driver's baseline;
    • repeated cold and warm hand-back;
    • ambient-light and brightness-range restoration.
  • Soak: at least 2 h of analytics, plus desktop and game sessions.
  • Lifecycle: suspend/resume, crash recovery, safe teardown, and warm handback.
  • External displays: external display and DP audio on T8140. These can't be tested on this bench yet, because no external sink is attached.

How it was written

All code in this series is newly written for it, following the existing driver's conventions.

🤖 Generated with Claude Code

Adopt the registered piodma child rather than creating a duplicate during
component rebind. Keep its lookup reference until unbind and release it on
every later unsuccessful bind; failed component binds have no unbind call.
A missing IOMMU domain defers bind. One cleanup helper distinguishes an
adopted registration from a child created by this bind and clears stale
child/domain pointers.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The number of display windows differs between DCP instances. Count
the disp-* names and fetch each resource by name so unrelated
registers do not shift the bandwidth window indexes. Retain the
positional lookup for device trees without reg-names.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The DCP writes its RTKit buffers without CPU cache maintenance.
A write-back mapping can read stale crash-log contents after the
firmware has filled the buffer. Use a write-combined mapping for
firmware-provided physical pages.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Map the first crash-buffer request and validate a complete public CLHE
header before decoding it. A fresh session's zeroed buffer remains an
ordinary allocation request. An inherited session has already negotiated
its buffer: mapping failure or an unreadable header must still notify the
client of the crash, with an empty log when necessary.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
AFK rings describe their payload size in the first word. Derive the
three header blocks from the INITRB total instead of assuming 64
bytes per block. Keep the offset and size fields wide enough for
the full wire range, and align queue entries to the derived stride.
Synthetic KUnit cases cover the older and larger ring headers and
malformed layouts (AFK-1).

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Firmware may send on an endpoint that this DCP instance did not
start. Log the endpoint with rate limiting and drop the message
instead of calling AFK through a NULL pointer or WARNing. Refuse
to start the DCP when RTKit is absent (RTK-2).

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
An inactive CRTC update can duplicate plane state without invoking the
plane update hook. Copy its cached rectangles and IOVA along with the
surface descriptor so a later activation presents the same scanout.

DRM's atomic plane helpers can skip updates on inactive CRTCs. Keep the
cached scanout fields consistent with the duplicated framebuffer state.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Allocate and reference displaced scanout during plane preparation, where
allocation failure can still abort the atomic commit. Transfer prepared
entries before disabling or updating CRTCs, including inactive commits.
Cleanup and state destruction release only unconsumed reservations.

Retain transferred references until a successful successor swap completes
or a successful power response confirms scanout stop on existing firmware
variants. Rejected swap starts never arm retirement; rejected, missing or
malformed power responses, timeouts and late replies cannot release live
scanout. H17P stop semantics remain unqualified, so its power replies do
not retire references. Initialize command output to an invalid status and
validate legacy reply lengths before dispatching responses.

Initialize retention ownership once at probe and reject rebind while a
previous session's references remain. This preserves quarantine ownership
instead of losing list links after a timed-out shutdown.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The IOMMU core installs firmware-requested mappings before the
locked stream is attached. Its root pages are not mapped at that
point, so publishing host entries fails with -EIO. Defer that
stream during early TLB sync; attach still requires every root and
publishes the complete page table (DART-2).

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Firmware-owned root slots remain live after Linux attaches. Accept private
host mappings only when every applicable stream agrees on the physical
address, full-page coverage and read/write/cache attributes encoded by the
public APPLE_DART2 format. Apply the same checks to attach-time leaf-table
mirroring and to every later mapping, without replacing occupied roots.

Keep translated reservations intact so the IOMMU core creates software
translations with the correct physical/DVA identity and domain DMA offset,
and preserves its translated-domain requirement. RTKit buffer queries use
that host table rather than an unchecked first-stream firmware fallback.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Describe the existing Asahi display nodes and the T8140 internal
and external DCP compatibles. The piodma child and panel properties
are included, and apple,iomfb-surfaces retains its per-slot enable
meaning. T8140 DCPs must not specify a reset, because resetting
the inherited display CPU can hang the machine (DT-5, DT-6).

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The loader reports whether the DCP core was running at hand-off
using a u32 in /chosen. Document both values and allow the property
to be absent on a chainload. The kernel uses this label to select
its start mode once the H17P path is implemented (DT-5, LIFE-1).

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Describe the H17-generation iop-vbar window independently of the numbered
display windows and include the existing T8142 compatible. Document the
clock names consumed by the driver and the loader's reserved-memory lists.

Permit partial surface-enable arrays: the public driver reads one flag per
slot and accepts up to four entries. This preserves its existing meaning
instead of requiring every device tree to provide all four slots.

The named resources follow the public Apple DRM driver and the Linux-side
J700 hardware-description observation. No reset is added to a device tree.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Select the existing firmware-root import path for locked T8140 DARTs.
The loader leaves occupied firmware translations in place; attach-time
mirroring and later host maps validate full-page addresses and protection
attributes across every applicable stream. Vacant slots remain available
for Linux mappings without overwriting inherited roots.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
A brightness-only atomic commit can acquire more than the CRTC lock.
Handle -EDEADLK by clearing the temporary state, backing off and retrying,
then drop the acquired locks and finalize the acquire context on every
exit. The previous path returned after backoff with the slow lock held
and never finalized the context on success or interruption.

Use the DRM single-lock helper when updating the cached brightness value.
That path acquires only the CRTC mutex and does not need an acquire
context. Release the mutex before starting the atomic brightness update.

This follows the public DRM modeset-lock and atomic-state contracts and
applies to every firmware variant without changing the brightness bytes.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The brightness update creates a CRTC-only atomic state and marks its
colour state changed. The atomic helpers do not add unchanged planes for
this non-modesetting transaction, but the DCP present builder clears all
surfaces and repopulates them only from planes in the atomic state.

Add the CRTC's affected planes before committing so a static-screen
brightness update re-presents the current scanout instead of a request
without surfaces. Use the existing cached plane-state duplication and
framebuffer references. Plane-state allocation and locking errors follow
the same atomic backoff and cleanup path as the CRTC state.

This uses the public DRM atomic-state contract and the existing Asahi
present path for all firmware variants, without changing record layouts.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The Linux-side ADT record R-PMGR-static identifies six physical display
power-state registers and their internal and external parent chains.
Describe them using the existing PMGR power-state binding. The common
fabric parent and DCP power-gate identifiers are virtual ADT devices
without power-state registers, so do not create physical controllers
for those identifiers.

Keep every new domain disabled. The system domains require firmware
notification, whose transition ordering has not yet been qualified.
This preserves the inherited display power state while providing the
resource descriptions needed for subsequent display integration.

Source: Linux ADT /arm-io/pmgr, decoded with public Asahi m1n1.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Describe the internal display, display GRT and DCP translation
controllers from the Linux-exported ADT. Translate their first register
windows through the ADT bus ranges and retain the shared interrupt.
These controllers use the existing T8110 DART register interface.

Only the translation controller windows are needed by the public DART
driver. Do not expose the additional ADT windows as DART registers.
Keep all three nodes disabled while display power transitions and
consumer lifetimes remain unqualified. DMA apertures and consumer
stream assignments will be described with their qualified consumers.

Source: Linux ADT /arm-io/dart-disp0, dart-dispgrt and dart-dcp,
decoded with public Asahi m1n1 (R-ADT).

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
A timing entry can populate its colour modes before being rejected as
virtual. enumerate_modes() then reuses that output slot for the next
entry. Clearing only the original allocation lets a later entry without
ColorModes inherit those colours. Even the first such entry sees zero
scores as valid, rather than reporting that no colour was selected.

Reset the output and score for each timing entry and initialise the
intermediate timing attributes. Initialise every colour entry with
invalid field values so a partial dictionary cannot reuse stack data
from a preceding colour entry. Complete dictionaries keep their existing
colour selection and preferred-mode ranking.

This follows the public TimingElements parser and the DRM-3 requirement
that rejected entries cannot leak fields into subsequent modes. Sixteen
own dictionary fixtures exercise the actual parser, including missing
colour arrays, rejected entries, partial colours and preferred ranking.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The Linux-exported ADT describes separate DART controllers for the
external display engine and coprocessor. Describe their controller
windows and shared interrupt alongside the internal display DARTs,
using the existing T8140/T8110 binding.

Public m1n1 ADTNode.get_reg() translates /arm-io/dart-dispext0 and
/arm-io/dart-dcpext0 through the parent bus ranges. Only the controller
windows are register resources here. Keep both nodes disabled until
consumer, stream and power integration has been qualified.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
enumerate_modes() treats a failure to parse one timing entry as
recoverable, but parse_mode() can return before consuming the rest of
that entry. The next iteration then starts inside the rejected
dictionary instead of at the next mode.

Save the entry's starting position and skip the complete entry after a
parse failure. If even the generic dictionary walker cannot skip it,
return that error instead of continuing from an unknown boundary.

Own public-format dictionary fixtures reproduce the failure with a
wrongly typed timing score or colour ID followed by a valid mode. The
following modes are now retained, including when a valid mode precedes
the rejected one. Complete dictionaries keep the existing parse path.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Dictionary tags are aligned to four bytes, so the following eight-byte
integer need not be naturally aligned. parse_int_bound() already copies
that value into aligned storage, but its source pointer still has an
s64 type. Keep the source as an untyped byte pointer for memcpy().

Own public-format dictionary fixtures place integers at both four- and
eight-byte boundaries. The actual parser now passes the alignment
sanitizer as well as the mode enumeration checks without changing any
wire bytes or integer bounds.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Implement the clean display SPEC BACKLIGHT-1..4 policy in the existing
Asahi backlight path. Keep commanded nits and completed levels separate,
preserve takeover, and cache requests while blanked or suspended.

Internal H17P DPMS keeps the pipe and surface alive. Admit range, takeover
and wire encoding through a narrow interface to the serialized present
queue. No H17P brightness bytes or default nits are inferred. Keep policy
storage at the end of the device and gate template changes at compile time
so older firmware keeps its existing fields and generated code.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Exercise the clean SPEC takeover, cached-level restore and suspend
ordering requirements. Verify that missing surfaces, busy transactions
and rejected or stale completions do not change the completed level or
lose pending requests.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Document the clean SPEC backlight policy, central queue and surface
ownership interface, missing admission records, and hardware gates.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Dictionary skips must validate payload bounds just like parsed values.
Stop at the first error, bound recursive nesting, and propagate invalid
container and skipped-value errors to each caller. Reject length
truncation and cursor overflow, and preserve the audio look-ahead cursor
until a complete key matches.

Handle string allocation failure and failed event strings explicitly.
These checks follow the existing public dictionary format and do not
change valid payloads.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Initialize timing fields as absent and require an active area, total,
porches, vertical refresh rate, timing ID and score. Validate each
dimension before calculating the clock or narrowing geometry to DRM mode
fields. Reject notch underflow, unrepresentable IDs and clocks, and sync
intervals beyond the advertised total.

The existing public dictionary parser supplies all inputs. Invalid
timing entries remain recoverable so a later valid mode can still be
advertised; explicitly zero porches remain valid.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Constrain each bandwidth property to a single provider reference with
its resource index, display register index and, for scratch registers,
byte offset. These are the arguments consumed by the existing public
DCP driver and supplied by the Apple device trees.

Add an example of the existing T8103 internal display resources and
piodma child so the binding checks also exercise the argument tuples.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The Linux-side startup record R-IOMFB-startup-run21 observes A000 with
four zero input bytes. The public template instead sends one, as required
by older firmware. Use zero for H17P while keeping the older variants'
late-init requests unchanged. Keep the existing H17G input as well: the
record admits only the H17P method profile.

This corrects one measured input in the existing Asahi boot chain; it
does not qualify the rest of startup or enable another device.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
H17P dispatch currently trusts the firmware's input and output lengths
before running typed callback handlers. A short record can make a handler
read outside its input or write beyond its reply.

Check the envelope and channel stack bounds before reading the header,
then require a recorded callback tuple before clearing or dispatching its
output. R-IOMFB-startup-run21 supplies the startup and present tuples;
R-ANALYTICS supplies the D114 tuple. Stop the H17P interface on a mismatch
rather than advancing its callback stack or sending subsequent calls.
Older firmware and the existing H17G tuple dispatch stay unchanged.

Tuple admission establishes sizes, not callback semantics or full device
support. H17P callbacks absent from the measured set fail closed until an
interoperability record admits them.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Linux startup capture on the internal display endpoint records seventeen
compact messages. Their header length counts all bytes after the first
eight bytes, and the service channel is carried at offset two. Announce
and report payloads start after the compact 24-byte header.

Check the recorded length against the actual queue-entry size before
normalizing a measured H17P receive header or dispatching its payload.
Keep the existing H17G framing path unchanged. No outgoing compact
message encoding is introduced by this receive-side check.

Captured messages, unaligned buffers, truncated headers and length-bit
mutations exercise the actual validator under address/undefined checks.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Three Linux startup transactions query the PMU Temperature property and
receive the same 64-bit value 3029 with a successful boolean result. This
is the existing Asahi firmware reply value, but the generic handler only
returns it for panels marked as mini-LED. The internal H17P panel also
makes this startup query.

Use the observed reply for the measured H17P property request, validating
the object, bounded property name and zero null/trailing bytes. Bytes
after the name terminator and the input's previous value are ignored.
Stop on unmeasured queries rather than returning an invented zero value.
The H17G profile retains the generic panel-dependent behavior.

The scalar is a firmware interoperability value; its temperature units
and any relationship to a physical sensor have not been established.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Linux startup measurements on T8140 identify the internal display's
H17P IOMFB interface and a live bootloader-owned RTKit session. Falling
back to the generic DCP match cannot select that firmware profile and
would attempt to start the coprocessor instead of adopting its session.

Match the internal T8140 DCP explicitly and reuse the existing H17
live-session adoption with the measured method profile. The match
advertises no external display ports; external DCP qualification remains
separate. The public DT still leaves display resources disabled.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The internal H17P display requests an eight-byte luma-range reply during
client open. Selector zero receives the binary32 encoding of 219.0 and a
zero trailing word. Leaving this measured callback unbound stops startup;
a zero range also cannot provide the firmware's required colour scale.

Provide the recorded reply for selector zero without kernel floating point.
Reject unqualified selectors, and preserve the H17G profile's existing
zero-filled unknown-callback result, including short output envelopes.

The actual dispatcher reproduces the captured reply and rejects selector
mutations without acknowledging them.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The internal H17P default-framebuffer registration uses an ARGB format
word, an opaque layout word and reserved surface handle four. The
existing template sends the older profile's different values. Comparing
the entire registered descriptor against a Linux startup capture exposes
the mismatch before the firmware receives it.

Override those three fields for the measured H17P profile using explicit
byte/unaligned encoding. Preserve the established H17G descriptor and
leave presentation surface construction on its separate path.

The full 560-byte registration request now reproduces the retained Linux
input. Hardware registration and presentation remain separate checks.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
H17P waits for every firmware callback acknowledgment. Stopping on an
unknown callback leaves the outer command outstanding and blocks all
later presentation. Its generic unsupported-callback response is the
zero-filled output area followed by the normal acknowledgment.

Restore that bounded fallback for callbacks without a handler. Validate
the header, tag range, stack depth, channel extent and complete record
length before touching output. Typed handlers still require their known
input/output sizes. Record unknown tags once per device, preserving the
older firmware profiles' established dispatch behavior.

Dispatcher fault injection covers malformed envelopes, output canaries,
missing handlers and the complete measured startup callback set.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
…ofile

The internal T8140 firmware exposes a sixth register aperture at
0x302800000 with size 0xbc000. Its bandwidth callback names the scratch
at offset 0x20000 and request doorbell at offset 0x68000. Using the AP
PMGR window from an older loader tree supplies different addresses and
breaks the display firmware's clock setup.

Describe this firmware aperture in the T8140 hardware profile. Append it
only after the five required display windows, validate both offsets and
use the same resource for the firmware register and bandwidth replies.
This does not map, prime or write the clock window from the AP. Older
profiles retain their DT-provided bandwidth resources and probe checks.

The resource matches the independently retained disp0 ADT register and
Linux register reply. Resource tests cover the two bandwidth addresses,
missing windows, bad offsets and the older DT path.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Linux powerlog observations contain millinits brightness hints before
presentation. Later reports can differ from the first commanded level,
so use the first valid panel-bounded hint and ignore subsequent reports
once the policy is ready. Keep the existing panel maximum and 509-nit
software clamp without inventing a fallback or calibration.

Connect the public report parser to the queued backlight policy. Reject
millinits overflow before narrowing, and keep registration and legacy
brightness submission unavailable until the measured profile has a hint.
Preserve the H17G and older firmware paths. Physical inherited-level
continuity remains a hardware qualification gate.

Add KUnit coverage for conversion bounds, zero hints and protection from
late reports after control registration.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Linux brightness changes and soft DPMS presents use the same activation
bytes and integer binary64 nits field. Encode the complete brightness
block through the existing queued reservation, preserving the panel
ceiling pair on every frame, including idle and pre-takeover frames.
Refuse missing ceilings instead of submitting a zero calibration pair.

An accepted matching completion updates the completed commanded level.
Idle presents leave activation disabled; zero-nit enabled presents blank
the retained scanout and unblank restores the user's target. Keep the
wire ceiling separate from the existing exposed software brightness cap.

Add a native actual-function fixture with captured packet fragments,
full-range enabled/disabled replay, registration and reservation checks,
rejection/coalescing and twenty software DPMS cycles. Document its mocked
transport limits and the remaining integrated hardware qualification.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Internal H17P startup requires one out-of-band power-on request after
client open. The soft-DPMS shortcut currently bypasses that first enable,
although it is appropriate for later brightness-only transitions.

Latch the matching successful enable reply and perform the initial enable
before entering soft DPMS. Later unblank operations restore brightness
without another power or display-device request. A missing or malformed
enable reply stops presentation instead of treating the pipe as ready.

Keep the measured H17P pipe live through off, sleep and shutdown entry
points: surface-free presents and firmware power-down commands can cause
null-base DMA faults or firmware NMI. Stop the software queue on shutdown
and retain scanout ownership without claiming a final hardware stop.
The older firmware profiles keep their established lifecycle paths.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
H17P applies the stored fourth byte as straight alpha even when the
framebuffer uses an X format. A depth-24 fbdev console therefore
produces transparent pixels and appears black.

Request depth 32 from the DMA fbdev helper only for the H17P
internal-panel profile. Older firmware retains its existing XRGB
console.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
H17P blends the stored X byte as alpha. Linux boundary measurements
show that property 0x49 set to zero and the existing premultiplied
surface marker make 8-bit XRGB scanout opaque without changing ARGB
alpha.

Describe the measured A352 request and send it as a priority item on
the serialized H17P queue after the first completed present of each
full power-on. Keep unqualified 10-bit XRGB off the H17P primary plane,
and cover the admitted surface offsets, IOVA tail and property bytes
with KUnit fixtures.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
H17P allocates firmware buffers through the DCP device DMA domain, then
requests the same scatterlist and IOVA in the piodma child domain. The
secondary mapping is read/write. Allocation failures receive an all-zero
reply; rejected maps echo the descriptor with a zero device address; normal
lifetime unmaps the secondary translation before releasing backing pages.

Decode and encode the packed H17P records explicitly in little endian.
Admit the unmap and release envelopes, reject stale and duplicate
descriptors, and roll back short map results. Keep ownership when unmap is
short, and make release remove any live secondary translation before
freeing the scatterlist and coherent allocation.

This bounds descriptor exhaustion, allocation and scatterlist failures,
partial maps and unmaps, duplicate operations, invalid IDs, and release
without an earlier unmap while retaining the existing older-firmware paths.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The working J700 loader predates the display power-table DT properties.
Requiring only those new properties prevents the firmware's default
framebuffer setup before a compatible loader can be installed.

Provide the independently observed J700 table bytes when the internal
T8140 endpoint lacks a property and the machine is specifically J700.
Explicit per-device DT data always wins; malformed present properties
still fail validation. Other boards keep the loader-data requirement.
The byte arrays match both the retained disp0 ADT and firmware replies;
no physical brightness range or power-model interpretation is added.

New loaders can forward all five properties verbatim using the existing
DT interface, removing the need for this compatibility path.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
…etup

A locked display DART already translates the boot firmware regions. When
the core builds temporary read-write mappings for those reservations,
their cache attributes and the firmware's read-only code region differ
from the inherited leaves. Exact mirror validation then rejects the
first default-domain attach with EBUSY.

Snapshot the supported three-level firmware roots during domain setup,
before the core checks translated reservations. Resolve existing firmware
translations when the software table has no entry, requiring unchanged
root ownership and consistent physical addresses across the domain's
streams. The core can then keep the existing mappings without creating
replacement leaves or widening firmware permissions.

Continue to validate host mappings and publish only into vacant root
slots. The lookup borrows mapped firmware tables; it does not install
those tables in the software allocator or free them with its page tables.
Unqualified layouts and conflicting stream translations remain refused.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Cover the backlight documentation and generic display replay tests
under the existing Apple display driver entry so changes reach its
reviewers together with the driver.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The qualified J700 loader passes one zero in apple,iomfb-surfaces to
select firmware surface zero. The per-slot flag parser instead leaves
the bitmap empty, which registers a CRTC without a primary plane and
crashes fbdev initialization. Recognize this exact legacy encoding only
on J700 internal T8140 DCP, and reject empty surface masks before CRTC
creation on every profile. Also check the CRTC allocation before use.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The qualified J700 bootloader uses one zero to select the primary
surface, rather than the per-slot enable flags used by other loaders.
Document that existing compatibility encoding.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide RyanTheTide changed the title drm: apple: T8140 (MacBook Neo) DCP foundation: DART, RTKit, lifetime, backlight and DT groundwork drm/apple: T8140 (J700) internal display support for the Apple DCP driver Oct 8, 2026
Internal H17P keeps its display pipe running when the panel is blanked.
Its shutdown path stops the outbound queue without a firmware-acknowledged
scanout stop. Deleting the component nevertheless releases the binding's
devres group, including RTKit shared buffers, and destroys a host-created
piodma device. The running firmware can still access those resources.

During system shutdown, stop host submissions and backlight work while
keeping the adopted component and its DMA resources allocated until reset.
Keep the existing component teardown for the older firmware profiles.
This does not qualify component removal or a firmware client-close method.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
An adopted H17P session keeps scanning after soft DPMS. Component unbind
and bind-error unwind release the RTKit devres group even though firmware
has not acknowledged a DMA stop. Driver removal can also drop its default
IOMMU-domain usage and release AFK rings and consumer contexts.

Export the existing default-domain usage helpers for module callers. Own
that usage in the DCP driver and retain it, RTKit shared
buffers, AFK rings, PIODMA and the referenced DRM objects until reset once
negotiation with the live firmware starts. Quiesce host callbacks and AFK
work without sending an unqualified firmware stop. Keep their contexts
valid through managed cleanup and unplug the DRM device before teardown.

Pin the DMA device, IOMMU group and module for that firmware lifetime,
reject rebinding
the same firmware node with an explicit reboot-required message, and keep
the existing resource releases for profiles with a normal stop path.
Pre-negotiation probe failures still release their resources.

Add a native regression exercising the actual component/master unbind and
resource-release functions through simulated component and driver devres
cleanup, including partial initialization and legacy release behavior.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
A rejected brightness present cancels its reservation and leaves the
policy dirty, but it receives no successful completion. The queue's
completion-only reschedule condition therefore drops the update on a
static display until another user request or frame arrives.

Track a rejected backlight reservation separately from a completed
present. After its channel drains, schedule up to three deferred retries
at 100, 200 and 400 ms through the existing outbound queue. Preserve the
last accepted surface, leave an exhausted target dirty, reset the budget
on a new user request or successful completion, and cancel delayed work
when the queue stops. Crashed and stopped queues never retry.

Add a native regression that executes the actual failure, queue-advance,
retry-work and completion functions: one rejected present is retried and
accepted without another user request. Check the finite retry budget,
new-target rearming and stopped, crashed and undrained-channel guards.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The new DCP bindings, backlight documentation and native tests belong to
Aurora's T8140 and J700 support. Move their file patterns to that existing
entry so reviews for those files reach their maintainer. Keep the existing
Apple DRM driver source pattern under its current display-driver entry.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Apple DRM can be enabled without DRM_FBDEV_EMULATION. In that
configuration the DMA fbdev helper does not declare its probe function,
but the custom Apple probe still calls it and fails to compile.

Compile the custom probe and select it only when fbdev emulation is
enabled. Otherwise use the DMA helper driver-ops macro, which supplies a
NULL probe. The H17P ARGB console policy is unchanged when enabled.

Fixes: 544eb67 ("drm: apple: use ARGB for H17P fbdev")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Linux measurements show that the H17P blend CRC command takes no input
and returns one little-endian 32-bit value. The existing completion path
instead supplies a constant zero to the DRM CRC interface.

Queue one read for each validated present completion while CRC capture
is enabled. Put it before the next pending present so the sample refers
to the completed frame, and send it only after the callback is acknowledged
and the transport is idle. Use the existing transaction timeout and crash
handling, reject malformed replies, and discard queued reads on shutdown.
Disabling capture suppresses both unsent requests and returned samples.

Older firmware and the H17G method profile retain their current behavior.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit 8b60159 into aurora-wip Oct 8, 2026
RyanTheTide added a commit that referenced this pull request Oct 8, 2026
drm/apple: T8140 (J700) internal display support for the Apple DCP driver

Original contributor commits are preserved. Conflict resolutions retain the audited shared driver APIs and their integrated review fixes.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
RyanTheTide added a commit that referenced this pull request Oct 8, 2026
…re-fini

drm/apple: backlight: pair drm_modeset_acquire_init() with _fini()

Original contributor commits are preserved. Conflict resolutions retain the audited shared driver APIs and their integrated review fixes.

Superseded by #172; no-op integration retains its balancing fix.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide deleted the j700-dcp-foundation branch October 8, 2026 10:22
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