Bug 24202

Summary: [830] drm:intel_prepare_page_flip, *ERROR* Prepared flip multiple times
Product: Drivers Reporter: mkkot (marcin2006)
Component: Video(DRI - Intel)Assignee: drivers_video-dri-intel (drivers_video-dri-intel)
Status: CLOSED CODE_FIX    
Severity: normal CC: celeonar, chris, daniel, diegoe, florian, gordon.jin, jbarnes, jpsinthemix, lucas.chiesa, maciej.rutecki, rjw, witold.baryluk+kernel
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.36.1-3 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 16444    
Attachments: glitches in GNOME3 ui
Specialise the interrupt handler on i8xx for working pageflips.

Description mkkot 2010-12-02 14:10:57 UTC
I have an IBM Thinkpad x30 with an Intel Almador(830MG) graphics card. I run lightweight Archlinux with Xfce. Something strange happened with my system after yesterdays upgrade. Finally I realised it's the full root partition. After removing appriopriate logs and restarting syslog-ng I extracted what caused the problem: fullscreen MatrixGL screensaver from xscreensaver's package have generated dozens of same messages in kernel log:

drm:intel_prepare_page_flip, *ERROR* Prepared flip multiple times

It happened after the latest kernel update:

[2010-11-30 20:06] upgraded kernel26 (2.6.35.8-1 -> 2.6.36.1-3)


There were also other packages updated:

[2010-11-30 19:49] Running 'pacman -Syu'
[2010-11-30 19:49] synchronizing package lists
[2010-11-30 19:49] starting full system upgrade
[2010-11-30 20:03] upgraded udev (163-1 -> 164-1)
[2010-11-30 20:03] upgraded device-mapper (2.02.76-1 -> 2.02.77-1)
[2010-11-30 20:03] upgraded findutils (4.4.2-2 -> 4.4.2-3)
[2010-11-30 20:03] upgraded gcc-libs (4.5.1-1 -> 4.5.1-2)
[2010-11-30 20:03] upgraded gpm (1.20.6-5 -> 1.20.6-6)
[2010-11-30 20:03] upgraded hyphen (2.6-1 -> 2.7-1)
[2010-11-30 20:03] upgraded libdrm (2.4.21-2 -> 2.4.22-1)
[2010-11-30 20:03] upgraded libgl (7.8.2-3 -> 7.9-1)
[2010-11-30 20:03] upgraded intel-dri (7.8.2-3 -> 7.9-1)
[2010-11-30 20:06] upgraded libpurple (2.7.6-1 -> 2.7.7-1)
[2010-11-30 20:06] upgraded libtasn1 (2.6-1 -> 2.8-1)
[2010-11-30 20:06] upgraded libvpx (0.9.5-1 -> 0.9.5-2)
[2010-11-30 20:06] upgraded libx11 (1.3.5-2 -> 1.4.0-1)
[2010-11-30 20:06] upgraded mesa (7.8.2-3 -> 7.9-1)
[2010-11-30 20:06] upgraded sdl (1.2.14-5 -> 1.2.14-6)
[2010-11-30 20:06] installed libasyncns (0.8-3)
[2010-11-30 20:06] installed libpulse (0.9.22-1)
[2010-11-30 20:06] upgraded pcre (8.10-1 -> 8.10-2)
[2010-11-30 20:06] upgraded xf86-video-intel (2.12.0-3 -> 2.13.0-4)
[2010-11-30 20:06] upgraded xine-lib (1.1.19-1 -> 1.1.19-2)
[2010-11-30 20:06] upgraded xorg-server-common (1.9.2-1 -> 1.9.2-2)
[2010-11-30 20:06] upgraded xorg-server (1.9.2-1 -> 1.9.2-2)

More info:
https://bugs.archlinux.org/task/21927
Comment 1 Diego Escalante Urrelo 2010-12-22 17:50:20 UTC
I can confirm on 855GM, my kern.log file fills up my root partition with:

[  863.022166] [drm:intel_prepare_page_flip] *ERROR* Prepared flip multiple times

I hit this when I use fullscreen opengl with wine, on "normal" 2D usage it never complains.
Comment 2 Florian Mickler 2011-03-29 21:28:55 UTC
Is this still a problem? Can you retest with 2.6.38.y?
Comment 3 mkkot 2011-03-29 22:23:33 UTC
It works on 2.6.37 but I'm not sure if it is not because of archlinux patch...
Comment 4 Florian Mickler 2011-03-30 19:58:09 UTC
If you could check, we could close this bug. (But of course, this is not time-critical, so do it at your own convenience.)
Comment 5 lucas.chiesa 2011-04-05 21:58:42 UTC
Hi,

I am using Fedora 15 (installed the alpha released and updated) and I'm having this problem.

Fedora 15 uses gnome3, and I see a number of glitches in the UI. For example, the icons of the launcher appear like white squares until I hover over them.
Also, I see some artifacts all over the screen.

dmesg shows a hoge amount of lines saying:
[drm:intel_prepare_page_flip] *ERROR* Prepared flip multiple times

I'm using 2.6.38.2-11.fc15.i686 kernel.
libdrm: 2.4.24
xorg-x11-drv-intel 2.14.0

This also happened using Debian 2.6.38 kernel in the same machine. However, 2.6.32 (debian stable) and 2.6.36 kernel work fine.

Please ask any more info you may need or how can I help debug this problem.
Comment 6 Diego Escalante Urrelo 2011-04-09 18:06:05 UTC
Created attachment 53922 [details]
glitches in GNOME3 ui

This is what Lucas' describes. I'm also on 855GM.
Comment 7 jpsinthemix 2011-04-17 02:36:08 UTC
For me, the deluge of Intel drm page-flip error/warning messages
   
   kernel: [drm:intel_prepare_page_flip] *ERROR* Prepared flip multiple times

in the system logs began sometime after xorg-server-1.8.2 with xf86-video-intel-2.10.0, mesa-7.9, libdrm-2.4.23, and linux-2.37.x, and has been present ever since. Associated with these messages are widespread video artifacts under KDE with Desktop Effects active, rendering KDE Desktop Effects unusable.  To work around this problem so that I could use xf86-video-intel-2.11.0 and above, I
have had to forcibly prevent the use of page-flipping on three PCs with Intel graphics (Intel 855GME, 865G, and 915G/GV/910GL), with a patch, such as:

--- xf86-video-intel-2.15.0.old/src/intel_display.c     2011-04-14 05:15:47.000000000 -0400
+++ xf86-video-intel-2.15.0.new/src/intel_display.c     2011-04-16 22:12:08.980997980 -0400
@@ -1609,8 +1609,8 @@
                                  sizeof(gp));
        if (has_flipping) {
                xf86DrvMsg(scrn->scrnIndex, X_INFO,
-                          "Kernel page flipping support detected, enabling\n");
-               intel->use_pageflipping = TRUE;
+                       "Kernel page flipping support detected, but forcibly disabled.\n");
+               intel->use_pageflipping = FALSE;

                mode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
                mode->event_context.vblank_handler = intel_vblank_handler;

For my purposes, this entirely solves the problem, at the expense of possible benifits of page-flipping.  Seems like the problem could be in xf86-video-intel, but I suspect more likely in the kernel/drm/i915 code, and probably only happens on specific, older Intel integrated graphics chips.
Comment 8 Michal Nowak 2011-05-09 20:02:53 UTC
Having:

00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)

Used jpsinthemix'es workaround and it fixed the flood but not the corrupted graphics in GNOME Shell I see a bit. Anyone's working on a proper fix?
Comment 9 Cesare Leonardi 2011-07-25 20:49:27 UTC
The constant of this bug seems to be the Intel old chipsets. Only gen2?

I have an i855 and in these days i've tried to replace Metacity with Mutter in my Gnome 2.30 graphics environment. It works rather good apart from some windows that get created with first a flash of black. I don't know how to explain...

Another evident and always reproducible similar effect is when i open Nautilus, enter on a folder and then return to the parent folder pressing backspace.
The entire screen has a rapid black flash, as if the backlight turn rapidly off and on.

I've noted that corresponding to all these effects, the syslog get filled with the messages reported in this bug report.

Debian Sid with kernel 3.0.0, intel driver 2.15.0 and mesa 7.10.3 (but also with a snapshot of 7.11).

Cesare.
Comment 10 Daniel Vetter 2012-03-25 14:28:50 UTC
This is a known issue on gen2 (i.e. i8xx) intel gpus. We have no idea what's going wrong.
Comment 11 Jesse Barnes 2012-04-18 20:12:00 UTC
I thought we fixed one of the error paths that might have caused this... but come to think of it that was 915 and caused an oops.  We should just disable flipping on 830.
Comment 12 Chris Wilson 2012-04-18 20:22:17 UTC
Pageflipping works. It's just noisy... And considering the noise I'm not sure it is saving any bandwidth.
Comment 13 Jesse Barnes 2012-04-18 20:29:23 UTC
Well if the messages are harmless we can certainly make them less verbose...
Comment 14 Chris Wilson 2012-04-18 21:56:23 UTC
Created attachment 72955 [details]
Specialise the interrupt handler on i8xx for working pageflips.
Comment 15 jpsinthemix 2012-04-18 22:39:29 UTC
Currently, using linux-3.3, Mesa-8.0.2, xorg-server-1.12.0, xf86-video-intel-2.18.0, and the current Qt/KDE (4.8.1/4.8.2) with compositing, on a laptop with an Intel Corporation 82852/855GM Integrated Graphics Device (rev 02), i915 w/page flipping enabled results in video distortions bad enough to make the PC unusable.

So I continue to disable page flipping (as in Comment #7) and all is well.I'm pretty sure most distros do this as well.

Re Comment #12: for at least some Intel Corporation 82852/855GM controllers this seems doubtful.

Re Comment #13: the logged messages are not merely annoying or overly verbose (thousands over several hours of use), but as I said in Comment #7, are associated with major/serious video distortion.

Currently, I don't have any time return to this issue.. perhaps in a couple of weeks. However, I may have time to simply try any i915 patches addressing the issue.

thanks for everyone's time on this..
Comment 16 Chris Wilson 2012-04-24 09:09:28 UTC
on drm-intel-next-queued:

commit 8fa2a569d3fb6ea78b83c6062b2f3aec528cc9e5
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Apr 22 21:13:57 2012 +0100

    drm/i915: i8xx interrupt handler
    
    gen2 hardware has some significant differences from the other interrupt
    routines that were glossed over and then forgotten about in the
    transition to KMS. Such as
    
    - 16bit IIR
    - PendingFlip status bit
    
    This patch reintroduces a handler specifically for gen2 for the purpose
    of handling pageflips correctly, simplifying code in the process.
    
    v2: Also fixup ring get/put irq to only access 16bit registers (Daniel)
    
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=24202
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41793
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Comment 17 jpsinthemix 2012-04-29 09:48:54 UTC
(In reply to comment #16)
> on drm-intel-next-queued:
> 
> commit 8fa2a569d3fb6ea78b83c6062b2f3aec528cc9e5
> Author: Chris Wilson <chris@chris-wilson.co.uk>
> Date:   Sun Apr 22 21:13:57 2012 +0100
> 
>     drm/i915: i8xx interrupt handler
> 
>     gen2 hardware has some significant differences from the other interrupt
>     routines that were glossed over and then forgotten about in the
>     transition to KMS. Such as
> 
>     - 16bit IIR
>     - PendingFlip status bit
> 
>     This patch reintroduces a handler specifically for gen2 for the purpose
>     of handling pageflips correctly, simplifying code in the process.
> 
>     v2: Also fixup ring get/put irq to only access 16bit registers (Daniel)
> 
>     Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=24202
>     Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41793
>     Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>     Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>


Looks good on a system with Linux-3.3.4, xorg-server.1.12.0 and 
xorg-xf86-video-intel.2.18.0.  There is a very brief, say 6x6 cm white flash appearing in the lower-right corner at boot up just before the upper-left linux-penguin appears (but who cares).  Really appreciate it, thanks much
Comment 18 Witold Baryluk 2012-05-08 20:16:34 UTC
I can also say that patch works for me (boots, works, Xorg works, mesa on simple programs works). I still need to test it more for stability (there are some system hangups in Xorg, but may be unrelated to patch). Gnome shell still have missing multiple font glyphs and other rendering artifacts, probably related to something different. Will try to find which version of kernel (if any), had this working on Intel Corporation 82865G Integrated Graphics Controller (rev 02).

Tested on 32-bit Intel with Linux 3.4.0-rc5+, and xorg-video-intel 2.18.0.

Thanks for taking care of this hardware.
Comment 19 Florian Mickler 2012-07-01 09:38:12 UTC
A patch referencing this bug report has been merged in Linux v3.5-rc1:

commit c2798b19bac2538393fc932bfbe59807a4734b3e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Apr 22 21:13:57 2012 +0100

    drm/i915: i8xx interrupt handler