Skip to content
Closed
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
9 changes: 7 additions & 2 deletions drivers/gpu/drm/apple/iomfb_v14_7.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,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
Expand Down Expand Up @@ -1702,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)
Expand Down
7 changes: 0 additions & 7 deletions drivers/gpu/drm/apple/iomfb_v14_7_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 this board's firmware completes at most one swap per
* 16.7 ms, so a 120 Hz panel presents at 60 fps.
*/
bool swap_timestamps;
/* This board has a qualified panel level block; machine admission is separate. */
bool panel_nits;
};
Expand Down
48 changes: 34 additions & 14 deletions drivers/gpu/drm/apple/v14-board-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <kunit/test.h>
#include <linux/string.h>
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -178,29 +181,46 @@ 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);

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_FALSE(test, j613_b->swap_timestamps);
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");

/* 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, 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));
/* 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));
}
Expand Down
Loading