Skip to content

Commit a7b1dd1

Browse files
Lawstorant1Naim
authored andcommitted
drm/amd/display: Support HDMI VRRmax=0
[Why] VRRmax=0 is a valid value and means that the upper bound is guared by the selected video mode. [How] In this context, saved vrr max is the max possible refresh rate ever. Try getting upper VRR bound from AMD vsdbif it exists or rely on the limitations of BRR in VTEM info frames. I found through testing, that TVs seem to reject VTEM when BRR is set to over 1023 Hz. Use this as the last resort VRRmax. 1023 is the max value for a 10-bit field as well. Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
1 parent 05666a1 commit a7b1dd1

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13268,14 +13268,27 @@ static void monitor_range_from_vsdb(struct drm_display_info *display,
1326813268
}
1326913269

1327013270
/**
13271-
* Get VRR range from HDMI VRR info in EDID.
13271+
* Get VRR range from HDMI VRR info in EDID. If VRRmax == 0,
13272+
* try getting upper bound from AMD vsdb.
1327213273
*
1327313274
* @conn: drm_connector with HDMI VRR info
13275+
* @vsdb: AMD vsdb from CAE
1327413276
*/
13275-
static void monitor_range_from_hdmi(struct drm_display_info *display)
13277+
static void monitor_range_from_hdmi(struct drm_display_info *display,
13278+
const struct amdgpu_hdmi_vsdb_info *vsdb)
1327613279
{
13280+
u16 vrr_max = display->hdmi.vrr_cap.vrr_max;
13281+
13282+
/* Try getting upper vrr bound from AMD vsdb */
13283+
if (vrr_max == 0)
13284+
vrr_max = vsdb->max_refresh_rate_hz;
13285+
13286+
/* Use max possible BRR value as a last resort */
13287+
if (vrr_max == 0)
13288+
vrr_max = VTEM_BRR_MAX;
13289+
1327713290
display->monitor_range.min_vfreq = display->hdmi.vrr_cap.vrr_min;
13278-
display->monitor_range.max_vfreq = display->hdmi.vrr_cap.vrr_max;
13291+
display->monitor_range.max_vfreq = vrr_max;
1327913292
}
1328013293

1328113294
/*
@@ -13422,8 +13435,8 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
1342213435
/* DP -> HDMI PCON */
1342313436
} else if (pcon_allowed) {
1342413437
/* Prefer HDMI VRR */
13425-
if (hdmi_vrr.supported && hdmi_vrr.vrr_max > 0)
13426-
monitor_range_from_hdmi(&connector->display_info);
13438+
if (hdmi_vrr.supported)
13439+
monitor_range_from_hdmi(&connector->display_info, &vsdb_info);
1342713440
else if (vsdb_info.freesync_supported) {
1342813441
amdgpu_dm_connector->vsdb_info = vsdb_info;
1342913442
monitor_range_from_vsdb(&connector->display_info, &vsdb_info);

drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ struct dc_stream_state;
3333
struct dc_info_packet;
3434
struct mod_vrr_params;
3535

36+
#define VTEM_BRR_MAX 1023
37+
3638
void set_vsc_packet_colorimetry_data(
3739
const struct dc_stream_state *stream,
3840
struct dc_info_packet *info_packet,

0 commit comments

Comments
 (0)