Skip to content

drm/apple: add hardware-scaled panel_views modes for J716c internal display - #3326

Closed
oreater wants to merge 1 commit into
aurora-silicon:mainfrom
oreater:pr/drm-apple-panel-views
Closed

oreater wants to merge 1 commit into
aurora-silicon:mainfrom
oreater:pr/drm-apple-panel-views

Conversation

@oreater

@oreater oreater commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

What: Expose hardware-scaled sub-modes (3456x2160, 3456x1944, 2560x1600, 2560x1440, 1920x1200, 1920x1080, 1728x1080 @ 120 Hz) for the J716c internal eDP panel below the 74-pixel camera notch, backed by the native 3456x2234@120 DCP timing and DCP plane scaling (panel_views module parameter, default on).

Tested: J716c (MacBook Pro 16" M5 Max) host build + tests at 7c0b2065575b (make LLVM=1 ARCH=arm64 drivers/gpu/drm/apple/ clean with 0 warnings; run-host-tests.py --only dcp 65/65 including full apple-dcp suite; ASAN+UBSAN geometry check across all 7 J716c panel views plus out-of-range/over-2x rejection). Equivalent panel_views path previously boot- and display-modeset-tested on J716c (7.3.0-40).

Risk: two-way · J716c (apple,j716c) internal eDP DCP v27 display when dcp->notch_height == 0 (disable via appledrm.panel_views=0). Zero behavioral change on other Macs or external displays.

Not yet: Bare-metal boot and modeset test on J716c at this exact rebased main commit (7c0b2065575b).

Offered J716c geometries and implementation details

For J716c native 3456x2234@120 with 74-pixel top notch clearance (avail_h = 2160):

  • 3456x2160 -> dst (0, 74, 3456x2160) (1:1 below notch)
  • 3456x1944 -> dst (0, 145, 3456x1944) (16:9 letterboxed below notch)
  • 2560x1600 -> dst (0, 74, 3456x2160) (1.35x 16:10)
  • 2560x1440 -> dst (0, 145, 3456x1944) (1.35x 16:9)
  • 1920x1200 -> dst (0, 74, 3456x2160) (1.8x 16:10)
  • 1920x1080 -> dst (0, 145, 3456x1944) (1.8x 16:9)
  • 1728x1080 -> dst (0, 74, 3456x2160) (2.0x integer HiDPI)

Implementation:

  • dcp_get_modes() appends the qualifying panel_views sub-modes cloned from the native 120 Hz mode.
  • dcp_find_mode() falls back to dcp_panel_view_find(), resolving panel_views modes back to the native DCP mode for lookup_mode(), dcp_mode_settable(), dcp_mode_valid(), dcp_has_mode(), and dcp_crtc_check_hdr().
  • apple_plane_atomic_check() calls dcp_mode_panel_view() to tighten min_scale so total hardware upscaling stays within DCP's 2x limit, and apple_plane_atomic_update() maps plane destination rectangles into the panel_view rectangle on the physical panel.
  • Updates apple-dcp host test shims in plane-layout.py and rate.py.

…isplay

The J716c (MacBook Pro 16" M5 Max) internal eDP panel exposes only its
native 3456x2234@120 timing from DCP firmware v27, leaving desktop
compositors and fullscreen games without smaller hardware-scaled modes
(such as 3456x2160, 2560x1600, 2560x1440, 1920x1200, 1920x1080, or
1728x1080) and exposing the top 74-pixel camera notch region.

Add panel_views support (gated by the panel_views module parameter,
default true, scoped to J716c DCP v27 internal eDP when dcp->notch_height
is 0):
- compute aspect-preserving, notch-avoiding destination rectangles on the
  panel within DCP's 2x hardware upscaling ceiling;
- advertise the matching sub-modes in dcp_get_modes() using the native
  120 Hz hardware timing and resolve them back to the native DCP mode in
  dcp_find_mode() (covering lookup_mode, dcp_mode_settable, dcp_mode_valid,
  dcp_has_mode, and dcp_crtc_check_hdr);
- tighten drm_atomic_helper_check_plane_state()'s min_scale in
  apple_plane_atomic_check() to account for the panel_view upscale ratio
  and remap plane destination rectangles into the panel_view target
  rectangle in apple_plane_atomic_update().

Keep the apple-dcp host test shims in plane-layout.py and rate.py updated
for the new helpers.

Signed-off-by: oreater <145754695+oreater@users.noreply.github.com>
@oreater
oreater marked this pull request as ready for review November 26, 2026 22:34
@oreater
oreater requested review from a team as code owners November 26, 2026 22:34
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at 7c0b2065: not ready yet

Check Detail
CI at head ok 19 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no requested by DjDeveloperr
Hardware row at head ok in the PR body at 7c0b2065
Conflicts ok none
PR text ok Risk: two-way · J716c (apple,j716c) internal eDP DCP v27 display when dcp->notchheight == 0 (disable via appledrm.panelviews=0). Zero behavioral change on other Macs or external displays.

Areas: area:display

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

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict at 7c0b2065575b: changes needed

The mode and plane code is careful, and its geometry matches the description. The problem is how the feature is switched on: a new module parameter, a board gate, a firmware-version gate and a hard-coded notch height. That last one replaces a hardware property the J716c doesn't receive today only because its DT lacks one alias.

Blockers

  1. The feature depends on a module parameter, a board gate and a magic constant where hardware data exists. (drivers/gpu/drm/apple/iomfb.c panel_views, dcp_is_j716c(), dcp_panel_views_enabled(), dcp_panel_view_notch())
    • What the patch adds:

      • module_param(panel_views, bool, 0444), a new module parameter;
      • of_machine_compatible_match("apple,j716c") together with fw_compat == DCP_FIRMWARE_V_27_0, a board gate and a firmware-version gate;
      • return dcp_is_j716c() ? 74 : 0, a per-board notch height in code.
    • The rule. The org rulebook's hard rule 4 ("No model gating, no hacks", AGENTS.md in agent-guidelines) and policy/merge-policy.md rule out each of these when a DT/ADT property can decide.

    • The hardware property already exists. m1n1 derives the notch from the ADT (/product partially-occluded-display, cropping to 16:10: 3456 × 10 / 16 = 2160, so 74 rows). kboot.c then writes it as apple,notch-height into the node behind the DT dcp alias. dcp.c reads that property, and the existing path hides the notch rows (iomfb_template.c offsets dst_rect.y by notch_height).

    • Why J716c reads 0. Every other notched MacBook DT has dcp = &dcp;:

      • t600x-j314-j316.dtsi:24;
      • t602x-j414-j416.dtsi:22;
      • t604x-j614-j616.dtsi:31;
      • t6041-j614c-j616c.dtsi:29;
      • t6050-j714s-gpu-panel.dtsi:18.

      The aliases in t6050-j716c.dts:25-30 don't include it, so the loader has nowhere to write the property. That is why dcp->notch_height is 0 on J716c, which is the condition this patch keys on.

    • What happens once the alias is in. The existing path offers the 3456x2160 below-notch mode by itself. This patch's !dcp->notch_height condition would then switch every panel view off.

    • Suggested direction.

      1. Add the dcp alias to the J716c DT (a separate, small DT change) so the notch comes from the loader.
      2. If the extra scaled modes are still wanted, key them on the panel's native mode and apple,notch-height, for every internal panel whose DCP scales.
      3. Drop the module parameter and the board and firmware checks, and give them rows on a second notched machine.

Checked

  • Geometry. dcp_panel_view_fit() keeps the aspect ratio, centres the view below the notch, and refuses more than 2× per axis.
    • dcp_panel_view_sizes() offers the below-notch crop, a 16:9 crop and the common sizes, de-duplicated and capped at 8.
    • Recomputed for 3456x2234 with a 74-row notch, it gives exactly the 7 views and rectangles in the description.
  • Mode lookup.
    • dcp_panel_view_lookup() accepts only modes whose timing matches the native mode in everything except the active size. dcp_find_mode() then resolves them to the native DCP mode for lookup_mode(), dcp_mode_valid(), dcp_mode_settable(), dcp_has_mode() and dcp_crtc_check_hdr().
    • dcp_mode_panel_view() takes the catalog through dcp_modes_snapshot() under modes_lock.
  • Planes.
    • min_scale becomes k/2 in 16.16 (k = view size / mode size, rounded up), so the plane's scale times the view's stays within the DCP's 2× upscale limit.
    • Mapped destinations stay inside the view rectangle, and the view and its flag are duplicated with the plane state.
    • There's no double notch offset, because views exist only while notch_height is 0.
  • Other machines. Nothing changes elsewhere: the gate keeps it to the J716c internal eDP, and dcpext connectors are not eDP.
  • Build and host tests.
    • checkpatch --strict: clean.
    • drivers/gpu/drm/apple/ builds with the asahi profile, with no warnings.
    • run-host-tests.py --only apple-dcp fails two subtests, same-handle-srcu-index and mux-release-stages, and fails them identically at the merge base 8e2ee15f3ca3, so they don't come from this PR.
  • Test gap. The host shims stub the new entry points: dcp_mode_panel_view() returns false in plane-layout.py, and dcp_panel_view_add_modes() and dcp_panel_view_find() return 0/NULL in rate.py. No in-tree test runs the new geometry, lookup or plane mapping, and the ASAN/UBSAN geometry check in Tested is not part of the PR. A host test over dcp_panel_view_fit() and _sizes() would cover it.
  • Text. Commit and PR text are neutral and carry no attribution.

Before merge

  • CI. Every CI workflow at this head is action_required: Apple build and KUnit, Apple DRM KUnit, host tests, pr-text.
  • Hardware rows. Not yet already lists a J716c boot and modeset at this commit. Once the feature is keyed on hardware data, it also needs a row on a second notched machine and an external-display row.
Evidence
head 7c0b2065575bd5b3599f0febfc4ad38f95b8ad42, merge-base 8e2ee15f3ca3, merge-tree clean with main 66fbacc273c6

iomfb.c     static bool panel_views = true; module_param(panel_views, bool, 0444);
iomfb.c     of_machine_compatible_match({"apple,j716c"}) ... fw_compat == DCP_FIRMWARE_V_27_0 ... !dcp->notch_height
iomfb.c     dcp_panel_view_notch(): return dcp_is_j716c() ? 74 : 0;
m1n1 kboot.c get_notchless_fb(): ADT /product partially-occluded-display -> 16:10 height
m1n1 kboot.c fdt_path_offset(dt, "dcp") -> fdt_appendprop_u32(.., "apple,notch-height", ..)
dcp.c       of_property_read_u32(dev->of_node, "apple,notch-height", &dcp->notch_height)
DT aliases  dcp = &dcp: j314/j316, j414/j416, j614/j616, j614c/j616c, j714s, k116s, t6030, t6031
            t6050-j716c.dts aliases: serial0, wifi0, bluetooth0 (no dcp)

views (3456x2234, notch 74): 3456x2160 (0,74,3456x2160) 3456x1944 (0,145,3456x1944)
  2560x1600/1920x1200/1728x1080 -> (0,74,3456x2160); 2560x1440/1920x1080 -> (0,145,3456x1944)

checkpatch.pl --strict --git main..HEAD     -> 0 errors, 0 warnings, 0 checks
build kernel --profile asahi -- drivers/gpu/drm/apple/  -> exit 0, no warnings (iomfb.o, plane.o, appledrm.o)
run-host-tests.py --only apple-dcp at head  -> not ok 90 same-handle-srcu-index, not ok 91 mux-release-stages
                              at 8e2ee15f3ca3 -> the same two
CI at head: Apple build and KUnit, Apple DRM KUnit, Host tests, pr-text -> action_required

@github-actions github-actions Bot added the changes-requested A reviewer requested changes (bot) label Nov 27, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks @oreater. We will handle the J716c notch with the missing dcp alias (in a separate DT PR) together with the runtime notch modes from #2814, which give the 3456x2160 below-notch mode without board gates. If you still want the extra scaled sizes, please rebase on #2814 and key them on apple,notch-height and the native mode of any notched panel, without a module parameter or board/firmware checks (as in the review). Otherwise we close this once the alias lands.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Closing this as stale in today's backlog triage. The changes requested on 11-27 are still open, and nothing has been pushed since 11-26. The feature still depends on a module parameter, a J716c board check, a firmware-version check and a hard-coded 74-row notch. Finishing it means rebasing on #2814 (merged 11-29, it gives the below-notch mode at run time) and keying the extra sizes on apple,notch-height and the panel's native mode. That is a design rework, not a small fix-up.

Your branch stays as it is. If you still want the extra scaled sizes, reopen this or open a new PR once it is rebased on main that way. The missing dcp alias in t6050-j716c.dts is still the fix for the J716c notch reading 0.

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

Labels

area:display Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants