diff mbox

[BUG] HDMI 12bpc causing occasional flickering and blanking

Message ID 20160215202633.GA23290@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Feb. 15, 2016, 8:26 p.m. UTC
On Mon, Feb 15, 2016 at 08:17:23PM +0100, Tore Anderson wrote:
> Hello,
> 
> Since upgrading to the Fedora 4.3 kernel package, the picture on my the
> BenQ M2700 HD monitor I've got connected to my HP EliteBook Folio 9470m
> laptop began having issues. The monitor is connected with a DP+-to-HDMI
> cable (HDMI in the monitor end), and the resolution I'm using is
> 1920x1080.
> 
> The symptoms are brief flickers of which looks like a thin horizontal
> line (or maybe more) overlaying the picture for a very brief period.
> This is ofte often (but not always) followed by the entire picture
> going completely black (kind of like when xscreensaver blanks the
> screen). Usually, the picture returns after maybe a second, but
> sometimes it remains off for several seconds before returning. It might
> also be that these blankings happen without a horizontal line flicker
> having occurred immediately before, thought it's hard to be certain
> because the flickers are very brief.
> 
> The laptop's internal screen is not impacted, the picture there remains
> stable while the external screen is flickering/blanking (including if
> both screens are set up in xrandr to show the same output).
> 
> Most of the time the flickers and blankings happens only occasionally,
> and be just a minor annoyance. However, some times it gets really bad,
> and the screen spends a majority of the time black - making it
> impossible to use the system. I have not determined anything that will
> with 100% certainty cause the symptoms to manifest themselves, but I do
> have a feeling that it is more likely to happen if the picture is
> mostly white/bright (e.g., when displaying a web browser window or an
> application such as gitk), and also after having resumed from suspend.
> But flickering/blanking certainly does happen if the screen showing
> mostly black xterms and without having suspended/resumed too.
> 
> I bisected the problem, which resulted in the following verdict:
> 
> 7a0baa6234468aa387f9b8a1a79dc2a4b4821f67 is the first bad commit
> commit 7a0baa6234468aa387f9b8a1a79dc2a4b4821f67
> Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Date:   Tue Jun 30 15:33:54 2015 +0300
> 
>     Revert "drm/i915: Disable 12bpc hdmi for now"
> 
>     HDMI 12bpc should be working fine now. Let it loose.
> 
>     This reverts commit 5e3daaca09f5158eff9c92290faa1d2001ecc6e4.
> 
>     v2: Rebased due to CHV/BXT port clock check improvemnts
> 
>     Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>     Reviewed-and-tested-by: Imre Deak <imre.deak@intel.com>
>     Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> I also confirmed that the problem is still present in drm-intel-nightly
> as of today (8ed1804). I'm currently running 8ed1804 + 7a0baa6 reverted
> and the symptoms are gone.
> 
> I've uploaded a kernel logs with drm.debug=0xe here:
> 
> http://filebin.net/r3nlwu09y2
> 
> One file is from when running 8ed1804 (with some comments of when the symptoms
> occurred added by me), the other file is from right now (running
> 8ed1804 + 7a0baa6 reverted) - I've not yet experienced any issues since
> booting the system with this kernel.

Could you test the following hack while using a 1920x1080 mode with 148.5 MHz
dotclock, and see if there's any improvement?

Comments

Tore Anderson Feb. 15, 2016, 10:37 p.m. UTC | #1
* Ville Syrjälä

> Could you test the following hack while using a 1920x1080 mode with
> 148.5 MHz dotclock, and see if there's any improvement?

I think it might be an improvement, that is, the blanking/flickers
seems to occur less often than it did with 8ed1804, but it is not
completely fixed. I've noticed 5-6 blankings events in the last hour or
so (during most of those events I wasn't even using the computer
actively, it was just sitting there showing a static image of gitk).

Kernel output here:

http://filebin.net/r3nlwu09y2/villepatched.txt

Tore
Tore Anderson Feb. 19, 2016, 7:55 p.m. UTC | #2
* Tore Anderson

> * Ville Syrjälä
> 
> > Could you test the following hack while using a 1920x1080 mode with
> > 148.5 MHz dotclock, and see if there's any improvement?  
> 
> I think it might be an improvement, that is, the blanking/flickers
> seems to occur less often than it did with 8ed1804, but it is not
> completely fixed.

Hi again Ville,

I spoke too soon. I've been doing some more testing with current Git
master (e7d04bf). I'm now certain that your patch makes no difference
whatsoever, the flickering/blanking is just as bad as before.

The intensity/frequency of the problems vary significantly, so when I
tested your patch previously I must have hit one of the better periods.
As I write this, however, the computer is essentially rendered
unusable. (I have no idea what causes this variance, unfortunately.)

Do you (or anyone else for that matter) have any other ideas?

By the way: Is it possible to disable HDMI 12bpc in a way that doesn't
require me to patch and rebuild the kernel drivers, such as a kernel
module parameter or sysfs setting? (I prefer to simply use the upstream
Fedora kernel RPMs, but this issue is currently making that impossible.)

Tore
Ville Syrjälä Feb. 23, 2016, 2:41 p.m. UTC | #3
On Fri, Feb 19, 2016 at 08:55:02PM +0100, Tore Anderson wrote:
> * Tore Anderson
> 
> > * Ville Syrjälä
> > 
> > > Could you test the following hack while using a 1920x1080 mode with
> > > 148.5 MHz dotclock, and see if there's any improvement?  
> > 
> > I think it might be an improvement, that is, the blanking/flickers
> > seems to occur less often than it did with 8ed1804, but it is not
> > completely fixed.
> 
> Hi again Ville,
> 
> I spoke too soon. I've been doing some more testing with current Git
> master (e7d04bf). I'm now certain that your patch makes no difference
> whatsoever, the flickering/blanking is just as bad as before.
> 
> The intensity/frequency of the problems vary significantly, so when I
> tested your patch previously I must have hit one of the better periods.
> As I write this, however, the computer is essentially rendered
> unusable. (I have no idea what causes this variance, unfortunately.)
> 
> Do you (or anyone else for that matter) have any other ideas?

"The monitor is connected with a DP+-to-HDMI cable"
This and some reading of the DP dual mode spec gave me another idea;
The DP->HDMI adaptor may simply be degrading the signal quality too
much. According to the DP dual mode spec we're supposed to limit the
TMDS clock based on the type of adapter used, but currently we have
no code to do that. I've cooked up a few patches that should do what
we want:
git://github.com/vsyrjala/linux.git dp_dual_mode

I've quickly tested it locally, and it seemed to do the right thing
with a few different types of adaptors.

> 
> By the way: Is it possible to disable HDMI 12bpc in a way that doesn't
> require me to patch and rebuild the kernel drivers, such as a kernel
> module parameter or sysfs setting? (I prefer to simply use the upstream
> Fedora kernel RPMs, but this issue is currently making that impossible.)

We don't have any knob to control this.

There is at least one way to do it though, but it's quite involved. What
you would need to do is dump the EDID, modify it to indicate that 12bpc
isn't supported (and fix up the CRC), and then use the firmware EDID
mechanism to override the EDID with the hacked up version.
Tore Anderson Feb. 23, 2016, 7:44 p.m. UTC | #4
Hi Ville,

> "The monitor is connected with a DP+-to-HDMI cable"
> This and some reading of the DP dual mode spec gave me another idea;
> The DP->HDMI adaptor may simply be degrading the signal quality too
> much. According to the DP dual mode spec we're supposed to limit the
> TMDS clock based on the type of adapter used, but currently we have
> no code to do that. I've cooked up a few patches that should do what
> we want:
> git://github.com/vsyrjala/linux.git dp_dual_mode
> 
> I've quickly tested it locally, and it seemed to do the right thing
> with a few different types of adaptors.

I've run 32fa589 for a few hours now and it have not seen a single
blank or flicker. So it seems you've nailed it - thanks a lot!

Let me know if you want me to test more patches, post debug logs, or
anything else.

BTW, also discovered right before you sent that e-mail that downgrading
to a 1920x1080i mode (rather than the monitor's native 1920x1080) would
also stop the flickering. I'd assume that also fits well with your
diagnosis (less bandwidth needed => better tolerance for degraded signal
quality), but I thought I'd let you know in case not.

> > By the way: Is it possible to disable HDMI 12bpc in a way that
> > doesn't require me to patch and rebuild the kernel drivers, such as
> > a kernel module parameter or sysfs setting? (I prefer to simply use
> > the upstream Fedora kernel RPMs, but this issue is currently making
> > that impossible.)  
> 
> We don't have any knob to control this.

I don't need it anymore, so no worries. ;-)

Tore
Ville Syrjälä Feb. 24, 2016, 3:09 p.m. UTC | #5
On Tue, Feb 23, 2016 at 08:44:49PM +0100, Tore Anderson wrote:
> Hi Ville,
> 
> > "The monitor is connected with a DP+-to-HDMI cable"
> > This and some reading of the DP dual mode spec gave me another idea;
> > The DP->HDMI adaptor may simply be degrading the signal quality too
> > much. According to the DP dual mode spec we're supposed to limit the
> > TMDS clock based on the type of adapter used, but currently we have
> > no code to do that. I've cooked up a few patches that should do what
> > we want:
> > git://github.com/vsyrjala/linux.git dp_dual_mode
> > 
> > I've quickly tested it locally, and it seemed to do the right thing
> > with a few different types of adaptors.
> 
> I've run 32fa589 for a few hours now and it have not seen a single
> blank or flicker. So it seems you've nailed it - thanks a lot!

Excellent.

> 
> Let me know if you want me to test more patches, post debug logs, or
> anything else.

Well, just to check the details of your particular cable/dongle,
maybe you can post the dmesg with drm.debug=0xe with my branch?
Or at least the parts that refer to DP dual mode adaptors.

> 
> BTW, also discovered right before you sent that e-mail that downgrading
> to a 1920x1080i mode (rather than the monitor's native 1920x1080) would
> also stop the flickering. I'd assume that also fits well with your
> diagnosis (less bandwidth needed => better tolerance for degraded signal
> quality), but I thought I'd let you know in case not.

Yeah, interlaced requires half the bandwidth of progressive, so it
should then fit comfortably within the 165MHz limit of the adaptor.

> 
> > > By the way: Is it possible to disable HDMI 12bpc in a way that
> > > doesn't require me to patch and rebuild the kernel drivers, such as
> > > a kernel module parameter or sysfs setting? (I prefer to simply use
> > > the upstream Fedora kernel RPMs, but this issue is currently making
> > > that impossible.)  
> > 
> > We don't have any knob to control this.
> 
> I don't need it anymore, so no worries. ;-)
> 
> Tore
Tore Anderson Feb. 24, 2016, 5:48 p.m. UTC | #6
Hi Ville,

> Well, just to check the details of your particular cable/dongle,
> maybe you can post the dmesg with drm.debug=0xe with my branch?
> Or at least the parts that refer to DP dual mode adaptors.

Here: http://filebin.net/gd91wnltky/dmesg.4.5.0-rc4-g32fa589.txt

I'm assuming the most important parts are:

[drm:intel_hdmi_dp_dual_mode_detect] DP dual mode adaptor (type 1 HDMI) detected (max TMDS clock: 165000 kHz, TMDS OE# control: no)
[drm:intel_hdmi_compute_config] picking bpc to 8 for HDMI output

For the record, I'd call my adapter a «cable» and not a «dongle». I had
thought it was completely passive; if there's any active circuitry
inside it it must be really tiny - it'd have to fit inside the rather
standard-sized HDMI/DP connectors in the ends.

Tore
Ville Syrjälä Feb. 24, 2016, 6:53 p.m. UTC | #7
On Wed, Feb 24, 2016 at 06:48:35PM +0100, Tore Anderson wrote:
> Hi Ville,
> 
> > Well, just to check the details of your particular cable/dongle,
> > maybe you can post the dmesg with drm.debug=0xe with my branch?
> > Or at least the parts that refer to DP dual mode adaptors.
> 
> Here: http://filebin.net/gd91wnltky/dmesg.4.5.0-rc4-g32fa589.txt
> 
> I'm assuming the most important parts are:
> 
> [drm:intel_hdmi_dp_dual_mode_detect] DP dual mode adaptor (type 1 HDMI) detected (max TMDS clock: 165000 kHz, TMDS OE# control: no)
> [drm:intel_hdmi_compute_config] picking bpc to 8 for HDMI output
> 
> For the record, I'd call my adapter a «cable» and not a «dongle». I had
> thought it was completely passive; if there's any active circuitry
> inside it it must be really tiny - it'd have to fit inside the rather
> standard-sized HDMI/DP connectors in the ends.

Yeah, the chips used for this stuff are pretty small. I had one dongle
fry itself a while back, so I pulled it apart and found a PS8121E
chip inside it (with a number of other mostly passive components).
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4e1321b96522..ea24de873e14 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12842,6 +12842,11 @@  intel_modeset_pipe_config(struct drm_crtc *crtc,
 
 	clear_intel_crtc_state(pipe_config);
 
+	if (pipe_config->base.adjusted_mode.clock == 148500) {
+		DRM_ERROR("adjusting dotclock\n");
+		pipe_config->base.adjusted_mode.clock = 148800;
+	}
+
 	pipe_config->cpu_transcoder =
 		(enum transcoder) to_intel_crtc(crtc)->pipe;