[PATCH] i915: Fix HBLANK Expansion Quirk Causing Modeset Failure on Dell WD19TB Dock at 3440x1440@100Hz

Benjamin Hoefs posted 1 patch 2 months ago
drivers/gpu/drm/i915/display/intel_dp_mst.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] i915: Fix HBLANK Expansion Quirk Causing Modeset Failure on Dell WD19TB Dock at 3440x1440@100Hz
Posted by Benjamin Hoefs 2 months ago
Hello,

I am using a Dell WD19TB dock with a 3440x1440 monitor. Using it at
100Hz used to work but recently I tried it again and discovered it no longer
did, specifically the modeset seems to silently fail with no error message in
userspace utilities like kscreen-doctor and xrandr and no output in dmesg.
I found the problematic commit using git bisect to be
55eaef164174480df6827edeac15620f3cbcd52b "Handle the Synaptics HBlank
expansion quirk".

I found the issue to be the hblank_expasion_quirk_needs_dsc function which uses
the following comparison in the current kernel tree:

if (mode_hblank_period_ns(adjusted_mode) > hblank_limit)
	return false;

with hblank_limit being earlier set as

int hblank_limit = is_uhbr_sink ? 500 : 300;

However, my monitor's HBLANK period in the 3440x1440@100Hz mode is
exactly 300 ns as verified by this printk immediately before the
problematic comparison.

printk(KERN_INFO "Hello, kernel world! %i\n",
	mode_hblank_period_ns(adjusted_mode));
[   38.429839] Hello, kernel world! 300

With the attached change the modeset works as expected at 100Hz. Would it be
acceptable to modify the comparison from > to >= here?

I'll do my best to provide any additional details you may need although
that printk and '=' sign is the only kernel code I've written, so my best may
not be great :).

Signed-off-by: Benjamin D. Hoefs <bendhoefs@gmail.com>
---
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 15541932b809..052c5a67df93 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -446,7 +446,7 @@ hblank_expansion_quirk_needs_dsc(const struct intel_connector *connector,
 	if (is_uhbr_sink && !drm_dp_is_uhbr_rate(limits->max_rate))
 		return false;
 
-	if (mode_hblank_period_ns(adjusted_mode) > hblank_limit)
+	if (mode_hblank_period_ns(adjusted_mode) >= hblank_limit)
 		return false;
 
 	return true;
-- 
2.46.2
Re: [PATCH] i915: Fix HBLANK Expansion Quirk Causing Modeset Failure on Dell WD19TB Dock at 3440x1440@100Hz
Posted by Imre Deak 2 months ago
On Wed, Sep 25, 2024 at 07:25:34PM -0500, Benjamin Hoefs wrote:
> Hello,
> 
> I am using a Dell WD19TB dock with a 3440x1440 monitor. Using it at
> 100Hz used to work but recently I tried it again and discovered it no longer
> did, specifically the modeset seems to silently fail with no error message in
> userspace utilities like kscreen-doctor and xrandr and no output in dmesg.
> I found the problematic commit using git bisect to be
> 55eaef164174480df6827edeac15620f3cbcd52b "Handle the Synaptics HBlank
> expansion quirk".
> 
> I found the issue to be the hblank_expasion_quirk_needs_dsc function which uses
> the following comparison in the current kernel tree:
> 
> if (mode_hblank_period_ns(adjusted_mode) > hblank_limit)
> 	return false;
> 
> with hblank_limit being earlier set as
> 
> int hblank_limit = is_uhbr_sink ? 500 : 300;
> 
> However, my monitor's HBLANK period in the 3440x1440@100Hz mode is
> exactly 300 ns as verified by this printk immediately before the
> problematic comparison.
> 
> printk(KERN_INFO "Hello, kernel world! %i\n",
> 	mode_hblank_period_ns(adjusted_mode));
> [   38.429839] Hello, kernel world! 300
> 
> With the attached change the modeset works as expected at 100Hz. Would it be
> acceptable to modify the comparison from > to >= here?
> 
> I'll do my best to provide any additional details you may need although
> that printk and '=' sign is the only kernel code I've written, so my best may
> not be great :).
> 
> Signed-off-by: Benjamin D. Hoefs <bendhoefs@gmail.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp_mst.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 15541932b809..052c5a67df93 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -446,7 +446,7 @@ hblank_expansion_quirk_needs_dsc(const struct intel_connector *connector,
>  	if (is_uhbr_sink && !drm_dp_is_uhbr_rate(limits->max_rate))
>  		return false;
>  
> -	if (mode_hblank_period_ns(adjusted_mode) > hblank_limit)
> +	if (mode_hblank_period_ns(adjusted_mode) >= hblank_limit)
>  		return false;

Disabling DSC this way could make another mode with the same hblank
period not work. This mode would require DSC in any case if there is a
link BW limitation, so would need to check why DSC is failing. Could you
open a ticket at:

https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/new

attaching a dmesg log booting with drm.debug=0x15e?

Thanks,
Imre

>  
>  	return true;
> -- 
> 2.46.2
>