[Why] The defaults eDP DSC link policy to minimize the link rate, while the preferred policy is to minimize the lane count.
[How] Use the minimize-lane policy by default. Fall back to the minimize-link-rate policy when FEC is unavailable or disabled. Update the KUnit expectation accordingly. Assisted-by: Cursor:Claude-Opus-5.5 Reviewed-by: Tom Chung <[email protected]> Signed-off-by: Ray Wu <[email protected]> --- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 5 ++++- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 20 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index 3217aa82bea2..2f9c98a89c94 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -1423,7 +1423,7 @@ void dm_helpers_init_panel_settings( panel_config->pps.extra_post_OUI_ms = 0; // Feature DSC panel_config->dsc.disable_dsc_edp = false; - panel_config->dsc.force_dsc_edp_policy = 0; + panel_config->dsc.force_dsc_edp_policy = 1; } EXPORT_IF_KUNIT(dm_helpers_init_panel_settings); @@ -1437,6 +1437,9 @@ void dm_helpers_override_panel_settings( if (amdgpu_dc_debug_mask & DC_DISABLE_DSC) link->panel_config.dsc.disable_dsc_edp = true; + if (!dc_link_should_enable_fec(link)) + link->panel_config.dsc.force_dsc_edp_policy = 0; + if (dc_get_edp_link_panel_inst(ctx->dc, link, &panel_inst) && panel_inst == 1) { link->panel_config.psr.disable_psr = true; link->panel_config.psr.disallow_psrsu = true; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c index d37fe26eecea..38f53c596f0d 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c @@ -2092,7 +2092,12 @@ static void dm_test_init_panel_settings_dsc(struct kunit *test) dm_helpers_init_panel_settings(NULL, &panel_config, sink); KUNIT_EXPECT_FALSE(test, panel_config.dsc.disable_dsc_edp); - KUNIT_EXPECT_EQ(test, panel_config.dsc.force_dsc_edp_policy, 0U); + KUNIT_EXPECT_EQ(test, panel_config.dsc.force_dsc_edp_policy, 1U); +} + +static bool dm_test_dp_should_enable_fec(const struct dc_link *link) +{ + return true; } /* Tests for dm_helpers_override_panel_settings() */ @@ -2106,14 +2111,20 @@ static void dm_test_override_panel_settings_debug_mask_disables_dsc(struct kunit struct dc_context *ctx; struct dc_link *link; struct dc *dc; + struct link_service *link_srv; uint old_debug_mask; ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); KUNIT_ASSERT_NOT_NULL(test, ctx); dc = kunit_kzalloc(test, sizeof(*dc), GFP_KERNEL); KUNIT_ASSERT_NOT_NULL(test, dc); + link_srv = kunit_kzalloc(test, sizeof(*link_srv), GFP_KERNEL); + KUNIT_ASSERT_NOT_NULL(test, link_srv); link = dm_kunit_alloc_link(test); ctx->dc = dc; + dc->link_srv = link_srv; + link->dc = dc; + link_srv->dp_should_enable_fec = dm_test_dp_should_enable_fec; link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT; old_debug_mask = dm_helpers_get_dc_debug_mask(); @@ -2134,15 +2145,22 @@ static void dm_test_override_panel_settings_second_edp_disables_psr(struct kunit struct dc_link *first_link; struct dc_link *second_link; struct dc *dc; + struct link_service *link_srv; ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); KUNIT_ASSERT_NOT_NULL(test, ctx); dc = kunit_kzalloc(test, sizeof(*dc), GFP_KERNEL); KUNIT_ASSERT_NOT_NULL(test, dc); + link_srv = kunit_kzalloc(test, sizeof(*link_srv), GFP_KERNEL); + KUNIT_ASSERT_NOT_NULL(test, link_srv); first_link = dm_kunit_alloc_link(test); second_link = dm_kunit_alloc_link(test); ctx->dc = dc; + dc->link_srv = link_srv; + link_srv->dp_should_enable_fec = dm_test_dp_should_enable_fec; + first_link->dc = dc; + second_link->dc = dc; dc->link_count = 2; dc->links[0] = first_link; dc->links[1] = second_link; -- 2.43.0
