Repository navigation
Conversation
…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>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
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
- The feature depends on a module parameter, a board gate and a magic constant where hardware data exists. (
drivers/gpu/drm/apple/iomfb.cpanel_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 withfw_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.mdin agent-guidelines) andpolicy/merge-policy.mdrule out each of these when a DT/ADT property can decide. -
The hardware property already exists. m1n1 derives the notch from the ADT (
/productpartially-occluded-display, cropping to 16:10: 3456 × 10 / 16 = 2160, so 74 rows).kboot.cthen writes it asapple,notch-heightinto the node behind the DTdcpalias.dcp.creads that property, and the existing path hides the notch rows (iomfb_template.coffsetsdst_rect.ybynotch_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-30don't include it, so the loader has nowhere to write the property. That is whydcp->notch_heightis 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_heightcondition would then switch every panel view off. -
Suggested direction.
- Add the
dcpalias to the J716c DT (a separate, small DT change) so the notch comes from the loader. - 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. - Drop the module parameter and the board and firmware checks, and give them rows on a second notched machine.
- Add the
-
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 forlookup_mode(),dcp_mode_valid(),dcp_mode_settable(),dcp_has_mode()anddcp_crtc_check_hdr().dcp_mode_panel_view()takes the catalog throughdcp_modes_snapshot()undermodes_lock.
- Planes.
min_scalebecomesk/2in 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_heightis 0.
- Other machines. Nothing changes elsewhere: the gate keeps it to the J716c internal eDP, and
dcpextconnectors 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-dcpfails two subtests,same-handle-srcu-indexandmux-release-stages, and fails them identically at the merge base8e2ee15f3ca3, so they don't come from this PR.
- Test gap. The host shims stub the new entry points:
dcp_mode_panel_view()returns false inplane-layout.py, anddcp_panel_view_add_modes()anddcp_panel_view_find()return 0/NULL inrate.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 overdcp_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
|
Thanks @oreater. We will handle the J716c notch with the missing |
|
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 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 |
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 native3456x2234@120DCP timing and DCP plane scaling (panel_viewsmodule 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 dcp65/65 including fullapple-dcpsuite; ASAN+UBSAN geometry check across all 7 J716c panel views plus out-of-range/over-2x rejection). Equivalentpanel_viewspath previously boot- and display-modeset-tested on J716c (7.3.0-40).Risk: two-way · J716c (
apple,j716c) internal eDP DCP v27 display whendcp->notch_height == 0(disable viaappledrm.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
maincommit (7c0b2065575b).Offered J716c geometries and implementation details
For J716c native
3456x2234@120with 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 qualifyingpanel_viewssub-modes cloned from the native 120 Hz mode.dcp_find_mode()falls back todcp_panel_view_find(), resolvingpanel_viewsmodes back to the native DCP mode forlookup_mode(),dcp_mode_settable(),dcp_mode_valid(),dcp_has_mode(), anddcp_crtc_check_hdr().apple_plane_atomic_check()callsdcp_mode_panel_view()to tightenmin_scaleso total hardware upscaling stays within DCP's 2x limit, andapple_plane_atomic_update()maps plane destination rectangles into thepanel_viewrectangle on the physical panel.apple-dcphost test shims inplane-layout.pyandrate.py.