Bug 63609

Summary: [i915 SDVO regression] omposite TV-OUT shows vertical flickering with kernel >= 3.6.11
Product: DRI Reporter: Pierre Assal <pierre.assal>
Component: DRM/IntelAssignee: Daniel Vetter <daniel>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: critical    
Priority: medium CC: pierre.assal
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
dmesg with drm.debug=0xe
none
intel reg dump for working vs not working version of kernel (3.3.4 vs 3.8.8) none

Description Pierre Assal 2013-04-16 15:20:13 UTC
Created attachment 78092 [details]
dmesg with drm.debug=0xe

Hi

I have a custom PC with a custom motherboard from Advantech which has a E2160 @ 1.80GHz intel CPU and the i915 intel chipset.

I have recently updated the kernel that I use from version 2.6.39 to 3.6.11 and I have a problem with the i915 composite TV-OUT. This video output shows vertical flickering with the new kernel. Also I have noticed that the TV-OUT is no more enabled at kernel boot (it was enabled with kernel 2.6.39). 

Then I have tried with the latest kernels 3.8.7 & 3.9-rc7 from krnel.org. With these kernels, the TV-OUT is now enabled at kernel boot but is still flickering vertically.

Then I have tried with kernels 3.0.73, 3.2.43 and finally 3.4.40. And I have found that the TV-OUT seems to have been broken in kernel 3.4.40.

Can anyone help me in fixing this issue with kernel 3.6.11?

Attached you will find dmesg logs with drm.debug=0xe.

Regards,
Pierre Assal
Comment 1 Daniel Vetter 2013-04-17 16:17:46 UTC
Hm, sounds like the main issue is the flickering, all other issue seem to be resolved again on latest kernels. Two requests:

- Can you try to bisect the kernel patch which introduced the regression?

- (Maybe do this one first) Can you grab the latest git of intel-gpu-tools from http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/ and then attach the output of intel_reg_dumper both from the latest working kernel and the latest broken kernel (i.e. 3.9-rc7). Please make sure that your xrandr configuration matches and obviously that the TV output is enabled.
Comment 2 Pierre Assal 2013-04-24 17:47:16 UTC
Created attachment 78434 [details]
intel reg dump for working vs not working version of kernel (3.3.4 vs 3.8.8)
Comment 3 Pierre Assal 2013-04-24 17:52:34 UTC
Hi,

Sorry it took so long before I get back to you but I had a hard time compiling the intel_gpu_tools.
Attached you will fing the reg dump for a working version of the kernel (3.3.4) and the latest stable kernel 3.8.8 which is not working.

I will now try to bisect the kernel patch which introduced the regression. I will get back to you as soon as I have some info.

Let me know If you want me to test any potential fix or patch.

Thanks again for your help.
Pierre Assal
Comment 4 Daniel Vetter 2013-04-24 18:19:14 UTC
Ah, here's the other bug been hiding that I've looked for ;-)

Can you please test the fdi-dither branch from my personal git repo at

http://cgit.freedesktop.org/~danvet/drm

Thanks!
Comment 5 Pierre Assal 2013-04-25 11:19:17 UTC
(In reply to comment #4)
> Ah, here's the other bug been hiding that I've looked for ;-)
> 
> Can you please test the fdi-dither branch from my personal git repo at
> 
> http://cgit.freedesktop.org/~danvet/drm
> 
> Thanks!

Unfortunately my device does not boot with this kernel. It reboot as soon as grub jumps in the kernel.
Comment 6 Daniel Vetter 2013-04-25 12:35:33 UTC
Hm, have you tried to boot with i915.die=1 to rule out the intel gfx driver causing havoc?

The branch is based on top of 3.9-rc6, can you pls test whether that works (in case this is not an issue with i915.ko)?
Comment 7 Pierre Assal 2013-04-25 12:47:29 UTC
(In reply to comment #6)
> Hm, have you tried to boot with i915.die=1 to rule out the intel gfx driver
> causing havoc?
> 
> The branch is based on top of 3.9-rc6, can you pls test whether that works
> (in case this is not an issue with i915.ko)?


I was not pointing to the correct kernel in the grub config.
It works fine. I'm sorry to have misled you.
Comment 8 Pierre Assal 2013-04-25 12:49:28 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Hm, have you tried to boot with i915.die=1 to rule out the intel gfx driver
> > causing havoc?
> > 
> > The branch is based on top of 3.9-rc6, can you pls test whether that works
> > (in case this is not an issue with i915.ko)?
> 
> 
> I was not pointing to the correct kernel in the grub config.
> It works fine. I'm sorry to have misled you.

Like I have mentionned, I'm currently using kernel 3.6.11.
Is it possible to backport your fixes for this kernel version?
Comment 9 Daniel Vetter 2013-04-25 13:11:16 UTC
So TV-out is now perfectly working, without any flickering?

Problem is that this is an pretty massive rework of the modeset flow for 3.11, so first we need to figure out what exactly fixed things for you. I suspect it's the patch titled "drm/i915: make SDVO TV-out work for multifunction devices". Can you please try to revert that with git revert <sha1 of patch>, compile & install the kernel and then check whether things are broken again? Please make really sure that you're booting the right kernel.

If it's indeed that patch we can try to figure out whether/how to backport this to older kernels.
Comment 10 Pierre Assal 2013-04-25 13:32:14 UTC
(In reply to comment #9)
> So TV-out is now perfectly working, without any flickering?
> 
> Problem is that this is an pretty massive rework of the modeset flow for
> 3.11, so first we need to figure out what exactly fixed things for you. I
> suspect it's the patch titled "drm/i915: make SDVO TV-out work for
> multifunction devices". Can you please try to revert that with git revert
> <sha1 of patch>, compile & install the kernel and then check whether things
> are broken again? Please make really sure that you're booting the right
> kernel.
> 
> If it's indeed that patch we can try to figure out whether/how to backport
> this to older kernels.

I will try this immediately and get back to you asap.
Again thanks alot for your help. It is extremely appreciated.
Comment 11 Pierre Assal 2013-04-25 14:00:14 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > So TV-out is now perfectly working, without any flickering?
> > 
> > Problem is that this is an pretty massive rework of the modeset flow for
> > 3.11, so first we need to figure out what exactly fixed things for you. I
> > suspect it's the patch titled "drm/i915: make SDVO TV-out work for
> > multifunction devices". Can you please try to revert that with git revert
> > <sha1 of patch>, compile & install the kernel and then check whether things
> > are broken again? Please make really sure that you're booting the right
> > kernel.
> > 
> > If it's indeed that patch we can try to figure out whether/how to backport
> > this to older kernels.
> 
> I will try this immediately and get back to you asap.
> Again thanks alot for your help. It is extremely appreciated.

You're right. If I revert this patch the things are broken again. 
I will try to merge it to my kernel 3.6.11.
Comment 12 Pierre Assal 2013-04-25 16:24:09 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > So TV-out is now perfectly working, without any flickering?
> > > 
> > > Problem is that this is an pretty massive rework of the modeset flow for
> > > 3.11, so first we need to figure out what exactly fixed things for you. I
> > > suspect it's the patch titled "drm/i915: make SDVO TV-out work for
> > > multifunction devices". Can you please try to revert that with git revert
> > > <sha1 of patch>, compile & install the kernel and then check whether things
> > > are broken again? Please make really sure that you're booting the right
> > > kernel.
> > > 
> > > If it's indeed that patch we can try to figure out whether/how to backport
> > > this to older kernels.
> > 
> > I will try this immediately and get back to you asap.
> > Again thanks alot for your help. It is extremely appreciated.
> 
> You're right. If I revert this patch the things are broken again. 
> I will try to merge it to my kernel 3.6.11.

At first sight, I do not think that It will be easy to patch kernel 3.6.11 with this fix.
Do you think that you could help me with that?
Comment 13 Daniel Vetter 2013-04-25 17:05:13 UTC
> --- Comment #12 from Pierre Assal <pierre.assal@verint.com> ---
> (In reply to comment #11)
> > (In reply to comment #10)
> > > (In reply to comment #9)
> > > > So TV-out is now perfectly working, without any flickering?
> > > > 
> > > > Problem is that this is an pretty massive rework of the modeset flow for
> > > > 3.11, so first we need to figure out what exactly fixed things for you. I
> > > > suspect it's the patch titled "drm/i915: make SDVO TV-out work for
> > > > multifunction devices". Can you please try to revert that with git revert
> > > > <sha1 of patch>, compile & install the kernel and then check whether things
> > > > are broken again? Please make really sure that you're booting the right
> > > > kernel.
> > > > 
> > > > If it's indeed that patch we can try to figure out whether/how to backport
> > > > this to older kernels.
> > > 
> > > I will try this immediately and get back to you asap.
> > > Again thanks alot for your help. It is extremely appreciated.
> > 
> > You're right. If I revert this patch the things are broken again. 
> > I will try to merge it to my kernel 3.6.11.
> 
> At first sight, I do not think that It will be easy to patch kernel 3.6.11 with
> this fix.
> Do you think that you could help me with that?

The below diff is the core change (or at least I hope it is):

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e8dd8fe..3343d37 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4303,7 +4303,8 @@ static void vlv_update_pll(struct intel_crtc *crtc)
 
 static void i9xx_update_pll(struct intel_crtc *crtc,
 			    intel_clock_t *reduced_clock,
-			    int num_connectors)
+			    int num_connectors,
+			    bool needs_tv_clock)
 {
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4361,7 +4362,7 @@ static void i9xx_update_pll(struct intel_crtc *crtc,
 	if (INTEL_INFO(dev)->gen >= 4)
 		dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT);
 
-	if (is_sdvo && intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_TVOUT))
+	if (is_sdvo && needs_tv_clock)
 		dpll |= PLL_REF_INPUT_TVCLKINBC;
 	else if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_TVOUT))
 		/* XXX: just matching BIOS for now */
@@ -4686,7 +4687,8 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 	else
 		i9xx_update_pll(intel_crtc,
 				has_reduced_clock ? &reduced_clock : NULL,
-				num_connectors);
+				num_connectors,
+				is_sdvo && is_tv);
 
 	/* Set up the display plane register */
 	dspcntr = DISPPLANE_GAMMA_ENABLE;
Comment 14 Pierre Assal 2013-04-25 17:43:24 UTC
I have succesfully patched my kernel 3.6.11 with the core changes that you have hilighted and it is now working fine. No more flickering on the TV out!

In the future if you need someone to test with this particular setup I would be glad to help you.

I think that it would also be nice to commit this fix to kernel.org.

I want to thak you again for your great help.

Best regards,
Pierre Assal
Comment 15 Daniel Vetter 2013-08-06 06:58:33 UTC
Ok, I've submitted the minimal backport for stable kernels. With that and the fix which is already in 3.11 I think we're fully covered.

Thanks a lot for reporting this and please reopen the bug (or file a new one) if something breaks a again.

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.