Bug 91871 - link retraining for DP not possible with current design of Atomic modeset framework
Summary: link retraining for DP not possible with current design of Atomic modeset fra...
Status: CLOSED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: Manasi
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-03 19:26 UTC by rtshiva
Modified: 2017-07-27 16:42 UTC (History)
3 users (show)

See Also:
i915 platform: ALL
i915 features: display/atomic, display/DP


Attachments

Description rtshiva 2015-09-03 19:26:00 UTC
DP spec requires Link training from highest link rate supported by panel to lowest link rate supported by panel. 

It is not possible to implement this in the current atomic modeset logic since it splits modeset into two half atomic_check and atomic_commit, where it is expected all values to be calculated in atomic_check and programmed in atomic_commit. 

link training being a negotiation phase of DP modeset it is not possible to predict if a training at certain link rate will succeed or not. if it does fail it will require us to disable, calculate new values and enable pll. this is not possible in current DRM Atomic modeset framework.
Comment 1 Jani Nikula 2015-09-04 06:51:58 UTC
To be fair, the same limitation was there before atomic.

Part of the problem is our modeset sequence, which we can't easily backtrack if the modeset fails at link training phase. Another part is that even if our modeset sequence supported that, we couldn't just reduce the mode to accommodate the lower link rate behind userspace's back. (We already pick the lowest rate that can support the mode; there's no margin to reduce.) We'd have to involve userspace somehow.

Drivers are free to use the drm dp helpers or use their own hooks for modeset. I think we should look at this from drm/i915 perspective, at least at first, so resassigning to DRM/Intel. If we come up with a way to negotiate this with userspace, that should be a generic solution.
Comment 2 Ville Syrjala 2015-09-04 07:28:24 UTC
One potential idea came to mind recently; We could try to train the link to the max immediately upon long hpd, and based on the maximum rate that was achieved we could filter out modes that exceed it. That way userspace shouldn't be able to request anything we can't deliver.

Unfortunately there are at least two problems with that apporach. First one being fastboot. We can't try to train the link when taking over from the BIOS without blinking the display, so we would either have to do that or limit the modes to whatever bitrate the BIOS chose to use. The other problem being that even if we initially succeed in training the link at a certain bitrate, there's no guarantee we can repeat the same feat later eg. due to changing environmental conditions. Though maybe this latter worry is a bit more theoretical, not sure.
Comment 3 dog 2017-02-01 20:55:47 UTC
Much work has been done on the DP driver lately in association with atomic mode set.  Can you verify if this is still an issue?  It seems to be more of an RFC which should be done on the mailing list.
Comment 4 Manasi 2017-02-02 20:01:52 UTC
Hi there,

I have been working on a solution for the problem discussed above and how can we send a notification back to userspace if link training fails during or after atomic modeset. Like Jani mentioned, in this case we cannot just reduce the link parameters and retrain the link because the link parameters are already set to the minimum required for the requested mode. So I have implemented a solution by adding a link-status property to the connector that will be set to BAD by the driver as soon as link training fails followed by a uevent sent to the userspace indicating the HW/connector configuration changed and it needs to refetch the modes and redo a modeset (effectively at lower mode). This avoids the problem of black screen on link failure during or after modeset, instead it retrains the link at lower link parameters and renders the display at lower resolution/mode resulting in a successful modeset at all times.

Some of the patches related to this are merged, few are still under review here:
https://patchwork.freedesktop.org/series/16912/

Regards
Manasi
Comment 5 Manasi 2017-04-27 23:50:19 UTC
Patches for Link retraining with current Atomic modeset framework are now merged.

So I am closing this bug for now. 

Manasi


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.