Bug 51062

Summary: [GM965/GL960] stale image after switching between VGA1 and LVDS1
Product: xorg Reporter: max <manikulin>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
dmesg
none
Xorg.0.log
none
xrandr --verbose
none
.xsession-errors none

Description max 2012-06-13 23:21:43 UTC
Created attachment 63008 [details]
dmesg

I found another case when xserver on my laptop fails into
a strange state after switching between LVDS1 and VGA1.

Unfortunately I have not managed to reproduce the bug
in a more simple configuration.

The steps to reproduce:
 - login from lightdm with Ubuntu Unity session
 - launch xterm (somehow it affects)
 - connect external monitor
 - press [Fn+F8] several times
First attempts to achieve the same state with xrandr
command were unsuccessful.

Xserver stops updating picture on the screen. Sometimes
display becomes black. Mouse pointer can be moved across
the screen even it is black. Sometimes xterm responds
to the commands typed on the keyboard. It is possible to
switch to any console with [Ctrl+Alt+F[1-6]], they work.
The same picture with mouse cursor can be restored
by [Alt+F7]. Xserver can be killed by [Ctrl+Alt+Backspace].

i915_error_state is clear.

The last lines of Xorg.0.log:
[   249.159] (--) synaptics: SynPS/2 Synaptics TouchPad: touchpad found
[   251.210] [dix] EventToCore: Not implemented yet 
[   274.692] (II) AIGLX: Suspending AIGLX clients for VT switch

.xsession-errors contains the following lines:
(gnome-settings-daemon:1898): color-plugin-WARNING **: failed to reset xrandr-AU Optronics gamma tables: gamma size is zero
failed to create drawable
compiz (core) - Warn: glXCreatePixmap failed
compiz (core) - Warn: Couldn't bind background pixmap 0x2400001 to texture
failed to create drawable

If I try xrandr from the console it reports:
DISPLAY=:0 xrandr --output LVDS1 --auto
xrandr: Configure crtc 1 failed

During the switching with [Fn+F8] at some point xrandr reports
external display resolution 1280x800. The monitor believes that
it is x768, not x800.

Example of xrandr summary:
* initial:
LVDS1 1280x800       60.0*+
* connected VGA
LVDS1 1280x800       60.0*+
VGA1  1600x1200      59.8*+   60.0
* [Fn+F8]
LVDS1 1280x800       60.0*+
VGA1  1280x800       84.9*    74.9     59.8
* [Fn+F8]
LVDS1 1280x800       60.0 +
VGA1  1600x1200      59.8*+   60.0
* xserver fails after the next [Fn+F8]
xrandr state is the same as the previous one.

  System info

Chipset:
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960
Integrated Graphics Controller (primary) (rev 03)
00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated
Graphics Controller (secondary) (rev 03)

uname -m
i686

xserver-xorg-video-intel
Version: 2:2.19.0+git20120613.0db789e1-0ubuntu0sarvatt~precise
xserver-xorg-core
Version: 2:1.12.2+git20120605+server-1.12-branch.aaf48906-0ubuntu0ricotz~precise
libgl1-mesa-dri
Version: 8.1~git20120529.f92b2e5e-0ubuntu0sarvatt~precise
libdrm-intel1
Version: 2.4.35+git20120613.d1fcfb17-0ubuntu0sarvatt~precise
kernel
3.4.0-994-generic #201206130406 SMP Wed Jun 13 08:15:01 UTC 2012 i686 i686 i386 GNU/Linux

Linux distribution:
Ubuntu 12.04 with xorg-edgers ppa
and kernel from drm-intel-experimental (quantal)

Asus F80L laptop
Displays: built-in LVDS1 and VGA1 (LG L2000CP)
Comment 1 max 2012-06-13 23:22:30 UTC
Created attachment 63009 [details]
Xorg.0.log
Comment 2 max 2012-06-13 23:23:10 UTC
Created attachment 63010 [details]
xrandr --verbose
Comment 3 max 2012-06-13 23:23:51 UTC
Created attachment 63011 [details]
.xsession-errors
Comment 4 max 2012-07-08 08:25:28 UTC
The bug still present with drm-intel-experimental kernel 3.5.0-994-generic #201207060407.

I do not see any apparent errors in dmesg or Xorg.0.log. Any of the messages in .xsession-errors were there before image disappeared from the displays (X only, consoles works)

compiz (core) - Warn: glXCreatePixmap failed
compiz (core) - Warn: Couldn't bind background pixmap 0x2600001 to texture

(gnome-settings-daemon:1978): color-plugin-WARNING **: failed to reset xrandr-AU Optronics gamma tables: gamma size is zero

(gnome-settings-daemon:1978): color-plugin-WARNING **: failed to reset xrandr-Goldstar Company Ltd-L2000C-162469 gamma tables: gamma size is zero
Comment 5 Chris Wilson 2012-08-04 11:23:29 UTC
I'm not yet seeing anything to indicate this is anything more than compiz not redrawing. :|
Comment 6 max 2012-08-04 13:38:17 UTC
Chris, do you think that the following error from
the original report is due to compiz as well?

If I try xrandr from the console it reports:
DISPLAY=:0 xrandr --output LVDS1 --auto
xrandr: Configure crtc 1 failed

I can admit it is another bug, unfortunately there are
more than enough of them for "production" system.
Fortunately I have not seen severe hangs for some time.

P.S. Just now in Ubuntu quantal unity+compiz do not want
to draw icons in launcher (left panel) and in the window
appearing on [Alt+Tab]. X server with just an xterm still
become dark after LVDS1<->VGA1 switching.
Comment 7 Chris Wilson 2012-08-04 13:48:56 UTC
(In reply to comment #6)
> Chris, do you think that the following error from
> the original report is due to compiz as well?
> 
> If I try xrandr from the console it reports:
> DISPLAY=:0 xrandr --output LVDS1 --auto
> xrandr: Configure crtc 1 failed

No, that's a completely separate bug which I thought was being tracked separately already.
Comment 8 max 2012-08-04 15:51:42 UTC
Chris, bad news for you. It is not compiz.
With ubuntu drm-intel-experimental kernel
3.5.0-994-generic #201207270423 SMP Fri Jul 27 08:31:26 UTC 2012 i686 i686 i686 GNU/Linux
I managed to reproduce a kind of this bug just with xterm.
The thing I do not like at all, that this time the issue
has quantum nature (Bad idea with "Quantal" name...).
If I set a timer with script, gathering some data
(dmesg, Xorg.0.log, regdump, i915_error state) the xterm
appears when this script executes.

startx /usr/bin/ck-launch-session xterm
# connect external monitor
xrandr --output VGA1 --auto --output LVDS1 --off
# black screen
# [Ctrl+Alt+F1] [Alt+F7]
# exit from xterm [Ctrl+d] (VGA1 is active, LVDS1 is not)
# disconnect external monitor
startx /usr/bin/ck-launch-session xterm
# connect external monitor
xrandr --output VGA1 --auto --output LVDS1 --off
# black screen
# [Ctrl+Alt+F1] [Alt+F7]
# Xorg log on the screen, no response to keyboard

Stale image, this time vt1.

The only way to bring the system to a sane state I found is
to unplug VGA cable. X server stops correctly on [Ctrl+d]
(in xterm) and new commands can be entered at vt1.

I have no idea how to debug this issue (only with my laptop).
I have a dmesg, but that script somehow restored the image.
Comment 9 Chris Wilson 2012-08-04 16:00:55 UTC
Again, that's not the bug you are reporting here. This bug is where we switch back to X and we have the X cursor, xterm responsive but only a black background.
Comment 10 max 2012-08-08 11:53:39 UTC
Sorry for the delay. Besides Bug 52140, [Fn+F8]
and other Fn keys do not work ubuntu quantal with
current xorg-edgers ppa.

Chris, I faced this problem simultaneously with
  xrandr: Configure crtc 1 failed
If you believe that this bug is solely related to compiz.
feel free to close it. Then I will report the issue
described in Comment 8 as a new bug.
Comment 11 Chris Wilson 2012-08-08 18:49:00 UTC
Yeah, even if we see a modeset failure, the original mode should be restored and the image should not "stick". There's a bug there between X and compiz for sure, and I'd like to keep that separate from addressing the bug that is causing the modeset to fail in the first place.
Comment 12 max 2012-08-09 12:50:39 UTC
Finally, I downgraded libgl1-mesa-dri from
8.1~git20120725.cc44aa77-0ubuntu0sarvatt 0
        500 http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu/ quantal/main
to
8.0.4-1ubuntu1 0
        500 http://linux.nsu.ru/ubuntu/ quantal/main i386 Packages
Other mesa libraries are from xorg-edgers (quantal).
So Unity desktop is displayed correctly (at least just after login).
There was a strange issue with Fn keys. It disappeared after
I touched hotkeys setup. Last tests are done with a new user
with clean profile. Anyway sometimes I have to remove "mirror"
tick in display setup.

Kernel is taken from drm-intel-experimental:
3.5.0-994-generic #201207270423 SMP Fri Jul 27 08:31:26 UTC 2012 i686 i686 i686 GNU/Linux

After several display switches by [Fn+F8] desktop image become
shifted and wrapped around. I have not noticed anything suspicious
in dmesg and Xorg.0.log. Although I was not able to switch screens
from the console:
DISPLAY=:0 xrandr --output LVDS1 --auto
xrandr: Configure crtc 1 failed

So compiz bug and driver's one work in companion.

Is it normal that CRTC have numbers 3 and 4 in dmesg,
but xrandr complains about crtc 0 or 1?

I did not managed to get LVDS1 working even after I killed X
and started it again. In response to [Ctrl+Alt+F1] [Alt+F1]
image blinked for a moment and the screen became blank in X.
So the problem lies deeper than in compiz.

Any ideas how to debug the issue? Will intel_reg_dumper help you?
Comment 13 max 2012-08-11 08:54:49 UTC
I can add a bit more.

The issue described in Comment 8 was caused by the Bug 52440

It seems that now I always get
DISPLAY=:0 xrandr --output LVDS1 --auto
xrandr: Configure crtc 1 failed
when I trying to switch screens from console.
If I switch back to X, the command works.
Is it normal?

I have noticed the following errors in Xorg.0.log:
[   203.293] (II) intel(0): Modeline "1600x1200"x0.0  162.00  1600 1664 1856 2160  1200 1201 1204 1250 +hsync +vsync (75.0 kHz e)
[   203.301] (--) synaptics: SynPS/2 Synaptics TouchPad: touchpad found
[   216.536] (II) AIGLX: Suspending AIGLX clients for VT switch
[   238.256] (II) intel(0): switch to mode 1280x800 on crtc 3 (pipe 0)
[   238.256] (EE) intel(0): get_fb: failed to add fb: 1600x1200 depth=24, bpp=32, pitch=6656: 13
[   238.274] (II) intel(0): switch to mode 1280x800 on crtc 3 (pipe 0)
[   238.274] (EE) intel(0): get_fb: failed to add fb: 1280x800 depth=24, bpp=32, pitch=5120: 13
[   255.274] (II) Open ACPI successful (/var/run/acpid.socket)
[   255.274] (II) AIGLX: Resuming AIGLX clients after VT switch
[   255.274] (II) intel(0): switch to mode 1280x800 on crtc 3 (pipe 0)
[   255.312] (II) intel(0): EDID vendor "AUO", prod id 17476
[   255.312] (II) intel(0): Printing DDC gathered Modelines:
[   255.312] (II) intel(0): Modeline "1280x800"x0.0   68.94  1280 1301 1333 1408  800 803 808 816 -hsync -vsync (49.0 kHz eP)

If I remember correctly, compiz was working at that time.

I wonder if the "[dix] EventToCore" records mean a bug?
Usually they appears when compiz does not properly redraw
the screens.
(from anothe Xorg.0.log)
[   258.127] (--) synaptics: SynPS/2 Synaptics TouchPad: touchpad found
[   258.755] [dix] EventToCore: Not implemented yet
[   271.388] (II) AIGLX: Suspending AIGLX clients for VT switch

And finally some speculations. It seems that compiz allows more
switches of LVDS1 and VGA1 by [Fn+F8] if I do not switch to
console and back ([Ctrl+Alt+F1], [Alt+F7]) in the meanwhile.
Comment 14 Chris Wilson 2012-10-07 17:07:18 UTC
So the stale image upon switching was likely to be the UXA pageflip vs modeset race. (And possibly the similar kernel bug.) So I believe this now to be fixed at last!

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.