From 2f912935168a3122371f1de85eed8d9cce192d0c Mon Sep 17 00:00:00 2001 From: Weiguang Li Date: Thu, 27 Nov 2025 17:49:49 +0800 Subject: [PATCH] drm/amd/display: Support DRR granularity [Why&How] Support DRR granularity for coasting Vtotal calculation Reviewed-by: Robin Chen Reviewed-by: Wenjing Liu Signed-off-by: Weiguang Li Signed-off-by: Chenyu Chen Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 1 + .../drm/amd/display/dc/link/protocols/link_dp_capability.c | 7 +++++++ drivers/gpu/drm/amd/display/include/dpcd_defs.h | 1 + 3 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h index 79e1696def630..273610d85438b 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h +++ b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h @@ -1296,6 +1296,7 @@ struct dpcd_caps { /* Indicates the number of SST links supported by MSO (Multi-Stream Output) */ uint8_t mso_cap_sst_links_supported; uint8_t dp_edp_general_cap_2; + uint16_t drr_granularity; }; union dpcd_sink_ext_caps { diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c index 3884851e2a9e7..54c417928b61a 100644 --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c @@ -2219,6 +2219,13 @@ void detect_edp_sink_caps(struct dc_link *link) (uint8_t *)&link->dpcd_caps.edp_oled_emission_rate, sizeof(link->dpcd_caps.edp_oled_emission_rate)); + /* + * Read DRR granularity + */ + core_link_read_dpcd(link, DP_SINK_DRR_GRANULARITY, + (uint8_t *)&link->dpcd_caps.drr_granularity, + sizeof(link->dpcd_caps.drr_granularity)); + /* * Read Multi-SST (Single Stream Transport) capability * for eDP version 1.4 or higher. diff --git a/drivers/gpu/drm/amd/display/include/dpcd_defs.h b/drivers/gpu/drm/amd/display/include/dpcd_defs.h index 07b937b92efc7..8445c540f042c 100644 --- a/drivers/gpu/drm/amd/display/include/dpcd_defs.h +++ b/drivers/gpu/drm/amd/display/include/dpcd_defs.h @@ -188,6 +188,7 @@ enum dpcd_psr_sink_states { #define DP_SOURCE_BACKLIGHT_CURRENT_PEAK 0x326 #define DP_SOURCE_BACKLIGHT_CONTROL 0x32E #define DP_SOURCE_BACKLIGHT_ENABLE 0x32F +#define DP_SINK_DRR_GRANULARITY 0x33B #define DP_SOURCE_MINIMUM_HBLANK_SUPPORTED 0x340 #define DP_SINK_PR_REPLAY_STATUS 0x378 #define DP_SINK_PR_PIXEL_DEVIATION_PER_LINE 0x379 -- 2.47.3