From: weiguali <[email protected]>

[Why&How]
Support DRR granularity for coasting Vtotal calculation

Reviewed-by: Robin Chen <[email protected]>
Reviewed-by: Wenjing Liu <[email protected]>
Signed-off-by: Weiguang Li <[email protected]>
Signed-off-by: Chenyu Chen <[email protected]>
---
 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 79e1696def63..273610d85438 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 3884851e2a9e..54c417928b61 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 07b937b92efc..8445c540f042 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.43.0

Reply via email to