Bug 30654

Summary: [855] flickers when vblank_mode is enabled
Product: DRI Reporter: Xavier <shiningxc>
Component: DRM/IntelAssignee: Default DRI bug account <dri-devel>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: medium CC: daniel, jbarnes, jd.girard
Version: XOrg git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
kernel log none

Description Xavier 2010-10-06 06:18:39 UTC
The 3 games I tried (teeworlds,tremulous,neverball) trigger the following error when run at fullscreen 1024x768 (laptop native resolution) :
[drm:intel_prepare_page_flip] *ERROR* Prepared flip multiple times

On tremulous and teeworlds, this is associated with a lot of black flashes / flickers.

In window mode or in fullscreen at lower resolution (e.g. 800x600), there is no flicker and no ERROR.

I am using latest git of everything but I believe the flickers have been there for quite some time and are probably reproducible on the latest stable release too.

00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)
mesa 06472ad7e835813ef7c9bf8a5cd8b62a25fa9cc3
ddx 1444ea35706992a1f094fe029e6a7d9eec0f93c6
drm-intel-next 7b4f3990a22fbe800945f12001bc30db374d0af5
X.Org X Server 1.9.0
Comment 1 Xavier 2010-10-06 06:19:46 UTC
Created attachment 39227 [details]
kernel log
Comment 2 Chris Wilson 2010-10-06 09:49:14 UTC
Daniel, if you have the opportunity, can you check for the same issue on your 855? Why would gen2 be any more susceptible to this than gen3? Unlikely to be purely a timing issue as then there would have been some reports on i915.
Comment 3 Daniel Vetter 2010-10-06 10:42:05 UTC
> --- Comment #2 from Chris Wilson <chris@chris-wilson.co.uk> 2010-10-06 09:49:14 PDT ---
> Daniel, if you have the opportunity, can you check for the same issue on your
> 855? Why would gen2 be any more susceptible to this than gen3? Unlikely to be
> purely a timing issue as then there would have been some reports on i915.

I've seen this problem on my i855gm and my ilk. Can't remember whether it
happens on my i945, too. Atm I can't reproduce it anymore on any of my
machines, tough. It usually happens fairly reliable with kde
compositioning (vsync enabled) and full-screen video watching when
switching between mplayer and other apps using the cover flip. Recently
I've also seen it without composition in gnome and mesa stuff.

So my money is on timing problem ... at least for the moment.
Comment 4 Chris Wilson 2010-10-06 10:53:29 UTC
Daniel mentioned observing this on Ironlake with virtual forbidden city on default fedora.
Comment 5 Daniel Vetter 2010-10-06 11:53:45 UTC
The "Prepared flip multiple times" might not be related to the flicker
bug. I can reproduce the flicker on my i855, too, and there I also have
tons of "Prepared flip multiple times". But not on my ironlake (even when
it flickers).
Comment 6 Chris Wilson 2010-10-07 03:51:13 UTC
Tremulous (via pts) on 965GM or Pineview isn't flickering nor spewing page flip errors. Sounds like a have a pair of separate bugs.
Comment 7 Chris Wilson 2010-10-07 03:51:52 UTC
(In reply to comment #5)
> But not on my ironlake (even when it flickers).

Daniel can you report a second bug for this?
Comment 8 Xavier 2010-11-06 10:48:05 UTC
ickle said a while ago 'Prepared flip multiple times' error might just be a misunderstanding of the hardware. 
It indeed does not seem to have any ill effect so maybe the debug message could be removed or put at a higher debug level (ratelimit would be good to have if it's not removed).

Today I finally found the real culprit : sync to vblank.
With vblank_mode=0, I don't see any flickering, either in fullscreen or window.

But by default (vblank on), I get flickering in both window and fullscreen mode.

Looking at the framerate in several games, it seems quite clear that the flickering happens when constant 60 fps (refresh rate) cannot be maintained.
So when the scene is too complex for the gpu, it seems to flicker at every frame associated with fps jumps.
When the scene is very simple, I see a constant 60fps and not any flickering.
And all the granularity between these two extremes.
Comment 9 Xavier 2010-11-07 01:55:57 UTC
It's interesting that when pageflip is active, it's always vsync-ed, so enabling/disabling vblank_mode just enables/disables flickering, without real effects on the framerate.

IE with pageflip on and vblank_mode=0, the fps can jump between 30 and 60 fps because my machine is too slow but there is not any flickering to see.
Comment 10 Daniel Vetter 2011-01-19 04:34:09 UTC
Fyi, my flickering problem got fixed by recompiling mesa. According to Jesse Barnes, inconsisten versions of the dri2 and gl proto headers when compiling the x server and mesa may lead to this flickering (for unknown reasons).
Comment 11 Xavier 2011-01-24 01:51:06 UTC
(In reply to comment #10)
> Fyi, my flickering problem got fixed by recompiling mesa. According to Jesse
> Barnes, inconsisten versions of the dri2 and gl proto headers when compiling
> the x server and mesa may lead to this flickering (for unknown reasons).

Last update of dri2 and gl proto headers on my system was before 2010-11-07 (date of my last comment).
I brought my system up-to-date yesterday, and the problem was completely gone.
I went back to older versions of kernel / libdrm / ddx / mesa, and never managed to reproduce the problem.
I did not try to downgrade everything though, there were probably a bunch of other xorg components that were updated by my distrib in the meantime.

vblank was definitely on since fps was either 30 or 60 fps, but no flickering to be seen. Well good news I guess !
Comment 12 Xavier 2011-02-27 09:48:57 UTC
Just a few days later my last report, the bug was back, while I didn't touch anything related to the graphic stack. It drove me mad.

Today I noticed something :
vblank off : it works and kernel log is fine (but pageflip seems to be used)
vblank on : it flickers, and dmesg is flooded with :
[drm:intel_prepare_page_flip] *ERROR* Prepared flip multiple times
Comment 13 Jean-Denis Girard 2011-04-16 10:42:31 UTC
I'm having the same problem when enabling desktop effects in KDE on my laptop (chipset 82852/855GM).
How do you enable / disable vblank ? I tried to use driconf but it does not seem to have any effect on vblank.
Comment 14 Xavier 2011-04-17 08:41:38 UTC
driconf does not support dri2, but it's only one dumb change : use driver=dri2.
One example I just found with google :
http://pastebin.com/3gr5VbHY
Comment 15 Jean-Denis Girard 2011-04-17 13:50:21 UTC
(In reply to comment #14)
> driconf does not support dri2, but it's only one dumb change : use driver=dri2.

Ok, thanks, I've been able to disable vblank, but KDE effects still produce the same error. Compiz works fine though (with vblank disabled), so maybe kwin is re-enabling it somehow.
Comment 16 Eugeni Dodonov 2011-09-08 15:56:22 UTC
This issue is affecting a hardware component which is not being actively worked on anymore.

Moving the assignee to the dri-devel list as contact, to give this issue a better coverage.
Comment 17 Chris Wilson 2012-04-24 02:11:18 UTC
I believe this will be fixed with:

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>

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.