Skip to content

drm/apple: control the panel notch at run time - #2814

Open
RyanTheTide wants to merge 6 commits into
mainfrom
notch-dyn/runtime-notch
Open

RyanTheTide wants to merge 6 commits into
mainfrom
notch-dyn/runtime-notch

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown

Problem

On a MacBook with a notch, the driver picked the panel geometry once, at probe. The notch rows were either hidden for the whole boot or shown for the whole boot (boot loader chosen/asahi,show-notch). Changing it needed a reboot. When the notch was shown, the text console drew its top lines under the notch: on a text-only system, or after Ctrl+Alt+F3.

Change

  • Both geometries are modes. Each panel timing is listed as the full panel and as a notch-free twin. The twin is the exact mode the old "hidden" setting produced: the notch rows are folded into vertical sync, with the same clock and totals. The mode a commit uses decides where the frame is scanned out. The twin is placed below the notch and those rows stay black. Switching between the two keeps the panel's timing, so it is a fast switch: no CRTC off/on and no firmware mode set.
  • Runtime control. Panels with notch rows get a new connector property, notch (enum hidden / shown), which a compositor can set atomically. The same switch is available as /sys/class/drm/cardN-eDP-1/notch for scripts. It chooses which geometry compositors are offered, and a change sends a hotplug event so they follow. The default is the boot loader's choice.
  • Console awareness. When no DRM master owns the device (multi-user.target, a switch to a text VT, a compositor that drops master or exits), only the notch-free geometry is offered. The console probes again into it, and its surface is sized to it, so it never draws under the notch. When the compositor takes the display back, it gets its own mode back as a fast switch.
  • M4 (T8132) pipe. This pipe only accepted full-panel frames. It now gets the same two modes, and a notch-free frame is placed with the swap's destination rectangle.
  • Selection by hardware description only. The rows come from apple,notch-height, which the boot loader takes from the ADT. There is no board list and no command-line or module parameter to set. Panels without notch rows (Neo, external displays) are unchanged. The standalone firmware 14.7 / 26.6 pipes build their single mode from the boot framebuffer, so they keep the boot loader's geometry for the boot.
  • A read-only debugfs file, dri/N/eDP-1/notch, reports rows, policy, whether a master owns the device, and the row offset of the last frame.

For compositors

Nothing new is needed. A compositor is offered the geometry the policy asks for, and follows a change through the usual hotplug re-probe. GNOME does this unmodified (rows below). A compositor that wants to decide for itself can set notch in the same atomic commit as the matching mode. Both modes are always accepted in a commit.

Testing

  • Host: the apple-dcp selftests, all groups (at the head: display 23/23, m4 9/9 rerun for c566162), including panel-notch-geometry (production parser + catalogue code on the J615 timing; twin bit-identical to the old hidden mode; offer/offset/ownership/physical-size rules; a mutation of the console rule fails it) and m4-notch-frame (swap destination y 64, height 1600 on the J713 profile). W=1 arm64 clean, checkpatch clean, CI host-tests green.
  • Hardware at 182aedb and c566162 (J615, fleet82-based one-shot, default command line, production Stage 2): toggles both ways, VT3 drops the notch line (2880x1800 at row 64) and the return to GNOME restores 2880x1864, DPMS off/on and a 15 s s2idle in each policy. Across two gdm restarts and two VT3 round trips the console kick and the client hotplug fire 0 times and the console commits exactly as often as on unmodified fleet83. After a runtime toggle that held only with c566162 (before it, 2 extra console commits on every return to GNOME).
  • Hardware at 4d7e97f, fleet81 plus this PR as a one-shot on each Mac, then restored to the default:
    • J615 and J713 (Airs, firmware 27.2): runtime toggle both ways, text VT and text-only boot notch-free, back to full height, a 15 s s2idle in each policy, show-notch Stage 2 boot full height.
    • M2 Air: the same, plus DPMS off/on in each policy.
    • J616s (desktop 26.6, ProMotion): all six timings twinned, toggles, DPMS.
    • M1 Pro: no internal panel attached here, so no-regression only.
    • 0 SELinux denials, 0 failed units, no kernel error lines beyond each production boot's own. Details are in the PR comments.

Still to run

  • DPMS off/on on the J713 at the head (the fleet81 DPMS reset is gone since linux#2857; the row has not been run yet).
  • An M4 board on firmware 26.6.2 for the default notch-free swap path (host test only so far).
  • A visual check on the panel of the whole boot sequence with the boot loader's show-notch default.
  • Text VTs served by kmscon (a userspace console holding DRM master, installed on the J616s) follow the policy like any compositor. Making kmscon pick the notch-free mode is a userspace follow-up.
First-commit hardware rows (0cb64c1, pre-review)

Evidence: traces/display/20261122-notch-dyn/ (lab store). Snapshots record the eDP mode list, sysfs and debugfs notch state, CRTC mode, VT/fbcon, the count of set_digital_out_mode calls this boot, and kernel errors, AVCs and failed units.

J615, kernel 7.3.0-aurora-g15nd1 = J615 default source + this commit (pre-rebase; differs only by the base and two whitespace fixes)

step eDP modes offered CRTC mode scanout_y DRM master fw mode sets
boot, default Stage 2 (hidden) 2880x1800 2880x1800 64 yes 1
echo shown 2880x1864 2880x1864 0 yes 1
chvt 3 2880x1800 2880x1800 (fbcon 360x112) 64 no 1
chvt 2 2880x1864 2880x1864 0 yes 1
echo hidden / shown follows follows 64 / 0 yes 1
VT3: modetest -a -w 49:notch:0, back to GNOME 2880x1800 2880x1800 64 yes 1
boot with show-notch Stage 2 2880x1864 2880x1864 0 yes 1
same, multi-user.target 2880x1800 2880x1800 (fbcon 360x112) 64 no 1

J713, kernel 7.3.0-aurora-f80cnd1+ = J713 default source (fleet80c) + this commit; same steps, 2560x1664 full / 2560x1600 notch-free, fbcon 320x100, 3 firmware mode sets per boot throughout.

Kernel error lines on every test boot are the production boot's own set: Bluetooth codec capabilities and AFK ep20 init props on the J615; AFK ep20, DFB layout, DCPDP13Service admission on the J713.

Design notes for reviewers
  • The catalogue keeps both twins (notch_free marks the twin; twins are appended after the firmware's timings). dcp_nr_timings() keeps the "single fixed timing" decisions (firmware 27 boot-mode inheritance, desktop 26.x fixed panel) counting firmware timings. The panel EDID is built from the timings only.
  • Offer rule (dcp_notch_offer()): the effective geometry only. Effective = policy while a master owns the device, else notch-free. A probe whose height limit is below the panel (the console's fbdev re-probe, bounded by its surface) is also offered the notch-free modes, so the console's stored mode set never loses the panel while a compositor holds full height. The connector's fill_modes records that limit.
  • Fast switch: apple_connector_notch_fastset() clears mode_changed in the connector check, before the colour/EOTF logic below it can ask for a real mode set, only when the CRTC stays on, VRR is unchanged, and the new mode is the twin of the old one and in the catalogue.
  • Console: master_set / master_drop record ownership. On drop, a work item runs drm_client_dev_hotplug() (master_drop holds master_mutex, which the console restore takes). apple_drm_fbdev_probe() sizes the console surface notch-free if its first probe ever ran while a boot splash held master.
  • The notch property lives in a connector state subclass. The sysfs write commits it like a compositor would, and the commit tail updates the policy and schedules the hotplug.
  • The show_notch module parameter is removed (follow-up commit): the boot loader sets the starting policy and the property changes it. Docs: Documentation/gpu/apple-dcp-notch.rst, Documentation/ABI/testing/sysfs-class-drm-apple-notch.

A panel with a camera housing has apple,notch-height rows at its top.
Until now the driver read them once at probe: hidden for the whole boot
unless the boot loader kept them (chosen asahi,show-notch) or a module
parameter said otherwise, with no way to change it without a reboot, and
the text console drew under the notch whenever the notch was shown.

The panel always runs its native timing; what changes is how much of it
is drawn on.  Keep both geometries of each panel timing in the mode
catalogue: the full panel and its notch-free twin, with the notch rows
folded into the vertical sync exactly as the boot-time hidden mode did.
The mode a commit carries decides where the frame is scanned out (the
twin starts below the notch rows, which stay black), and switching
between the twins keeps the panel's mode, so it is no mode set.

Which geometry is offered follows a policy: the boot loader's choice,
then the new "notch" connector property (enum: hidden, shown), which a
compositor sets atomically, or /sys/class/drm/cardN-eDP-1/notch for
scripts.  A change re-probes userspace and the console.  The notch-free
modes are always offered; the full ones only while they are wanted and a
DRM master owns the device.  When no master does (a text-only system, a
VT switch, a compositor that dropped master or exited), the console gets
the notch-free geometry and re-probes into it; its surface is sized to
it, so it never draws under the notch.  A master that comes back gets
its own mode again, as a fast switch.

The M4 (T8132) pipe, which only took full-panel frames, gets the same
two modes: a notch-free frame is placed with the swap's destination
rectangle.  The standalone firmware 14.7/26.6 pipes keep the boot
loader's geometry for the boot.

Nothing is selected by board: the rows come from apple,notch-height,
which the boot loader takes from the ADT, and a panel without them is
unchanged.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@DjDeveloperr DjDeveloperr 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.

Pre-PR Checklist Review (§1–§6) — 0cb64c16fa63f3ffb439c4f1e9689092c9a1d55c

The overall design (twin modes in the catalogue, dcp_notch_offset scanout placement, atomic "notch" property, fastset between twin geometries) is clean and hardware-driven (§1, §3, §4, §6 pass), but there are several concrete blockers in the M4 (DCP_FIRMWARE_M4) path, teardown ordering, formatting, and §5 hardware coverage that need fixing before merge.

Blockers

  1. M4 (DCP_FIRMWARE_M4 / iomfb_is_m4()) rejects notch-free modes in 3 un-updated iomfb.c sites (§2):
    PR #2814 updated dcp_crtc_atomic_check() (dcp.c:2025) to call dcp_notch_mode_known(), but missed three remaining iomfb_is_m4(dcp) mode checks in drivers/gpu/drm/apple/iomfb.c that still require drm_mode_equal(mode, &fixed):

    • dcp_mode_valid() (iomfb.c:3645-3650): drm_helper_probe_single_connector_modes() calls mode_valid() on every mode added by dcp_get_modes() and prunes anything returning MODE_BAD. On an M4 DCP_FIRMWARE_M4 (26.6.2) boot with notch hidden, dcp_get_modes() offers only the notch-free mode and dcp_mode_valid() immediately prunes it, leaving zero modes on the panel.
    • dcp_crtc_atomic_modeset() (iomfb.c:3675-3683): rejects any real modeset to a notch-free mode with -EINVAL.
    • dcp_crtc_mode_fixup() (iomfb.c:3854-3858): rejects any non-fastset modeset (initial enable, DPMS wake, suspend/resume) to a notch-free mode with -EINVAL.

    (This escaped the J713 test because J713 ran firmware 27.2, where iomfb_is_m4() is false.) All three sites should use dcp_notch_mode_known(dcp, ...).

  2. M4 atomic_check vs dcp_flush() dst_y mismatch (§2):

    • iomfb_m4_plane_frame() (iomfb_m4_present.h:37-41) computes dst_y = height < DCP_M4_PANEL_HEIGHT ? DCP_M4_PANEL_HEIGHT - height : 0 without checking dcp->notch_rows, whereas dcp_flush() (iomfb.c:4452-4454) computes dcp_notch_offset(&new->mode, READ_ONCE(dcp->notch_panel_rows), dcp->notch_rows).
    • On M4, dcp->notch_panel_rows is only populated inside dcp_get_modes() (iomfb.c:2810). If a commit runs before dcp_get_modes() (e.g. retained modeset or restoring a cached mode), atomic_check succeeds while dcp_flush() computes dst_y = 0 and fails mid-commit in iomfb_m4_present_at() -> dcp_m4_frame_check() (-EINVAL -> dcp_drm_crtc_error(-EIO)). Populate notch_panel_rows when the M4 panel mode is established (or compute consistently from iomfb_m4_get_mode()).
  3. Teardown UAF / workqueue re-arm race in apple_drm_uninit() (apple_drv.c:2278-2285) (§2):

    • cancel_work_sync(&apple->notch_hotplug) and cancel_work_sync(&apple->notch_console) are placed before drm_dev_unplug(&apple->drm) and drm_atomic_helper_shutdown(&apple->drm).
    • Until drm_dev_unplug() unregisters sysfs and closes off DRM ioctls, notch_store(), an atomic commit, or apple_drm_master_drop() can re-queue either work item after cancel_work_sync() returns, allowing drm_kms_helper_hotplug_event() / drm_client_dev_hotplug() to run after component_unbind_all() / dcp_unlink().
    • Move both cancel_work_sync() calls after drm_dev_unplug() and drm_atomic_helper_shutdown(), and guard notch_store() with drm_dev_enter()/drm_dev_exit().
  4. Accidental deleted newline in drivers/gpu/drm/apple/parser.h:237:

    /* Caller serializes readers against replacement. */int replace_modes(struct dcp_parse_ctx *handle,

    Please restore the newline between the comment and prototype.

  5. §5 Evidence incomplete (acknowledged in PR "Still to run"):

    • Only J615 (pre-rebase, fw 27.2) and J713 (fw 27.2) have been tested so far.
    • Missing hardware verification on: J616s (desktop 26.6), M1 Pro / M2 (older DCP fw), M4 26.6.2 (DCP_FIRMWARE_M4 path, which has blocker #1 above), a non-notch panel regression (e.g. MacBook Neo / external-only display), and the visual boot-logo check with show-notch Stage 2.

Non-blocking / ABI & Correctness Notes

  • Commit message vs dcp_notch_offer(): The commit message says "The notch-free modes are always offered; the full ones only while they are wanted and a DRM master owns the device", but dcp_notch_offer() actually hides notch-free modes whenever effective == DCP_NOTCH_SHOWN && full_fits (only one geometry is offered at a time, as the PR body's Design notes describe). Please align the commit message.
  • Sysfs ABI documentation: The new writable /sys/class/drm/cardN-eDP-1/notch sysfs attribute should be documented under Documentation/ABI/testing/.
  • fbdev initial-probe / master_drop() race: If a boot splash holds DRM master during apple_drm_fbdev_probe(), drm_client_modeset_probe() has already selected the full-panel mode before apple_drm_fbdev_probe() shrinks sizes->surface_height by notch_rows, leaving the cached modeset mode taller than the fbdev surface until the async notch_console work runs; on master_drop(), drm_client_dev_restore() can race ahead of schedule_work(&apple->notch_console).
  • Fastset adjusted_mode: Clearing new_cs->mode_changed = false in apple_connector_notch_fastset() skips mode_fixup() in drm_atomic_helper_check_modeset(), leaving crtc_state->adjusted_mode.vdisplay at the previous geometry (currently harmless since drm/apple uses crtc_state->mode and clock/totals match, but worth copying or noting explicitly).

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Author

Review at 0cb64c1.

  1. The T8132 pipe still treats the notch-free twin as invalid in three places this PR doesn't touch. dcp_mode_valid() returns MODE_BAD unless drm_mode_equal(mode, &fixed) (iomfb.c:3645-3649), so the probe helper drops the 2560x1600 twin that dcp_get_modes() adds. With the default hidden policy, the full mode isn't offered either (iomfb.c get_modes M4 branch), so the eDP connector ends up with no valid mode. dcp_crtc_mode_fixup() (iomfb.c:3853-3857) and dcp_crtc_atomic_modeset() (iomfb.c:3675-3683) also require the full mode, so any real modeset of the twin fails: the first enable, DPMS off/on, and resume (apple_drm_drop_stale_crtcs() resumes that CRTC disabled). Only dcp_crtc_atomic_check() was changed to dcp_notch_mode_known(). All four checks should use it. The J713 row ("fbcon 320x100") can't come from this head. Please re-run it on the PR head.
  2. Default-boot regression on the dynamic pipes: notch_height is now 0 there, so dcp_panel_read_dimensions() / dcp_panel_read_adt() (dcp.c:1246, 1291) report the full height-mm while the default mode is the notch-free one. Before, the hidden boot reported adj-height-mm. The twin needs its own height_mm (adj-height-mm), or the physical size should follow the mode offered.
  3. If notch rows are set but the catalogue has no twins (dcp_notch_free_mode() refuses a timing, or dcp_modes_adopt()), the hidden policy filters out every full mode (iomfb.c:3039). Fall back to offering the full timing when it has no twin.
  4. show_notch (dcp.c:376) is still 0644, but it is only read at bind now, so writing it at run time does nothing. Now that the policy comes from chosen/asahi,show-notch and can be changed at run time, please drop the parameter, or at least make it 0444.
  5. New uAPI: the notch connector property and /sys/class/drm/cardN-eDP-1/notch need a Documentation/ABI entry, plus a note in the DRM driver docs for the property.
  6. parser.h:237: the comment and int replace_modes( got joined on one line (whitespace damage).
  7. Rows at this head: J713 (all steps, plus s2idle resume and DPMS off/on with the notch hidden), J615 s2idle resume with each policy, J616s regression, and the other notched panels on the template path (M1 Pro/Max J314/J316, M2 Air J413, M2/M3 Pro MBP), which reach the new twin catalogue and fast switch.

Follow-up to "drm/apple: control the panel notch at run time":

- M4 (T8132, firmware 26.6.2) pipe: mode_valid(), mode_fixup() and the
  CRTC mode set still required the full panel mode, so the probe pruned
  the notch-free twin (no mode at all with the notch hidden) and a real
  mode set of it failed.  Accept the panel timing in either geometry
  everywhere, and place a frame from the timing the firmware reports
  rather than from a value get_modes() caches.
- Teardown: cancel the notch work items after drm_dev_unplug() and the
  shutdown commit, and run them, the sysfs write and the master-drop
  scheduling only while the device is plugged.
- A full timing that cannot have a twin is offered as it is under either
  policy, instead of being filtered out.
- The physical height reported follows the geometry offered: the
  notch-free modes and the connector take the panel's adj-height-mm, or
  the full height scaled by rows.
- The fast switch leaves the adjusted mode equal to the mode, as
  mode_fixup() would.
- Drop the show_notch module parameter, now only read at bind: the boot
  loader sets the starting choice and the "notch" property changes it.
- Document the property and the sysfs attribute
  (Documentation/gpu/apple-dcp-notch.rst,
  Documentation/ABI/testing/sysfs-class-drm-apple-notch).
- Fix the parser.h line the first commit joined.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Author

Thanks to both reviews. Fixed in 0c29a3e (follow-up commit; the first commit is unchanged):

  1. M4 pipe checks. dcp_mode_valid(), dcp_crtc_mode_fixup() and the M4 branch of dcp_crtc_atomic_modeset() now use dcp_notch_mode_known(), like dcp_crtc_atomic_check(). The twin is no longer pruned, and a real mode set to it (first enable, DPMS, resume) is accepted.
  2. M4 dst_y. dcp_flush() computes the offset from the timing the firmware reports (iomfb_m4_get_mode() plus dcp_notch_twin_of()), the same thing iomfb_m4_plane_frame() checks against. It no longer depends on notch_panel_rows being cached by get_modes().
  3. Teardown. Both cancel_work_sync() calls now run after drm_dev_unplug() and drm_atomic_helper_shutdown(). notch_store() and both work functions run inside drm_dev_enter()/drm_dev_exit(), and master_drop() does not schedule once the device is unplugged.
  4. parser.h line. Restored.
  5. Physical size. The panel's adj-height-mm is always read. Notch-free modes get it (or the full height scaled by rows when the DT has none), and dcp_update_connector_dimensions() reports the height of the geometry currently offered to a compositor. The host j616s-panel-identity case caught a stale adj_height_mm on re-read, which is fixed too.
  6. Timing without a twin. Full modes are marked notch_twin when they get one. A timing without one is offered as it is under either policy.
  7. show_notch. Removed. The boot loader sets the starting choice and the property changes it. apple-drm-parameters.rst now points to the new doc.
  8. Docs. Added Documentation/gpu/apple-dcp-notch.rst (property, console rule, sysfs, debugfs) and Documentation/ABI/testing/sysfs-class-drm-apple-notch.
  9. Fast switch. It now copies mode into adjusted_mode when it clears mode_changed.
  10. Commit text. The follow-up commit message describes the offer rule as it is: one geometry at a time, plus notch-free for a probe bounded by the console surface.

On the earlier J713 row: on fleet80c with firmware 27.2, iomfb_is_m4() is false and the panel runs the template pipe (set_digital_out_mode and timing ids in its log, eDP 2560x1600 hidden by default). The rows exercised that pipe, not the M4 one. No lab Mac runs the M4 26.6.2 pipe at the moment. That pipe is covered by the m4-notch-frame host case and the checks above.

fbdev first-probe race: if a boot splash held master during the console's first probe, the surface is clamped notch-free and the stale full-height mode set is replaced at the next master drop. A restore that runs before that work item fails once (plane larger than the surface) and changes nothing on screen. It does not occur on a normal boot, where the first probe runs before any master.

Host: apple-dcp 94/94 at this head, W=1 clean. Rows at 0c29a3e to follow: J713 (all steps, plus a short s2idle and DPMS off/on with the notch hidden), J615 (s2idle in each policy), J616s regression, M1 Pro and M2.

@DjDeveloperr DjDeveloperr 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.

Pre-PR Checklist Re-Review (§1–§6) — 0c29a3e42b3d526f27219cbd9ca8414ed23b51f0

All three prior kernel blockers from the 0cb64c16 review (and the formatting/uAPI items) are resolved cleanly in 0c29a3e4:

  • M4 (DCP_FIRMWARE_M4 / 26.6.2) mode checks (resolved): dcp_mode_valid(), dcp_crtc_atomic_modeset(), and dcp_crtc_mode_fixup() in drivers/gpu/drm/apple/iomfb.c now all use dcp_notch_mode_known(), matching dcp_crtc_atomic_check().
  • M4 dst_y consistency (resolved): dcp_flush() now uses dcp_m4_notch_y(), deriving the scanout offset directly from iomfb_m4_get_mode() + dcp_notch_twin_of() so it matches iomfb_m4_plane_frame() even before dcp_get_modes() runs.
  • Teardown ordering (resolved): apple_drm_uninit() now cancels notch_hotplug and notch_console after drm_dev_unplug() and drm_atomic_helper_shutdown(), with drm_dev_enter()/drm_dev_exit() guards in notch_store() and both work items, plus !drm_dev_is_unplugged(drm) in apple_drm_notch_owner().
  • Other prior items (resolved): parser.h newline restored; show_notch module parameter dropped (pure default cmdline, §2); adj-height-mm / dcp_notch_free_mm() physical height wired up; notch_twin fallback preserves timings without twins; fastset copies mode to adjusted_mode; ABI & driver docs added (Documentation/ABI/testing/sysfs-class-drm-apple-notch, Documentation/gpu/apple-dcp-notch.rst).
  • §1, §2, §3, §4, §6: Pass (DT/ADT-driven with no model gating, human commits with human Signed-off-by and no AI commit trailers, host-tests CI green).

Remaining Blocker

  1. §5 Hardware evidence at 0c29a3e4 still pending:
    • No hardware runs have been posted for 0c29a3e4 yet (which changed dcp.c, iomfb.c, apple_drv.c, dcp-notch.h, and dropped show_notch).
    • As noted in the follow-up comment and PR body ("Still to run"), please post the 0c29a3e4 hardware rows before merge: J713 (full steps + s2idle + DPMS off/on with notch hidden), J615 (s2idle in each policy), J616s (desktop 26.6 regression), M1 Pro / M2 template-pipe regression, and the visual boot-logo check with show-notch Stage 2 (each with 0 SELinux denials, 0 failed units, 0 new kernel errors).

Non-blocking Notes

  • Teardown hardening (apple_drv.c:2307-2308): Switching cancel_work_sync(&apple->notch_hotplug) / cancel_work_sync(&apple->notch_console) to disable_work_sync() (matching apple_drm_quiesce_connectors()) would close the narrow window where an in-flight apple_drm_master_drop() (which does not hold drm_dev_enter()) or a nonblocking commit tail running apple_commit_notch() after drm_atomic_helper_commit_hw_done() re-queues work after cancel_work_sync().
  • Async dcp_set_dimensions() physical height (dcp.c:1509-1512): dcp_set_dimensions() writes full height_mm directly to connector->display_info.height_mm without applying dcp_notch_free_mm() when READ_ONCE(dcp->notch_free_offered) is true, so an async dimensions_wq run can overwrite the notch-free physical height until the next dcp_get_modes(). Also, caching READ_ONCE(dcp->notch_panel_rows) once in dcp_update_connector_dimensions() avoids reading it twice.

Assisted-by: LLM (Gemini 4 Neon)

- Disable rather than cancel the notch work items at teardown, as the
  connector work items are: a master drop or a commit tail still in
  flight cannot queue them again.
- dcp_set_dimensions() (the asynchronous DisplayAttributes update)
  reports the connector's size through dcp_update_connector_dimensions(),
  so it keeps the notch-free height while that geometry is offered.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Author

Hardware rows at 4d7e97f. Each Mac ran fleet81 plus the three commits of this PR as a one-shot (driver diff identical to the PR), and each was restored to its default afterwards. Counts are 0 SELinux denials, 0 failed units, and no kernel error lines beyond the production boot's own.

Mac default geometry runtime toggle console when no master DPMS off/on 15 s s2idle
J713 (M4 Air, fw 27.2) hidden: 2560x1600 at row 64; with a show-notch Stage 2: 2560x1664 both ways, no firmware mode set VT3 and a multi-user.target boot: 2560x1600 at row 64 see below each policy, geometry kept on resume
M2 Air (template pipe) 2560x1664 (show-notch Stage 2) both ways VT3: 2560x1600 at row 64 each policy, geometry kept each policy, geometry kept
J616s (desktop 26.6, ProMotion) 3456x2234, all 6 timings 3456x2160 at row 74 (6 twins) and back VT3 runs kmscon (see below) each policy, geometry kept not run (below)
M1 Pro this unit has no internal panel connected (no eDP modes on production either) – – – –

Notes:

J615 rows at this head (with s2idle in each policy) follow when the Mac is free. The visual boot-logo check is still open.

@DjDeveloperr DjDeveloperr 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.

Pre-PR Checklist Re-Review (§1–§6) — 4d7e97f68d519724f28f7859940bd0430bde3b42

Verified live at 4d7e97f68d519724f28f7859940bd0430bde3b42 (all 3 commits 0cb64c16 -> 0c29a3e4 -> 4d7e97f6):

  • Delta at 4d7e97f6 (clean):
    • drivers/gpu/drm/apple/apple_drv.c: switched notch_hotplug and notch_console teardown in apple_drm_init() (err_unbind) and apple_drm_uninit() from cancel_work_sync() to disable_work_sync(), closing the re-arm window noted on 0c29a3e4.
    • drivers/gpu/drm/apple/dcp.c: dcp_set_dimensions() now calls dcp_update_connector_dimensions() so asynchronous DisplayAttributes updates preserve the notch-free physical height while that geometry is offered, and dcp_update_connector_dimensions() caches READ_ONCE(dcp->notch_panel_rows) once. (dcp_get_modes() recomputes mode->height_mm via dcp_notch_free_mm() when duplicating notch-free modes, so catalogue mode.height_mm stays consistent.)
    • tools/testing/selftests/drivers/gpu/apple-dcp/edid.py: reordered extracted helper definitions to match the new call from dcp_set_dimensions(); host-tests CI is green (1/1).
  • §5 Hardware evidence at 4d7e97f6 (posted):
    • Hardware runs on fleet81 + all 3 PR commits across three distinct notched Mac generations/pipes — J713 (M4 Air, fw 27.2: hidden/shown default, fast runtime toggle with 0 firmware modesets, VT3 & multi-user.target notch-free console, 15 s s2idle both policies), M2 Air (template pipe: toggle, VT3 console, DPMS off/on & 15 s s2idle both policies), and J616s (M4 Pro, desktop 26.6 ProMotion: 6 timings + 6 notch-free twins at row 74, toggle, DPMS off/on both policies) — all with 0 SELinux denials, 0 failed units, and 0 new kernel error lines.
  • §1, §2, §3, §4, §6: All pass. Pure DT/ADT-driven (apple,notch-height, no model gating), default kernel command line (no show_notch module param), clean human commit history (Signed-off-by: Ryan Murray <ryan@aurorasilicon.org> on all 3 commits, zero AI commit trailers).

Non-blocking Follow-ups

  • Please add the J615 4d7e97f6 s2idle row and the visual boot-logo check when the machine is free.
  • Minor PR body housekeeping: the PR description's Design Notes still mention show_notch being kept (removed in 0c29a3e4) and "Still to run" still lists J616s/M2 (now completed at 4d7e97f6).

Code, CI, and multi-generation §5 evidence at 4d7e97f6 are clean — approved and ready for MERGETRAIN-LINUX4.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown
Author

Merge-train adversarial review (MERGETRAIN-LINUX4) at 4d7e97f: one blocker (below). Merges clean on integration/aurora 000ab96.

Blocker: apple_drm_master_drop() schedules notch_console unconditionally on every notched panel (apple_drv.c:300-302), and that work calls drm_client_dev_hotplug() (apple_drv.c:324). With no master at that moment the fbdev helper re-probes and commits its own framebuffer, which a DROP_MASTER never did before (only lastclose or a switch to a text VT). Any handoff where one master drops and the next takes over a moment later (boot splash -> display manager, greeter -> session, user switching) can now flash the console, and on multi-timing panels may add mode sets. The console already gets the notch-free geometry whenever it probes with no master, so the unconditional kick is only needed for the case where a splash held master during the console's first probe; a one-shot flag set when the clamp fires would cover that. No row covers a graphical handoff yet.

Full review

VERDICT: BLOCKERS

Blockers

  1. Every DRM-master drop now makes the fbdev console take the display, on every notched Mac, whatever the policy.
    apple_drm_master_drop() -> apple_drm_notch_owner(drm, false) schedules notch_console without any condition (apple_drv.c:300-302). The work calls drm_client_dev_hotplug() (apple_drv.c:324). That reaches drm_fbdev_client_hotplug() -> drm_fb_helper_hotplug_event(). With no master at that moment, drm_master_internal_acquire() succeeds, so it probes and then calls drm_fb_helper_set_par(). That runs __drm_fb_helper_restore_fbdev_mode_unlocked(force=false) -> drm_client_modeset_commit(), which commits the fbdev framebuffer to the CRTC (drm_fb_helper.c drm_fb_helper_hotplug_event/drm_fb_helper_set_par; drm_drop_master() calls master_drop before it clears dev->master, drm_auth.c).
    Before this PR a DROP_MASTER never restored fbdev. Only lastclose or a KD_TEXT VT switch did.
    • Failure scenario: a boot splash or display manager hands over by dropping master while it keeps its fd, and the next compositor takes master some time later. Examples are plymouth deactivate followed by GDM/mutter starting (I did not check plymouth's source for this), or logind deactivating one graphical session before it activates the next (greeter -> user session, fast user switching). In that gap the work flips the fbdev buffer onto the panel. Under fbcon deferred takeover that buffer is black. On a verbose boot it is console text. This breaks the flicker-free handoff.
    • On a panel with several timings (J616s has 6, ProMotion M1/M2 Pro/Max), the console's timing can differ from the compositor's. Then the handoff becomes a real firmware mode set to the console's timing and another one back. That is an inference: I did not check which timing fbdev picks there.
    • This happens even with policy hidden, where the master already ran the notch-free mode. The owner loop sets notch = true for any notched dynamic pipe (apple_drv.c:295-299).
    • The re-probe is also not needed in steady state. fbdev only re-probes with no master (drm_fb_helper_hotplug_event requires drm_master_internal_acquire), so notch_owned is already false and the probe gets the notch-free twins. Its surface is clamped notch-free in apple_drm_fbdev_probe() (apple_drv.c:256-270), so full_fits is false too.
    • The only case the work covers is the first probe running in __drm_fb_helper_initial_config_and_unlock() while a splash holds master. Handle that one case with a one-shot flag set in apple_drm_fbdev_probe() when it had to clamp the surface. Do not schedule a console commit on every master drop.
    • The rows don't cover this. They are VT3 and multi-user.target, both text, and the "visual boot-logo check" is still open per the 18:33Z comment. There is no greeter -> session, splash -> DM or user-switch row.

Nits / non-blocking issues

  1. A fast switch leaves the planes out of the commit (apple_drv.c:1242-1262).

    • When the connector is in the commit from the start, the first connector loop of drm_atomic_helper_check_modeset() clears mode_changed before the "needs modeset" loop. So drm_atomic_add_affected_planes() never runs and planes the client did not include are neither re-clipped against the new vdisplay nor re-sent.
    • The template flush only swaps planes in the state (iomfb_template.c:4491-4520), so an overlay plane the compositor did not touch keeps its old dst y. After full -> notch-free it sits 64/74 rows off the shifted primary until it is next updated. An overlay near the bottom also stays unclipped against the shorter mode.
    • A MODE_ID-only commit (no plane) takes the !has_surface && !planes_changed path (iomfb_template.c:4563-4567). It only fires vblank, so the old frame stays at the old offset.
    • The fbcon path (drm_client_modeset_commit_atomic adds every plane) and mutter/wlroots primary-only use are fine. Fix: call drm_atomic_add_affected_planes(state, new->crtc) in the fast switch.
  2. master_set() does not re-probe (apple_drv.c:305-309). A client that probed with no master (it gets only the notch-free modes) and became master later gets nothing that makes it re-probe. With policy shown it keeps the notch-free list until some other hotplug. The comment's "at its next probe" relies on the compositor re-probing on session activation, which not every compositor does. Scheduling notch_hotplug on set when the effective geometry changes would cost little.

  3. dcp_notch_offset() decides "notch-free" from vdisplay == panel_rows - rows (dcp-notch.h:80-85, used in iomfb_template.c:4516). A real panel timing whose height happens to equal that, or a catalogue where notch_panel_rows is the maximum over timings of different heights, would be shifted wrongly. Using the catalogue's notch_free flag (lookup_mode() already finds the entry) would be exact.

  4. uAPI.

    • notch is a driver-private enum connector property, and the mode list depends on device-wide master state, not on the caller. Upstream DRM would want an open userspace consumer and kms property docs. Acceptable for the fork, but it is new uAPI to keep stable.
    • The sysfs file is a second writer. It is 0644 (root only), but it commits from the kernel behind an active master's back (apple_drv.c:1081-1108, 1127-1147). A blocking commit that includes the CRTC can make the compositor's concurrent nonblocking flip return -EBUSY.
    • device_create_file() in late_register (apple_drv.c:1156) adds the attribute after the KOBJ_ADD uevent, so udev can miss it.
    • The EDID published for the panel lists only the full-height timing, as the preferred one, while hidden offers 2560x1600. The kernel mode list is what counts, but tools that read the EDID see the other geometry.
  5. M4 get_modes: effective/full_fits are read in if (free.vdisplay < fixed.vdisplay && full_fits && effective == ...) (iomfb.c:2844). On the no-twin path they are never assigned, and only the short-circuit protects them. Initialise them.

  6. Fleet cmdline: appledrm.show_notch is gone. That matches the boot loader deciding the default (chosen/asahi,show-notch). Any one-shot entry or kit that still carries it now gets an "unknown parameter" line, and the notch hidden unless Stage 2 sets asahi,show-notch.

  7. Commit hygiene. All three commits are by Ryan Murray with only Signed-off-by: Ryan Murray <ryan@aurorasilicon.org> and no agent trailers (OK). The series is fix-ups on top:

    • 0cb64c1 alone leaves the M4 26.6.2 panel with no mode when the notch is hidden (the reviews' item 1) and joins two lines in parser.h.
    • 0cb64c1 keeps a 0644 show_notch parameter that does nothing.
    • Its message says "the notch-free modes are always offered", which is false.

    A bisect that lands on 0cb64c1 hits the M4 breakage. Squash the three before merge. The PR body is also stale (show_notch "kept", "Still to run" lists finished rows).

  8. Binding rules: OK.

    • No new module parameter, __setup or compatible check. apple-drm-parameters.rst now only points to the new doc.
    • The one new gate is dcp_notch_dynamic() (dcp-internal.h:1218, fw_compat != 14.7/26.6 standalone). It is structural: those pipes build one mode from the boot framebuffer. The other pipe test is the existing iomfb_is_m4().
    • The rows come from DT apple,notch-height, and the default from chosen/asahi,show-notch.
    • No Apple class or method names in the added lines. The selftest keys (HorizontalAttributes, FrontPorch, …) are the existing parser fixture's, and the J615 timing is from our own boot log.
  9. Checked and fine:

    • Template scanout offset: it goes in the same swap as the frame (iomfb_template.c:4516-4520), so a fast switch that carries its plane does not tear.
    • M4 offset: dcp_flush uses dcp_m4_notch_y() (iomfb.c:3580-3586), which matches iomfb_m4_plane_frame() (iomfb_m4_present.h:37-41).
    • Teardown: disable_work_sync() runs after drm_dev_unplug() and the shutdown commit (apple_drv.c:2299-2304), and on the init error path.
    • Mode checks agree: mode_valid, mode_fixup, atomic_check and atomic_modeset all use dcp_notch_mode_known().
    • Twins share timing/colour ids, so the desktop 26.6 takeover trial and H17P's "preferred only" filter still admit them.
    • Other properties: atomic_get/set_property returning -EINVAL for other properties is harmless, because the one other private property (PQ_REFERENCE_LUMINANCE) is immutable.
    • The Neo or any panel without apple,notch-height is inert: no property or sysfs, no twins, offset 0, no owner toggling.
    • External displays get no twins (fixed_connector_type == eDP gate, iomfb.c:2535).

Missing rows

  • M4 26.6.2 pipe (DCP_FIRMWARE_M4). This is a default-path change with no hardware evidence. Before the PR this pipe always showed the full 1664 frame (get_modes offered only the fixed mode). Now a default boot (no show-notch) sends a 1600-row frame with dst y=64 in the new swap field +0x110 (dcp-m4-frame.h:258). The only coverage is the host case m4-notch-frame, and the author says no lab Mac runs this pipe. If the firmware ignores or refuses that field, the default console lands under the notch or the CRTC errors out (-EIO). This needs a row before it is the default.
  • Graphical handoffs on a notched Mac (blocker 1): splash -> display manager, greeter -> session, user switch. Check visually for a black or console flash, and for extra mode sets in the log. The visual boot-logo check is still open.
  • J615 at 4d7e97f (s2idle in each policy): promised, not posted.
  • J713 DPMS off/on with the notch hidden: not shown at this head. The base resets on DPMS.
  • J616s s2idle: not run.
  • Template pipes on older firmware: M1 Pro/Max (J314/J316) and M2 Pro/Max (J414/J416) notched panels have no row. The lab M1 Pro has no panel, so the M1 Pro "row" is empty. The M2 Air is the only template row besides J713/J616s.
  • M3 Pro/Max (14.7 standalone) and the 26.6 standalone pipe: no regression row. The code is meant to change nothing there apart from dropping show_notch.
  • Neo (no notch): no regression row. By inspection the feature is inert there.
  • No KUnit run is reported. The parser-test cases that touch dcp_panel_read_dimensions()/dcp_get_modes() still read as consistent, but were not run. Only the host python suite (94/94) and W=1 are claimed.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Author

J615 (M3 Air 15", firmware 27.2) at 4d7e97f, fleet81 plus this PR as a one-shot:

  • Default Stage 2 (notch hidden): GNOME at 2880x1800, row 64. shown gives 2880x1864 at row 0. VT3 gives the console 2880x1800 at row 64 with no master. Back to GNOME restores 2880x1864. Toggled both ways twice.
  • A 15 s s2idle (apple-pmu-rtc) in each policy resumes in the same geometry: 2880x1800/64 hidden, 2880x1864/0 shown.
  • With a show-notch Stage 2 one-shot, GNOME boots at 2880x1864 and VT3 is notch-free.
  • 0 SELinux denials, 0 failed units. Kernel error lines are the production boot's set (AFK ep20 init props, Bluetooth codec capabilities, the latter repeated after each resume as on production).

All the requested rows are now done except two. DPMS on the J713 is blocked by the reset the unmodified fleet81 kernel shows there. The visual check of the boot sequence on the panel is still open.

…stale

apple_drm_master_drop() scheduled a console hotplug on every master
drop on a notched panel.  With no master at that moment the fbdev
client re-probes and commits its framebuffer, so every handoff gap
(boot splash to display manager, greeter to session, user switch)
could flash the console, which a DROP_MASTER never did before.

Every console probe after the first is bounded by its notch-free
surface and picks the notch-free modes whoever owns the device.  Only
a first probe under a master that was offered the full panel (a boot
splash with the notch shown) leaves the console with full modes; the
surface clamp in apple_drm_fbdev_probe() marks that case, and only
the first master drop after it now asks the console to re-probe.

The fast switch between the two notch geometries clears mode_changed
in the connector check, before the core adds the CRTC's planes to a
mode set.  The swap that moves the frame by the notch rows needs them:
add the planes there.

The apple-dcp host case panel-notch-console runs the production
fbdev probe and master hooks through repeated handoffs, a stale first
probe, an unplugged device, a fixed-geometry pipe and a panel without
notch rows.  With the old unconditional kick it fails.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@DjDeveloperr DjDeveloperr 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.

Formal §1–§6 pre-PR checklist re-review at 182aedbd8b20a971267876cc27403b4ff510e718 (following the new commit on top of previously approved 4d7e97f68d51).

Delta Audit (182aedbd8b20)

  1. One-shot console re-probe gate (drivers/gpu/drm/apple/apple_drv.c:89, 275, 311-313) — Clean:
    Resolves the MERGETRAIN-LINUX4 master-drop fbdev flash blocker. apple_drm_fbdev_probe() marks notch_console_stale = true (WRITE_ONCE) only when clamping a full-height initial console probe, and apple_drm_notch_owner() atomically consumes it via xchg(&to_apple_drm(drm)->notch_console_stale, false) (8-bit xchg is supported on arm64, which CONFIG_DRM_APPLE depends on) on !owned while plugged. Subsequent master handoffs (greeter → session, user switch) no longer kick drm_client_dev_hotplug() or flash fbcon; if a second master races ahead of the scheduled work, drm_fb_helper_hotplug_event() sets delayed_hotplug = true so the re-probe is not lost. Teardown remains protected by disable_work_sync() after drm_dev_unplug().
  2. Fastset plane inclusion (drivers/gpu/drm/apple/apple_drv.c:1253-1292) — Clean:
    apple_connector_notch_fastset() now returns drm_atomic_add_affected_planes(state, new->crtc) and apple_connector_atomic_check() propagates errors (-EDEADLK/-ENOMEM). Verified against iomfb_template.c:4491-4568: untouched overlay planes and MODE_ID-only commits now enter the plane check/swap loop so all active planes are re-clipped against the new vdisplay and receive the updated notch_y offset in the same swap.
  3. Host test (tools/testing/selftests/drivers/gpu/apple-dcp/display.py, run.py) — Clean:
    New panel-notch-console case exercises the production apple_drv.c probe/master hooks across repeated handoffs, stale initial probe, unplugged teardown, fixed-geometry pipes, and non-notched panels; host-tests CI is 1/1 green at 182aedbd8b20.

Checklist Summary

  • §1 No model gating: Pass (DT/ADT-driven apple,notch-height, no board/SoC gates).
  • §2 Production-ready, no hacks: Pass (0 code blockers).
  • §3 Safety: Pass.
  • §4 Clean-room & attribution: Pass (all 4 commits carry human author/committer and human Signed-off-by: Ryan Murray <ryan@aurorasilicon.org> only, zero AI trailers in commits; PR body disclosure present).
  • §5 Evidence: Waiting on 182aedbd8b20 hardware re-verification.
    • Prior multi-generation hardware rows (J713, M2 Air, J616s, J615) were run at 4d7e97f68d51 prior to the apple_drv.c changes in 182aedbd8b20. Please post a quick hardware verification at 182aedbd8b20 on a notched Mac confirming runtime fastset toggle + VT switch / graphical handoff (greeter → session or VT back/forth, 0 console flash, 0 SELinux denials, 0 failed units, 0 new kernel errors).
    • Also still noted as open under "Still to run": visual boot-logo check with show-notch Stage 2, and M4 26.6.2 (DCP_FIRMWARE_M4) hardware verification for the default notch-free dst_y swap path (currently host-test only).
  • §6 Naming: Pass.

Non-blocking Note

  • Consider squashing the 4 fixup commits before merge so intermediate bisect points (specifically 0cb64c16) do not expose the pre-fix M4 mode-check bug or joined parser.h line.

Zero code or policy blockers remain; posting COMMENT pending §5 hardware confirmation at 182aedbd8b20 before MERGETRAIN-LINUX4.

Assisted-by: LLM (Gemini 4 Neon)

The console's fbdev keeps the physical size of its screen info from its
first probe, which offers it the notch-free geometry.  After a runtime
"notch" change, its next probe is bounded by its notch-free surface and
offered only notch-free modes, but get_modes() then left the physical
height a compositor had last been given: the full panel's.  The fbdev
helper copies that height into every var it checks, so each VT's saved
var no longer matched and every console switch or unblank, including the
one on the way back to a compositor's VT, did a forced restore commit.
On a J615 after one hidden/shown cycle, a VT round trip made 9 + 2
console commits instead of 3 + 0.

Report the notch-free height whenever the probe offers only the
notch-free geometry: the policy hides the notch, or the probe cannot take
the full panel.  This is the rule dcp_notch_offer() already applies to
the modes themselves.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

RyanTheTide commented Nov 23, 2026 •

Copy link
Copy Markdown
Author

Hardware rows at 182aedb, one new commit (c566162) for a problem these rows found, and the same rows with it. Re-review requested at the head.

J615 (M3 Air 15", firmware 27.2), 182aedb. A one-shot of fleet82 + integration (including linux#2857) + this PR, on the default command line and production Stage 2 (show-notch on), restored to the fleet83 default afterwards:

  • Toggles both ways. VT3 drops the notch line (no master, 2880x1800 scanned out at row 64). Back to GNOME restores 2880x1864 at row 0, twice.
  • DPMS off/on and a 15 s RTC s2idle, each with the notch hidden and shown: geometry kept, 0 SELinux denials, 0 failed units, no kernel error lines beyond the production set.
  • Graphical handoffs (two gdm restarts, greeter to autologin session, plus two VT3 round trips) with kprobes on apple_drm_notch_console, drm_client_dev_hotplug and drm_client_modeset_commit_locked. The console kick and the client hotplug fired 0 times. The fbdev commits matched unmodified fleet83 exactly, measured the same way on the same Mac: 1/1/3/3 on the first pass after boot, 5/5/3/3 on the second, 0 on each return to GNOME.

What the rows found. After a runtime toggle the counts doubled: 11 per gdm restart, 7 to 9 per VT3 entry, and 2 on every return to GNOME where fleet83 has 0. A kprobe on fb_set_var showed why. The fbdev info->var.height was 211 mm (the full panel) while each VT's saved var held 204 mm (notch-free). After the toggle the console's re-probe is bounded by its 1800-row surface, so full_fits is false. get_modes() then kept the physical height the compositor had last been offered. drm_fb_helper_check_var() copies info->var.height into every var it checks, so the memcmp in fb_set_var() never matched again, and every fbcon switch or unblank did a forced restore commit, including in the gap before the compositor takes master back.

c566162 drm/apple: notch: report the notch-free size to a bounded probe. The physical height now follows what this probe offers: notch-free when the policy hides the notch or the probe cannot take the full panel. That is the rule dcp_notch_offer() already applies to the modes. It is one helper, dcp_notch_free_only(), used by both get_modes paths (M4 and the catalogue). Unbounded probes (compositors) are unchanged. No gate and no parameter.

  • Host: apple-dcp display 23/23 and m4 9/9. panel-notch-geometry now checks that the helper agrees with dcp_notch_offer() for every policy/fit pair, and putting the old rule back fails it. checkpatch and W=1 on iomfb.o are clean.
  • J615 with c566162 (the same one-shot with the rebuilt drivers/gpu/drm/apple modules), after the full toggle sequence: handoffs 4/5/3/3 with 0 on return to GNOME (= fleet83), fbdev var height 204 = VT var 204, DPMS + s2idle hidden/shown pass, 0 denials, 0 failed units.

Still open, as in the body: the J713 DPMS row at the head, and an M4 26.6.2 board for the default notch-free swap path. On squashing: no force push here, so a squash merge would keep 0cb64c16 out of bisect.

Evidence and method
  • Lab store traces/display/20261123-notch-dyn2/ (README, j615-7.3.0-aurora-f82nd4/ at 182aedb including the fleet83 baseline B0/B1-fleet83-handoff.txt, j615-7.3.0-aurora-f82nd4-mm/ with c566162). Our own measurements, not tainted.
  • Handoff script: kprobes plus stack traces, trace markers per step, counts from kprobe_profile. fb var probe: p fb_set_var ih=info->var.height h=var->height iy=info->var.yres y=var->yres across chvt 3 / chvt 2.
  • The c566162 row ran the rebuilt module set on the same f82nd4 Image. This was a development A/B only: module BTF was dropped because the modules rebuild relinked vmlinux, and the modules were re-signed with the tree key. The fleet cut carries the commit as source.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Author

Hold: please don't merge yet. The J713 row at the head found a reset that this PR introduces.

J713 (M4 Air, firmware 27.2), the same fleet82-based one-shot without an external display: after a runtime hidden -> shown switch under GNOME, the next DPMS off/on resets the Mac at the power-on commit (4 of 4 tries, at 182aedb and with c566162). Everything else on that Mac passes:

  • DPMS off/on on a fresh boot with the notch shown: 3/3.
  • DPMS with hidden after a shown -> hidden switch: 3/3.
  • A 15 s s2idle in each policy.
  • The handoff rows, which match the J615's.

Unmodified fleet81 on the same Mac passes s2idle followed by DPMS 3/3. Network console plus runtime drm debug show the switch committed as a 2560x1664 mode change, then the CRTC disabled on DPMS off, then the reset during the enable with nothing logged after it. I'm root-causing this in the M4/fw-27 enable path and will push a fix with J713 rows.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Author

Update on the J713 hold. It is timing-dependent:

  • A DPMS off/on within about 12 s of a hidden -> shown switch resets the J713. That held in 6 tries across two kernels: 182aedb's own modules and c566162. It also resets when the panel was never powered on in the notch-free geometry (boot shown -> hidden -> shown -> DPMS).
  • The same DPMS about 60 s after the switch passes 2/2.
  • A 15 s s2idle right after the switch passes, and DPMS after that passes 2/2.
  • Switching shown -> hidden followed by DPMS passes. So does everything without a switch.

On this Mac DPMS off stops the DCP firmware and DPMS on is a warm restart; that is not the case on the J615, M2 or J616s, which all pass. The firmware's power-off sequence is the same in a passing run and a resetting one. An offline review found nothing on the Linux restart path that reads the notch state.

So the cause is something left pending for some seconds after the notch-free -> full switch, which a firmware stop interrupts. It is not root-caused yet. I'm keeping the hold: the fix has to remove the window, not wait it out, and a VT visit followed by a quick DPMS hits it too. The J615 result and c566162 above are unaffected.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Author

HOLD root-caused: the J713 reset is not in this PR's code. Fix: #2962

  • Cause. On the J713 (firmware 27.2), DPMS off stops the DCP firmware and lowers the display power domains. The display DART that maps the framebuffers goes off with them. It was only marked dark (memory-only unmaps) when the firmware's D572 reported 0, and this firmware reports 1. A framebuffer freed while the display was off therefore made the DART driver write TLB registers in a powered-down domain, and the SoC reset.
  • Why this PR showed it. After a hidden->shown switch, Mutter frees the old geometry's buffers a few seconds later. A DPMS cycle in that window, or a switch while the display is off, hit the bug every time. Any framebuffer free during DPMS off on the J713 does the same.
  • Evidence.
    • With gnome-shell stopped, the kernel side of the switch (commit, hotplug, fbdev re-probe) survives.
    • The reset follows gnome-shell's MODE_CLOSEFB / DESTROY_DUMB.
    • A kprobe shows the D572 value at every DPMS off.
  • Rows. J713, fleet85 + this PR (c566162 content) + drm/apple: dcp: keep the display DART dark while DPMS has its domains off #2962:

Merge order: #2962 first, then this PR. Its code is unchanged; head stays c566162. J615 / J616s rows with both are next.

@RyanTheTide

Copy link
Copy Markdown
Author

Rows for this PR's head (c566162 content) + #2962, fleet85 kernel, dev appledrm one-shot on each Mac, default cmdline (no notch arg):

Mac Rows (hidden->shown + DPMS 3 s later; shown while DPMS-off; hidden->shown->hidden + DPMS; shown->hidden + DPMS) Result
J713 (M4 Air, fw 27.2) 11 rows over two boots 11/11 pass (9/9 reset without #2962)
J615 (M3 Air) 5 5/5 pass
J616s (M4 Pro MBP) 4 4/4 pass
Neo (T8140, no notch) #2962 only: 6 DPMS cycles 6/6 pass

No DART faults and no new DCP errors on any of them. The HOLD can come off once #2962 lands; merge #2962 first.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Re-reviewed the delta from the previously approved 4d7e97f68d51 to c56616203ad2. The physical height now follows the geometry that the current probe offers on both mode-list paths. The modes themselves, panel timing and boot property are untouched by this follow-up.

I compiled the exact notch helpers with GCC and Clang under ASan/UBSan. Each passed 16/16 combinations of hidden/shown policy, DRM ownership and bounded/unbounded probes. The bounded console now keeps the notch-free physical height through a shown-policy re-probe, while an unbounded compositor still gets the full height.

This clears the latest source delta. The existing J615 VT trace and the J413 notch/DPMS rows cover different pieces of the behavior, so the J615 VT count remains specific to the bounded-console row.

Keep the shared sleep notifier list and per-device restore work from integration. Keep the notch property and its separately drained hotplug and console work. The removed per-device notifier has no remaining users.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@DjDeveloperr DjDeveloperr 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.

Formal §1–§6 pre-PR checklist re-review at verified live head 27b43cd108d74283c1983b0268d3d9aa981f5f1d (MERGEABLE / CLEAN, CI 2/2 green: Apple DRM KUnit / kunit, Host tests / host-tests).

Delta Audit Since 182aedbd8b20

  1. Bounded-probe physical height (c56616203ad2, dcp-notch.h, iomfb.c, display.py): Clean fix. dcp_notch_free_only(effective, full_fits) (effective == DCP_NOTCH_HIDDEN || !full_fits) ensures bounded console probes always receive the notch-free physical height on both M4 and catalogue dcp_get_modes() paths, matching dcp_notch_offer() and eliminating the forced fbdev restore commits on VT return to GNOME. Verified in panel-notch-geometry (16/16 policy/ownership/fit matrix).
  2. Merge with integration/aurora (27b43cd108d7): Clean conflict resolution in apple_drv.c preserving the shared sleep notifier list (pm_node, pm_resume_work) alongside notch_hotplug / notch_console (disable_work_sync() in both err_unbind and apple_drm_uninit() after drm_dev_unplug() and drm_atomic_helper_shutdown()). Confirmed aurora-silicon/linux#2962 (48b7191062ea, display-DART DPMS fix that resolved the J713 hold) is merged and an ancestor of 27b43cd108d7.

Checklist Summary

  • §1 No model gating: Pass — driven purely by DT apple,notch-height and chosen/asahi,show-notch; verified across 4 distinct notched Mac pipes (J713 M4 Air, J615 M3 Air, J616s M4 Pro desktop 26.6 ProMotion, M2 Air template) plus non-notched Neo regression.
  • §2 Production-ready, no hacks: Pass — works on default kernel command line (appledrm.show_notch module param removed), no sleeps/retries/hacks, 0 code blockers.
  • §3 Safety: Pass — proper teardown ordering and drm_dev_enter/drm_dev_exit guards; J713 DPMS reset root-caused and fixed in merged #2962.
  • §4 Clean-room & attribution: Pass — all 6 commits (including merge commit 27b43cd108d7) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only, zero AI trailers in commits; PR body disclosure present.
  • §5 Evidence: Pass — exact driver code (c5661620 + merged #2962) verified across:
    • J713 (M4 Air, fw 27.2): 11/11 DPMS + notch-toggle rows pass across 2 boots (vs 9/9 reset without #2962), plus full toggle/VT3/multi-user/s2idle row, 0 DART faults, 0 SELinux denials, 0 failed units, 0 new kernel errors.
    • J615 (M3 Air, fw 27.2): c5661620 handoff trace matches unmodified fleet83 (0 console kicks, 0 extra commits on return to GNOME, fbdev var height 204 == VT var 204), toggle/VT3/DPMS/s2idle + 5/5 #2962 DPMS rows pass, 0 SELinux denials, 0 failed units, 0 new kernel errors.
    • J616s (M4 Pro MBP, desktop 26.6): 6 ProMotion timings twinned + 4/4 #2962 DPMS+toggle rows pass, 0 SELinux denials, 0 failed units, 0 new kernel errors.
    • M2 Air (template pipe) & Neo (T8140, no notch): toggle/VT3/DPMS/s2idle and 6/6 DPMS no-regression rows pass.
  • §6 Naming: Pass.

Non-blocking Notes

  • Recommend squash-merge (as you noted) so intermediate commit 0cb64c16 (pre-fix M4 mode check / parser.h line) does not appear in git bisect history.
  • Keep the two non-blocking follow-up observations tracked when available (M4 26.6.2 DCP_FIRMWARE_M4 hardware check for dst_y, currently covered by m4-notch-frame host test, and the visual boot-logo pass).

All §1–§6 criteria and CI pass — APPROVED and ready to merge.

Assisted-by: LLM (Gemini 4 Neon)

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.

2 participants