Bug 42174

Summary: Unable to get 15" IBM L150P second display to work when plugged into (VGA2) using Intel Sandybridge linux driver
Product: xorg Reporter: Trey Ramsay <tramsay>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: eugeni, jbarnes, kwrzalik, przanoni
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
intel_reg_dumper_19VGA1_15VGA2.not_working: 15" L150P plugged into VGA2 does not work
none
intel_reg_dumper_15VGA1_19VGA2: 15" L150P display works when plugged into VGA1
none
dmesg_15VGA1_19VGA2: good
none
dmesg_19VGA1_15VGA2.not_working: bad
none
xrandr_non-working: 19"VGA1 1280x1024 60.0 15"VGA2 1024x768 60.0>
none
xrandr_vga1-15_vga2-19
none
xrandr_vga1-19_vga2-15
none
proposed patch
none
testdisplay-output.txt VGA1 - Good VGA2 - No Sync
none
dmesg.att_53752_06 none

Description Trey Ramsay 2011-10-24 14:01:55 UTC
With the patch provided from Bug 41272, both VGA1 and VGA2 work with my 19" and 20" displays.  I have a 15" L150P where dual display works when plugged into VGA1 and the 19" display is plugged into VGA2.  However, when I plug the 15" L150P into VGA2 and the 19" into VGA1, the 15" display does not sync when linux is booting and displays "Input signal out of range" on the display.  I see the BIOS startup screen on both screens. I was able to get X to mirror the second display when I set the Monitor sections in the xorg.conf file to:
      Option "PreferredMode" "800x600"


From Bug 41272 Comment 32
>Yes, this looks like a separate bug
>
>Please open a new bug and attach:
>- intel_reg_dumper with 15" on VGA2 and 19" on VGA1 (not working)
>- intel_reg_dumper with 15" on VGA1 and 19" on VGA2 (working)
>
>Comparing the two dumps might lead us to a fix.
Comment 1 Trey Ramsay 2011-10-24 14:05:20 UTC
Created attachment 52708 [details]
intel_reg_dumper_19VGA1_15VGA2.not_working:  15" L150P plugged into VGA2 does not work
Comment 2 Trey Ramsay 2011-10-24 14:07:02 UTC
Created attachment 52712 [details]
intel_reg_dumper_15VGA1_19VGA2: 15" L150P display works when plugged into VGA1
Comment 3 Trey Ramsay 2011-10-24 14:08:33 UTC
Created attachment 52714 [details]
dmesg_15VGA1_19VGA2:  good
Comment 4 Trey Ramsay 2011-10-24 14:09:30 UTC
Created attachment 52715 [details]
dmesg_19VGA1_15VGA2.not_working: bad
Comment 5 Chris Wilson 2011-10-24 14:28:58 UTC
Does the 15" display work independently on VGA-2 if nothing is plugged into VGA-1?

We have very little control over what the ADD2 card actually does, we request an output mode, it chooses what to signal to the display. As far as I can see, the register settings are consistently swapped over as the displays are swapped, so internally things look correct.
Comment 6 Trey Ramsay 2011-10-24 14:59:22 UTC
With no display plugged into VGA1, the 15" display did not work when plugged into VGA2.
Comment 8 Paulo Zanoni 2011-10-25 06:51:05 UTC
When you're at the "non-working" state, what happens if you try to change the video modes (using xrandr) on the not-working monitor? Does any of the modes work?
Comment 9 Trey Ramsay 2011-10-25 12:04:12 UTC
yes.. looks like I can get some of the modes to work using xrandr.

i.e.  xrandr --output VGA2 --mode 800x600 --rate 75

The table below shows the modes I tried using the 15" display attached to VGA2.  BAD indicates that the screen was blank, blinking green light and a "Input Signal Out of Range" message.  GOOD indicates that there was a picture and solid green light.

   1024x768       60.0_BAD     75.1_GOOD     70.1_BAD
   832x624        74.6_BAD
   800x600        72.2_GOOD    75.0_GOOD     60.3        56.2
   640x480        72.8         75.0          60.0        59.9
   720x400        70.1

I tried the following modes with the 19" plugged into VGA1 and the 15" plugged into VGA2.

   1024x768       60.0_BAD     75.1_GOOD
Comment 10 Paulo Zanoni 2011-10-25 12:09:46 UTC
(In reply to comment #9)
> yes.. looks like I can get some of the modes to work using xrandr.
> 
> i.e.  xrandr --output VGA2 --mode 800x600 --rate 75
> 
> The table below shows the modes I tried using the 15" display attached to VGA2.
>  BAD indicates that the screen was blank, blinking green light and a "Input
> Signal Out of Range" message.  GOOD indicates that there was a picture and
> solid green light.

The "picture and solid green light" is what you were expecting to see?

Please do this:
- go back to the non-working configuration
- obtain the output of "xrandr --verbose" and paste it here.
Comment 11 Trey Ramsay 2011-10-25 13:02:46 UTC
Created attachment 52760 [details]
xrandr_non-working: 19"VGA1 1280x1024 60.0     15"VGA2 1024x768 60.0>

>The "picture and solid green light" is what you were expecting to see?
Yes

>Please do this:
>- go back to the non-working configuration
>- obtain the output of "xrandr --verbose" and paste it here.
The xrandr_non-working attachment is with the --verbose flag
# xrandr
Screen 0: minimum 320 x 200, current 2304 x 1024, maximum 8192 x 8192
VGA1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm x 301mm
   1280x1024      60.0*+   75.0     72.0  
   1152x864       75.0  
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        72.8     75.0     66.7     60.0  
   720x400        70.1  
TV1 disconnected (normal left inverted right x axis y axis)
TV2 disconnected (normal left inverted right x axis y axis)
VGA2 connected 1024x768+1280+0 (normal left inverted right x axis y axis) 304mm x 228mm
   1024x768       60.0*+   75.1     70.1  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        72.8     75.0     60.0     59.9  
   720x400        70.1
Comment 12 Paulo Zanoni 2011-10-26 05:07:42 UTC
From looking at the logs and from the "good" and "bad" definitions you see, the first pattern I can observe is that the "-HSync -VSync" modes don't work...

It would be interesting to test 720x400 since it is the only "-HSync +VSync" mode.

I'll try to find out why this is happening.
Comment 13 Trey Ramsay 2011-10-26 08:40:40 UTC
15" Display: Mode 720x400 "-HSync +VSync" on VGA2 does not work

   1024x768       60.0_BAD     75.1_GOOD     70.1_BAD
   832x624        74.6_BAD
   800x600        72.2_GOOD    75.0_GOOD     60.3        56.2
   640x480        72.8         75.0          60.0        59.9
   720x400        70.1_BAD
Comment 14 Paulo Zanoni 2011-10-26 08:42:51 UTC
While you're at a non-working mode, what happens if you set the 18th bit of the 0xe1140 register to 1?

If you use "./intel_reg_read 0xe1140", you'll probably get a value of "0xa0000004". In this case, you'll have to "./intel_reg_write 0xe1140 0xa0040004".
Comment 15 Trey Ramsay 2011-10-26 10:07:16 UTC
Used 1024x768@60Hz on VGA2
No change after setting the register.  Blank Screen, blinking green light and 
"Input Signal Out of Range Message"

# ./intel_reg_read 0xe1140
0xE1140 : 0xA0000004

# ./intel_reg_write 0xe1140 0xa0040004
Value before: 0xA0000004
Value after: 0xA0040004
Comment 16 Trey Ramsay 2011-10-26 12:48:20 UTC
I have some good news. I tried setting the Sync_Polarity to High 

I can get the 2nd display to work by setting 0xe1140 to 0xA000001C

HDMIB register and setting it to 

# ./intel_reg_write 0xe1140 0xa000001C
Value before: 0xA0000004
Value after: 0xA000001C
Comment 17 Paulo Zanoni 2011-10-28 11:57:43 UTC
Ok, two more questions:

- If you connect another monitor on the sdvo output and ask for a mode that uses -VSync/-HSync, does it work?
- If you connect the 15" monitor on the non-sdvo output, do the -VSync/-HSync modes work?

If the problems only happen in the sDVO output, I'll have to ask:
- Connect a monitor on a non-sdvo, save the "xrandr --verbose" output.
- Connect the same monitor on the sdvo, save the "xrandr --verbose" output.

What I'm trying to check:
- Is the problem on the monitor (and its edid)?
- Is the problem on the way we read EDID from the monitors on the sdvo card?
Comment 18 Trey Ramsay 2011-10-31 13:30:08 UTC
>- If you connect another monitor on the sdvo output and ask for a mode that
>uses -VSync/-HSync, does it work?

No. I connected the 19" display to VGA2 and "1024x768 (0x47) 75.0MHz -HSync -VSync" did not work.  I was able to get it to work by updating 0xE1140 to 0xA000001C. 

1024x768 (0x47)   75.0MHz -HSync -VSync *current
        h: width  1024 start 1048 end 1184 total 1328 skew    0 clock   56.5KHz
        v: height  768 start  771 end  777 total  806           clock   70.1Hz

[root@sbtest1 intel]# ./intel_reg_read 0xe1140
0xE1140 : 0xA0000004
[root@sbtest1 intel]# ./intel_reg_write 0xe1140 0xa000001C
Value before: 0xA0000004
Value after: 0xA000001C   <--- This made it work

>- If you connect the 15" monitor on the non-sdvo output, do the -VSync/-HSync
>modes work?

Yes.  The 15" display using -VSync/-HSync works on VGA1

>If the problems only happen in the sDVO output, I'll have to ask:
>- Connect a monitor on a non-sdvo, save the "xrandr --verbose" output.
>- Connect the same monitor on the sdvo, save the "xrandr --verbose" output.

See Attachments: 
xrandr_vga1-15_vga2-19
xrandr_vga1-19_vga2-15
Comment 19 Trey Ramsay 2011-10-31 13:31:12 UTC
Created attachment 52969 [details]
xrandr_vga1-15_vga2-19
Comment 20 Trey Ramsay 2011-10-31 13:31:51 UTC
Created attachment 52970 [details]
xrandr_vga1-19_vga2-15
Comment 21 Trey Ramsay 2011-11-02 09:43:28 UTC
Paulo,
As an experiment, I set the SDVO HDMIB to always use +vsync and +hsync and was able to get all the modes on both my displays to work when attached to VGA2.  When booting to the command line,  the 19" display on VGA1 blinked twice before the 15" display on VGA2 synced up which took about 12 seconds.  Once it was up, all the modes including the -vsync and/or -hsync modes worked.

These are the changes I made for the experiment.

--- linux-3.0.x86_64.orig/drivers/gpu/drm/i915/intel_sdvo.c     2011-10-28 11:58:37.508722513 -0500
+++ linux-3.0.x86_64/drivers/gpu/drm/i915/intel_sdvo.c          2011-11-01 21:44:34.852123713 -0500
@@ -1072,9 +1072,13 @@ static void intel_sdvo_mode_set(struct d
                        sdvox |= intel_sdvo->color_range;
                if (INTEL_INFO(dev)->gen < 5)
                        sdvox |= SDVO_BORDER_ENABLE;
-               if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
+
+                /* HDMIB is not working with -vsync -hsync
+                 * Always set SDVO_VSYNC_ACTIVE_HIGH and SDVO_HSYNC_ACTIVE_HIGH
+                 */
+               if (1 || adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
                        sdvox |= SDVO_VSYNC_ACTIVE_HIGH;
-               if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
+               if (1 || adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
                        sdvox |= SDVO_HSYNC_ACTIVE_HIGH;
        } else {
                sdvox = I915_READ(intel_sdvo->sdvo_reg);
Comment 22 Paulo Zanoni 2011-11-21 12:47:22 UTC
Hello again

I need you to provide some more information:

First of all, please revert the patch you mentioned in comment #21. It is a temporary fix for the problem, you can use it in your production systems while we don't write a "proper" fix for the bug, but we don't want it interfering with our tests.

Then please get to the "bad state" (where the monitor on sdvo is out of sync). Then you go to the console (without Xorg, press ctrl+alt+f1) and login as root. Go to where you compiled intel-gpu-tools, and go to the "test/" directory. There, please run "./testdisplay -i > testdisplay-output.txt" and attach the "testdisplay-output.txt" file to this bug.

In addition, I'll attach a kernel patch to this bug report. Please apply this patch, reboot and test if the patch fixes the problem. If not, please boot with drm.debug=0x06 and send the "dmesg" output to me.
Comment 23 Paulo Zanoni 2011-11-21 12:49:17 UTC
Created attachment 53752 [details] [review]
proposed patch

Patch mentioned by the comment #22
Comment 24 Trey Ramsay 2011-12-02 11:56:13 UTC
Thanks Paulo!
We are working on getting the information you requested.
Comment 25 Trey Ramsay 2011-12-05 09:35:03 UTC
The testdisplay-output.txt is the result of running "./testdisplay -i > testdisplay-output.txt"
Comment 26 Trey Ramsay 2011-12-05 09:35:36 UTC
Created attachment 54122 [details]
testdisplay-output.txt         VGA1 - Good        VGA2 - No Sync
Comment 27 Trey Ramsay 2011-12-05 16:18:22 UTC
Created attachment 54127 [details]
dmesg.att_53752_06

The 53752: proposed patch did not fix the problem.
I applied the patch and VGA2 did not have sync after reboot.  It doesn't look like intel_sdvo_get_mode_from_dtd is getting called.
Comment 28 Paulo Zanoni 2011-12-09 09:37:41 UTC
*** Bug 43333 has been marked as a duplicate of this bug. ***
Comment 29 Paulo Zanoni 2011-12-19 17:01:50 UTC
Based on everything that was studied/discussed (not only in this bug report), this is supposed to be the "final" patch proposal:

http://lists.freedesktop.org/archives/intel-gfx/2011-December/014052.html

Please test it and report the results. It is supposed to be equivalent to the other patches already tested by you, so we shouldn't expect any problems.

Thank you,
Paulo
Comment 30 Trey Ramsay 2012-01-04 11:53:25 UTC
The patch allows the second display to work. As noted in comment 21, it takes a few seconds after the the 1st display comes up before the second display syncs.
Comment 31 Paulo Zanoni 2012-01-30 08:27:42 UTC
Closing bug. Patch is in Linus's tree and also queued for Stable trees.

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=ba68e086223a5f149f37bf8692c8cdbf1b0ba3ef

If the patch does not fix the bug, feel free to reopen.

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.