From 1882f3be6ee2d72bf3386ae46bd27c6f9c57880a Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Thu, 12 Nov 2026 15:09:44 +1100 Subject: [PATCH 1/2] drm/apple: stamp the swaps of every 14.7 ProMotion panel On a J514S (MacBook Pro 14", M3 Pro) the internal panel is set to its 3024x1890@120 timing, but swaps complete 16.64 ms apart and Wayland frame callbacks run at about 60 fps. The T6030 board record, which serves the J514S and J516S, has promotion but not swap_timestamps, so its swaps go out with zero timestamps. With zero timestamps the 14.7 firmware completes at most one swap per 16.7 ms, the behaviour 47d53ce42303 ("drm/apple: stamp the J516C panel's 14.7 swaps") fixed on the J516C. The J514C record has the same gap: it runs the J516C's own DCP image, where stamping was measured, on a 120 Hz panel. Set swap_timestamps in the T6030 and J514C records. Every 14.x board record with a 120 Hz panel now stamps its internal swaps with the constant deadline, as the template path (fa13cbdc1103) and the M4 path (09986eed1029) do for their 120 Hz panels. The 60 Hz J613/J615 panels and the external processors keep zero timestamps, byte for byte. The board KUnit case now checks the J514S, J516S, J514C, J516C, J613 and J615 records, and that swap_timestamps follows promotion on each. Not tested on M3 hardware: no J514S, J516S or J514C was available. The J516C result and the reporter's measurements are the evidence; the reporter's test of this change on a J514S is the check. Reported-by: fraudsta (Discord: thetennisfan) Signed-off-by: Ryan Murray --- drivers/gpu/drm/apple/iomfb_v14_7.c | 2 ++ drivers/gpu/drm/apple/iomfb_v14_7_board.h | 4 +-- drivers/gpu/drm/apple/v14-board-test.c | 41 +++++++++++++++++------ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/apple/iomfb_v14_7.c b/drivers/gpu/drm/apple/iomfb_v14_7.c index a99bfed67183f..deb610e8016df 100644 --- a/drivers/gpu/drm/apple/iomfb_v14_7.c +++ b/drivers/gpu/drm/apple/iomfb_v14_7.c @@ -103,6 +103,7 @@ static const struct dcp_v14_board dcp_v14_board_t6030 = { .firmware_uuid = DCP_V14_FIRMWARE_UUID, .handoff = "apple,t6030-handoff", .promotion = true, + .swap_timestamps = true, .panel_nits = true, }; @@ -187,6 +188,7 @@ static const struct dcp_v14_board dcp_v14_board_j514c = { .handoff = "apple,t6031-handoff", .promotion = true, .log_bringup = true, + .swap_timestamps = true, }; static const struct dcp_v14_board *const dcp_v14_boards[] = { diff --git a/drivers/gpu/drm/apple/iomfb_v14_7_board.h b/drivers/gpu/drm/apple/iomfb_v14_7_board.h index 6de1ae9004122..b8bdcdd916510 100644 --- a/drivers/gpu/drm/apple/iomfb_v14_7_board.h +++ b/drivers/gpu/drm/apple/iomfb_v14_7_board.h @@ -42,8 +42,8 @@ struct dcp_v14_board { /* * The panel's swaps carry the constant timestamp * DCP_V14_SWAP_TIMESTAMP_VALUE in slots 0, 1 and 6. With zero - * timestamps this board's firmware completes at most one swap per - * 16.7 ms, so a 120 Hz panel presents at 60 fps. + * timestamps the firmware completes at most one swap per 16.7 ms, so a + * 120 Hz panel presents at 60 fps: set wherever promotion is. */ bool swap_timestamps; /* This board has a qualified panel level block; machine admission is separate. */ diff --git a/drivers/gpu/drm/apple/v14-board-test.c b/drivers/gpu/drm/apple/v14-board-test.c index f9b84ab36a7cc..7fa88be797f49 100644 --- a/drivers/gpu/drm/apple/v14-board-test.c +++ b/drivers/gpu/drm/apple/v14-board-test.c @@ -4,8 +4,9 @@ * and which DCP firmware image a record admits. The J516C (T6031) record * admits only the T6030 image, whose IOMFB layouts were validated, and * refuses every other; the existing records are unchanged. Which DCPs stamp - * their swaps: the internal panel of a T6031 record; the T6030 and T8122 - * panels and external processors keep zero timestamps, byte for byte. + * their swaps: the internal panel of every record with a 120 Hz panel (T6030, + * J516C, J514C); the 60 Hz T8122 panels and external processors keep zero + * timestamps, byte for byte. */ #include #include @@ -53,7 +54,9 @@ static const char *const j516c[] = { "apple,j516c", "apple,t6031", "apple,arm-pl static const char *const j514c[] = { "apple,j514c", "apple,t6031", "apple,arm-platform", NULL }; static const char *const j516m[] = { "apple,j516m", "apple,t6034", "apple,arm-platform", NULL }; static const char *const j516s[] = { "apple,j516s", "apple,t6030", "apple,arm-platform", NULL }; +static const char *const j514s[] = { "apple,j514s", "apple,t6030", "apple,arm-platform", NULL }; static const char *const j613[] = { "apple,j613", "apple,t8122", "apple,arm-platform", NULL }; +static const char *const j615[] = { "apple,j615", "apple,t8122", "apple,arm-platform", NULL }; static void v14_board_j516c(struct kunit *test) { @@ -178,29 +181,45 @@ static void v14_board_unchanged(struct kunit *test) KUNIT_EXPECT_TRUE(test, known); } -/* Only the internal panel of the J516C record stamps its swaps. */ +/* The internal panel of every 120 Hz record stamps its swaps, and only that. */ static void v14_board_swap_timestamps(struct kunit *test) { - const struct dcp_v14_board *j516c_b, *j514c_b, *t6030_b, *j613_b; + const struct dcp_v14_board *j516c_b, *j514c_b, *j514s_b, *j516s_b, *j613_b, *j615_b; bool known; j516c_b = board_for("apple,t6031-dcp", j516c, &known); j514c_b = board_for("apple,t6031-dcp", j514c, &known); - t6030_b = board_for("apple,t6030-dcp", j516s, &known); + j514s_b = board_for("apple,t6030-dcp", j514s, &known); + j516s_b = board_for("apple,t6030-dcp", j516s, &known); j613_b = board_for("apple,t8122-dcp", j613, &known); - KUNIT_ASSERT_TRUE(test, j516c_b && j514c_b && t6030_b && j613_b); + j615_b = board_for("apple,t8122-dcp", j615, &known); + KUNIT_ASSERT_TRUE(test, j516c_b && j514c_b && j514s_b && j516s_b && j613_b && j615_b); + + /* The J514S and J516S (M3 Pro) share the T6030 record. */ + KUNIT_EXPECT_PTR_EQ(test, j514s_b, j516s_b); + KUNIT_EXPECT_STREQ(test, j514s_b->name, "T6030"); 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, j514c_b->swap_timestamps); + KUNIT_EXPECT_TRUE(test, j514s_b->swap_timestamps); KUNIT_EXPECT_FALSE(test, j613_b->swap_timestamps); + KUNIT_EXPECT_FALSE(test, j615_b->swap_timestamps); + + /* A 120 Hz panel without stamps presents at 60 fps. */ + KUNIT_EXPECT_EQ(test, j516c_b->swap_timestamps, j516c_b->promotion); + KUNIT_EXPECT_EQ(test, j514c_b->swap_timestamps, j514c_b->promotion); + KUNIT_EXPECT_EQ(test, j514s_b->swap_timestamps, j514s_b->promotion); + KUNIT_EXPECT_EQ(test, j613_b->swap_timestamps, j613_b->promotion); + KUNIT_EXPECT_EQ(test, j615_b->swap_timestamps, j615_b->promotion); 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_FALSE(test, dcp_v14_board_stamps_swaps(j514c_b, false)); + KUNIT_EXPECT_TRUE(test, dcp_v14_board_stamps_swaps(j514c_b, false)); + KUNIT_EXPECT_TRUE(test, dcp_v14_board_stamps_swaps(j514s_b, false)); + /* The external role, the 60 Hz T8122 panels, no record. */ 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(j514s_b, true)); KUNIT_EXPECT_FALSE(test, dcp_v14_board_stamps_swaps(j613_b, false)); + KUNIT_EXPECT_FALSE(test, dcp_v14_board_stamps_swaps(j615_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 2506e1647580b8f0548cb3e76a0112fb034274d5 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Sat, 21 Nov 2026 23:39:53 +1100 Subject: [PATCH 2/2] drm/apple: stamp 14.7 swaps from the board's ProMotion bit swap_timestamps was set on exactly the records that have promotion, and the KUnit case asserted that the two are equal. A separate flag only leaves room for the next 120 Hz record to miss it, which is how the T6030 and J514C records lost their stamps. Decide it in dcp_v14_board_stamps_swaps() from board->promotion and drop the field. No record changes behaviour: the three records that stamped still do, and the 60 Hz T8122 records still don't. The KUnit case now checks the ProMotion bits and that the stamp decision follows them. Signed-off-by: Ryan Murray --- drivers/gpu/drm/apple/iomfb_v14_7.c | 11 +++++++---- drivers/gpu/drm/apple/iomfb_v14_7_board.h | 7 ------- drivers/gpu/drm/apple/v14-board-test.c | 21 +++++++++++---------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/apple/iomfb_v14_7.c b/drivers/gpu/drm/apple/iomfb_v14_7.c index deb610e8016df..21a7093322999 100644 --- a/drivers/gpu/drm/apple/iomfb_v14_7.c +++ b/drivers/gpu/drm/apple/iomfb_v14_7.c @@ -103,7 +103,6 @@ static const struct dcp_v14_board dcp_v14_board_t6030 = { .firmware_uuid = DCP_V14_FIRMWARE_UUID, .handoff = "apple,t6030-handoff", .promotion = true, - .swap_timestamps = true, .panel_nits = true, }; @@ -163,7 +162,6 @@ static const struct dcp_v14_board dcp_v14_board_j516c = { .panel_height = 2234, .promotion = true, .log_bringup = true, - .swap_timestamps = true, /* * The J516S panel and this image's swap carry the level block the * T6030 record uses (present byte +0x354, binary64 nits +0x35c, 500 nits @@ -188,7 +186,6 @@ static const struct dcp_v14_board dcp_v14_board_j514c = { .handoff = "apple,t6031-handoff", .promotion = true, .log_bringup = true, - .swap_timestamps = true, }; static const struct dcp_v14_board *const dcp_v14_boards[] = { @@ -1704,9 +1701,15 @@ const char *iomfb_v14_7_board_name(const struct dcp_v14_board *board) return board->name; } +/* + * The internal panel's swaps carry the constant timestamp + * DCP_V14_SWAP_TIMESTAMP_VALUE in slots 0, 1 and 6. With zero timestamps the + * firmware completes at most one swap per 16.7 ms, so a 120 Hz panel would + * present at 60 fps: stamp wherever the panel is ProMotion. + */ bool dcp_v14_board_stamps_swaps(const struct dcp_v14_board *board, bool external) { - return board && !external && board->swap_timestamps; + return board && !external && board->promotion; } int iomfb_v14_7_probe(struct apple_dcp *dcp) diff --git a/drivers/gpu/drm/apple/iomfb_v14_7_board.h b/drivers/gpu/drm/apple/iomfb_v14_7_board.h index b8bdcdd916510..7043fb2f44ca6 100644 --- a/drivers/gpu/drm/apple/iomfb_v14_7_board.h +++ b/drivers/gpu/drm/apple/iomfb_v14_7_board.h @@ -39,13 +39,6 @@ struct dcp_v14_board { * releases, so they are only set where tested. */ u32 ctm_set, ctm_get; - /* - * The panel's swaps carry the constant timestamp - * DCP_V14_SWAP_TIMESTAMP_VALUE in slots 0, 1 and 6. With zero - * timestamps the firmware completes at most one swap per 16.7 ms, so a - * 120 Hz panel presents at 60 fps: set wherever promotion is. - */ - bool swap_timestamps; /* This board has a qualified panel level block; machine admission is separate. */ bool panel_nits; }; diff --git a/drivers/gpu/drm/apple/v14-board-test.c b/drivers/gpu/drm/apple/v14-board-test.c index 7fa88be797f49..b9db39ed73beb 100644 --- a/drivers/gpu/drm/apple/v14-board-test.c +++ b/drivers/gpu/drm/apple/v14-board-test.c @@ -199,18 +199,19 @@ static void v14_board_swap_timestamps(struct kunit *test) KUNIT_EXPECT_PTR_EQ(test, j514s_b, j516s_b); KUNIT_EXPECT_STREQ(test, j514s_b->name, "T6030"); - KUNIT_EXPECT_TRUE(test, j516c_b->swap_timestamps); - KUNIT_EXPECT_TRUE(test, j514c_b->swap_timestamps); - KUNIT_EXPECT_TRUE(test, j514s_b->swap_timestamps); - KUNIT_EXPECT_FALSE(test, j613_b->swap_timestamps); - KUNIT_EXPECT_FALSE(test, j615_b->swap_timestamps); + /* The M3 Pro/Max records are ProMotion, the M3 Air ones are not. */ + KUNIT_EXPECT_TRUE(test, j516c_b->promotion); + KUNIT_EXPECT_TRUE(test, j514c_b->promotion); + KUNIT_EXPECT_TRUE(test, j514s_b->promotion); + KUNIT_EXPECT_FALSE(test, j613_b->promotion); + KUNIT_EXPECT_FALSE(test, j615_b->promotion); /* A 120 Hz panel without stamps presents at 60 fps. */ - KUNIT_EXPECT_EQ(test, j516c_b->swap_timestamps, j516c_b->promotion); - KUNIT_EXPECT_EQ(test, j514c_b->swap_timestamps, j514c_b->promotion); - KUNIT_EXPECT_EQ(test, j514s_b->swap_timestamps, j514s_b->promotion); - KUNIT_EXPECT_EQ(test, j613_b->swap_timestamps, j613_b->promotion); - KUNIT_EXPECT_EQ(test, j615_b->swap_timestamps, j615_b->promotion); + KUNIT_EXPECT_EQ(test, dcp_v14_board_stamps_swaps(j516c_b, false), j516c_b->promotion); + KUNIT_EXPECT_EQ(test, dcp_v14_board_stamps_swaps(j514c_b, false), j514c_b->promotion); + KUNIT_EXPECT_EQ(test, dcp_v14_board_stamps_swaps(j514s_b, false), j514s_b->promotion); + KUNIT_EXPECT_EQ(test, dcp_v14_board_stamps_swaps(j613_b, false), j613_b->promotion); + KUNIT_EXPECT_EQ(test, dcp_v14_board_stamps_swaps(j615_b, false), j615_b->promotion); KUNIT_EXPECT_TRUE(test, dcp_v14_board_stamps_swaps(j516c_b, false)); KUNIT_EXPECT_TRUE(test, dcp_v14_board_stamps_swaps(j514c_b, false));