From bc0f857d28469effc516d33faa806de6fd8e6384 Mon Sep 17 00:00:00 2001 From: cachebag Date: Wed, 4 Nov 2026 23:08:51 +0000 Subject: [PATCH 1/2] drm/apple: time-stamp T6030 swaps on 14.7 for 120 Hz The T6030 (M3 Pro) record admits the panel's 120 Hz timing, but its swaps go out with zero timestamps, so the firmware completes at most one per 16.7 ms: the mode reports 120 Hz while a vsync-locked client measures 60 fps. The J516C already sends the constant timestamps for this; set swap_timestamps on the T6030 record too. Tested on a J514S (MacBook Pro 14", M3 Pro), DCP firmware 14.7, on aurora-2026.10.17.20 with the equivalent change: es2gears_wayland goes from 60.0 to 119.9 fps on the built-in panel. Not tested on a J516S, which shares the record. Signed-off-by: cachebag --- drivers/gpu/drm/apple/iomfb_v14_7.c | 1 + drivers/gpu/drm/apple/v14-board-test.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/apple/iomfb_v14_7.c b/drivers/gpu/drm/apple/iomfb_v14_7.c index 7a6c96dfa1f74f..815eacdc88b870 100644 --- a/drivers/gpu/drm/apple/iomfb_v14_7.c +++ b/drivers/gpu/drm/apple/iomfb_v14_7.c @@ -105,6 +105,7 @@ static const struct dcp_v14_board dcp_v14_board_t6030 = { .handoff = "apple,t6030-handoff", .promotion = true, .panel_nits = true, + .swap_timestamps = true, }; /* diff --git a/drivers/gpu/drm/apple/v14-board-test.c b/drivers/gpu/drm/apple/v14-board-test.c index 858b5db4e2835d..7d16a2ebb11f4d 100644 --- a/drivers/gpu/drm/apple/v14-board-test.c +++ b/drivers/gpu/drm/apple/v14-board-test.c @@ -257,14 +257,14 @@ static void v14_board_swap_timestamps(struct kunit *test) KUNIT_EXPECT_TRUE(test, j516c_b->swap_timestamps); KUNIT_EXPECT_FALSE(test, j514c_b->swap_timestamps); - KUNIT_EXPECT_FALSE(test, t6030_b->swap_timestamps); + KUNIT_EXPECT_TRUE(test, t6030_b->swap_timestamps); KUNIT_EXPECT_FALSE(test, j613_b->swap_timestamps); KUNIT_EXPECT_TRUE(test, dcp_v14_board_stamps_swaps(j516c_b, false)); - /* The J514C, the external role, the T6030 (J514S, J516S) and T8122 panels, no record. */ + KUNIT_EXPECT_TRUE(test, dcp_v14_board_stamps_swaps(t6030_b, false)); + /* The J514C, the external role, the T8122 panels, no record. */ KUNIT_EXPECT_FALSE(test, dcp_v14_board_stamps_swaps(j514c_b, false)); KUNIT_EXPECT_FALSE(test, dcp_v14_board_stamps_swaps(j516c_b, true)); - KUNIT_EXPECT_FALSE(test, dcp_v14_board_stamps_swaps(t6030_b, false)); KUNIT_EXPECT_FALSE(test, dcp_v14_board_stamps_swaps(j613_b, false)); KUNIT_EXPECT_FALSE(test, dcp_v14_board_stamps_swaps(NULL, false)); KUNIT_EXPECT_FALSE(test, dcp_v14_board_stamps_swaps(NULL, true)); From c41855ae2ce78c2797cffd975aafaacccea82504 Mon Sep 17 00:00:00 2001 From: Ilyas Akin Date: Sun, 15 Nov 2026 22:51:06 +0300 Subject: [PATCH 2/2] drm/apple: v14.7: offer a locked 60 Hz mode beside variable refresh A ProMotion panel on the 14.7 path has a single 120 Hz timing (one "timing 1/1" on a J514S), so GNOME, KDE and Hyprland offer only 120 Hz, with no way to run the panel at 60 Hz. On a board whose swaps carry timing words, offer it as two modes, as the 26.6 path does: the 120 Hz timing as the variable-refresh mode, and the same timing as a locked 60 Hz mode whose swaps carry none, which the firmware then shows at 60 Hz. The firmware keeps its boot timing either way, so switching modes sends nothing to it and the panel never blanks. Boards that don't stamp swaps keep their single mode: both modes would send the same swaps there. Swaps stay timed unless the locked mode is set, so a stamping board keeps its timing words whatever its best timing. On a J514S (MacBook Pro 14", M3 Pro), with the desktop idle (0.1 swaps a second), the variable-refresh mode draws 7.88 W and the locked 60 Hz mode 8.45 W: the panel lowers its refresh rate when no swaps come. glmark2 with FIFO runs at 120 and 60 FPS in the two modes. Link: https://github.com/aurora-silicon/linux/issues/1633 Assisted-by: Claude:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Ilyas Akin --- drivers/gpu/drm/apple/iomfb_v14_7.c | 50 +++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/apple/iomfb_v14_7.c b/drivers/gpu/drm/apple/iomfb_v14_7.c index 815eacdc88b870..9f8f626e2084d5 100644 --- a/drivers/gpu/drm/apple/iomfb_v14_7.c +++ b/drivers/gpu/drm/apple/iomfb_v14_7.c @@ -328,6 +328,12 @@ struct apple_dcp_v14 { bool mode_live; u32 mode_timing, mode_color; u64 mode_swaps; + /* + * Internal: the panel has the locked 60 Hz mode beside the + * variable-refresh one, and swaps carry timing words unless the + * locked mode is set. + */ + bool locked_mode, timed; /* External: catalog generation when a chunked property started. */ u64 chunk_generation; /* External: the parts of the display's description published now. */ @@ -2615,6 +2621,7 @@ static int dcp_v14_mode(struct apple_dcp *dcp, struct apple_dcp_v14 *v14) struct dcp_display_mode *modes, *best = NULL, *selected; struct dcp_parse_ctx ctx; unsigned int count, i; + bool split; void *blob = NULL; u32 size = 0; int ret; @@ -2661,14 +2668,36 @@ static int dcp_v14_mode(struct apple_dcp *dcp, struct apple_dcp_v14 *v14) return -EINVAL; } best->mode.type |= DRM_MODE_TYPE_PREFERRED; - selected = kmemdup(best, sizeof(*best), GFP_KERNEL); - kfree(modes); - if (!selected) + /* + * On a board whose swaps carry timing words, the panel's 120 Hz + * ProMotion timing is offered twice, as the 26.6 path does: as the + * variable-refresh mode, and as a locked 60 Hz mode whose swaps carry + * none, which the firmware then shows at 60 Hz. The firmware keeps + * its boot timing either way. + */ + split = v14->board->promotion && drm_mode_vrefresh(&best->mode) == 120 && + dcp_v14_board_stamps_swaps(v14->board, false); + selected = kcalloc(split ? 2 : 1, sizeof(*selected), GFP_KERNEL); + if (!selected) { + kfree(modes); return -ENOMEM; + } + selected[0] = *best; + kfree(modes); + if (split) { + selected[0].vrr = true; + selected[1] = selected[0]; + selected[1].vrr = false; + selected[1].mode.clock = DIV_ROUND_CLOSEST(selected[1].mode.clock, 2); + selected[1].mode.type &= ~DRM_MODE_TYPE_PREFERRED; + drm_mode_set_name(&selected[1].mode); + } + v14->locked_mode = split; + WRITE_ONCE(v14->timed, true); mutex_lock(&dcp->modes_lock); kfree(dcp->modes); dcp->modes = selected; - dcp->nr_modes = 1; + dcp->nr_modes = split ? 2 : 1; dcp->modes_admitted = true; mutex_unlock(&dcp->modes_lock); return 0; @@ -2905,7 +2934,7 @@ static int dcp_v14_swap_locked(struct apple_dcp_v14 *v14, const u8 *surface, u64 if (!ret) { dcp_v14_encode_swap(swap, id, DCP_V14_BLACK, surface, iova, width, height, dst_y, DCP_V14_LAYER); - if (dcp_v14_board_stamps_swaps(v14->board, v14->external)) + if (dcp_v14_board_stamps_swaps(v14->board, v14->external) && READ_ONCE(v14->timed)) dcp_v14_swap_timestamps(swap); nits = dcp_v14_swap_nits(v14, swap, &present); ret = dcp_v14_call_guarded(v14, A(407), swap, DCP_V14_SWAP_SIZE, result, sizeof(result), @@ -3387,9 +3416,16 @@ int iomfb_v14_7_modeset(struct apple_dcp *dcp, struct drm_crtc_state *crtc_state { if (dcp->external) return dcp_v14_external_modeset(dcp, crtc_state); - /* The firmware keeps the timing it booted with, which is the only mode. */ - if (!lookup_mode(dcp, &crtc_state->mode, NULL)) + struct dcp_display_mode mode; + + /* + * The firmware keeps the timing it booted with, which every mode + * shares: the mode only decides whether swaps carry timing words. + */ + if (!lookup_mode(dcp, &crtc_state->mode, &mode)) return -EINVAL; + if (dcp->v14) + WRITE_ONCE(dcp->v14->timed, !dcp->v14->locked_mode || mode.vrr); scoped_guard(spinlock_irqsave, &dcp->mode_state.lock) dcp->mode_state.valid = true; return 0;