Skip to content

Commit ec8e59c

Browse files
Bhawanpreet Lakhaalexdeucher
authored andcommitted
drm/amd/display: Get replay info from VSDB
We need to make sure that the panel supports replay. This info is inside the amd vsdb (vendor specific data block). Create a function to parse the block and read the replay_mode bit. Signed-off-by: Bhawanpreet Lakha <[email protected]> Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 7957ec8 commit ec8e59c

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10490,6 +10490,41 @@ static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector,
1049010490
return ret;
1049110491
}
1049210492

10493+
static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector,
10494+
struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info)
10495+
{
10496+
u8 *edid_ext = NULL;
10497+
int i;
10498+
int j = 0;
10499+
10500+
if (edid == NULL || edid->extensions == 0)
10501+
return -ENODEV;
10502+
10503+
/* Find DisplayID extension */
10504+
for (i = 0; i < edid->extensions; i++) {
10505+
edid_ext = (void *)(edid + (i + 1));
10506+
if (edid_ext[0] == DISPLAYID_EXT)
10507+
break;
10508+
}
10509+
10510+
while (j < EDID_LENGTH) {
10511+
struct amd_vsdb_block *amd_vsdb = (struct amd_vsdb_block *)&edid_ext[j];
10512+
unsigned int ieeeId = (amd_vsdb->ieee_id[2] << 16) | (amd_vsdb->ieee_id[1] << 8) | (amd_vsdb->ieee_id[0]);
10513+
10514+
if (ieeeId == HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_IEEE_REGISTRATION_ID &&
10515+
amd_vsdb->version == HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_VERSION_3) {
10516+
vsdb_info->replay_mode = (amd_vsdb->feature_caps & AMD_VSDB_VERSION_3_FEATURECAP_REPLAYMODE) ? true : false;
10517+
vsdb_info->amd_vsdb_version = HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_VERSION_3;
10518+
DRM_DEBUG_KMS("Panel supports Replay Mode: %d\n", vsdb_info->replay_mode);
10519+
10520+
return true;
10521+
}
10522+
j++;
10523+
}
10524+
10525+
return false;
10526+
}
10527+
1049310528
static int parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector,
1049410529
struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info)
1049510530
{
@@ -10625,6 +10660,14 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
1062510660
freesync_capable = true;
1062610661
}
1062710662
}
10663+
parse_amd_vsdb(amdgpu_dm_connector, edid, &vsdb_info);
10664+
10665+
if (vsdb_info.replay_mode) {
10666+
amdgpu_dm_connector->vsdb_info.replay_mode = vsdb_info.replay_mode;
10667+
amdgpu_dm_connector->vsdb_info.amd_vsdb_version = vsdb_info.amd_vsdb_version;
10668+
amdgpu_dm_connector->as_type = ADAPTIVE_SYNC_TYPE_EDP;
10669+
}
10670+
1062810671
} else if (edid && sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A) {
1062910672
i = parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, &vsdb_info);
1063010673
if (i >= 0 && vsdb_info.freesync_supported) {

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151

5252
#define AMDGPU_DMUB_NOTIFICATION_MAX 5
5353

54+
#define HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_IEEE_REGISTRATION_ID 0x00001A
55+
#define AMD_VSDB_VERSION_3_FEATURECAP_REPLAYMODE 0x40
56+
#define HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_VERSION_3 0x3
5457
/*
5558
#include "include/amdgpu_dal_power_if.h"
5659
#include "amdgpu_dm_irq.h"
@@ -75,6 +78,12 @@ struct dmub_srv;
7578
struct dc_plane_state;
7679
struct dmub_notification;
7780

81+
struct amd_vsdb_block {
82+
unsigned char ieee_id[3];
83+
unsigned char version;
84+
unsigned char feature_caps;
85+
};
86+
7887
struct common_irq_params {
7988
struct amdgpu_device *adev;
8089
enum dc_irq_source irq_src;
@@ -609,6 +618,11 @@ struct amdgpu_hdmi_vsdb_info {
609618
* @max_refresh_rate_hz: FreeSync Maximum Refresh Rate in Hz
610619
*/
611620
unsigned int max_refresh_rate_hz;
621+
622+
/**
623+
* @replay mode: Replay supported
624+
*/
625+
bool replay_mode;
612626
};
613627

614628
struct amdgpu_dm_connector {

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ static bool link_supports_replay(struct dc_link *link, struct amdgpu_dm_connecto
4646
if (!state->freesync_capable)
4747
return false;
4848

49+
if (!aconnector->vsdb_info.replay_mode)
50+
return false;
51+
4952
// Check the eDP version
5053
if (dpcd_caps->edp_rev < EDP_REVISION_13)
5154
return false;
@@ -71,6 +74,10 @@ bool amdgpu_dm_setup_replay(struct dc_link *link, struct amdgpu_dm_connector *ac
7174
struct replay_config pr_config;
7275
union replay_debug_flags *debug_flags = NULL;
7376

77+
// For eDP, if Replay is supported, return true to skip checks
78+
if (link->replay_settings.config.replay_supported)
79+
return true;
80+
7481
if (!dc_is_embedded_signal(link->connector_signal))
7582
return false;
7683

0 commit comments

Comments
 (0)