Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions drivers/gpu/drm/apple/iomfb_v14_7.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ static const struct dcp_v14_board dcp_v14_board_t6030 = {
.firmware_uuid = DCP_V14_FIRMWARE_UUID,
.handoff = "apple,t6030-handoff",
.promotion = true,
/* Without the swap timestamps this panel presents at 60 fps. */
.swap_timestamps = true,
.panel_nits = true,
};

Expand Down Expand Up @@ -3364,6 +3366,25 @@ void iomfb_v14_7_flush(struct apple_dcp *dcp, struct drm_crtc *crtc,
if (!dcp->external)
dcp_v14_configure_backlight(dcp);
dcp->swap_start = ktime_get();
/*
* The internal panel's swap blocks until the firmware completes it, so
* report the flip before the swap: the compositor builds its next
* frame while this one is still in the firmware. The next commit
* cannot overtake this swap (v14->lock and the CRTC commit
* dependencies), and displaced framebuffers stay pinned until the
* swap completes, so none is freed while the firmware may still scan
* it. A 3-buffer swapchain renders into the buffer from two flips
* back, which is already off screen.
*/
if (!dcp->external && dcp->v14 && fb && !READ_ONCE(dcp->v14->failed)) {
dcp_drm_crtc_page_flip(dcp, ktime_get());
if (dcp_v14_present(dcp->v14, fb, fb->width, fb->height,
dcp->notch_height, cs))
dcp_release_all_retained_framebuffers(dcp);
else
dcp_v14_cancel_event(dcp);
return;
}
if (dcp->v14 && dcp_v14_present(dcp->v14, fb,
fb ? (dcp->external ? p->src_w >> 16 : fb->width) : 0,
fb ? (dcp->external ? p->src_h >> 16 : fb->height) : 0,
Expand Down
16 changes: 8 additions & 8 deletions drivers/gpu/drm/apple/v14-board-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* The 14.x IOMFB board records: which record a DCP gets on which machine,
* 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.
* refuses every other. Which DCPs stamp their swaps: the internal panel of a
* T6030 board and of the J516C record; the J514C and T8122 panels and external
* processors keep zero timestamps, byte for byte.
*/
#include <kunit/test.h>
#include <linux/string.h>
Expand Down Expand Up @@ -139,7 +139,7 @@ static void v14_board_j516c_image(struct kunit *test)
KUNIT_EXPECT_FALSE(test, dcp_v14_board_admits(b, "00000000-0000-0000-0000-000000000000"));
}

/* The records that were there before are what they were. */
/* The other fields of the records that were there before are unchanged. */
static void v14_board_unchanged(struct kunit *test)
{
const struct dcp_v14_board *b;
Expand Down Expand Up @@ -178,7 +178,7 @@ 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 T6030 and J516C internal panels stamp their swaps. */
static void v14_board_swap_timestamps(struct kunit *test)
{
const struct dcp_v14_board *j516c_b, *j514c_b, *t6030_b, *j613_b;
Expand All @@ -192,14 +192,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. */
/* The J514C, the external role, the T8122 panel, 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_TRUE(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));
Expand Down