[PATCH] drm/atomic: don't reset link-status to GOOD without ALLOW_MODESET

Simon Ser contact at emersion.fr
Wed Jun 3 10:45:23 UTC 2020


In update_output_state, the link-status property was reset to GOOD to
ensure legacy drmModeSetCrtc re-trains the link. However this auto-reset
is also performed on an atomic commit without ALLLOW_MODESET. If a
driver reads link-status to figure out whether to re-train the link,
this could cause an atomic commit failure. User-space doesn't expect
such a failure, because commits without ALLOW_MODESET aren't supposed to
fail because of link training issues.

Change update_output_state to implicitly reset link-status to GOOD only
if ALLOW_MODESET is set. This is the case for legacy drmModeSetCrtc
because drm_atomic_state_init sets it (and is used in
drm_atomic_helper_set_config, called from drm_mode_setcrtc).

Drivers don't seem to read link-status at the moment -- they seem to
rely on user-space performing a modeset instead. So this shouldn't
result in any change in behaviour, this should only prevent future
failures if drivers start reading link-status.

Signed-off-by: Simon Ser <contact at emersion.fr>
Suggested-by: Pekka Paalanen <ppaalanen at gmail.com>
Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Manasi Navare <manasi.d.navare at intel.com>
---
 drivers/gpu/drm/drm_atomic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 965173fd0ac2..3d9d9e6f7397 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1426,7 +1426,8 @@ static int update_output_state(struct drm_atomic_state *state,
 				return ret;
 
 			/* Make sure legacy setCrtc always re-trains */
-			new_conn_state->link_status = DRM_LINK_STATUS_GOOD;
+			if (state->allow_modeset)
+				new_conn_state->link_status = DRM_LINK_STATUS_GOOD;
 		}
 	}
 
-- 
2.26.2




More information about the dri-devel mailing list