Some eDP fixes/improvements.
Subsystems (3)
Hi and happy new year!
Since i now have a MBP 2017 to play with, with a 10 bit Retina panel, and Polaris gpu, i'm trying to get it to get 10 bits, and found one small bug [fix: patch1], and a quirk of Apples Retina eDP sink, for which i propose patch2 as solution. I sent a similar patch to i915 to make 10 bit Retina work with the Intel Kabylake igp on that machine.
If these make sense, it would be cool to still get them into drm-fixes for Linux 5.5, so users of spring distro updates like Ubuntu 20.04 LTS can get a more colorful new year.
thanks,
-mario
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/2 drm/amd/display: Reorder detect_edp_sink_caps before link settings read.
read_current_link_settings_on_detect() on eDP 1.4+ may use the edp_supported_link_rates table which is set up by detect_edp_sink_caps(), so that function needs to be called first.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -1
@@ -817,8 +817,8 @@ static bool dc_link_detect_helper(struct dc_link *link, }case SIGNAL_TYPE_EDP : { -read_current_link_settings_on_detect (link);detect_edp_sink_caps (link); +read_current_link_settings_on_detect (link); sink_caps.transaction_type =DDC_TRANSACTION_TYPE_I2C_OVER_AUX ; sink_caps.signal =SIGNAL_TYPE_EDP ;break ;
Signature · 6 lines
2.24.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/2] drm/amd/display: Reorder detect_edp_sink_caps before link settings read.
Quoted 6 lines · Mario Kleiner
read_current_link_settings_on_detect()on eDP 1.4+ may use theedp_supported_link_ratestable which is set up bydetect_edp_sink_caps(), so that function needs to be called first.Signed-off-by Mario Kleiner <[email protected]>Cc Martin Leung <[email protected]>
This also fixes our assumption that retrieve_link_cap is the first DPCD reads we perform during detection.
Harry
Quoted 10 lines
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/core/dc_link.c +0
-0
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link *link, · line 824
Quoted 9 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-1@@ -817,8 +817,8 @@ static bool dc_link_detect_helper(struct dc_link *link, }case SIGNAL_TYPE_EDP : { -read_current_link_settings_on_detect (link);detect_edp_sink_caps (link); +read_current_link_settings_on_detect (link); sink_caps.transaction_type =DDC_TRANSACTION_TYPE_I2C_OVER_AUX ; sink_caps.signal =SIGNAL_TYPE_EDP ;break ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
AppliedRe: [PATCH 1/2] drm/amd/display: Reorder detect_edp_sink_caps before link settings read.
Applied. Thanks!
Alex
Quoted 27 lines · Harry Wentland
Quoted 6 lines · Mario Kleiner
read_current_link_settings_on_detect()on eDP 1.4+ may use theedp_supported_link_ratestable which is set up bydetect_edp_sink_caps(), so that function needs to be called first.Signed-off-by Mario Kleiner <[email protected]>Cc Martin Leung <[email protected]>Reviewed-by Harry Wentland <[email protected]>This also fixes our assumption that
retrieve_link_capis the first DPCD reads we perform during detection.Harry
Quoted 11 lines
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/core/dc_link.c +0
-0@@ -817,8 +817,8 @@ static bool dc_link_detect_helper(struct dc_link *link, }
Quoted 12 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link *link, · line 824
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-1case SIGNAL_TYPE_EDP : { -read_current_link_settings_on_detect (link);detect_edp_sink_caps (link); +read_current_link_settings_on_detect (link); sink_caps.transaction_type =DDC_TRANSACTION_TYPE_I2C_OVER_AUX ; sink_caps.signal =SIGNAL_TYPE_EDP ;break ;_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amd/display: Allow current eDP link settings to override verified ones.
In reply to Mario KleinerIf the current eDP link settings, as read from hw, provide a higher bandwidth than the verified_link_cap ones (= reported_link_cap), then override verified_link_cap with current settings.
These initial current eDP link settings have been set up by firmware during boot, so they should work on the eDP panel. Therefore use them if the firmware thinks they are good and they provide higher link bandwidth, e.g., to enable higher resolutions / color depths.
This fixes a problem found on the MacBookPro 2017 Retina panel:
The panel reports 10 bpc color depth in its EDID, and the firmware chooses link settings at boot which support enough bandwidth for 10 bpc (324000 kbit/sec aka LINK_RATE_RBR2), but the DP_MAX_LINK_RATE dpcd register only reports 2.7 Gbps as possible, so verified_link_cap is only good for 2.7 Gbps and 8 bpc, not providing the full color depth of the panel.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +21 -0
@@ -819,6 +819,27 @@ static bool dc_link_detect_helper(struct dc_link *link,case SIGNAL_TYPE_EDP : {detect_edp_sink_caps (link);read_current_link_settings_on_detect (link); + +/* If cur_link_settings provides higher bandwidth than +* verified_link_cap, then use cur_link_settings as new +* verified_link_cap, as it obviously works according to +* firmware boot setup. +* +* This has been observed on the Apple MacBookPro 2017 +* Retina panel, which boots with a link setting higher +* than what dpcd[DP_MAX_LINK_RATE] claims as possible. +* Overriding allows to run the panel at 10 bpc / 30 bit. +*/ +if (dc_link_bandwidth_kbps (link, &link->cur_link_settings) > +dc_link_bandwidth_kbps (link, &link->verified_link_cap)) { +DC_LOG_DETECTION_DP_CAPS ( +"eDP current link setting bw %d kbps > verified_link_cap %d kbps. Override." , +dc_link_bandwidth_kbps (link, &link->cur_link_settings), +dc_link_bandwidth_kbps (link, &link->verified_link_cap)); + + link->verified_link_cap = link->cur_link_settings; + } + sink_caps.transaction_type =DDC_TRANSACTION_TYPE_I2C_OVER_AUX ; sink_caps.signal =SIGNAL_TYPE_EDP ;break ;
Signature · 6 lines
2.24.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amd/display: Allow current eDP link settings to override verified ones.
Quoted 10 lines · Mario Kleiner
If the current eDP link settings, as read from hw, provide a higher bandwidth than the
verified_link_capones (=reported_link_cap), then overrideverified_link_capwith current settings.These initial current eDP link settings have been set up by firmware during boot, so they should work on the eDP panel. Therefore use them if the firmware thinks they are good and they provide higher link bandwidth, e.g., to enable higher resolutions / color depths.
This only works when taking over from UEFI, so on boot or resume from hibernate. This wouldn't work on a normal suspend/resume.
Can you check if setting link->dc->config.optimize_edp_link_rate (see first if statement in detect_edp_sink_caps) fixes this? I imagine we need to read the reported settings from DP_SUPPORTED_LINK_RATES and fail to do so.
Thanks,
Harry
Quoted 38 lines
This fixes a problem found on the MacBookPro 2017 Retina panel:
The panel reports 10 bpc color depth in its EDID, and the firmware chooses link settings at boot which support enough bandwidth for 10 bpc (324000 kbit/sec aka
LINK_RATE_RBR2), but theDP_MAX_LINK_RATEdpcd register only reports 2.7 Gbps as possible, soverified_link_capis only good for 2.7 Gbps and 8 bpc, not providing the full color depth of the panel.Signed-off-by Mario Kleiner <[email protected]>Cc Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)drivers/gpu/drm/amd/display/dc/core/dc_link.c +14
-0@@ -819,6 +819,27 @@ static bool dc_link_detect_helper(struct dc_link *link,case SIGNAL_TYPE_EDP : {detect_edp_sink_caps (link);read_current_link_settings_on_detect (link); + +/* If cur_link_settings provides higher bandwidth than +* verified_link_cap, then use cur_link_settings as new +* verified_link_cap, as it obviously works according to +* firmware boot setup. +* +* This has been observed on the Apple MacBookPro 2017 +* Retina panel, which boots with a link setting higher +* than what dpcd[DP_MAX_LINK_RATE] claims as possible. +* Overriding allows to run the panel at 10 bpc / 30 bit. +*/ +if (dc_link_bandwidth_kbps (link, &link->cur_link_settings) > +dc_link_bandwidth_kbps (link, &link->verified_link_cap)) { + DC_LOG_DETECTION_DP_CAPS(
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link *link, · line 845
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +7
-0+"eDP current link setting bw %d kbps > verified_link_cap %d kbps. Override." , +dc_link_bandwidth_kbps (link, &link->cur_link_settings), + dc_link_bandwidth_kbps(link, &link->verified_link_cap)); + + link->verified_link_cap = link->cur_link_settings; + } + sink_caps.transaction_type =DDC_TRANSACTION_TYPE_I2C_OVER_AUX ; sink_caps.signal =SIGNAL_TYPE_EDP ;break ;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/amd/display: Allow current eDP link settings to override verified ones.
Quoted 5 lines · Harry Wentland
Quoted 4 lines · Mario Kleiner
If the current eDP link settings, as read from hw, provide a higher bandwidth than the
verified_link_capones (=reported_link_cap), then overrideverified_link_capwith current settings.
Quoted 7 lines
Quoted 6 lines
These initial current eDP link settings have been set up by firmware during boot, so they should work on the eDP panel. Therefore use them if the firmware thinks they are good and they provide higher link bandwidth, e.g., to enable higher resolutions / color depths.
Hi Harry, happy new year!
This only works when taking over from UEFI, so on boot or resume from
Quoted 3 lines
hibernate. This wouldn't work on a normal suspend/resume.
See the other thread i just cc'ed you on. Depends if dc_link_detect_helper() gets skipped/early returns or not on EDP. Some if statement suggests it might get skipped on EDP + resume?
Quoted 5 lines
Can you check if setting
link->dc->config.optimize_edp_link_rate(see first if statement indetect_edp_sink_caps) fixes this? I imagine we need to read the reported settings fromDP_SUPPORTED_LINK_RATESand fail to do so.
Tried that already (see other mail), replacing the whole if statement with a if (true) to force reading DP_SUPPORTED_LINK_RATES. The whole table reads back as all-zero, and versions are DP 1.1, eDP 1.3, not 1.4+ as what seems to be required. The use the classic link bw stuff, but with a non-standard link bandwidth multiplier of 0xc, and a reported DP_MAX_LINK_RATE of 0xa, contradicting the 0xc setting that the firmware sets at bootup.
Seems to be a very Apple thing...
-mario
Quoted 57 lines
Thanks,
HarryQuoted 9 lines
This fixes a problem found on the MacBookPro 2017 Retina panel:
The panel reports 10 bpc color depth in its EDID, and the firmware chooses link settings at boot which support enough bandwidth for 10 bpc (324000 kbit/sec aka
LINK_RATE_RBR2), but theDP_MAX_LINK_RATEdpcd register only reports 2.7 Gbps as possible, soverified_link_capis only good for 2.7 Gbps and 8 bpc, not providing the full color depth of the panel.Review
Quoted 7 lines
Signed-off-by Mario Kleiner <[email protected]>Cc Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/display/dc/core/dc_link.cdrivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link
Quoted 4 lines
index
5ea4a1675259..f3acdb8fead5100644drivers/gpu/drm/amd/display/dc/core/dc_link.c +0
-0@@ -819,6 +819,27 @@ static bool dc_link_detect_helper(struct dc_link*link,
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link *link,
Quoted 5 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2
-0case SIGNAL_TYPE_EDP : {detect_edp_sink_caps (link);read_current_link_settings_on_detect (link); + +/* If cur_link_settings provides higher bandwidth than
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 824
Quoted 1 line
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-0+* verified_link_cap, then use cur_link_settings as new
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 825
Quoted 1 line
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-0+* verified_link_cap, as it obviously works according to
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link *link,
Quoted 3 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +3
-0+* firmware boot setup. +* +* This has been observed on the Apple MacBookPro 2017
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 829
Quoted 1 line
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-0+* Retina panel, which boots with a link setting higher
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 830
Quoted 1 line
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-0+* than what dpcd[DP_MAX_LINK_RATE] claims as possible.
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 831
Quoted 1 line
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-0+* Overriding allows to run the panel at 10 bpc / 30 bit.
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 833
Quoted 2 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2
-0+*/ + if (dc_link_bandwidth_kbps(link,
&link->cur_link_settings) >drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 834
Quoted 1 line
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-0+ dc_link_bandwidth_kbps(link,
&link->verified_link_cap)) {drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 836
Quoted 2 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2
-0+ DC_LOG_DETECTION_DP_CAPS( + "eDP current link setting bw %d kbps >
verified_link_cap%d kbps. Override.",drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 837
Quoted 1 line
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-0+ dc_link_bandwidth_kbps(link,
&link->cur_link_settings),drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 838
Quoted 1 line
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1
-0+ dc_link_bandwidth_kbps(link,
Quoted 12 lines
&link->verified_link_cap));drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link · line 840
Quoted 2 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2
-0+ + link->verified_link_cap =
link->cur_link_settings;drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link *link,
Quoted 3 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2
-0+ } + sink_caps.transaction_type =
DDC_TRANSACTION_TYPE_I2C_OVER_AUX;Quoted 3 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +0
-0sink_caps.signal =SIGNAL_TYPE_EDP ;break ;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/amd/display: Allow current eDP link settings to override verified ones.
Quoted 14 lines · Mario Kleiner
On Thu, Jan 9, 2020 at 7:44 PM Harry Wentland <[email protected] <mailto:[email protected]>> wrote:
On 2020-01-09 10:20 a.m., Mario Kleiner wrote:
> If the current eDP link settings, as read from hw, provide a higher > bandwidth than theverified_link_capones (=reported_link_cap), then > overrideverified_link_capwith current settings.
>
> These initial current eDP link settings have been set up by > firmware during boot, so they should work on the eDP panel. > Therefore use them if the firmware thinks they are good and > they provide higher link bandwidth, e.g., to enable higher > resolutions / color depths.
>
Quoted 5 lines
Hi Harry, happy new year!
Frohes Neues. :)
Quoted 8 lines
This only works when taking over from UEFI, so on boot or resume from hibernate. This wouldn't work on a normal suspend/resume.
See the other thread i just cc'ed you on. Depends if
dc_link_detect_helper()gets skipped/early returns or not on EDP. Some if statement suggests it might get skipped on EDP + resume?
You've likely looked at the code more closely while debugging this than I have recently. It looks like we indeed skip detection if we've previously detected the eDP sink.
Quoted 15 lines
Can you check if setting
link->dc->config.optimize_edp_link_rate(see first if statement indetect_edp_sink_caps) fixes this? I imagine we need to read the reported settings fromDP_SUPPORTED_LINK_RATESand fail to do so.Tried that already (see other mail), replacing the whole if statement with a if (true) to force reading
DP_SUPPORTED_LINK_RATES. The whole table reads back as all-zero, and versions are DP 1.1, eDP 1.3, not 1.4+ as what seems to be required. The use the classic link bw stuff, but with a non-standard link bandwidth multiplier of0xc, and a reportedDP_MAX_LINK_RATEof0xa, contradicting the0xcsetting that the firmware sets at bootup.
Quoted 1 line
Seems to be a very Apple thing...
Indeed. I think it was a funky panel that was "ahead of its time" and ahead of the spec.
I would prefer a DPCD quirk for this panel that updates the reported DP caps, rather than picking the "current" ones from the FW lightup.
Harry
Quoted 66 lines
-mario
Thanks, Harry > This fixes a problem found on the MacBookPro 2017 Retina panel: > > The panel reports 10 bpc color depth in its EDID, and the > firmware chooses link settings at boot which support enough > bandwidth for 10 bpc (324000 kbit/sec aka LINK_RATE_RBR2), > but the DP_MAX_LINK_RATE dpcd register only reports 2.7 Gbps > as possible, so verified_link_cap is only good for 2.7 Gbps > and 8 bpc, not providing the full color depth of the panel. > > Signed-off-by: Mario Kleiner <[email protected] <mailto:[email protected]>> > Cc: Alex Deucher <[email protected] <mailto:[email protected]>> > --- > drivers/gpu/drm/amd/display/dc/core/dc_link.c | 21 +++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c > index 5ea4a1675259..f3acdb8fead5 100644 > --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c > @@ -819,6 +819,27 @@ static bool dc_link_detect_helper(struct dc_link *link, > case SIGNAL_TYPE_EDP: { > detect_edp_sink_caps(link); > read_current_link_settings_on_detect(link); > + > + /* If cur_link_settings provides higher bandwidth than > + * verified_link_cap, then use cur_link_settings as new > + * verified_link_cap, as it obviously works according to > + * firmware boot setup. > + * > + * This has been observed on the Apple MacBookPro 2017 > + * Retina panel, which boots with a link setting higher > + * than what dpcd[DP_MAX_LINK_RATE] claims as possible. > + * Overriding allows to run the panel at 10 bpc / 30 bit. > + */ > + if (dc_link_bandwidth_kbps(link, &link->cur_link_settings) > > + dc_link_bandwidth_kbps(link, &link->verified_link_cap)) { > + DC_LOG_DETECTION_DP_CAPS( > + "eDP current link setting bw %d kbps > verified_link_cap %d kbps. Override.", > + dc_link_bandwidth_kbps(link, &link->cur_link_settings), > + dc_link_bandwidth_kbps(link, &link->verified_link_cap)); > + > + link->verified_link_cap =
Quoted 9 lines
link->cur_link_settings;
> + }
> +
> sink_caps.transaction_type =
DDC_TRANSACTION_TYPE_I2C_OVER_AUX;
> sink_caps.signal = SIGNAL_TYPE_EDP;
> break;
>_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/amd/display: Allow current eDP link settings to override verified ones.
Hi Harry
Ok, back from various other emergencies and deadlines, sorry for the late reply. I also fixed my e-mail address - it was mistyped, causing all these delivery failures :/
Quoted 16 lines · Harry Wentland
Quoted 14 lines · Mario Kleiner
On Thu, Jan 9, 2020 at 7:44 PM Harry Wentland <[email protected] <mailto:[email protected]>> wrote:
On 2020-01-09 10:20 a.m., Mario Kleiner wrote:
> If the current eDP link settings, as read from hw, provide a higher > bandwidth than theverified_link_capones (=reported_link_cap), then > overrideverified_link_capwith current settings.
>
> These initial current eDP link settings have been set up by > firmware during boot, so they should work on the eDP panel. > Therefore use them if the firmware thinks they are good and > they provide higher link bandwidth, e.g., to enable higher > resolutions / color depths.
>
... snip ...
Quoted 12 lines
Quoted 11 lines
Tried that already (see other mail), replacing the whole if statement with a if (true) to force reading
DP_SUPPORTED_LINK_RATES. The whole table reads back as all-zero, and versions are DP 1.1, eDP 1.3, not 1.4+ as what seems to be required. The use the classic link bw stuff, but with a non-standard link bandwidth multiplier of0xc, and a reportedDP_MAX_LINK_RATEof0xa, contradicting the0xcsetting that the firmware sets at bootup.Seems to be a very Apple thing...
Quoted 8 lines
Indeed. I think it was a funky panel that was "ahead of its time" and ahead of the spec.
I would prefer a DPCD quirk for this panel that updates the reported DP caps, rather than picking the "current" ones from the FW lightup.
Harry
How would i do this? I see various options:
I could rewrite my current patch, move it down inside dc_link_detect_helper() until after the edid was read and we have vendor/model id available, then say if(everything that's there now && (vendor=Apple) && (model=Troublesomepanel)) { ... }
Or i could add quirk code to detect_edp_sink_caps() after retrieve_link_cap() [or inside retrieve_link_cap] to override the reported_link_cap. But at that point we don't have edid yet and therefore no vendor/model id. Is there something inside the dpcd one can use to uniquely identify this display model?
struct dp_device_vendor_id sink_id; queried inside retrieve_link_cap() sounds like it could be a unique id? I don't know about that.
My intention was to actually do nothing on the AMD side here, as my photometer measurements suggest that the panel gives better quality results for >= 10 bpc output if it is operated at 8 bit and then the gpu's spatial dithering convincingly fakes the extra bits. Quality seems worse if one actually switches the panel into 10 bpc, as it doesn't seem to be a real 10 bit panel, just a 8 bit panel that accepts 10 bit and then badly dithers it to 10 bit.
The situation has changed for Linux 5.6-rc, because of this recent commit from Roman Li, which is already in 5.6-rc:4a8ca46bae8affba063aabac85a0b1401ba810a3 "drm/amd/display: Default max bpc to 16 for eDP"
While that commit supposedly fixes some darkness on some other eDP panel, it now breaks my eDP panel. It leaves edid reported bpc unclamped, so the driver uses 10 bpc as basis for required bandwidth calculations and then the required bandwidth for all modes exceeds the link bandwidth. I end with the eDP panel having no valid modes at all ==> Panel goes black, game over.
We either need to revert that commit for drm-fixes, or quirk it for the specific panels that are troublesome, or need to get some solution into 5.6-rc, otherwise there will be a lot of regressions for at least Apple MBP users.
thanks,
-mario
Quoted 67 lines
Quoted 67 lines
-mario
Thanks,
Harry> This fixes a problem found on the MacBookPro 2017 Retina panel:
>
> The panel reports 10 bpc color depth in its EDID, and the > firmware chooses link settings at boot which support enough > bandwidth for 10 bpc (324000 kbit/sec akaLINK_RATE_RBR2), > but theDP_MAX_LINK_RATEdpcd register only reports 2.7 Gbps > as possible, soverified_link_capis only good for 2.7 Gbps > and 8 bpc, not providing the full color depth of the panel. >
> Signed-off-by: Mario Kleiner <[email protected] <mailto:[email protected]>>
> Cc: Alex Deucher <[email protected] <mailto:[email protected]>>
> ---
>drivers/gpu/drm/amd/display/dc/core/dc_link.c| 21
+++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --gita/drivers/gpu/drm/amd/display/dc/core/dc_link.cb/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> index5ea4a1675259..f3acdb8fead5100644
> ---a/drivers/gpu/drm/amd/display/dc/core/dc_link.c> +++b/drivers/gpu/drm/amd/display/dc/core/dc_link.c> @@ -819,6 +819,27 @@ static bool dc_link_detect_helper(structdc_link*link,
> caseSIGNAL_TYPE_EDP: {
>detect_edp_sink_caps(link);
>read_current_link_settings_on_detect(link);
> +
> + /* Ifcur_link_settingsprovides higher
bandwidth than
> + *verified_link_cap, then use
cur_link_settingsas new
> + *verified_link_cap, as it obviously works
according to
> + * firmware boot setup.
> + *
> + * This has been observed on the Apple
MacBookPro 2017
> + * Retina panel, which boots with a link
setting higher
> + * than what dpcd[DP_MAX_LINK_RATE] claims
as possible.
> + * Overriding allows to run the panel at 10
bpc / 30 bit.
> + */
> + if (dc_link_bandwidth_kbps(link,
&link->cur_link_settings) >
> + dc_link_bandwidth_kbps(link,
&link->verified_link_cap)) {
> + DC_LOG_DETECTION_DP_CAPS(
> + "eDP current link setting bw %d kbps
>verified_link_cap%d kbps. Override.",
> + dc_link_bandwidth_kbps(link,
&link->cur_link_settings),
> + dc_link_bandwidth_kbps(link,
&link->verified_link_cap));
> +
> +link->verified_link_cap=
link->cur_link_settings;
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c static bool dc_link_detect_helper(struct dc_link *link,
Quoted 3 lines
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2
-0+ } + sink_caps.transaction_type =DDC_TRANSACTION_TYPE_I2C_OVER_AUX; > sink_caps.signal = SIGNAL_TYPE_EDP; > break; >
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amd/display: Allow current eDP link settings to override verified ones.
Quoted 82 lines · Mario Kleiner
Hi Harry
Ok, back from various other emergencies and deadlines, sorry for the late reply. I also fixed my e-mail address - it was mistyped, causing all these delivery failures :/
Quoted 16 lines · Harry Wentland
Quoted 14 lines · Mario Kleiner
On Thu, Jan 9, 2020 at 7:44 PM Harry Wentland <[email protected] <mailto:[email protected]>> wrote:
On 2020-01-09 10:20 a.m., Mario Kleiner wrote:
> If the current eDP link settings, as read from hw, provide a higher > bandwidth than theverified_link_capones (=reported_link_cap), then > overrideverified_link_capwith current settings.
>
> These initial current eDP link settings have been set up by > firmware during boot, so they should work on the eDP panel. > Therefore use them if the firmware thinks they are good and > they provide higher link bandwidth, e.g., to enable higher > resolutions / color depths.
>... snip ...
Quoted 12 lines
Quoted 11 lines
Tried that already (see other mail), replacing the whole if statement with a if (true) to force reading
DP_SUPPORTED_LINK_RATES. The whole table reads back as all-zero, and versions are DP 1.1, eDP 1.3, not 1.4+ as what seems to be required. The use the classic link bw stuff, but with a non-standard link bandwidth multiplier of0xc, and a reportedDP_MAX_LINK_RATEof0xa, contradicting the0xcsetting that the firmware sets at bootup.Seems to be a very Apple thing...
Quoted 8 lines
Indeed. I think it was a funky panel that was "ahead of its time" and ahead of the spec.
I would prefer a DPCD quirk for this panel that updates the reported DP caps, rather than picking the "current" ones from the FW lightup.
Harry
How would i do this? I see various options:
I could rewrite my current patch, move it down inside
dc_link_detect_helper()until after the edid was read and we have vendor/model id available, then sayif(everything that's there now && (vendor=Apple) && (model=Troublesomepanel)){ ... }Or i could add quirk code to
detect_edp_sink_caps()afterretrieve_link_cap()[or insideretrieve_link_cap] to override thereported_link_cap. But at that point we don't have edid yet and therefore no vendor/model id. Is there something inside the dpcd one can use to uniquely identify this display model?struct
dp_device_vendor_idsink_id; queried insideretrieve_link_cap()sounds like it could be a unique id? I don't know about that.My intention was to actually do nothing on the AMD side here, as my photometer measurements suggest that the panel gives better quality results for >= 10 bpc output if it is operated at 8 bit and then the gpu's spatial dithering convincingly fakes the extra bits. Quality seems worse if one actually switches the panel into 10 bpc, as it doesn't seem to be a real 10 bit panel, just a 8 bit panel that accepts 10 bit and then badly dithers it to 10 bit.
The situation has changed for Linux 5.6-rc, because of this recent commit from Roman Li, which is already in 5.6-rc:
4a8ca46bae8affba063aabac85a0b1401ba810a3"drm/amd/display: Default max bpc to 16 for eDP"While that commit supposedly fixes some darkness on some other eDP panel, it now breaks my eDP panel. It leaves edid reported bpc unclamped, so the driver uses 10 bpc as basis for required bandwidth calculations and then the required bandwidth for all modes exceeds the link bandwidth. I end with the eDP panel having no valid modes at all ==> Panel goes black, game over.
Quoted 8 lines
We either need to revert that commit for drm-fixes, or quirk it for the specific panels that are troublesome, or need to get some solution into 5.6-rc, otherwise there will be a lot of regressions for at least Apple MBP users.
thanks,
-mario
Ok, just sent out a patch with a specific dpcd quirk for this as:
[PATCH] drm/amd/display: Add link_rate quirk for Apple 15" MBP 2017
Tested against drm-next for Linux 5.6, works.
-mario
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Mario Kleiner
Hi and happy new year!
Since i now have a MBP 2017 to play with, with a 10 bit Retina panel, and Polaris gpu, i'm trying to get it to get 10 bits, and found one small bug [fix: patch1], and a quirk of Apples Retina eDP sink, for which i propose patch2 as solution. I sent a similar patch to i915 to make 10 bit Retina work with the Intel Kabylake igp on that machine.
If these make sense, it would be cool to still get them into drm-fixes for Linux 5.5, so users of spring distro updates like Ubuntu 20.04 LTS can get a more colorful new year.
Just FTR, 20.04 will ship with 5.4 longterm kernel, not 5.5.
Signature · 5 lines
t _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel