Bug 51616 - [GM965/GL960] Xorg.0.log flooded with "intel(0): first get vblank counter failed: Invalid argument"
Summary: [GM965/GL960] Xorg.0.log flooded with "intel(0): first get vblank counter fai...
Status: CLOSED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: XOrg git
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Daniel Vetter
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-01 04:36 UTC by max
Modified: 2017-07-24 23:01 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg.0.log (34.10 KB, text/plain)
2012-07-01 04:36 UTC, max
no flags Details
dmesg with drm.debug=0x0e (120.59 KB, text/plain)
2012-07-01 04:37 UTC, max
no flags Details
xrandr --verbose (11.40 KB, text/plain)
2012-07-01 06:49 UTC, max
no flags Details
use intel_crtc->active (921 bytes, patch)
2012-09-24 12:04 UTC, Daniel Vetter
no flags Details | Splinter Review

Description max 2012-07-01 04:36:51 UTC
Created attachment 63663 [details]
Xorg.0.log

With recent kernels I have plenty of
[   129.881] (WW) intel(0): first get vblank counter failed: Invalid argument
lines in Xorg.0.log after switch between LVDS1 and VGA1.

What I do:
* kernel boot
* login as root (lightdm is disabled)
* # start lightdm
* [Ctrl+Alt+F1] while lightdm is starting and [Ctrl+d] in vt1 (otherwise power off from X session does not work). Actually it is not necessary, but this way the warnings appear much faster.
* login in lightdm
* launch xterm, tail -f /var/log/Xorg.0.log
* [Fn+F8] to switch display

Xorg.0.log:
[   101.591] (II) intel(0): Allocated new frame buffer 1280x800 stride 5120, til
ed
[   101.813] (WW) intel(0): flip queue failed: Invalid argument
[   102.100] (WW) intel(0): Page flip failed: Invalid argument
[   102.100] (WW) intel(0): divisor 0 get vblank counter failed: Invalid argument
[   102.301] (WW) intel(0): I830DRI2GetMSC:1479 get vblank counter failed: Invalid argument
[   102.336] (WW) intel(0): I830DRI2GetMSC:1479 get vblank counter failed: Invalid argument
[   102.336] (WW) intel(0): first get vblank counter failed: Invalid argument

This log is obtained with kernel built from drm-intel-next branch
of git://people.freedesktop.org/~danvet/drm-intel repository. The latest drm-intel-experimental kernel linux-image-3.5.0-994-generic_3.5.0-994.201206300436_i386.deb has quite similar behaviour

lspci:
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)

Asus F80L laptop (VGA connector for external display)

Version info:
Ubuntu-12.04 + xorg-edgers + some packages from quantal
xserver-xorg-video-intel
Version: 2:2.19.0+git20120629.eae5e127-0ubuntu0sarvatt~precise
xserver-xorg-core
Version: 2:1.12.2.901+git20120629+server-1.12-branch.b0be2d29-0ubuntu0ricotz~precise
libgl1-mesa-dri
Version: 8.1~git20120529.f92b2e5e-0ubuntu0sarvatt~precise
libdrm-intel1
Version: 2.4.36+git20120628.a7805194-0ubuntu0sarvatt~precise
Comment 1 max 2012-07-01 04:37:39 UTC
Created attachment 63664 [details]
dmesg with drm.debug=0x0e
Comment 2 Daniel Vetter 2012-07-01 05:44:44 UTC
Can you please attach xrandr --verbose when this issue happens?
Comment 3 max 2012-07-01 06:49:11 UTC
Created attachment 63666 [details]
xrandr --verbose

Full xrandr --verbose output is attached
...
LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 304mm x 190mm
   1280x800       60.0*+
...
VGA1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 408mm x 306mm
   1600x1200      59.8 +   60.0  
...
   1280x800       84.9*    74.9     59.8  
...
Actually, LVDS1 is black and image does not appear even after [Ctrl+Alt+F1], [Alt+F7]. The patch for removing of wide-screen modes is not applied.

I forgot to mention that I plug VGA connector after login to Ubuntu Unity session.
Comment 4 Chris Wilson 2012-07-03 02:07:54 UTC
So what is happening here is that one of the outputs (CRTC 3) is being switched off as the result of the modeset on the other pipe. So X believes it has both pipes switched on, but in reality only the second is. So when we try to use the dead pipe for vblanks, the kernel complains that it is switched off. If instead we try to submit a wait-for-scanlines, the GPU would hang. The latter condition now has a guard against the hang, but only SNA currently checks that the outputs are configured as requested following a modeset.

The root cause is that the second setcrtc (unexpectedly from X's perspective) disables the first pipe.
Comment 5 max 2012-07-08 08:28:15 UTC
I can not reproduce this bug with drm-intel-experimental kernel

3.5.0-994-generic #201207060407 SMP Fri Jul 6 08:15:55 UTC 2012 i686 i686 i386 GNU/Linux

Probably due to each time I catch Bug 51062 earlier.
Comment 6 Chris Wilson 2012-09-15 09:42:55 UTC
I believe this should be fixed with

commit 5f779ba10d8f65187fbb61ed092174d2b16ae361
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Sep 6 22:08:35 2012 +0200

    drm/i915: update dpms property in set_mode
    
    Hopefully this makes userspace slightly less confused about us
    frobbing the dpms state behind its back. Yeah, it would be better
    to be more careful with not changing the dpms state, but that is
    quite more invasive.
    
    Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

(and its preceding friends.)
Comment 7 max 2012-09-18 16:39:01 UTC
I am sorry, but I can not confirm the fix.

Just now I only can say that
http://kernel.ubuntu.com/~kernel-ppa/mainline/drm-intel-experimental/2012-09-15-quantal/
is built without many USB modules (e.g. mouse does not work,
lsusb reports an error).

This kernel can not suspend external monitor connected to VGA port.
When xrandr reports that VGA1 is turned off, the monitor blinks with
a red horizontal stripe at random position. (I know, it is completely
different issue, but I am too busy for detailed bug report.
Just for the case you have an idea related to this regression.)

Just for the record, I was able to reproduce "first get vblank
counter failed" issue with current Ubuntu kernel 3.5.0-14-generic
and with http://kernel.ubuntu.com/~kernel-ppa/mainline/daily/2012-09-15-quantal/
(3.6.0)
Comment 8 max 2012-09-23 05:11:53 UTC
Bad news, the bug is still alive.

Ubuntu drm-intel-experimental kernel from 2012-09-21, i386
built from
http://cgit.freedesktop.org/~danvet/drm-intel/commit/?h=drm-intel-next-queued&id=853c70e8dabcb1ae2c38ef2b8d40f6eb5435555b

First time I faced it switching internal screen/external monitor with
[Fn+F8] hotkey while google-earth was running on Ubuntu Unity desktop:

[  1469.608] (II) intel(0): Printing DDC gathered Modelines:
[  1469.608] (II) intel(0): Modeline "1280x800"x0.0   68.94  1280 1301 1333 1408  800 803 808 816 -hsync -vsync (49.0 kHz eP)
[  1469.804] (II) intel(0): Allocated new frame buffer 1280x800 stride 5120, tiled
[  1469.953] (WW) intel(0): I830DRI2GetMSC:1354 get vblank counter failed: Invalid argument
[  1469.953] (WW) intel(0): first get vblank counter failed: Invalid argument
[  1469.970] (WW) intel(0): I830DRI2GetMSC:1354 get vblank counter failed: Invalid argument
[  1469.970] (WW) intel(0): first get vblank counter failed: Invalid argument
[  1469.996] (WW) intel(0): I830DRI2GetMSC:1354 get vblank counter failed: Invalid argument
[  1470.000] (WW) intel(0): I830DRI2GetMSC:1354 get vblank counter failed: Invalid argument
[  1470.000] (WW) intel(0): first get vblank counter failed: Invalid argument
[  1470.084] (WW) intel(0): I830DRI2GetMSC:1354 get vblank counter failed: Invalid argument
[  1470.156] (WW) intel(0): first get vblank counter failed: Invalid argument
[  1470.208] (WW) intel(0): first get vblank counter failed: Invalid argument
[  1470.209] (WW) intel(0): first get vblank counter failed: Invalid argument
[  1470.244] (WW) intel(0): first get vblank counter failed: Invalid argument

i915_error_state is clean. Stale image was on the screen, however the pointer
was responding to mouse moves. After switching to console and back external
monitor started to blink with red horizontal stripe. 

Next time I was just writing new comment to this bug. It was a real flood
grep vblank 2012-09-23_vblank2_Xorg.0.log | wc
   2450   26950  191170
in less than a minute.

I have just updated ubuntu quantal. Xorg-edgers ppa is disabled due to only
fragments of windows are visible after a display switch.

Should I open a new bug?
Comment 9 Chris Wilson 2012-09-23 10:36:43 UTC
No, we still have the same bug. The WaitVBlank ioctl is complaining the pipe is off, yet the kernel is reporting that the pipe is active (or at least the crtc is bound to an fb and has a mode set, and that the DPMS setting is active).
Comment 10 Daniel Vetter 2012-09-24 12:04:23 UTC
Created attachment 67627 [details] [review]
use intel_crtc->active

Can you please try this quick patch?
Comment 11 max 2012-09-27 16:40:06 UTC
I have tried the patch. Today I can not reproduce "vblank"
issue with any kernel. Flickering red stripes on external
monitor supposed to be in power save mode. Blank screen
on vt1. Blank screen with pointer in X if I run google-earth,
make the globe spinning and press [Fn+F8]. But no vblank
floods even with the kernel mentioned in comment 8.

I will try again on weekend. I do not think I did twice
_warm_ reboot a week ago, but I have no another hypothesis
as well.
Comment 12 Chris Wilson 2012-09-27 21:00:50 UTC
There's a rumour going around being mercilessly spread by Timo Aaltonen that xf86-video-intel.git commit 88cfd23379950d1fe4e682519c48ef6e3091c2f3
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Sep 27 16:16:39 2012 +0100

    uxa: Update mode->fb_id after completing pageflips

and its friends successfully hides the issue for UXA. (Note that these are a backport of sanity checks from SNA.)
Comment 13 max 2012-09-30 05:28:12 UTC
I did not upgrade that system between the tests.
Just before that I tried xorg-edgers ppa, but it was unusable:
compiz could not update screen after one or two switches between
built-in and external display. That is why I downgraded to default
Ubuntu Quantal packages and noticed vblank issue.

Today I realized that a week ago I missed Bug 55458.

Anyway I can not reproduce "vblank" issue, so the bug can be closed either permanently or temporally.
Comment 14 Chris Wilson 2012-10-07 09:50:43 UTC
Believed to be a victim of the UXA pageflip vs dpms race.


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.