Bug 15949 - LVDS-0 has wrapped screen with Randr1.2
Summary: LVDS-0 has wrapped screen with Randr1.2
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/nouveau (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Nouveau Project
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-15 17:53 UTC by Carl van Tonder
Modified: 2008-08-16 14:14 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg log with external monitor plugged in (413.80 KB, application/octet-stream)
2008-05-15 17:53 UTC, Carl van Tonder
no flags Details
Top-left corner of LVDS-0 (181.61 KB, image/jpeg)
2008-05-15 17:54 UTC, Carl van Tonder
no flags Details
Top-right corner of LVDS-0 (162.65 KB, image/jpeg)
2008-05-15 17:55 UTC, Carl van Tonder
no flags Details
xog.conf (771 bytes, application/octet-stream)
2008-05-15 17:56 UTC, Carl van Tonder
no flags Details
radeontool register dump, randr12 enabled, cold boot (44.64 KB, text/plain)
2008-08-13 04:16 UTC, Joel
no flags Details
radeontool register dump, randr12 disabled (44.64 KB, text/plain)
2008-08-13 04:19 UTC, Joel
no flags Details
Probable fix (3.34 KB, patch)
2008-08-15 16:41 UTC, Stuart Bennett
no flags Details | Splinter Review

Description Carl van Tonder 2008-05-15 17:53:56 UTC
Created attachment 16562 [details]
Xorg log with external monitor plugged in

Problem:
Left-most 10px of my laptop's screen are offset right 10px, right-most 10px are displayed on the left of that screen. VGA-0 has no problems.

Steps to re-produce:
xrandr --output VGA-0 --mode 640x480 # to eleminate my previous Virtual line as a source of the problem
xrandr --output VGA-0 --left-of LVDS-0
xrandr --output LVDS-0 --mode 1280x800

Expected result:
The laptop and the external monitor form one large desktop, with all pixels in their correct spots!

Actual result:
See attached images

Work-around:
This problem persists even if the external monitor is removed and the computer re-booted. The only way to restore the correct display of LVDS-0 is to disable Randr1.2 in xorg.conf and re-boot (zapping X doesn't help in this case).

-------------------------------------------------------------------------
[root@castlereagh ~]# lspci -vv -d10de:0244
00:05.0 VGA compatible controller: nVidia Corporation C51 [Geforce 6150 Go] (rev a2) (prog-if 00 [VGA controller])
	Subsystem: Hewlett-Packard Company Unknown device 30bf
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 17
	Region 0: Memory at b2000000 (32-bit, non-prefetchable) [size=16M]
	Region 1: Memory at c0000000 (64-bit, prefetchable) [size=256M]
	Region 3: Memory at b1000000 (64-bit, non-prefetchable) [size=16M]
	Capabilities: [48] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [50] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable-
		Address: 0000000000000000  Data: 0000
	Kernel modules: nvidiafb
-------------------------------------------------------------------------
carl@castlereagh:~$ lshal
[snip]
udi = '/org/freedesktop/Hal/devices/pci_10de_244'
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  info.product = 'C51 [Geforce 6150 Go]'  (string)
  info.subsystem = 'pci'  (string)
  info.udi = '/org/freedesktop/Hal/devices/pci_10de_244'  (string)
  info.vendor = 'nVidia Corporation'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'pci'  (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:05.0'  (string)
  pci.device_class = 3  (0x3)  (int)
  pci.device_protocol = 0  (0x0)  (int)
  pci.device_subclass = 0  (0x0)  (int)
  pci.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:05.0'  (string)
  pci.product = 'C51 [Geforce 6150 Go]'  (string)
  pci.product_id = 580  (0x244)  (int)
  pci.subsys_product_id = 12479  (0x30bf)  (int)
  pci.subsys_vendor = 'Hewlett-Packard Company'  (string)
  pci.subsys_vendor_id = 4156  (0x103c)  (int)
  pci.vendor = 'nVidia Corporation'  (string)
  pci.vendor_id = 4318  (0x10de)  (int)
[snip]
Comment 1 Carl van Tonder 2008-05-15 17:54:44 UTC
Created attachment 16563 [details]
Top-left corner of LVDS-0
Comment 2 Carl van Tonder 2008-05-15 17:55:36 UTC
Created attachment 16564 [details]
Top-right corner of LVDS-0
Comment 3 Carl van Tonder 2008-05-15 17:56:44 UTC
Created attachment 16565 [details]
xog.conf
Comment 4 Stuart Bennett 2008-05-16 15:00:55 UTC
Does the problem happen when not using nvidiafb? Is this effect still visible when starting X (from a good initial state) without the VGA head plugged? Do different modes affect it (it seems to be starting in a 1024x768 mode below; is it setting 1280x800 that breaks it)?
Comment 5 Carl van Tonder 2008-05-22 05:40:02 UTC
>> Does the problem happen when not using nvidiafb?
AFAIK I'm not using it. It doesn't show up in lsmod, at any rate

>> Is this effect still visible
when starting X (from a good initial state) without the VGA head plugged?
If I set the laptop to a resolution at which the screen wraps, then reboot it with no external monitor plugged in, the problem persists.

>> Do
different modes affect it (it seems to be starting in a 1024x768 mode below; is
it setting 1280x800 that breaks it)?
12800x800 is the only ode I've been able to find that actually fills the screen --- it's a 16:10 and resolutions like 1024x786 show up in the centre with vertical letterboxing.
Comment 6 Joel 2008-08-09 21:33:48 UTC
I see this too on a HP Pavilion tx1000 - the screen is wraps ~10 pixels from the right side over to the left.  This is with the LDVS panel, I haven't tested VGA.

Using nouveau git from 20080801, and xserver 1.4.99.906 on Ubuntu Intrepid.

Logs can be found at http://verbal.mithis.com/~shenki/nouveau/
Comment 7 Carl van Tonder 2008-08-10 11:01:44 UTC
This bug has persisted since first report despite:
 * Changing distro (Ubuntu -> Fedora)
 * Updating nouveau drm and x module to git head on a weekly basis
 * Changing kernel (whatever Ubuntu was on to 2.6.25.11-97.fc9.i686
hence it does seem to be a genuine bug with nouveau. For me the wrapping is now confirmed as exactly 15px.
Comment 8 Stuart Bennett 2008-08-10 17:01:56 UTC
Just to be sure, can you confirm that once the wrapping has occurred, either returning to VT or starting X with randr12 disabled still displays the wrapping?

Please also make register dumps while in X -- one with randr12 disabled (and no wrapping present), and one with the wrapping present -- as follows:

git clone git://people.freedesktop.org/~airlied/radeontool
git checkout origin/nvidia
make (if there's problems with the asm/page.h include, comment it out)
./radeontool regs > logfile
Comment 9 Joel 2008-08-11 19:34:30 UTC
(In reply to comment #8)
> Just to be sure, can you confirm that once the wrapping has occurred, either
> returning to VT or starting X with randr12 disabled still displays the
> wrapping?

If the wrapping is present, I can switch to a vt (where wrapping is not present), but switching back to X still shows wrapping.

I then modified xorg.conf to disable randr12, re-started X, there is no wrapping.


> Please also make register dumps while in X -- one with randr12 disabled (and no
> wrapping present), and one with the wrapping present -- as follows:
> 
> git clone git://people.freedesktop.org/~airlied/radeontool
> git checkout origin/nvidia
> make (if there's problems with the asm/page.h include, comment it out)
> ./radeontool regs > logfile

This is all I get (amd64, ubuntu intrepid):

$ sudo ./radeontool regs
00:00.0 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
	Subsystem: Hewlett-Packard Company Device 30bf
	Flags: bus master, 66MHz, fast devsel, latency 0
	Capabilities: [44] HyperTransport: Slave or Primary Interface
	Capabilities: [e0] HyperTransport: MSI Mapping Enable+ Fixed-
Radeon control memory not found.
Comment 10 Stuart Bennett 2008-08-12 07:55:20 UTC
(In reply to comment #9)
> If the wrapping is present, I can switch to a vt (where wrapping is not
> present), but switching back to X still shows wrapping.
> 
> I then modified xorg.conf to disable randr12, re-started X, there is no
> wrapping.

Without a reboot in between, right?

> > git clone git://people.freedesktop.org/~airlied/radeontool
> > git checkout origin/nvidia
> > make (if there's problems with the asm/page.h include, comment it out)
> > ./radeontool regs > logfile
> 
> This is all I get (amd64, ubuntu intrepid):
> 
> $ sudo ./radeontool regs
> 00:00.0 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)
>         Subsystem: Hewlett-Packard Company Device 30bf
>         Flags: bus master, 66MHz, fast devsel, latency 0
>         Capabilities: [44] HyperTransport: Slave or Primary Interface
>         Capabilities: [e0] HyperTransport: MSI Mapping Enable+ Fixed-
> Radeon control memory not found.

Bah, nvidia chipset :)

Try changing line ~478, replacing "nVidia" with "VGA compatible controller":

@@ -475,7 +475,7 @@ We need to look through it to find the smaller region base address f8fffc00.
        if(fgets(line,sizeof(line),fp) == NULL) {  /* if end of file */
           fatal("Radeon hardware not found in lspci output.\n");
        }
-       if(strstr(line,"nVidia") || strstr(line,"nVidia Corp")) {  /* if line contains a "radeon" string */
+       if(strstr(line,"VGA compatible controller") || strstr(line,"nVidia Corp")) {  /* if line contains a "radeon"
           if(skip-- < 1) {
              break;
           }

then re-run make and try again
Comment 11 Joel 2008-08-13 04:15:08 UTC
(In reply to comment #10)
> > I then modified xorg.conf to disable randr12, re-started X, there is no
> > wrapping.
> 
> Without a reboot in between, right?

Correct.

> Try changing line ~478, replacing "nVidia" with "VGA compatible controller":
> 
> @@ -475,7 +475,7 @@ We need to look through it to find the smaller region base
> address f8fffc00.
>         if(fgets(line,sizeof(line),fp) == NULL) {  /* if end of file */
>            fatal("Radeon hardware not found in lspci output.\n");
>         }
> -       if(strstr(line,"nVidia") || strstr(line,"nVidia Corp")) {  /* if line
> contains a "radeon" string */
> +       if(strstr(line,"VGA compatible controller") || strstr(line,"nVidia
> Corp")) {  /* if line contains a "radeon"
>            if(skip-- < 1) {
>               break;
>            }


For those who read this later: I had to remove the strstr(line, "nVidia Corp") from the if too, or else it would incorrectly match on that.

Attachments of the register dumps follow.
Comment 12 Joel 2008-08-13 04:16:16 UTC
Created attachment 18260 [details]
radeontool register dump, randr12 enabled, cold boot
Comment 13 Joel 2008-08-13 04:19:35 UTC
Created attachment 18261 [details]
radeontool register dump, randr12 disabled

No reboot between this dump and attachment 18260 [details], only an X server restart.
Comment 14 Stuart Bennett 2008-08-13 11:03:19 UTC
Three things to try (try them individually first, then if no success, try them together), then add to the bug which one or which combination works (if any).

1) use a different 1280x800 mode at runtime:

xrandr --newmode "1280x800R"   71.00  1280 1328 1360 1440  800 803 809 823
xrandr --addmode LVDS-0 1280x800R
xrandr --output LVDS-0 --mode 1280x800R

2) hard code panel size in nv_crtc.c (then re-run make install etc):

@@ -945,7 +945,7 @@ nv_crtc_mode_set_fp_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr a

        regp->fp_horiz_regs[REG_DISP_END] = adjusted_mode->HDisplay - 1;
        regp->fp_horiz_regs[REG_DISP_TOTAL] = adjusted_mode->HTotal - 1;
-       regp->fp_horiz_regs[REG_DISP_CRTC] = adjusted_mode->HSyncStart - 75 - 1;
+       regp->fp_horiz_regs[REG_DISP_CRTC] = 0x500;
        regp->fp_horiz_regs[REG_DISP_SYNC_START] = adjusted_mode->HSyncStart - 1;
        regp->fp_horiz_regs[REG_DISP_SYNC_END] = adjusted_mode->HSyncEnd - 1;
        regp->fp_horiz_regs[REG_DISP_VALID_START] = adjusted_mode->HSkew;
@@ -953,7 +953,7 @@ nv_crtc_mode_set_fp_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr a

        regp->fp_vert_regs[REG_DISP_END] = adjusted_mode->VDisplay - 1;
        regp->fp_vert_regs[REG_DISP_TOTAL] = adjusted_mode->VTotal - 1;
-       regp->fp_vert_regs[REG_DISP_CRTC] = adjusted_mode->VTotal - 5 - 1;
+       regp->fp_vert_regs[REG_DISP_CRTC] = 0x320;
        regp->fp_vert_regs[REG_DISP_SYNC_START] = adjusted_mode->VSyncStart - 1;
        regp->fp_vert_regs[REG_DISP_SYNC_END] = adjusted_mode->VSyncEnd - 1;
        regp->fp_vert_regs[REG_DISP_VALID_START] = 0;

3) change a flag register in nv_crtc.c (then re-run make install etc):

@@ -1018,7 +1018,7 @@ nv_crtc_mode_set_fp_regs(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr a
                regp->fp_control |= (8 << 28);

        /* Use the generic value, and enable x-scaling, y-scaling, and the TMDS enable bit */
-       regp->debug_0 = 0x01101191;
+       regp->debug_0 = 0x01141191;
        /* We want automatic scaling */
        regp->debug_1 = 0;
        /* This can override HTOTAL and VTOTAL */
Comment 15 Joel 2008-08-15 07:52:17 UTC
(In reply to comment #14)
> 1) use a different 1280x800 mode at runtime

Didn't work.

> 2) hard code panel size in nv_crtc.c

Worked!

In case it's useful, here's what the driver had calculated for the offending values:

 adjusted_mode->HSyncStart - 75 -1 = 0x578

 adjusted_mode->VTotal - 5 - 1 = 0x326
 
> 3) change a flag register in nv_crtc.c

Err, wrong button :)

That one produced an artistic combination of black alternating vertical lines and a vertically stretched image (we could only see the top 1/3 of the screen on the panel).
Comment 16 Stuart Bennett 2008-08-15 16:41:53 UTC
Created attachment 18310 [details] [review]
Probable fix

Could you both test this please?
Comment 17 Joel 2008-08-15 20:55:53 UTC
(In reply to comment #16)
> Created an attachment (id=18310) [details]
> Probable fix

Works for me.

Thanks!
Comment 18 Carl van Tonder 2008-08-16 11:01:12 UTC
(In reply to comment #16)
> Created an attachment (id=18310) [details]
> Probable fix
> 
> Could you both test this please?
> 

Fixed my instance of the problem too. Thanks a lot!
Comment 19 Stuart Bennett 2008-08-16 14:14:27 UTC
Patch applied


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.