Skip to content

Commit f407df3

Browse files
alexdeuchergregkh
authored andcommitted
drm/radeon/kms: handle !force case in connector detect more gracefully
commit d0d0a22 upstream. When force == false, we don't do load detection in the connector detect functions. Unforunately, we also return the previous connector state so we never get disconnect events for DVI-I, DVI-A, or VGA. Save whether we detected the monitor via load detection previously and use that to determine whether we return the previous state or not. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41561 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent e5edf27 commit f407df3

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎drivers/gpu/drm/radeon/radeon_connectors.c‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
724724
dret = radeon_ddc_probe(radeon_connector,
725725
radeon_connector->requires_extended_probe);
726726
if (dret) {
727+
radeon_connector->detected_by_load = false;
727728
if (radeon_connector->edid) {
728729
kfree(radeon_connector->edid);
729730
radeon_connector->edid = NULL;
@@ -750,12 +751,21 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
750751
} else {
751752

752753
/* if we aren't forcing don't do destructive polling */
753-
if (!force)
754-
return connector->status;
754+
if (!force) {
755+
/* only return the previous status if we last
756+
* detected a monitor via load.
757+
*/
758+
if (radeon_connector->detected_by_load)
759+
return connector->status;
760+
else
761+
return ret;
762+
}
755763

756764
if (radeon_connector->dac_load_detect && encoder) {
757765
encoder_funcs = encoder->helper_private;
758766
ret = encoder_funcs->detect(encoder, connector);
767+
if (ret == connector_status_connected)
768+
radeon_connector->detected_by_load = true;
759769
}
760770
}
761771

@@ -897,6 +907,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
897907
dret = radeon_ddc_probe(radeon_connector,
898908
radeon_connector->requires_extended_probe);
899909
if (dret) {
910+
radeon_connector->detected_by_load = false;
900911
if (radeon_connector->edid) {
901912
kfree(radeon_connector->edid);
902913
radeon_connector->edid = NULL;
@@ -964,8 +975,13 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
964975
(connector->connector_type == DRM_MODE_CONNECTOR_HDMIA))
965976
goto out;
966977

978+
/* if we aren't forcing don't do destructive polling */
967979
if (!force) {
968-
ret = connector->status;
980+
/* only return the previous status if we last
981+
* detected a monitor via load.
982+
*/
983+
if (radeon_connector->detected_by_load)
984+
ret = connector->status;
969985
goto out;
970986
}
971987

@@ -989,6 +1005,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
9891005
ret = encoder_funcs->detect(encoder, connector);
9901006
if (ret == connector_status_connected) {
9911007
radeon_connector->use_digital = false;
1008+
radeon_connector->detected_by_load = true;
9921009
}
9931010
}
9941011
break;

‎drivers/gpu/drm/radeon/radeon_mode.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ struct radeon_connector {
447447
struct edid *edid;
448448
void *con_priv;
449449
bool dac_load_detect;
450+
bool detected_by_load; /* if the connection status was determined by load */
450451
uint16_t connector_object_id;
451452
struct radeon_hpd hpd;
452453
struct radeon_router router;

0 commit comments

Comments
 (0)