drm/amd/display: Use drm_edid for more code
Subsystems (3)
v6 cover drm/amd/display: Use drm_edid for more code
From: Mario Limonciello <[email protected]>
This is the successor of Melissa's v5 series that was posted [1] as well as my series that was posted [2].
Melissa's patches are mostly unmodified from v5, but modified to apply on top of v6.11-rc7 instead.
The same limitations she called out with amd-staging-drm-next missing symbols from the development release still apply. So applying this series will probably need to wait for that to be rebased.
As were both touching similar code for fetching the EDID, I've merged the pertinent parts of my series into this one in allowing the connector to fetch the EDID from _DDC if available for eDP as well.
There are still some remaining uses of drm_edid_raw() but they touch pure DC code, so a wrapper or macro will probably be needed to convert them. This can be for follow ups later on.
Mario Limonciello (1):
drm/amd: Fetch the EDID from _DDC if available for eDP
Melissa Wen (9):
drm/amd/display: switch amdgpu_dm_connector to use struct drm_edid drm/amd/display: switch to setting physical address directly drm/amd/display: always call connector_update when parsing
freesync_caps
drm/amd/display: remove redundant freesync parser for DP drm/amd/display: use drm_edid_product_id for parsing EDID product info drm/amd/display: parse display name from drm_eld drm/amd/display: get SAD from drm_eld when parsing EDID caps drm/amd/display: get SADB from drm_eld when parsing EDID caps drm/amd/display: remove dc_edid handler from
dm_helpers_parse_edid_caps
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 215 +++++------------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 4 +- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 173 +++++++++----- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 34 +-- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 1 - .../drm/amd/display/dc/link/link_detection.c | 6 +- drivers/gpu/drm/amd/include/amd_shared.h | 1 + 7 files changed, 196 insertions(+), 238 deletions(-)
Signature · 1 line
2.43.0
PATCH v6 1/10 drm/amd/display: switch amdgpu_dm_connector to use struct drm_edid
From: Melissa Wen <[email protected]>
Replace raw edid handling (struct edid) with the opaque EDID type (struct drm_edid) on amdgpu_dm_connector for consistency. It may also prevent mismatch of approaches in different parts of the driver code.
---
v6: Move changelog to cutlist
Update text of commit message
Add missing newline (checkpatch.pl)
Split long line in dm_dp_mst_get_modes()
v5: remove deprecated comments (Alex H)
use edid from dc_sink instead of call drm_edid_raw for now (Alex H) remove unnecessary cast (Alex H)
v4: rename edid to drm_edid in amdgpu_connector (Jani)
call drm_edid_connector_update to clear edid in case of NULL (Jani) keep setting NULL instead of free drm_edid (Jani)
check drm_edid not NULL, instead of valid (Jani)
v3: fix general protection fault on mst
v2: use const to fix warnings (Alex Hung)
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 121 ++++++++---------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 4 +- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 13 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 34 ++--- 4 files changed, 83 insertions(+), 89 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +54 -67
@@ -3436,7 +3436,7 @@ void amdgpu_dm_update_connector_after_detect( aconnector->dc_sink = sink;dc_sink_retain (aconnector->dc_sink);amdgpu_dm_update_freesync_caps (connector, - aconnector->edid); + aconnector->drm_edid); }else {amdgpu_dm_update_freesync_caps (connector,NULL );if (!aconnector->dc_sink) {
@@ -3495,18 +3495,19 @@ void amdgpu_dm_update_connector_after_detect( aconnector->dc_sink = sink;dc_sink_retain (aconnector->dc_sink);if (sink->dc_edid.length ==0 ) { - aconnector->edid =NULL ; + aconnector->drm_edid =NULL ;if (aconnector->dc_link->aux_mode) {drm_dp_cec_unset_edid ( &aconnector->dm_dp_aux.aux); } }else { - aconnector->edid = - (struct edid *)sink->dc_edid.raw_edid; +const struct edid *edid = (const struct edid *)sink->dc_edid.raw_edid; + + aconnector->drm_edid =drm_edid_alloc (edid, sink->dc_edid.length); +drm_edid_connector_update (connector, aconnector->drm_edid);if (aconnector->dc_link->aux_mode) -drm_dp_cec_set_edid (&aconnector->dm_dp_aux.aux, - aconnector->edid); +drm_dp_cec_set_edid (&aconnector->dm_dp_aux.aux, edid); }if (!aconnector->timing_requested) {
@@ -3517,17 +3518,18 @@ void amdgpu_dm_update_connector_after_detect( "failed to create aconnector->requested_timing\n"); } -drm_connector_update_edid_property (connector, aconnector->edid); -amdgpu_dm_update_freesync_caps (connector, aconnector->edid); +drm_edid_connector_update (connector, aconnector->drm_edid); +amdgpu_dm_update_freesync_caps (connector, aconnector->drm_edid);update_connector_ext_caps (aconnector); }else {drm_dp_cec_unset_edid (&aconnector->dm_dp_aux.aux);amdgpu_dm_update_freesync_caps (connector,NULL ); -drm_connector_update_edid_property (connector,NULL ); +drm_edid_connector_update (connector,NULL ); aconnector->num_modes =0 ;dc_sink_release (aconnector->dc_sink); aconnector->dc_sink =NULL ; - aconnector->edid =NULL ; +drm_edid_free (aconnector->drm_edid); + aconnector->drm_edid =NULL ;kfree (aconnector->timing_requested); aconnector->timing_requested =NULL ;/* Set CP to DESIRED if it was ENABLED, so we can re-enable it again on hotplug */
@@ -7041,32 +7043,24 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)struct amdgpu_dm_connector *aconnector =to_amdgpu_dm_connector (connector);struct dc_link *dc_link = aconnector->dc_link;struct dc_sink *dc_em_sink = aconnector->dc_em_sink; -struct edid *edid; -struct i2c_adapter *ddc; - -if (dc_link && dc_link->aux_mode) - ddc = &aconnector->dm_dp_aux.aux.ddc; -else - ddc = &aconnector->i2c->base; +const struct drm_edid *drm_edid; -/* -* Note: drm_get_edid gets edid in the following order: -* 1) override EDID if set via edid_override debugfs, -* 2) firmware EDID if set via edid_firmware module parameter -* 3) regular DDC read. -*/ - edid =drm_get_edid (connector, ddc); -if (!edid) { + drm_edid =drm_edid_read (connector); +drm_edid_connector_update (connector, drm_edid); +if (!drm_edid) {DRM_ERROR ("No EDID found on connector: %s.\n" , connector->name);return ; } - aconnector->edid = edid; - + aconnector->drm_edid = drm_edid;/* Update emulated (virtual) sink's EDID */ if (dc_em_sink && dc_link) { +// FIXME: Get rid of drm_edid_raw() +const struct edid *edid =drm_edid_raw (drm_edid); +memset (&dc_em_sink->edid_caps,0 ,sizeof (struct dc_edid_caps )); -memmove (dc_em_sink->dc_edid.raw_edid, edid, (edid->extensions +1 ) *EDID_LENGTH ); +memmove (dc_em_sink->dc_edid.raw_edid, edid, + (edid->extensions +1 ) *EDID_LENGTH ); dm_helpers_parse_edid_caps( dc_link, &dc_em_sink->dc_edid,
@@ -7096,36 +7090,26 @@ static int get_modes(struct drm_connector *connector)static void create_eml_sink (struct amdgpu_dm_connector *aconnector) {struct drm_connector *connector = &aconnector->base; -struct dc_link *dc_link = aconnector->dc_link;struct dc_sink_init_data init_params = { .link = aconnector->dc_link, .sink_signal =SIGNAL_TYPE_VIRTUAL }; -struct edid *edid; -struct i2c_adapter *ddc; - -if (dc_link->aux_mode) - ddc = &aconnector->dm_dp_aux.aux.ddc; -else - ddc = &aconnector->i2c->base; +const struct drm_edid *drm_edid; +const struct edid *edid; -/* -* Note: drm_get_edid gets edid in the following order: -* 1) override EDID if set via edid_override debugfs, -* 2) firmware EDID if set via edid_firmware module parameter -* 3) regular DDC read. -*/ - edid =drm_get_edid (connector, ddc); -if (!edid) { + drm_edid =drm_edid_read (connector); +drm_edid_connector_update (connector, drm_edid); +if (!drm_edid) {DRM_ERROR ("No EDID found on connector: %s.\n" , connector->name);return ; } -if (drm_detect_hdmi_monitor (edid)) +if (connector->display_info.is_hdmi) init_params.sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ; - aconnector->edid = edid; + aconnector->drm_edid = drm_edid; + edid =drm_edid_raw (drm_edid);// FIXME: Get rid of drm_edid_raw() aconnector->dc_em_sink = dc_link_add_remote_sink( aconnector->dc_link, (uint8_t *)edid,
@@ -7809,16 +7793,16 @@ static void amdgpu_set_panel_orientation(struct drm_connector *connector) }static void amdgpu_dm_connector_ddc_get_modes (struct drm_connector *connector, -struct edid *edid) +const struct drm_edid *drm_edid) {struct amdgpu_dm_connector *amdgpu_dm_connector =to_amdgpu_dm_connector (connector); -if (edid) { +if (drm_edid) {/* empty probed_modes */ INIT_LIST_HEAD (&connector->probed_modes); amdgpu_dm_connector->num_modes = -drm_add_edid_modes (connector, edid); +drm_edid_connector_add_modes (connector);/* sorting the probed modes before calling function * amdgpu_dm_get_native_mode() since EDID can have
@@ -7832,10 +7816,10 @@ static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector,amdgpu_dm_get_native_mode (connector);/* Freesync capabilities are reset by calling -* drm_add_edid_modes() and need to be +* drm_edid_connector_add_modes() and need to be * restored here. */ -amdgpu_dm_update_freesync_caps (connector, edid); +amdgpu_dm_update_freesync_caps (connector, drm_edid); }else { amdgpu_dm_connector->num_modes =0 ; }
@@ -7931,12 +7915,12 @@ static uint add_fs_modes(struct amdgpu_dm_connector *aconnector) }static void amdgpu_dm_connector_add_freesync_modes (struct drm_connector *connector, -struct edid *edid) +const struct drm_edid *drm_edid) {struct amdgpu_dm_connector *amdgpu_dm_connector =to_amdgpu_dm_connector (connector); -if (!(amdgpu_freesync_vid_mode && edid)) +if (!(amdgpu_freesync_vid_mode && drm_edid))return ;if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq >10 )
@@ -7949,24 +7933,24 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)struct amdgpu_dm_connector *amdgpu_dm_connector =to_amdgpu_dm_connector (connector);struct drm_encoder *encoder; -struct edid *edid = amdgpu_dm_connector->edid; +const struct drm_edid *drm_edid = amdgpu_dm_connector->drm_edid;struct dc_link_settings *verified_link_cap = &amdgpu_dm_connector->dc_link->verified_link_cap;const struct dc *dc = amdgpu_dm_connector->dc_link->dc; encoder =amdgpu_dm_connector_to_encoder (connector); -if (!drm_edid_is_valid (edid)) { +if (!drm_edid) { amdgpu_dm_connector->num_modes =drm_add_modes_noedid (connector,640 ,480 );if (dc->link_srv->dp_get_encoding_format (verified_link_cap) == DP_128b_132b_ENCODING) amdgpu_dm_connector->num_modes +=drm_add_modes_noedid (connector,1920 ,1080 ); }else { -amdgpu_dm_connector_ddc_get_modes (connector, edid); +amdgpu_dm_connector_ddc_get_modes (connector, drm_edid);if (encoder)amdgpu_dm_connector_add_common_modes (encoder, connector); -amdgpu_dm_connector_add_freesync_modes (connector, edid); +amdgpu_dm_connector_add_freesync_modes (connector, drm_edid); }amdgpu_dm_fbc_init (connector);
@@ -11905,7 +11889,7 @@ static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector, }static void parse_edid_displayid_vrr (struct drm_connector *connector, -struct edid *edid) +const struct edid *edid) {u8 *edid_ext =NULL ;int i;
@@ -11948,7 +11932,7 @@ static void parse_edid_displayid_vrr(struct drm_connector *connector, }static int parse_amd_vsdb (struct amdgpu_dm_connector *aconnector, -struct edid *edid,struct amdgpu_hdmi_vsdb_info *vsdb_info) +const struct edid *edid,struct amdgpu_hdmi_vsdb_info *vsdb_info) {u8 *edid_ext =NULL ;int i;
@@ -11983,7 +11967,8 @@ static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector, }static int parse_hdmi_amd_vsdb (struct amdgpu_dm_connector *aconnector, -struct edid *edid,struct amdgpu_hdmi_vsdb_info *vsdb_info) +const struct edid *edid, +struct amdgpu_hdmi_vsdb_info *vsdb_info) {u8 *edid_ext =NULL ;int i;
@@ -12025,19 +12010,19 @@ static int parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector,* FreeSync parameters. */ void amdgpu_dm_update_freesync_caps (struct drm_connector *connector, -struct edid *edid) +const struct drm_edid *drm_edid) {int i =0 ; -struct detailed_timing *timing; -struct detailed_non_pixel *data; -struct detailed_data_monitor_range *range; +const struct detailed_timing *timing; +const struct detailed_non_pixel *data; +const struct detailed_data_monitor_range *range;struct amdgpu_dm_connector *amdgpu_dm_connector =to_amdgpu_dm_connector (connector);struct dm_connector_state *dm_con_state =NULL ;struct dc_sink *sink; -struct amdgpu_device *adev =drm_to_adev (connector->dev);struct amdgpu_hdmi_vsdb_info vsdb_info = {0 }; +const struct edid *edid;bool freesync_capable = false;enum adaptive_sync_type as_type =ADAPTIVE_SYNC_TYPE_NONE ;
@@ -12050,7 +12035,7 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector->dc_sink : amdgpu_dm_connector->dc_em_sink; -if (!edid || !sink) { +if (!drm_edid || !sink) { dm_con_state =to_dm_connector_state (connector->state); amdgpu_dm_connector->min_vfreq =0 ;
@@ -12067,6 +12052,8 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,if (!adev->dm.freesync_module) goto update; + edid =drm_edid_raw (drm_edid);// FIXME: Get rid of drm_edid_raw() +/* Some eDP panels only have the refresh rate range info in DisplayID */ if ((connector->display_info.monitor_range.min_vfreq ==0 || connector->display_info.monitor_range.max_vfreq ==0 ))
@@ -12143,7 +12130,7 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector->as_type =ADAPTIVE_SYNC_TYPE_EDP ; } - }else if (edid && sink->sink_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) { + }else if (drm_edid && sink->sink_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) { i =parse_hdmi_amd_vsdb (amdgpu_dm_connector, edid, &vsdb_info);if (i >=0 && vsdb_info.freesync_supported) { timing = &edid->detailed_timings[i];
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +2 -2
@@ -673,7 +673,7 @@ struct amdgpu_dm_connector {/* we need to mind the EDID between detect and get modes due to analog/digital/tvencoder */ -struct edid *edid; +const struct drm_edid *drm_edid;/* shared with amdgpu */ struct amdgpu_hpd hpd;
@@ -951,7 +951,7 @@ void dm_restore_drm_connector_state(struct drm_device *dev, struct drm_connector *connector);void amdgpu_dm_update_freesync_caps (struct drm_connector *connector, -struct edid *edid); +const struct drm_edid *drm_edid);void amdgpu_dm_trigger_timing_sync (struct drm_device *dev);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +8 -5
@@ -897,7 +897,8 @@ enum dc_edid_status dm_helpers_read_local_edid(struct i2c_adapter *ddc;int retry =3 ;enum dc_edid_status edid_status; -struct edid *edid; +const struct drm_edid *drm_edid; +const struct edid *edid;if (link->aux_mode) ddc = &aconnector->dm_dp_aux.aux.ddc;
@@ -909,25 +910,27 @@ enum dc_edid_status dm_helpers_read_local_edid(*/ do { - edid = drm_get_edid(&aconnector->base, ddc); + drm_edid = drm_edid_read_ddc(connector, ddc); + drm_edid_connector_update(connector, drm_edid); /* DP Compliance Test 4.2.2.6 */ if (link->aux_mode && connector->edid_corrupt) drm_dp_send_real_edid_checksum(&aconnector->dm_dp_aux.aux, connector->real_edid_checksum); - if (!edid && connector->edid_corrupt) { + if (!drm_edid && connector->edid_corrupt) { connector->edid_corrupt = false; return EDID_BAD_CHECKSUM; } - if (!edid) + if (!drm_edid) return EDID_NO_RESPONSE; + edid = drm_edid_raw(drm_edid); // FIXME: Get rid of drm_edid_raw() sink->dc_edid.length = EDID_LENGTH * (edid->extensions + 1); memmove(sink->dc_edid.raw_edid, (uint8_t *)edid, sink->dc_edid.length); /* We don't need the original edid anymore */ - kfree(edid); + drm_edid_free(drm_edid); edid_status = dm_helpers_parse_edid_caps( link,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +19 -15
@@ -129,7 +129,7 @@ dm_dp_mst_connector_destroy(struct drm_connector *connector)dc_sink_release (aconnector->dc_sink); } -kfree (aconnector->edid); +drm_edid_free (aconnector->drm_edid);drm_connector_cleanup (connector);drm_dp_mst_put_port_malloc (aconnector->mst_output_port);
@@ -182,7 +182,7 @@ amdgpu_dm_mst_connector_early_unregister(struct drm_connector *connector)dc_sink_release (dc_sink); aconnector->dc_sink =NULL ; - aconnector->edid =NULL ; + aconnector->drm_edid =NULL ; aconnector->dsc_aux =NULL ; port->passthrough_aux =NULL ; }
@@ -302,16 +302,18 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)if (!aconnector)return drm_add_edid_modes (connector,NULL ); -if (!aconnector->edid) { -struct edid *edid; +if (!aconnector->drm_edid) { +const struct drm_edid *drm_edid; - edid =drm_dp_mst_get_edid (connector, &aconnector->mst_root->mst_mgr, aconnector->mst_output_port); + drm_edid =drm_dp_mst_edid_read (connector, + &aconnector->mst_root->mst_mgr, + aconnector->mst_output_port); -if (!edid) { +if (!drm_edid) {amdgpu_dm_set_mst_status (&aconnector->mst_status,MST_REMOTE_EDID , false); -drm_connector_update_edid_property ( +drm_edid_connector_update ( &aconnector->base,NULL );
@@ -345,7 +347,7 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)return ret; } - aconnector->edid = edid; + aconnector->drm_edid = drm_edid;amdgpu_dm_set_mst_status (&aconnector->mst_status,MST_REMOTE_EDID , true); }
@@ -360,10 +362,13 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)struct dc_sink_init_data init_params = { .link = aconnector->dc_link, .sink_signal =SIGNAL_TYPE_DISPLAY_PORT_MST }; +const struct edid *edid; + + edid =drm_edid_raw (aconnector->drm_edid);// FIXME: Get rid of drm_edid_raw() dc_sink =dc_link_add_remote_sink ( aconnector->dc_link, - (uint8_t *)aconnector->edid, - (aconnector->edid->extensions +1 ) *EDID_LENGTH , + (uint8_t *)edid, + (edid->extensions +1 ) *EDID_LENGTH , &init_params);if (!dc_sink) {
@@ -405,7 +410,7 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)if (aconnector->dc_sink) {amdgpu_dm_update_freesync_caps ( - connector, aconnector->edid); + connector, aconnector->drm_edid);#if defined(CONFIG_DRM_AMD_DC_FP )if (!validate_dsc_caps_on_connector (aconnector))
@@ -419,10 +424,9 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) } } -drm_connector_update_edid_property ( - &aconnector->base, aconnector->edid); +drm_edid_connector_update (&aconnector->base, aconnector->drm_edid); - ret =drm_add_edid_modes (connector, aconnector->edid); + ret =drm_edid_connector_add_modes (connector);return ret; }
@@ -500,7 +504,7 @@ dm_dp_mst_detect(struct drm_connector *connector,dc_sink_release (aconnector->dc_sink); aconnector->dc_sink =NULL ; - aconnector->edid =NULL ; + aconnector->drm_edid =NULL ; aconnector->dsc_aux =NULL ; port->passthrough_aux =NULL ;
Signature · 1 line
2.43.0
PATCH v6 2/10 drm/amd/display: switch to setting physical address directly
In reply to Mario LimoncielloFrom: Melissa Wen <[email protected]>
Connectors have source physical address available in display info. Use drm_dp_cec_attach() to use it instead of parsing the EDID again.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -3
@@ -3497,8 +3497,7 @@ void amdgpu_dm_update_connector_after_detect(if (sink->dc_edid.length ==0 ) { aconnector->drm_edid =NULL ;if (aconnector->dc_link->aux_mode) { -drm_dp_cec_unset_edid ( - &aconnector->dm_dp_aux.aux); +drm_dp_cec_unset_edid (&aconnector->dm_dp_aux.aux); } }else {const struct edid *edid = (const struct edid *)sink->dc_edid.raw_edid;
@@ -3507,7 +3506,8 @@ void amdgpu_dm_update_connector_after_detect(drm_edid_connector_update (connector, aconnector->drm_edid);if (aconnector->dc_link->aux_mode) -drm_dp_cec_set_edid (&aconnector->dm_dp_aux.aux, edid); +drm_dp_cec_attach (&aconnector->dm_dp_aux.aux, + connector->display_info.source_physical_address); }if (!aconnector->timing_requested) {
Signature · 1 line
2.43.0
PATCH v6 3/10 drm/amd/display: always call connector_update when parsing freesync_caps
In reply to Mario LimoncielloFrom: Melissa Wen <[email protected]>
Update connector caps with drm_edid data before parsing info for freesync.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -2
@@ -3518,13 +3518,11 @@ void amdgpu_dm_update_connector_after_detect( "failed to create aconnector->requested_timing\n"); } -drm_edid_connector_update (connector, aconnector->drm_edid);amdgpu_dm_update_freesync_caps (connector, aconnector->drm_edid);update_connector_ext_caps (aconnector); }else {drm_dp_cec_unset_edid (&aconnector->dm_dp_aux.aux);amdgpu_dm_update_freesync_caps (connector,NULL ); -drm_edid_connector_update (connector,NULL ); aconnector->num_modes =0 ;dc_sink_release (aconnector->dc_sink); aconnector->dc_sink =NULL ;
@@ -12035,6 +12033,8 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector->dc_sink : amdgpu_dm_connector->dc_em_sink; +drm_edid_connector_update (connector, drm_edid); +if (!drm_edid || !sink) { dm_con_state =to_dm_connector_state (connector->state);
Signature · 1 line
2.43.0
PATCH v6 4/10 drm/amd/display: remove redundant freesync parser for DP
In reply to Mario LimoncielloFrom: Melissa Wen <[email protected]>
When updating connector under drm_edid infrastructure, many calculations and validations are already done and become redundant inside AMD driver. Remove those driver-specific code in favor of the DRM common code.
---
v6:
* Drop unneeded is_dp_capable_without_timing_msa()
* Rebase on v6.11-rc7
* Add Co-developed-by tag
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 91 +------------------ 1 file changed, 4 insertions(+), 87 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -87
@@ -11737,25 +11737,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,return ret; } -static bool is_dp_capable_without_timing_msa (struct dc *dc, -struct amdgpu_dm_connector *amdgpu_dm_connector) -{ -u8 dpcd_data; -bool capable = false; - -if (amdgpu_dm_connector->dc_link && -dm_helpers_dp_read_dpcd ( -NULL , - amdgpu_dm_connector->dc_link, -DP_DOWN_STREAM_PORT_COUNT , - &dpcd_data, -sizeof (dpcd_data))) { - capable = (dpcd_data &DP_MSA_TIMING_PAR_IGNORED ) ? true:false; - } - -return capable; -} - static bool dm_edid_parser_send_cea(struct amdgpu_display_manager *dm, unsigned int offset, unsigned int total_length,
@@ -12011,9 +11992,6 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, const struct drm_edid *drm_edid) {int i =0 ; -const struct detailed_timing *timing; -const struct detailed_non_pixel *data; -const struct detailed_data_monitor_range *range;struct amdgpu_dm_connector *amdgpu_dm_connector =to_amdgpu_dm_connector (connector);struct dm_connector_state *dm_con_state =NULL ;
@@ -12040,8 +12018,6 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector->min_vfreq =0 ; amdgpu_dm_connector->max_vfreq =0 ; - connector->display_info.monitor_range.min_vfreq =0 ; - connector->display_info.monitor_range.max_vfreq =0 ; freesync_capable = false; goto update;
@@ -12061,67 +12037,12 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,if (edid && (sink->sink_signal ==SIGNAL_TYPE_DISPLAY_PORT || sink->sink_signal ==SIGNAL_TYPE_EDP )) { -bool edid_check_required = false; - -if (is_dp_capable_without_timing_msa (adev->dm.dc, - amdgpu_dm_connector)) { -if (edid->features &DRM_EDID_FEATURE_CONTINUOUS_FREQ ) { - amdgpu_dm_connector->min_vfreq = connector->display_info.monitor_range.min_vfreq; - amdgpu_dm_connector->max_vfreq = connector->display_info.monitor_range.max_vfreq; -if (amdgpu_dm_connector->max_vfreq - - amdgpu_dm_connector->min_vfreq >10 ) - freesync_capable = true; - }else { - edid_check_required = edid->version >1 || - (edid->version ==1 && - edid->revision >1 ); - } - } -if (edid_check_required) { -for (i =0 ; i <4 ; i++) { - - timing = &edid->detailed_timings[i]; - data = &timing->data.other_data; - range = &data->data.range; -/* -* Check if monitor has continuous frequency mode -*/ -if (data->type !=EDID_DETAIL_MONITOR_RANGE ) -continue ; -/* -* Check for flag range limits only. If flag == 1 then -* no additional timing information provided. -* Default GTF, GTF Secondary curve and CVT are not -* supported -*/ -if (range->flags !=1 ) -continue ; + amdgpu_dm_connector->min_vfreq = connector->display_info.monitor_range.min_vfreq; + amdgpu_dm_connector->max_vfreq = connector->display_info.monitor_range.max_vfreq; +if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq >10 ) + freesync_capable = true; - connector->display_info.monitor_range.min_vfreq = range->min_vfreq; - connector->display_info.monitor_range.max_vfreq = range->max_vfreq; - -if (edid->revision >=4 ) { -if (data->pad2 &DRM_EDID_RANGE_OFFSET_MIN_VFREQ ) - connector->display_info.monitor_range.min_vfreq +=255 ; -if (data->pad2 &DRM_EDID_RANGE_OFFSET_MAX_VFREQ ) - connector->display_info.monitor_range.max_vfreq +=255 ; - } - - amdgpu_dm_connector->min_vfreq = - connector->display_info.monitor_range.min_vfreq; - amdgpu_dm_connector->max_vfreq = - connector->display_info.monitor_range.max_vfreq; - -break ; - } - -if (amdgpu_dm_connector->max_vfreq - - amdgpu_dm_connector->min_vfreq >10 ) { - - freesync_capable = true; - } - }parse_amd_vsdb (amdgpu_dm_connector, edid, &vsdb_info);if (vsdb_info.replay_mode) {
@@ -12129,13 +12050,9 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector->vsdb_info.amd_vsdb_version = vsdb_info.amd_vsdb_version; amdgpu_dm_connector->as_type =ADAPTIVE_SYNC_TYPE_EDP ; } - }else if (drm_edid && sink->sink_signal ==SIGNAL_TYPE_HDMI_TYPE_A ) { i =parse_hdmi_amd_vsdb (amdgpu_dm_connector, edid, &vsdb_info);if (i >=0 && vsdb_info.freesync_supported) { - timing = &edid->detailed_timings[i]; - data = &timing->data.other_data; - amdgpu_dm_connector->min_vfreq = vsdb_info.min_refresh_rate_hz; amdgpu_dm_connector->max_vfreq = vsdb_info.max_refresh_rate_hz;if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq >10 )
Signature · 1 line
2.43.0
PATCH v6 5/10 drm/amd/display: use drm_edid_product_id for parsing EDID product info
In reply to Mario LimoncielloFrom: Melissa Wen <[email protected]>
Since [1], we can use drm_edid_product_id to get debug info from drm_edid instead of directly parsing EDID.
---
v6: Split apply_edid_quirks() to two lines
--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +20 -18
@@ -45,16 +45,16 @@#include "dm_helpers.h" #include "ddc_service_types.h" -static u32 edid_extract_panel_id (struct edid *edid) +static u32 edid_extract_panel_id (struct drm_edid_product_id *product_id) { -return (u32 )edid->mfg_id[0 ] <<24 | - (u32 )edid->mfg_id[1 ] <<16 | - (u32 )EDID_PRODUCT_ID (edid); +return (u32 )be16_to_cpu (product_id->manufacturer_name) <<16 | + (u32 )le16_to_cpu (product_id->product_code); } -static void apply_edid_quirks (struct edid *edid,struct dc_edid_caps *edid_caps) +static void apply_edid_quirks (struct drm_edid_product_id *product_id, +struct dc_edid_caps *edid_caps) { -uint32_t panel_id =edid_extract_panel_id (edid); +uint32_t panel_id =edid_extract_panel_id (product_id);switch (panel_id) {/* Workaround for some monitors which does not work well with FAMS */
@@ -94,6 +94,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps( {struct amdgpu_dm_connector *aconnector = link->priv;struct drm_connector *connector = &aconnector->base; +const struct drm_edid *drm_edid = aconnector->drm_edid; +struct drm_edid_product_id product_id;struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid :NULL ;struct cea_sad *sads;int sad_count =-1 ;
@@ -109,13 +111,13 @@ enum dc_edid_status dm_helpers_parse_edid_caps(if (!drm_edid_is_valid (edid_buf)) result =EDID_BAD_CHECKSUM ; - edid_caps->manufacturer_id = (uint16_t ) edid_buf->mfg_id[0 ] | - ((uint16_t ) edid_buf->mfg_id[1 ])<<8 ; - edid_caps->product_id = (uint16_t ) edid_buf->prod_code[0 ] | - ((uint16_t ) edid_buf->prod_code[1 ])<<8 ; - edid_caps->serial_number = edid_buf->serial; - edid_caps->manufacture_week = edid_buf->mfg_week; - edid_caps->manufacture_year = edid_buf->mfg_year; +drm_edid_get_product_id (drm_edid, &product_id); + + edid_caps->manufacturer_id =le16_to_cpu (product_id.manufacturer_name); + edid_caps->product_id =le16_to_cpu (product_id.product_code); + edid_caps->serial_number =le32_to_cpu (product_id.serial_number); + edid_caps->manufacture_week = product_id.week_of_manufacture; + edid_caps->manufacture_year = product_id.year_of_manufacture; drm_edid_get_monitor_name(edid_buf, edid_caps->display_name,
@@ -123,7 +125,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->edid_hdmi = connector->display_info.is_hdmi; -apply_edid_quirks (edid_buf, edid_caps); +apply_edid_quirks (&product_id, edid_caps); sad_count =drm_edid_to_sad ((struct edid *) edid->raw_edid, &sads);if (sad_count <=0 )
@@ -909,9 +911,9 @@ enum dc_edid_status dm_helpers_read_local_edid(* do check sum and retry to make sure read correct edid. */ do { - drm_edid = drm_edid_read_ddc(connector, ddc); drm_edid_connector_update(connector, drm_edid); + aconnector->drm_edid = drm_edid; /* DP Compliance Test 4.2.2.6 */ if (link->aux_mode && connector->edid_corrupt)
@@ -929,14 +931,14 @@ enum dc_edid_status dm_helpers_read_local_edid( sink->dc_edid.length =EDID_LENGTH * (edid->extensions +1 );memmove (sink->dc_edid.raw_edid, (uint8_t *)edid, sink->dc_edid.length); -/* We don't need the original edid anymore */ -drm_edid_free (drm_edid); - edid_status =dm_helpers_parse_edid_caps ( link, &sink->dc_edid, &sink->edid_caps); +/* We don't need the original edid anymore */ +drm_edid_free (drm_edid); + }while (edid_status ==EDID_BAD_CHECKSUM && --retry >0 );if (edid_status !=EDID_OK )
Signature · 1 line
2.43.0
PATCH v6 6/10 drm/amd/display: parse display name from drm_eld
In reply to Mario LimoncielloFrom: Melissa Wen <[email protected]>
We don't need to parse dc_edid to get the display name since it's already set in drm_eld which in turn had it values updated when updating connector with the opaque drm_edid.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +6 -4
@@ -32,7 +32,7 @@#include <drm/amdgpu_drm.h> #include <drm/drm_edid.h> #include <drm/drm_fixed.h> - +#include <drm/drm_eld.h> #include "dm_services.h" #include "amdgpu.h" #include "dc.h"
@@ -78,6 +78,7 @@ static void apply_edid_quirks(struct drm_edid_product_id *product_id, } } +#define AMDGPU_ELD_DISPLAY_NAME_SIZE_IN_CHARS 13/** * dm_helpers_parse_edid_caps() - Parse edid caps *
@@ -119,9 +120,10 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->manufacture_week = product_id.week_of_manufacture; edid_caps->manufacture_year = product_id.year_of_manufacture; -drm_edid_get_monitor_name (edid_buf, - edid_caps->display_name, -AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS ); +memset (edid_caps->display_name,0 ,AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS ); +memcpy (edid_caps->display_name, + &connector->eld[DRM_ELD_MONITOR_NAME_STRING ], +AMDGPU_ELD_DISPLAY_NAME_SIZE_IN_CHARS ); edid_caps->edid_hdmi = connector->display_info.is_hdmi;
Signature · 1 line
2.43.0
PATCH v6 7/10 drm/amd/display: get SAD from drm_eld when parsing EDID caps
In reply to Mario LimoncielloFrom: Melissa Wen <[email protected]>
drm_edid_connector_update() updates display info, filling ELD with audio info from Short-Audio Descriptors in the last step of update_dislay_info(). Our goal is stopping using raw edid, so we can extract SAD from drm_eld instead of access raw edid to get audio caps.
---
v6:
- Move changelog to below cutlist
v5:
- squash with don't give initial values for sad/b_count (Alex H)
- add more informative commit description (Alex H)
--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +10 -10
@@ -98,9 +98,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(const struct drm_edid *drm_edid = aconnector->drm_edid;struct drm_edid_product_id product_id;struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid :NULL ; -struct cea_sad *sads; -int sad_count =-1 ; -int sadb_count =-1 ; +int sad_count, sadb_count;int i =0 ;uint8_t *sadb =NULL ;
@@ -129,18 +127,21 @@ enum dc_edid_status dm_helpers_parse_edid_caps(apply_edid_quirks (&product_id, edid_caps); - sad_count =drm_edid_to_sad ((struct edid *) edid->raw_edid, &sads); + sad_count =drm_eld_sad_count (connector->eld);if (sad_count <=0 )return result; edid_caps->audio_mode_count =min (sad_count,DC_MAX_AUDIO_DESC_COUNT );for (i =0 ; i < edid_caps->audio_mode_count; ++i) { -struct cea_sad *sad = &sads[i]; +struct cea_sad sad; - edid_caps->audio_modes[i].format_code = sad->format; - edid_caps->audio_modes[i].channel_count = sad->channels +1 ; - edid_caps->audio_modes[i].sample_rate = sad->freq; - edid_caps->audio_modes[i].sample_size = sad->byte2; +if (drm_eld_sad_get (connector->eld, i, &sad) <0 ) +continue ; + + edid_caps->audio_modes[i].format_code = sad.format; + edid_caps->audio_modes[i].channel_count = sad.channels +1 ; + edid_caps->audio_modes[i].sample_rate = sad.freq; + edid_caps->audio_modes[i].sample_size = sad.byte2; } sadb_count =drm_edid_to_speaker_allocation ((struct edid *) edid->raw_edid, &sadb);
@@ -155,7 +156,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps(else edid_caps->speaker_flags =DEFAULT_SPEAKER_LOCATION ; -kfree (sads);kfree (sadb);return result;
Signature · 1 line
2.43.0
PATCH v6 8/10 drm/amd/display: get SADB from drm_eld when parsing EDID caps
In reply to Mario LimoncielloFrom: Melissa Wen <[email protected]>
drm_edid_connector_update() updates display info, filling ELD with speaker allocation data in the last step of update_dislay_info(). Our goal is stopping using raw edid, so we can extract SADB from drm_eld instead of access raw edid to get audio caps.
---
v6: Move changelog below cutlist
v5: add more informative commit description (Alex H)
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +3 -12
@@ -98,9 +98,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps(const struct drm_edid *drm_edid = aconnector->drm_edid;struct drm_edid_product_id product_id;struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid :NULL ; -int sad_count, sadb_count; +int sad_count;int i =0 ; -uint8_t *sadb =NULL ;enum dc_edid_status result =EDID_OK ;
@@ -144,20 +143,12 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->audio_modes[i].sample_size = sad.byte2; } - sadb_count =drm_edid_to_speaker_allocation ((struct edid *) edid->raw_edid, &sadb); -if (sadb_count <0 ) { -DRM_ERROR ("Couldn't read Speaker Allocation Data Block: %d\n" , sadb_count); - sadb_count =0 ; - } - -if (sadb_count) - edid_caps->speaker_flags = sadb[0 ]; +if (connector->eld[DRM_ELD_SPEAKER ]) + edid_caps->speaker_flags = connector->eld[DRM_ELD_SPEAKER ];else edid_caps->speaker_flags =DEFAULT_SPEAKER_LOCATION ; -kfree (sadb); -return result; }
Signature · 1 line
2.43.0
PATCH v6 9/10 drm/amd/display: remove dc_edid handler from dm_helpers_parse_edid_caps
In reply to Mario LimoncielloFrom: Melissa Wen <[email protected]>
We can parse edid caps from drm_edid and drm_eld and any calls of dm_helpers_parse_edid_caps is made in a state that we have drm_edid set to amdgpu connector.
---
v6:
- Move changelog below cutlist
- Rebase on v6.11-rc7
v5: also remove the parameter from kernel-doc (kernel test bot)
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 30 ++++++++----------- drivers/gpu/drm/amd/display/dc/dm_helpers.h | 1 - .../drm/amd/display/dc/link/link_detection.c | 6 ++-- 4 files changed, 16 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -4
@@ -7059,10 +7059,7 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)memset (&dc_em_sink->edid_caps,0 ,sizeof (struct dc_edid_caps ));memmove (dc_em_sink->dc_edid.raw_edid, edid, (edid->extensions +1 ) *EDID_LENGTH ); -dm_helpers_parse_edid_caps ( - dc_link, - &dc_em_sink->dc_edid, - &dc_em_sink->edid_caps); +dm_helpers_parse_edid_caps (dc_link, &dc_em_sink->edid_caps); } }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +13 -17
@@ -83,32 +83,24 @@ static void apply_edid_quirks(struct drm_edid_product_id *product_id,* dm_helpers_parse_edid_caps() - Parse edid caps * * @link: current detected link -* @edid: [in] pointer to edid * @edid_caps: [in] pointer to edid caps * * Return: void */ -enum dc_edid_status dm_helpers_parse_edid_caps ( -struct dc_link *link, -const struct dc_edid *edid, -struct dc_edid_caps *edid_caps) +enum dc_edid_status dm_helpers_parse_edid_caps (struct dc_link *link, +struct dc_edid_caps *edid_caps) {struct amdgpu_dm_connector *aconnector = link->priv;struct drm_connector *connector = &aconnector->base;const struct drm_edid *drm_edid = aconnector->drm_edid;struct drm_edid_product_id product_id; -struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid :NULL ;int sad_count;int i =0 ; -enum dc_edid_status result =EDID_OK ; -if (!edid_caps || !edid) +if (!edid_caps || !drm_edid)return EDID_BAD_INPUT ; -if (!drm_edid_is_valid (edid_buf)) - result =EDID_BAD_CHECKSUM ; -drm_edid_get_product_id (drm_edid, &product_id); edid_caps->manufacturer_id =le16_to_cpu (product_id.manufacturer_name);
@@ -920,19 +912,23 @@ enum dc_edid_status dm_helpers_read_local_edid(if (!drm_edid)return EDID_NO_RESPONSE ; - edid =drm_edid_raw (drm_edid);// FIXME: Get rid of drm_edid_raw() +/* FIXME: Get rid of drm_edid_raw() +* Raw edid is still needed for dm_helpers_dp_write_dpcd() +*/ + edid =drm_edid_raw (drm_edid); sink->dc_edid.length =EDID_LENGTH * (edid->extensions +1 );memmove (sink->dc_edid.raw_edid, (uint8_t *)edid, sink->dc_edid.length); edid_status =dm_helpers_parse_edid_caps ( link, - &sink->dc_edid, &sink->edid_caps); -/* We don't need the original edid anymore */ -drm_edid_free (drm_edid); - - }while (edid_status ==EDID_BAD_CHECKSUM && --retry >0 ); +if (edid_status !=EDID_OK ) { +/* We can discard the drm_edid and retry */ +drm_edid_free (drm_edid); +drm_edid_connector_update (connector, drm_edid); + } + }while (edid_status !=EDID_OK && --retry >0 );if (edid_status !=EDID_OK ) DRM_ERROR("EDID err: %d, on connector: %s",
drivers/gpu/drm/amd/display/dc/dm_helpers.h +0 -1
@@ -61,7 +61,6 @@ void dm_helpers_free_gpu_mem(enum dc_edid_status dm_helpers_parse_edid_caps (struct dc_link *link, -const struct dc_edid *edid,struct dc_edid_caps *edid_caps);
drivers/gpu/drm/amd/display/dc/link/link_detection.c +2 -4
@@ -1417,10 +1417,8 @@ struct dc_sink *link_add_remote_sink( dc_sink)) goto fail_add_sink; - edid_status =dm_helpers_parse_edid_caps ( - link, - &dc_sink->dc_edid, - &dc_sink->edid_caps); + edid_status =dm_helpers_parse_edid_caps (link, + &dc_sink->edid_caps);/* * Treat device as no EDID device if EDID
Signature · 1 line
2.43.0
PATCH v6 10/10 drm/amd: Fetch the EDID from _DDC if available for eDP
In reply to Mario LimoncielloFrom: Mario Limonciello <[email protected]>
Some manufacturers have intentionally put an EDID that differs from the EDID on the internal panel on laptops.
Attempt to fetch this EDID if it exists and prefer it over the EDID that is provided by the panel. If a user prefers to use the EDID from the panel, offer a DC debugging parameter that would disable this.
--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 63 ++++++++++++++++++- drivers/gpu/drm/amd/include/amd_shared.h | 1 + 2 files changed, 63 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +62 -1
@@ -23,6 +23,8 @@* */ +#include <acpi/video.h> +#include <linux/string.h> #include <linux/acpi.h> #include <linux/i2c.h>
@@ -874,6 +876,61 @@ bool dm_helpers_is_dp_sink_present(struct dc_link *link)return dp_sink_present; } +static int +dm_helpers_probe_acpi_edid (void *data,u8 *buf,unsigned int block,size_t len) +{ +struct drm_connector *connector = data; +struct drm_device *ddev = connector->dev; +struct acpi_device *acpidev =ACPI_COMPANION (ddev->dev); +unsigned char start = block *EDID_LENGTH ; +void *edid; +int r; + +if (!acpidev) +return -ENODEV ; + +/* fetch the entire edid from BIOS */ + r =acpi_video_get_edid (acpidev,ACPI_VIDEO_DISPLAY_LCD ,-1 , &edid); +if (r <0 ) { +DRM_DEBUG_KMS ("Failed to get EDID from ACPI: %d\n" , r); +return r; + } +if (len > r || start > r || start + len > r) { + r = -EINVAL ; + goto cleanup; + } + +memcpy (buf, edid + start, len); + r =0 ; + +cleanup: +kfree (edid); + +return r; +} + +static const struct drm_edid * +dm_helpers_read_acpi_edid (struct amdgpu_dm_connector *aconnector) +{ +struct drm_connector *connector = &aconnector->base; + +if (amdgpu_dc_debug_mask &DC_DISABLE_ACPI_EDID ) +return NULL ; + +switch (connector->connector_type) { +case DRM_MODE_CONNECTOR_LVDS : +case DRM_MODE_CONNECTOR_eDP: +break ; +default : +return NULL ; + } + +if (connector->force ==DRM_FORCE_OFF ) +return NULL ; + +return drm_edid_read_custom (connector, dm_helpers_probe_acpi_edid, connector); +} + enum dc_edid_status dm_helpers_read_local_edid( struct dc_context *ctx, struct dc_link *link,
@@ -896,7 +953,11 @@ enum dc_edid_status dm_helpers_read_local_edid(* do check sum and retry to make sure read correct edid. */ do { - drm_edid = drm_edid_read_ddc(connector, ddc); + drm_edid = dm_helpers_read_acpi_edid(aconnector); + if (drm_edid) + DRM_DEBUG_KMS("Using ACPI provided EDID for %s\n", connector->name); + else + drm_edid = drm_edid_read_ddc(connector, ddc); drm_edid_connector_update(connector, drm_edid); aconnector->drm_edid = drm_edid;
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
@@ -264,6 +264,7 @@ enum DC_DEBUG_MASK {DC_DISABLE_PSR_SU =0x200 ,DC_DISABLE_REPLAY =0x400 ,DC_DISABLE_IPS =0x800 , + DC_DISABLE_ACPI_EDID = 0x1000, };enum amd_dpm_forced_level ;
Signature · 1 line
2.43.0
PATCH v6 10/10 drm/amd/display: Fetch the EDID from _DDC if available for eDP
In reply to Mario LimoncielloFrom: Mario Limonciello <[email protected]>
Some manufacturers have intentionally put an EDID that differs from the EDID on the internal panel on laptops.
Attempt to fetch this EDID if it exists and prefer it over the EDID that is provided by the panel. If a user prefers to use the EDID from the panel, offer a DC debugging parameter that would disable this.
--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 63 ++++++++++++++++++- drivers/gpu/drm/amd/include/amd_shared.h | 1 + 2 files changed, 63 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +62 -1
@@ -23,6 +23,8 @@* */ +#include <acpi/video.h> +#include <linux/string.h> #include <linux/acpi.h> #include <linux/i2c.h>
@@ -874,6 +876,61 @@ bool dm_helpers_is_dp_sink_present(struct dc_link *link)return dp_sink_present; } +static int +dm_helpers_probe_acpi_edid (void *data,u8 *buf,unsigned int block,size_t len) +{ +struct drm_connector *connector = data; +struct drm_device *ddev = connector->dev; +struct acpi_device *acpidev =ACPI_COMPANION (ddev->dev); +unsigned char start = block *EDID_LENGTH ; +void *edid; +int r; + +if (!acpidev) +return -ENODEV ; + +/* fetch the entire edid from BIOS */ + r =acpi_video_get_edid (acpidev,ACPI_VIDEO_DISPLAY_LCD ,-1 , &edid); +if (r <0 ) { +DRM_DEBUG_KMS ("Failed to get EDID from ACPI: %d\n" , r); +return r; + } +if (len > r || start > r || start + len > r) { + r = -EINVAL ; + goto cleanup; + } + +memcpy (buf, edid + start, len); + r =0 ; + +cleanup: +kfree (edid); + +return r; +} + +static const struct drm_edid * +dm_helpers_read_acpi_edid (struct amdgpu_dm_connector *aconnector) +{ +struct drm_connector *connector = &aconnector->base; + +if (amdgpu_dc_debug_mask &DC_DISABLE_ACPI_EDID ) +return NULL ; + +switch (connector->connector_type) { +case DRM_MODE_CONNECTOR_LVDS : +case DRM_MODE_CONNECTOR_eDP: +break ; +default : +return NULL ; + } + +if (connector->force ==DRM_FORCE_OFF ) +return NULL ; + +return drm_edid_read_custom (connector, dm_helpers_probe_acpi_edid, connector); +} + enum dc_edid_status dm_helpers_read_local_edid( struct dc_context *ctx, struct dc_link *link,
@@ -896,7 +953,11 @@ enum dc_edid_status dm_helpers_read_local_edid(* do check sum and retry to make sure read correct edid. */ do { - drm_edid = drm_edid_read_ddc(connector, ddc); + drm_edid = dm_helpers_read_acpi_edid(aconnector); + if (drm_edid) + DRM_DEBUG_KMS("Using ACPI provided EDID for %s\n", connector->name); + else + drm_edid = drm_edid_read_ddc(connector, ddc); drm_edid_connector_update(connector, drm_edid); aconnector->drm_edid = drm_edid;
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
@@ -264,6 +264,7 @@ enum DC_DEBUG_MASK {DC_DISABLE_PSR_SU =0x200 ,DC_DISABLE_REPLAY =0x400 ,DC_DISABLE_IPS =0x800 , + DC_DISABLE_ACPI_EDID = 0x1000, };enum amd_dpm_forced_level ;
Signature · 1 line
2.43.0
kernel test robot
build botRe: [PATCH v6 01/10] drm/amd/display: switch amdgpu_dm_connector to use struct drm_edid
In reply to Mario Limonciellokernel test robot noticed the following build warnings:
Hi Mario,
kernel test robot noticed the following build warnings:
[auto build test WARNING on amd-pstate/linux-next]
[also build test WARNING on amd-pstate/bleeding-edge linus/master v6.11-rc7 next-20240913] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/drm-amd-display-switch-amdgpu_dm_connector-to-use-struct-drm_edid/20240912-093827 base: https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git linux-next patch link: https://lore.kernel.org/r/20240911213537.2338164-2-superm1%40kernel.org patch subject: [PATCH v6 01/10] drm/amd/display: switch amdgpu_dm_connector to use struct drm_edid config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240915/[email protected]/config) compiler: alpha-linux-gcc (GCC) 13.3.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240915/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:11976: warning: Function parameter or struct member 'drm_edid' not described in 'amdgpu_dm_update_freesync_caps' >> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:11976: warning: Excess function parameter 'edid' description in 'amdgpu_dm_update_freesync_caps'
vim +11976 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
f9b4f20c4777bd Stylon Wang 2020-12-04 11962
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11963 /**
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11964 * amdgpu_dm_update_freesync_caps - Update Freesync capabilities
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11965 *
41ee1f18ef5239 Alex Deucher 2022-08-30 11966 * @connector: Connector to query.
41ee1f18ef5239 Alex Deucher 2022-08-30 11967 * @edid: EDID from monitor
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11968 *
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11969 * Amdgpu supports Freesync in DP and HDMI displays, and it is required to keep
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11970 * track of some of the display information in the internal data struct used by
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11971 * amdgpu_dm. This function checks which type of connector we need to set the
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11972 * FreeSync parameters.
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11973 */
98e6436d3af5fe Anthony Koo 2018-08-21 11974 void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
c8133532d2e08c Melissa Wen 2024-09-11 11975 const struct drm_edid *drm_edid)
e7b07ceef2a650 Harry Wentland 2017-08-10 @11976 {
eb0709ba077a21 Souptick Joarder 2021-02-23 11977 int i = 0;
c8133532d2e08c Melissa Wen 2024-09-11 11978 const struct detailed_timing *timing;
c8133532d2e08c Melissa Wen 2024-09-11 11979 const struct detailed_non_pixel *data;
c8133532d2e08c Melissa Wen 2024-09-11 11980 const struct detailed_data_monitor_range *range;
c84dec2fe8837f Harry Wentland 2017-09-05 11981 struct amdgpu_dm_connector *amdgpu_dm_connector =
c84dec2fe8837f Harry Wentland 2017-09-05 11982 to_amdgpu_dm_connector(connector);
bb47de73666188 Nicholas Kazlauskas 2018-10-04 11983 struct dm_connector_state *dm_con_state = NULL;
9ad544670514e2 Colin Ian King 2021-08-29 11984 struct dc_sink *sink;
534eee82356c22 Srinivasan Shanmugam 2023-11-12 11985 struct amdgpu_device *adev = drm_to_adev(connector->dev);
f9b4f20c4777bd Stylon Wang 2020-12-04 11986 struct amdgpu_hdmi_vsdb_info vsdb_info = {0};
c8133532d2e08c Melissa Wen 2024-09-11 11987 const struct edid *edid;
c620e79bb695b8 Rodrigo Siqueira 2022-02-21 11988 bool freesync_capable = false;
5b49da02ddbe1b Sung Joon Kim 2023-01-12 11989 enum adaptive_sync_type as_type = ADAPTIVE_SYNC_TYPE_NONE;
b830ebc910f641 Harry Wentland 2017-07-26 11990
8218d7f1f70179 Harry Wentland 2017-10-17 11991 if (!connector->state) {
8218d7f1f70179 Harry Wentland 2017-10-17 11992 DRM_ERROR("%s - Connector has no state", __func__);
bb47de73666188 Nicholas Kazlauskas 2018-10-04 11993 goto update;
8218d7f1f70179 Harry Wentland 2017-10-17 11994 }
8218d7f1f70179 Harry Wentland 2017-10-17 11995
9b2fdc33218933 Aurabindo Pillai 2021-08-11 11996 sink = amdgpu_dm_connector->dc_sink ?
9b2fdc33218933 Aurabindo Pillai 2021-08-11 11997 amdgpu_dm_connector->dc_sink :
9b2fdc33218933 Aurabindo Pillai 2021-08-11 11998 amdgpu_dm_connector->dc_em_sink;
9b2fdc33218933 Aurabindo Pillai 2021-08-11 11999
c8133532d2e08c Melissa Wen 2024-09-11 12000 if (!drm_edid || !sink) {
98e6436d3af5fe Anthony Koo 2018-08-21 12001 dm_con_state = to_dm_connector_state(connector->state);
98e6436d3af5fe Anthony Koo 2018-08-21 12002
98e6436d3af5fe Anthony Koo 2018-08-21 12003 amdgpu_dm_connector->min_vfreq = 0;
98e6436d3af5fe Anthony Koo 2018-08-21 12004 amdgpu_dm_connector->max_vfreq = 0;
9b2fdc33218933 Aurabindo Pillai 2021-08-11 12005 connector->display_info.monitor_range.min_vfreq = 0;
9b2fdc33218933 Aurabindo Pillai 2021-08-11 12006 connector->display_info.monitor_range.max_vfreq = 0;
9b2fdc33218933 Aurabindo Pillai 2021-08-11 12007 freesync_capable = false;
98e6436d3af5fe Anthony Koo 2018-08-21 12008
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12009 goto update;
98e6436d3af5fe Anthony Koo 2018-08-21 12010 }
98e6436d3af5fe Anthony Koo 2018-08-21 12011
8218d7f1f70179 Harry Wentland 2017-10-17 12012 dm_con_state = to_dm_connector_state(connector->state);
8218d7f1f70179 Harry Wentland 2017-10-17 12013
e7b07ceef2a650 Harry Wentland 2017-08-10 12014 if (!adev->dm.freesync_module)
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12015 goto update;
f9b4f20c4777bd Stylon Wang 2020-12-04 12016
c8133532d2e08c Melissa Wen 2024-09-11 12017 edid = drm_edid_raw(drm_edid); // FIXME: Get rid of drm_edid_raw()
c8133532d2e08c Melissa Wen 2024-09-11 12018
a638b837d0e605 Tom Chung 2024-06-14 12019 /* Some eDP panels only have the refresh rate range info in DisplayID */
a638b837d0e605 Tom Chung 2024-06-14 12020 if ((connector->display_info.monitor_range.min_vfreq == 0 ||
a638b837d0e605 Tom Chung 2024-06-14 12021 connector->display_info.monitor_range.max_vfreq == 0))
a638b837d0e605 Tom Chung 2024-06-14 12022 parse_edid_displayid_vrr(connector, edid);
a638b837d0e605 Tom Chung 2024-06-14 12023
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12024 if (edid && (sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT ||
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12025 sink->sink_signal == SIGNAL_TYPE_EDP)) {
f9b4f20c4777bd Stylon Wang 2020-12-04 12026 bool edid_check_required = false;
f9b4f20c4777bd Stylon Wang 2020-12-04 12027
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12028 if (is_dp_capable_without_timing_msa(adev->dm.dc,
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12029 amdgpu_dm_connector)) {
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12030 if (edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ) {
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12031 amdgpu_dm_connector->min_vfreq = connector->display_info.monitor_range.min_vfreq;
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12032 amdgpu_dm_connector->max_vfreq = connector->display_info.monitor_range.max_vfreq;
9023ec5d55f399 Tom Chung 2024-06-19 12033 if (amdgpu_dm_connector->max_vfreq -
9023ec5d55f399 Tom Chung 2024-06-19 12034 amdgpu_dm_connector->min_vfreq > 10)
9023ec5d55f399 Tom Chung 2024-06-19 12035 freesync_capable = true;
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12036 } else {
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12037 edid_check_required = edid->version > 1 ||
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12038 (edid->version == 1 &&
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12039 edid->revision > 1);
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12040 }
e7b07ceef2a650 Harry Wentland 2017-08-10 12041 }
f9b4f20c4777bd Stylon Wang 2020-12-04 12042
2f14c0c8cae8e9 Mario Limonciello 2024-03-05 12043 if (edid_check_required) {
e7b07ceef2a650 Harry Wentland 2017-08-10 12044 for (i = 0; i < 4; i++) {
e7b07ceef2a650 Harry Wentland 2017-08-10 12045
e7b07ceef2a650 Harry Wentland 2017-08-10 12046 timing = &edid->detailed_timings[i];
e7b07ceef2a650 Harry Wentland 2017-08-10 12047 data = &timing->data.other_data;
e7b07ceef2a650 Harry Wentland 2017-08-10 12048 range = &data->data.range;
e7b07ceef2a650 Harry Wentland 2017-08-10 12049 /*
e7b07ceef2a650 Harry Wentland 2017-08-10 12050 * Check if monitor has continuous frequency mode
e7b07ceef2a650 Harry Wentland 2017-08-10 12051 */
e7b07ceef2a650 Harry Wentland 2017-08-10 12052 if (data->type != EDID_DETAIL_MONITOR_RANGE)
e7b07ceef2a650 Harry Wentland 2017-08-10 12053 continue;
e7b07ceef2a650 Harry Wentland 2017-08-10 12054 /*
e7b07ceef2a650 Harry Wentland 2017-08-10 12055 * Check for flag range limits only. If flag == 1 then
e7b07ceef2a650 Harry Wentland 2017-08-10 12056 * no additional timing information provided.
e7b07ceef2a650 Harry Wentland 2017-08-10 12057 * Default GTF, GTF Secondary curve and CVT are not
e7b07ceef2a650 Harry Wentland 2017-08-10 12058 * supported
e7b07ceef2a650 Harry Wentland 2017-08-10 12059 */
e7b07ceef2a650 Harry Wentland 2017-08-10 12060 if (range->flags != 1)
e7b07ceef2a650 Harry Wentland 2017-08-10 12061 continue;
e7b07ceef2a650 Harry Wentland 2017-08-10 12062
a0ffc3fd67e72b Stylon Wang 2021-01-05 12063 connector->display_info.monitor_range.min_vfreq = range->min_vfreq;
a0ffc3fd67e72b Stylon Wang 2021-01-05 12064 connector->display_info.monitor_range.max_vfreq = range->max_vfreq;
a0ffc3fd67e72b Stylon Wang 2021-01-05 12065
68e05b932dcba9 Alex Deucher 2024-02-28 12066 if (edid->revision >= 4) {
68e05b932dcba9 Alex Deucher 2024-02-28 12067 if (data->pad2 & DRM_EDID_RANGE_OFFSET_MIN_VFREQ)
68e05b932dcba9 Alex Deucher 2024-02-28 12068 connector->display_info.monitor_range.min_vfreq += 255;
68e05b932dcba9 Alex Deucher 2024-02-28 12069 if (data->pad2 & DRM_EDID_RANGE_OFFSET_MAX_VFREQ)
68e05b932dcba9 Alex Deucher 2024-02-28 12070 connector->display_info.monitor_range.max_vfreq += 255;
68e05b932dcba9 Alex Deucher 2024-02-28 12071 }
68e05b932dcba9 Alex Deucher 2024-02-28 12072
68e05b932dcba9 Alex Deucher 2024-02-28 12073 amdgpu_dm_connector->min_vfreq =
68e05b932dcba9 Alex Deucher 2024-02-28 12074 connector->display_info.monitor_range.min_vfreq;
68e05b932dcba9 Alex Deucher 2024-02-28 12075 amdgpu_dm_connector->max_vfreq =
68e05b932dcba9 Alex Deucher 2024-02-28 12076 connector->display_info.monitor_range.max_vfreq;
68e05b932dcba9 Alex Deucher 2024-02-28 12077
e7b07ceef2a650 Harry Wentland 2017-08-10 12078 break;
e7b07ceef2a650 Harry Wentland 2017-08-10 12079 }
e7b07ceef2a650 Harry Wentland 2017-08-10 12080
c84dec2fe8837f Harry Wentland 2017-09-05 12081 if (amdgpu_dm_connector->max_vfreq -
c84dec2fe8837f Harry Wentland 2017-09-05 12082 amdgpu_dm_connector->min_vfreq > 10) {
98e6436d3af5fe Anthony Koo 2018-08-21 12083
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12084 freesync_capable = true;
e7b07ceef2a650 Harry Wentland 2017-08-10 12085 }
e7b07ceef2a650 Harry Wentland 2017-08-10 12086 }
ec8e59cb4e0c1a Bhawanpreet Lakha 2023-06-12 12087 parse_amd_vsdb(amdgpu_dm_connector, edid, &vsdb_info);
ec8e59cb4e0c1a Bhawanpreet Lakha 2023-06-12 12088
ec8e59cb4e0c1a Bhawanpreet Lakha 2023-06-12 12089 if (vsdb_info.replay_mode) {
ec8e59cb4e0c1a Bhawanpreet Lakha 2023-06-12 12090 amdgpu_dm_connector->vsdb_info.replay_mode = vsdb_info.replay_mode;
ec8e59cb4e0c1a Bhawanpreet Lakha 2023-06-12 12091 amdgpu_dm_connector->vsdb_info.amd_vsdb_version = vsdb_info.amd_vsdb_version;
ec8e59cb4e0c1a Bhawanpreet Lakha 2023-06-12 12092 amdgpu_dm_connector->as_type = ADAPTIVE_SYNC_TYPE_EDP;
ec8e59cb4e0c1a Bhawanpreet Lakha 2023-06-12 12093 }
ec8e59cb4e0c1a Bhawanpreet Lakha 2023-06-12 12094
c8133532d2e08c Melissa Wen 2024-09-11 12095 } else if (drm_edid && sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A) {
7c7dd77489540d Arnd Bergmann 2021-02-25 12096 i = parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, &vsdb_info);
7c7dd77489540d Arnd Bergmann 2021-02-25 12097 if (i >= 0 && vsdb_info.freesync_supported) {
f9b4f20c4777bd Stylon Wang 2020-12-04 12098 timing = &edid->detailed_timings[i];
f9b4f20c4777bd Stylon Wang 2020-12-04 12099 data = &timing->data.other_data;
f9b4f20c4777bd Stylon Wang 2020-12-04 12100
f9b4f20c4777bd Stylon Wang 2020-12-04 12101 amdgpu_dm_connector->min_vfreq = vsdb_info.min_refresh_rate_hz;
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12102 amdgpu_dm_connector->max_vfreq = vsdb_info.max_refresh_rate_hz;
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12103 if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10)
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12104 freesync_capable = true;
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12105
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12106 connector->display_info.monitor_range.min_vfreq = vsdb_info.min_refresh_rate_hz;
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12107 connector->display_info.monitor_range.max_vfreq = vsdb_info.max_refresh_rate_hz;
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12108 }
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12109 }
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12110
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12111 as_type = dm_get_adaptive_sync_support_type(amdgpu_dm_connector->dc_link);
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12112
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12113 if (as_type == FREESYNC_TYPE_PCON_IN_WHITELIST) {
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12114 i = parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, &vsdb_info);
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12115 if (i >= 0 && vsdb_info.freesync_supported && vsdb_info.amd_vsdb_version > 0) {
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12116
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12117 amdgpu_dm_connector->pack_sdp_v1_3 = true;
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12118 amdgpu_dm_connector->as_type = as_type;
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12119 amdgpu_dm_connector->vsdb_info = vsdb_info;
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12120
5b49da02ddbe1b Sung Joon Kim 2023-01-12 12121 amdgpu_dm_connector->min_vfreq = vsdb_info.min_refresh_rate_hz;
f9b4f20c4777bd Stylon Wang 2020-12-04 12122 amdgpu_dm_connector->max_vfreq = vsdb_info.max_refresh_rate_hz;
f9b4f20c4777bd Stylon Wang 2020-12-04 12123 if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10)
f9b4f20c4777bd Stylon Wang 2020-12-04 12124 freesync_capable = true;
f9b4f20c4777bd Stylon Wang 2020-12-04 12125
f9b4f20c4777bd Stylon Wang 2020-12-04 12126 connector->display_info.monitor_range.min_vfreq = vsdb_info.min_refresh_rate_hz;
f9b4f20c4777bd Stylon Wang 2020-12-04 12127 connector->display_info.monitor_range.max_vfreq = vsdb_info.max_refresh_rate_hz;
f9b4f20c4777bd Stylon Wang 2020-12-04 12128 }
f9b4f20c4777bd Stylon Wang 2020-12-04 12129 }
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12130
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12131 update:
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12132 if (dm_con_state)
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12133 dm_con_state->freesync_capable = freesync_capable;
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12134
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12135 if (connector->vrr_capable_property)
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12136 drm_connector_set_vrr_capable_property(connector,
bb47de73666188 Nicholas Kazlauskas 2018-10-04 12137 freesync_capable);
e7b07ceef2a650 Harry Wentland 2017-08-10 12138 }
e7b07ceef2a650 Harry Wentland 2017-08-10 12139 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v6 10/10] drm/amd/display: Fetch the EDID from _DDC if available for eDP
In reply to Mario Limonciellokernel test robot noticed the following build warnings:
Hi Mario,
kernel test robot noticed the following build warnings:
[auto build test WARNING on amd-pstate/linux-next]
[also build test WARNING on amd-pstate/bleeding-edge linus/master v6.11] [cannot apply to next-20240913]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/drm-amd-display-switch-amdgpu_dm_connector-to-use-struct-drm_edid/20240912-093827 base: https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git linux-next patch link: https://lore.kernel.org/r/20240911213537.2338164-11-superm1%40kernel.org patch subject: [PATCH v6 10/10] drm/amd/display: Fetch the EDID from _DDC if available for eDP config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240916/[email protected]/config) compiler: alpha-linux-gcc (GCC) 13.3.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240916/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c: In function 'dm_helpers_probe_acpi_edid':
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c:883:28: warning: unused variable 'ddev' [-Wunused-variable]
883 | struct drm_device *ddev = connector->dev;
| ^~~~vim +/ddev +883 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c
878
879 static int
880 dm_helpers_probe_acpi_edid(void *data, u8 *buf, unsigned int block, size_t len)
881 {
882 struct drm_connector *connector = data;
> 883 struct drm_device *ddev = connector->dev;
884 struct acpi_device *acpidev = ACPI_COMPANION(ddev->dev);
885 unsigned char start = block * EDID_LENGTH;
886 void *edid;
887 int r;
888
889 if (!acpidev)
890 return -ENODEV;
891
892 /* fetch the entire edid from BIOS */
893 r = acpi_video_get_edid(acpidev, ACPI_VIDEO_DISPLAY_LCD, -1, &edid);
894 if (r < 0) {
895 DRM_DEBUG_KMS("Failed to get EDID from ACPI: %d\n", r);
896 return r;
897 }
898 if (len > r || start > r || start + len > r) {
899 r = -EINVAL;
900 goto cleanup;
901 }
902
903 memcpy(buf, edid + start, len);
904 r = 0;
905
906 cleanup:
907 kfree(edid);
908
909 return r;
910 }
911
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v6 10/10] drm/amd/display: Fetch the EDID from _DDC if available for eDP
In reply to Mario Limonciellokernel test robot noticed the following build errors:
Hi Mario,
kernel test robot noticed the following build errors:
[auto build test ERROR on amd-pstate/linux-next]
[also build test ERROR on amd-pstate/bleeding-edge linus/master v6.11] [cannot apply to next-20240918]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/drm-amd-display-switch-amdgpu_dm_connector-to-use-struct-drm_edid/20240912-093827 base: https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git linux-next patch link: https://lore.kernel.org/r/20240911213537.2338164-11-superm1%40kernel.org patch subject: [PATCH v6 10/10] drm/amd/display: Fetch the EDID from _DDC if available for eDP config: arm64-randconfig-003-20240918 (https://download.01.org/0day-ci/archive/20240919/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240919/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c: In function 'dm_helpers_probe_acpi_edid':
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c:883:28: error: unused variable 'ddev' [-Werror=unused-variable]
883 | struct drm_device *ddev = connector->dev;
| ^~~~cc1: all warnings being treated as errors
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for FB_IOMEM_HELPERS
Depends on [n]: HAS_IOMEM [=y] && FB_CORE [=n]
Selected by [m]:
- DRM_XE_DISPLAY [=y] && HAS_IOMEM [=y] && DRM [=y] && DRM_XE [=m] && DRM_XE [=m]=m [=m]
vim +/ddev +883 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c
878
879 static int
880 dm_helpers_probe_acpi_edid(void *data, u8 *buf, unsigned int block, size_t len)
881 {
882 struct drm_connector *connector = data;
> 883 struct drm_device *ddev = connector->dev;
884 struct acpi_device *acpidev = ACPI_COMPANION(ddev->dev);
885 unsigned char start = block * EDID_LENGTH;
886 void *edid;
887 int r;
888
889 if (!acpidev)
890 return -ENODEV;
891
892 /* fetch the entire edid from BIOS */
893 r = acpi_video_get_edid(acpidev, ACPI_VIDEO_DISPLAY_LCD, -1, &edid);
894 if (r < 0) {
895 DRM_DEBUG_KMS("Failed to get EDID from ACPI: %d\n", r);
896 return r;
897 }
898 if (len > r || start > r || start + len > r) {
899 r = -EINVAL;
900 goto cleanup;
901 }
902
903 memcpy(buf, edid + start, len);
904 r = 0;
905
906 cleanup:
907 kfree(edid);
908
909 return r;
910 }
911
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki