Skip to content

Commit c03d770

Browse files
Michael Straussalexdeucher
authored andcommitted
drm/amd/display: Attempt to avoid empty TUs when endpoint is DPIA
[WHY] Empty SST TUs are illegal to transmit over a USB4 DP tunnel. Current policy is to configure stream encoder to pack 2 pixels per pclk even when ODM combine is not in use, allowing seamless dynamic ODM reconfiguration. However, in extreme edge cases where average pixel count per TU is less than 2, this can lead to unexpected empty TU generation during compliance testing. For example, VIC 1 with a 1xHBR3 link configuration will average 1.98 pix/TU. [HOW] Calculate average pixel count per TU, and block 2 pixels per clock if endpoint is a DPIA tunnel and pixel clock is low enough that we will never require 2:1 ODM combine. Cc: [email protected] # 6.6+ Reviewed-by: Wenjing Liu <[email protected]> Acked-by: Hamza Mahfooz <[email protected]> Signed-off-by: Michael Strauss <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 6071607 commit c03d770

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,3 +1439,75 @@ void dcn35_set_long_vblank(struct pipe_ctx **pipe_ctx,
14391439
}
14401440
}
14411441
}
1442+
1443+
static bool should_avoid_empty_tu(struct pipe_ctx *pipe_ctx)
1444+
{
1445+
/* Calculate average pixel count per TU, return false if under ~2.00 to
1446+
* avoid empty TUs. This is only required for DPIA tunneling as empty TUs
1447+
* are legal to generate for native DP links. Assume TU size 64 as there
1448+
* is currently no scenario where it's reprogrammed from HW default.
1449+
* MTPs have no such limitation, so this does not affect MST use cases.
1450+
*/
1451+
unsigned int pix_clk_mhz;
1452+
unsigned int symclk_mhz;
1453+
unsigned int avg_pix_per_tu_x1000;
1454+
unsigned int tu_size_bytes = 64;
1455+
struct dc_crtc_timing *timing = &pipe_ctx->stream->timing;
1456+
struct dc_link_settings *link_settings = &pipe_ctx->link_config.dp_link_settings;
1457+
const struct dc *dc = pipe_ctx->stream->link->dc;
1458+
1459+
if (pipe_ctx->stream->link->ep_type != DISPLAY_ENDPOINT_USB4_DPIA)
1460+
return false;
1461+
1462+
// Not necessary for MST configurations
1463+
if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
1464+
return false;
1465+
1466+
pix_clk_mhz = timing->pix_clk_100hz / 10000;
1467+
1468+
// If this is true, can't block due to dynamic ODM
1469+
if (pix_clk_mhz > dc->clk_mgr->bw_params->clk_table.entries[0].dispclk_mhz)
1470+
return false;
1471+
1472+
switch (link_settings->link_rate) {
1473+
case LINK_RATE_LOW:
1474+
symclk_mhz = 162;
1475+
break;
1476+
case LINK_RATE_HIGH:
1477+
symclk_mhz = 270;
1478+
break;
1479+
case LINK_RATE_HIGH2:
1480+
symclk_mhz = 540;
1481+
break;
1482+
case LINK_RATE_HIGH3:
1483+
symclk_mhz = 810;
1484+
break;
1485+
default:
1486+
// We shouldn't be tunneling any other rates, something is wrong
1487+
ASSERT(0);
1488+
return false;
1489+
}
1490+
1491+
avg_pix_per_tu_x1000 = (1000 * pix_clk_mhz * tu_size_bytes)
1492+
/ (symclk_mhz * link_settings->lane_count);
1493+
1494+
// Add small empirically-decided margin to account for potential jitter
1495+
return (avg_pix_per_tu_x1000 < 2020);
1496+
}
1497+
1498+
bool dcn35_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx)
1499+
{
1500+
struct dc *dc = pipe_ctx->stream->ctx->dc;
1501+
1502+
if (!is_h_timing_divisible_by_2(pipe_ctx->stream))
1503+
return false;
1504+
1505+
if (should_avoid_empty_tu(pipe_ctx))
1506+
return false;
1507+
1508+
if (dc_is_dp_signal(pipe_ctx->stream->signal) && !dc->link_srv->dp_is_128b_132b_signal(pipe_ctx) &&
1509+
dc->debug.enable_dp_dig_pixel_rate_div_policy)
1510+
return true;
1511+
1512+
return false;
1513+
}

drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,6 @@ void dcn35_set_static_screen_control(struct pipe_ctx **pipe_ctx,
9595
void dcn35_set_long_vblank(struct pipe_ctx **pipe_ctx,
9696
int num_pipes, uint32_t v_total_min, uint32_t v_total_max);
9797

98+
bool dcn35_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx);
99+
98100
#endif /* __DC_HWSS_DCN35_H__ */

drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static const struct hwseq_private_funcs dcn35_private_funcs = {
158158
.setup_hpo_hw_control = dcn35_setup_hpo_hw_control,
159159
.calculate_dccg_k1_k2_values = dcn32_calculate_dccg_k1_k2_values,
160160
.set_pixels_per_cycle = dcn32_set_pixels_per_cycle,
161-
.is_dp_dig_pixel_rate_div_policy = dcn32_is_dp_dig_pixel_rate_div_policy,
161+
.is_dp_dig_pixel_rate_div_policy = dcn35_is_dp_dig_pixel_rate_div_policy,
162162
.dsc_pg_control = dcn35_dsc_pg_control,
163163
.dsc_pg_status = dcn32_dsc_pg_status,
164164
.enable_plane = dcn35_enable_plane,

0 commit comments

Comments
 (0)