drm/dp: AS SDP cleanups and additions for Panel Replay + VRR
cover drm/dp: AS SDP cleanups and additions for Panel Replay + VRR
This is a subset of patches separated from the series at
https://patchwork.freedesktop.org/series/164512/ for merging.
These are drm-core (drm/dp) patches that clean up and extend the Adaptive Sync SDP definitions and helpers in preparation for Panel Replay + VRR support.
Ankit Nautiyal (7):
drm/dp: Rename and relocate AS SDP payload field masks drm/dp: Clean up DPRX feature enumeration macros drm/dp: Add bits for AS SDP FAVT Payload Fields Parsing support drm/dp: Add DPCD for configuring AS SDP for PR + VRR drm/dp: Store coasting vtotal in struct drm_dp_as_sdp drm/dp: Add a helper to get the SDP type as a string drm/dp: Add target_rr_divider field in AS SDP logging
drivers/gpu/drm/display/drm_dp_helper.c | 39 ++++++++++++++++++++++--- drivers/gpu/drm/i915/display/intel_dp.c | 4 +-- include/drm/display/drm_dp.h | 20 +++++++++---- include/drm/display/drm_dp_helper.h | 1 + 4 files changed, 52 insertions(+), 12 deletions(-)
Signature · 1 line
2.45.2
PATCH 1/7 drm/dp: Rename and relocate AS SDP payload field masks
The AS SDP payload field masks were misnamed and placed under the DPRX feature enumeration list. These are not DPRX capability bits, but are payload field masks for the Adaptive Sync SDP.
Relocate both masks next to the AS SDP definitions. Update users to the corrected names. No functional change.
--- drivers/gpu/drm/i915/display/intel_dp.c | 4 ++-- include/drm/display/drm_dp.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +2 -2
@@ -5354,8 +5354,8 @@ int intel_dp_as_sdp_unpack(struct drm_dp_as_sdp *as_sdp,if ((sdp->sdp_header.HB3 &0x3F ) !=9 )return -EINVAL ; - as_sdp->length = sdp->sdp_header.HB3 &DP_ADAPTIVE_SYNC_SDP_LENGTH ; - as_sdp->mode = sdp->db[0 ] &DP_ADAPTIVE_SYNC_SDP_OPERATION_MODE ; + as_sdp->length = sdp->sdp_header.HB3 &DP_AS_SDP_LENGTH_MASK ; + as_sdp->mode = sdp->db[0 ] &DP_AS_SDP_OPERATION_MODE_MASK ; as_sdp->vtotal = (sdp->db[2 ] <<8 ) | sdp->db[1 ]; as_sdp->target_rr = (u64 )sdp->db[3 ] | ((u64 )sdp->db[4 ] &0x3 ); as_sdp->target_rr_divider = sdp->db[4 ] &0x20 ? true : false;
include/drm/display/drm_dp.h +3 -2
@@ -1204,8 +1204,6 @@#define DP_DPRX_FEATURE_ENUMERATION_LIST_CONT_1 0x2214/* 2.0 E11 */ # define DP_ADAPTIVE_SYNC_SDP_SUPPORTED (1 << 0) -# define DP_ADAPTIVE_SYNC_SDP_OPERATION_MODE GENMASK(1, 0) -# define DP_ADAPTIVE_SYNC_SDP_LENGTH GENMASK(5, 0)# define DP_AS_SDP_FIRST_HALF_LINE_OR_3840_PIXEL_CYCLE_WINDOW_NOT_SUPPORTED (1 << 1)# define DP_VSC_EXT_SDP_FRAMEWORK_VERSION_1_SUPPORTED (1 << 4)
@@ -1870,4 +1868,7 @@ enum operation_mode {DP_AS_SDP_FAVT_TRR_REACHED =0x03 }; +#define DP_AS_SDP_OPERATION_MODE_MASK GENMASK(1, 0) +#define DP_AS_SDP_LENGTH_MASK GENMASK(5, 0) +#endif /* _DRM_DP_H_ */
Signature · 1 line
2.45.2
PATCH 2/7 drm/dp: Clean up DPRX feature enumeration macros
In reply to Ankit NautiyalAlign the DP_DPRX feature enumeration macros for better readability and consistency, and use the BIT() macro instead of open-coded shifts.
--- include/drm/display/drm_dp.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/drm/display/drm_dp.h +4 -4
@@ -1202,10 +1202,10 @@# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS 0x04# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS 0x05 -#define DP_DPRX_FEATURE_ENUMERATION_LIST_CONT_1 0x2214/* 2.0 E11 */ -# define DP_ADAPTIVE_SYNC_SDP_SUPPORTED (1 << 0) -# define DP_AS_SDP_FIRST_HALF_LINE_OR_3840_PIXEL_CYCLE_WINDOW_NOT_SUPPORTED (1 << 1) -# define DP_VSC_EXT_SDP_FRAMEWORK_VERSION_1_SUPPORTED (1 << 4) +#define DP_DPRX_FEATURE_ENUMERATION_LIST_CONT_1 0x2214/* 2.0 E11 */ +# define DP_ADAPTIVE_SYNC_SDP_SUPPORTED BIT(0) +# define DP_AS_SDP_FIRST_HALF_LINE_OR_3840_PIXEL_CYCLE_WINDOW_NOT_SUPPORTED BIT(1) +# define DP_VSC_EXT_SDP_FRAMEWORK_VERSION_1_SUPPORTED BIT(4)#define DP_128B132B_SUPPORTED_LINK_RATES 0x2215/* 2.0 */ # define DP_UHBR10 (1 << 0)
Signature · 1 line
2.45.2
PATCH 3/7 drm/dp: Add bits for AS SDP FAVT Payload Fields Parsing support
In reply to Ankit NautiyalDP v2.1 introduced support for sending AS SDP payload bytes for FAVT. Add the relavant bits for the same.
--- include/drm/display/drm_dp.h | 1 + 1 file changed, 1 insertion(+)
include/drm/display/drm_dp.h +1 -0
@@ -1205,6 +1205,7 @@#define DP_DPRX_FEATURE_ENUMERATION_LIST_CONT_1 0x2214/* 2.0 E11 */ # define DP_ADAPTIVE_SYNC_SDP_SUPPORTED BIT(0)# define DP_AS_SDP_FIRST_HALF_LINE_OR_3840_PIXEL_CYCLE_WINDOW_NOT_SUPPORTED BIT(1) +# define DP_AS_SDP_FAVT_PAYLOAD_FIELDS_PARSING_SUPPORTED BIT(2)/* 2.1 */ # define DP_VSC_EXT_SDP_FRAMEWORK_VERSION_1_SUPPORTED BIT(4)#define DP_128B132B_SUPPORTED_LINK_RATES 0x2215/* 2.0 */
Signature · 1 line
2.45.2
PATCH 4/7 drm/dp: Add DPCD for configuring AS SDP for PR + VRR
In reply to Ankit NautiyalAdd additional DPCDs required to be configured to support VRR with Panel Replay. These DPCDs are specifically required for configuring Adaptive Sync SDP and are introduced in DP v2.1.
v2:
- Correct the shift for the bits. (Ville)
- Add DP_PR_ prefix for the PR-related fields.
v3:
- Use macro values in their shifted form to match the convention. (Ville)
v4:
- Add macro for the mask. (Ville)
--- include/drm/display/drm_dp.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/drm/display/drm_dp.h +6 -0
@@ -718,6 +718,12 @@#define DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT 0x119/* 1.4a */ # define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED (1 << 0) +#define PANEL_REPLAY_CONFIG3 0x11a/* DP 2.1 */ +# define DP_PR_AS_SDP_SETUP_TIME_MASK (3 << 6) +# define DP_PR_AS_SDP_SETUP_TIME_T1 (0 << 6) +# define DP_PR_AS_SDP_SETUP_TIME_DYNAMIC (1 << 6)/* DP 2.1 Table 2-227 */ +# define DP_PR_AS_SDP_SETUP_TIME_T2 (2 << 6) +#define DP_FEC_CONFIGURATION 0x120/* 1.4 */ # define DP_FEC_READY (1 << 0)# define DP_FEC_ERR_COUNT_SEL_MASK (7 << 1)
Signature · 1 line
2.45.2
PATCH 5/7 drm/dp: Store coasting vtotal in struct drm_dp_as_sdp
In reply to Ankit NautiyalAdd new field in struct drm_dp_as_sdp to store coasting vtotal. This is used by the sinks that support Panel Replay and Asynchronous timing during PR Active to derive refresh rate, when AS SDP transmission is stopped by the source.
--- drivers/gpu/drm/display/drm_dp_helper.c | 1 + include/drm/display/drm_dp_helper.h | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/display/drm_dp_helper.c +1 -0
@@ -3512,6 +3512,7 @@ void drm_dp_as_sdp_log(struct drm_printer *p, const struct drm_dp_as_sdp *as_sdpdrm_printf (p," duration_incr_ms: %d\n" , as_sdp->duration_incr_ms);drm_printf (p," duration_decr_ms: %d\n" , as_sdp->duration_decr_ms);drm_printf (p," operation_mode: %d\n" , as_sdp->mode); +drm_printf (p," coasting vtotal: %d\n" , as_sdp->coasting_vtotal); }EXPORT_SYMBOL (drm_dp_as_sdp_log);
include/drm/display/drm_dp_helper.h +1 -0
@@ -126,6 +126,7 @@ struct drm_dp_as_sdp {int duration_decr_ms;bool target_rr_divider;enum operation_mode mode; +int coasting_vtotal; }; void drm_dp_as_sdp_log(struct drm_printer *p,
Signature · 1 line
2.45.2
PATCH 6/7 drm/dp: Add a helper to get the SDP type as a string
In reply to Ankit NautiyalIntroduce dp_sdp_type_get_name() to get the SDP type as a string. Use this to log the SDP type based on the sdp_type fields of the VSC and AS SDPs instead of the hardcoded strings.
While at it, rename "SDP : AS_SDP" to "SDP : Adaptive Sync"
--- drivers/gpu/drm/display/drm_dp_helper.c | 36 ++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-)
drivers/gpu/drm/display/drm_dp_helper.c +32 -4
@@ -3487,10 +3487,38 @@ static const char *dp_content_type_get_name(enum dp_content_type content_type) } } +static const char *dp_sdp_type_get_name (unsigned char type) +{ +switch (type) { +case DP_SDP_AUDIO_TIMESTAMP : +return "Audio Timestamp" ; +case DP_SDP_AUDIO_STREAM : +return "Audio Stream" ; +case DP_SDP_EXTENSION : +return "Extension" ; +case DP_SDP_AUDIO_COPYMANAGEMENT : +return "Audio Copy Management" ; +case DP_SDP_ISRC : +return "ISRC" ; +case DP_SDP_VSC : +return "VSC" ; +case DP_SDP_PPS : +return "PPS" ; +case DP_SDP_VSC_EXT_VESA : +return "VSC EXT VESA" ; +case DP_SDP_VSC_EXT_CEA : +return "VSC EXT CEA" ; +case DP_SDP_ADAPTIVE_SYNC : +return "Adaptive Sync" ; +default : +return "Unknown" ; + } +} +void drm_dp_vsc_sdp_log (struct drm_printer *p,const struct drm_dp_vsc_sdp *vsc) { -drm_printf (p,"DP SDP: VSC, revision %u, length %u\n" , - vsc->revision, vsc->length); +drm_printf (p,"DP SDP: %s, revision %u, length %u\n" , +dp_sdp_type_get_name (vsc->sdp_type), vsc->revision, vsc->length);drm_printf (p," pixelformat: %s\n" ,dp_pixelformat_get_name (vsc->pixelformat)); drm_printf(p, " colorimetry: %s\n",
@@ -3505,8 +3533,8 @@ EXPORT_SYMBOL(drm_dp_vsc_sdp_log);void drm_dp_as_sdp_log (struct drm_printer *p,const struct drm_dp_as_sdp *as_sdp) { -drm_printf (p,"DP SDP: AS_SDP, revision %u, length %u\n" , - as_sdp->revision, as_sdp->length); +drm_printf (p,"DP SDP: %s, revision %u, length %u\n" , +dp_sdp_type_get_name (as_sdp->sdp_type), as_sdp->revision, as_sdp->length);drm_printf (p," vtotal: %d\n" , as_sdp->vtotal);drm_printf (p," target_rr: %d\n" , as_sdp->target_rr);drm_printf (p," duration_incr_ms: %d\n" , as_sdp->duration_incr_ms);
Signature · 1 line
2.45.2
PATCH 7/7 drm/dp: Add target_rr_divider field in AS SDP logging
In reply to Ankit NautiyalThe field target_rr_divider is missing from the AS SDP logging. Add it and print the divider value (1.001 or 1.000) as per the DP 2.1 spec.
--- drivers/gpu/drm/display/drm_dp_helper.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/display/drm_dp_helper.c +2 -0
@@ -3537,6 +3537,8 @@ void drm_dp_as_sdp_log(struct drm_printer *p, const struct drm_dp_as_sdp *as_sdp dp_sdp_type_get_name(as_sdp->sdp_type), as_sdp->revision, as_sdp->length);drm_printf (p," vtotal: %d\n" , as_sdp->vtotal);drm_printf (p," target_rr: %d\n" , as_sdp->target_rr); +drm_printf (p," target_rr_divider: %s\n" , + as_sdp->target_rr_divider ?"1.001" :"1.000" );drm_printf (p," duration_incr_ms: %d\n" , as_sdp->duration_incr_ms);drm_printf (p," duration_decr_ms: %d\n" , as_sdp->duration_decr_ms);drm_printf (p," operation_mode: %d\n" , as_sdp->mode);
Signature · 1 line
2.45.2