Message ID | 6Q-O7vKObfRu8cOyvcAxR_uRWgjQdlYgVursTGN2AaHtdaUZICSC6szFjkkDGXhyKF22Grj-aGCTC74OGhtuJ9JChitqvqtCVi1wr_Lnh6Y=@emersion.fr (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/atomic: don't reset link-status to GOOD without ALLOW_MODESET | expand |
On Wed, Jun 03, 2020 at 10:45:23AM +0000, Simon Ser wrote: > 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@emersion.fr> > Suggested-by: Pekka Paalanen <ppaalanen@gmail.com> I think we should have Cc: stable@vger.kernel.org on this. Also I think would be really awesome if we can update/extend the igt, but I guess if you don't have a chamelium it's a bit hard to make that happen :-/ Also I guess you'll reflect this in your doc patch? With the cc: stable this has my Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cheers, Daniel > Cc: Daniel Vetter <daniel@ffwll.ch> > Cc: Manasi Navare <manasi.d.navare@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 > >
On Wed, Jun 03, 2020 at 10:45:23AM +0000, Simon Ser wrote: > 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 I didn't think udate_output_state() was getting called for non-legacy paths. Where is that coming from? > 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@emersion.fr> > Suggested-by: Pekka Paalanen <ppaalanen@gmail.com> > Cc: Daniel Vetter <daniel@ffwll.ch> > Cc: Manasi Navare <manasi.d.navare@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 > > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel
On Wed, Jun 03, 2020 at 02:13:43PM +0300, Ville Syrjälä wrote: > On Wed, Jun 03, 2020 at 10:45:23AM +0000, Simon Ser wrote: > > 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 > > I didn't think udate_output_state() was getting called for > non-legacy paths. Where is that coming from? Oops, I'm blind and you're right, there's no bug. We already only force-set this for legacy modeset (and fbcon). That also means that atomic userspace has to handle this, which is maybe not so awesome ... So maybe we need to duct-tape over this for atomic too, and in that case it should be only done when ALLOW_MODESET is set. But maybe all the compositors that care will handle this :-/ -Daniel > > > 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@emersion.fr> > > Suggested-by: Pekka Paalanen <ppaalanen@gmail.com> > > Cc: Daniel Vetter <daniel@ffwll.ch> > > Cc: Manasi Navare <manasi.d.navare@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 > > > > > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > > -- > Ville Syrjälä > Intel > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel
On Wednesday, June 3, 2020 1:36 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > On Wed, Jun 03, 2020 at 02:13:43PM +0300, Ville Syrjälä wrote: > > > On Wed, Jun 03, 2020 at 10:45:23AM +0000, Simon Ser wrote: > > > > > 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 > > > > I didn't think udate_output_state() was getting called for > > non-legacy paths. Where is that coming from? > > Oops, I'm blind and you're right, there's no bug. We already only > force-set this for legacy modeset (and fbcon). Indeed, good catch Ville. set_config is purely a legacy thing. > That also means that atomic userspace has to handle this, which is maybe > not so awesome ... So maybe we need to duct-tape over this for atomic too, > and in that case it should be only done when ALLOW_MODESET is set. > > But maybe all the compositors that care will handle this :-/ Not fond of this because we'll basically end up with some drivers checking for link-status (none do that yet) and some user-space resetting it to GOOD. It'll break only if user-space doesn't reset and a driver which checks link-status is used. Driver-specific behaviour isn't great.
On Wed, Jun 03, 2020 at 01:17:14PM +0000, Simon Ser wrote: > On Wednesday, June 3, 2020 1:36 PM, Daniel Vetter <daniel@ffwll.ch> wrote: > > > On Wed, Jun 03, 2020 at 02:13:43PM +0300, Ville Syrjälä wrote: > > > > > On Wed, Jun 03, 2020 at 10:45:23AM +0000, Simon Ser wrote: > > > > > > > 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 > > > > > > I didn't think udate_output_state() was getting called for > > > non-legacy paths. Where is that coming from? > > > > Oops, I'm blind and you're right, there's no bug. We already only > > force-set this for legacy modeset (and fbcon). > > Indeed, good catch Ville. set_config is purely a legacy thing. > > > That also means that atomic userspace has to handle this, which is maybe > > not so awesome ... So maybe we need to duct-tape over this for atomic too, > > and in that case it should be only done when ALLOW_MODESET is set. > > > > But maybe all the compositors that care will handle this :-/ > > Not fond of this because we'll basically end up with some drivers > checking for link-status (none do that yet) and some user-space > resetting it to GOOD. It'll break only if user-space doesn't reset and > a driver which checks link-status is used. Driver-specific behaviour > isn't great. See my other reply, drivers don't need to check for GOOD, it's kinda magic. -Daniel
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; } }
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@emersion.fr> Suggested-by: Pekka Paalanen <ppaalanen@gmail.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Manasi Navare <manasi.d.navare@intel.com> --- drivers/gpu/drm/drm_atomic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)