[i945gm] (Needs kernel 2.6.32) DRI2 swapbuffers and page flipping

Bug #377090 reported by Eric Appleman on 2009-05-15
40
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Linux
Invalid
Undecided
Unassigned
Mesa
Invalid
Undecided
Unassigned
X.Org X server
Invalid
Undecided
Unassigned
xf86-video-intel
Fix Released
Wishlist
linux (Ubuntu)
High
Unassigned
Nominated for Maverick by madbiologist
Karmic
High
Unassigned
mesa (Ubuntu)
Wishlist
Unassigned
Nominated for Maverick by madbiologist
Karmic
Undecided
Unassigned
x11proto-dri2 (Ubuntu)
Wishlist
Unassigned
Nominated for Maverick by madbiologist
Karmic
Medium
Unassigned
xorg-server (Ubuntu)
Wishlist
Unassigned
Nominated for Maverick by madbiologist
Karmic
Undecided
Unassigned
xserver-xorg-video-intel (Ubuntu)
Wishlist
Unassigned
Nominated for Maverick by madbiologist
Karmic
High
Unassigned

Bug Description

Binary package hint: xserver-xorg-video-intel

I'm not really sure how to best describe this bug, so I think it would be best to invoke the wisdom of the person working on it: http://virtuousgeek.org/blog/index.php/jbarnes/2009/05/07/pageflipping_blocking_etc

Jesse Barnes and others are hard at work at this moment to deliver tear-free output (read vsync) over DRI2. Unfortunately, only 95% of the requisite code may make it into Karmic if 2.6.30 is the chosen kernel for the release.

Short of a backport of the needed kernel modifications and a merging of the dri2-swapbuffers branches into certain packages, Ubuntu may find itself lacking proper vsync in an DRI2+UXA+KMS setup until at least next April.

In order to properly implement DRI2 swapbuffers, the following modifications are needed:

    * dri2-swapbuffers branches of dri2proto, mesa, xserver and xf86-video-intel
    * kms-pageflip from the drm tree
    * i915-dri2-swapbuffers-15.patch from the “[RFC] DRI2 swapbuffers (yes yet again)” thread on <email address hidden>

[lspci]
00:00.0 Host bridge [0600]: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub [8086:27a0] (rev 03)
     Subsystem: Dell Device [1028:01d8]
00:02.0 VGA compatible controller [0300]: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller [8086:27a2] (rev 03)
     Subsystem: Dell Device [1028:01d8]

I'm not sure who is working on this? (CCing bunch of people)

FWIW, at least compiz and xfwm4 can be configured to unredirect fullscreen windows.

*** Bug 19458 has been marked as a duplicate of this bug. ***

Updated the summary and changed to an RFE. Last patch set went to dri-devel under the subject "Another page flipping update".

Basically, compositing managers need a way of making sure their front buffer rendering can occur w/o tearing. This includes composited video. This RFE covers an tear-free glXSwapBuffers implementation that any OpenGL application can use for this purpose. It's possible to do this in other ways, for example through an X extension or something, but that's a subject for another RFE if someone wants to take it on.

Maybe it is stupid but why not enable vsync for the whole composite output? I mean who needs more than 60 fps anywhere? For benchmark reasons there could be an option which disables it which results in video tearing.

I think a lot of compositing managers will choose that option (when they have updated frames to display of course). Right now though there's no good way for them to sync all output. They can block on a given pipe's vblank event, but that's racy, since the compositor process may not be woken up in time or may not finish its drawing in time to draw w/o tearing. So we really need glXSwapBuffers to be sync'd automatically, which allows the compositor (or other GL apps) to prepare a whole frame, swap buffers, and then continue rendering the next frame and not worry about tearing at all.

Are there any patches to test or a plan for integration. Is it likely that it make it into stable until October?

If so the next release will be really great for Composite.

I just updated the patches to incorporate some feedback last week; I hope to have them integrated for this release.

Binary package hint: xserver-xorg-video-intel

I'm not really sure how to best describe this bug, so I think it would be best to invoke the wisdom of the person working on it: http://virtuousgeek.org/blog/index.php/jbarnes/2009/05/07/pageflipping_blocking_etc

Jesse Barnes and others are hard at work at this moment to deliver tear-free output (read vsync) over DRI2. Unfortunately, only 95% of the requisite code may make it into Karmic if 2.6.30 is the chosen kernel for the release.

Short of a backport of the needed kernel modifications and a merging of the dri2-swapbuffers branches into certain packages, Ubuntu may find itself lacking proper vsync in an DRI2+UXA+KMS setup until at least next April.

description: updated
Bryce Harrington (bryce) wrote :

(Btw, use the 'Also affects distribution' link to add tasks to other source packages in ubuntu, rather than the 'Also affects project' link, which just adds an upstream watch.)

This bug is a request for a backport of the DRI2 swapbuffer kernel patches that jbarnes is working on. There is no work to be done for -intel; but we're keeping this bug open simply for tracking purposes.

Changed in xserver-xorg-video-intel (Ubuntu Karmic):
importance: Undecided → High
status: New → Triaged
Bryce Harrington (bryce) wrote :

[Setting a milestone on this since we'll want to make a decision on this one once the kernel version for karmic is determined.]

Changed in xserver-xorg-video-intel (Ubuntu Karmic):
milestone: none → karmic-alpha-3
Changed in xserver-xorg-video-intel:
status: Unknown → Confirmed
Eric Appleman (erappleman) wrote :

The other day, Jesse mentioned that the dri2-swapbuffers branch would be merged with the master for intel, I'm not sure about the other git trees though.

Eric Appleman (erappleman) wrote :

*would be merged within a few days

Bryce Harrington (bryce) wrote :

Hi llstarks,

Please attach the output of `lspci -vvnn`, and attach your /var/log/Xorg.0.log (and maybe Xorg.0.log.old) file from after reproducing this issue. If you've made any customizations to your /etc/X11/xorg.conf please attach that as well.

[This is an automated message. Apologies if it has reached you inappropriately; please just reply to this message indicating so.]

tags: added: needs-xorglog
tags: added: needs-lspci-vvnn
Eric Appleman (erappleman) wrote :
Eric Appleman (erappleman) wrote :
summary: - [RFC Karmic] DRI2 swapbuffers
+ [945gm] [RFC Karmic] DRI2 swapbuffers
Bryce Harrington (bryce) on 2009-05-25
summary: - [945gm] [RFC Karmic] DRI2 swapbuffers
+ [i945gm] [RFC Karmic] DRI2 swapbuffers

[Unnecessary to have this filed against the xorg meta package as well]

Changed in xorg (Ubuntu Karmic):
status: New → Invalid

commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
Author: Jesse Barnes <email address hidden>
Date: Tue Jun 2 16:42:56 2009 +0100

    Sync DRI2 CopyRegion to vertical retrace

Bryce Harrington (bryce) on 2009-06-02
description: updated
Changed in xserver-xorg-video-intel:
status: Confirmed → Fix Released

FYI, at UDS it was decided that the Karmic kernel would target 2.6.31.

Changed in linux (Ubuntu Karmic):
importance: Undecided → High
status: New → Triaged

(In reply to comment #9)
> commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
> Author: Jesse Barnes <email address hidden>
> Date: Tue Jun 2 16:42:56 2009 +0100
>
> Sync DRI2 CopyRegion to vertical retrace
>

This commit caused screen to stop redrawing. I use two monitors, laptop screen and external one. Works ok if I disconnect external monitor but it it's connected screen freezes.

(In reply to comment #10)
> (In reply to comment #9)
> > commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
> > Author: Jesse Barnes <email address hidden>
> > Date: Tue Jun 2 16:42:56 2009 +0100
> >
> > Sync DRI2 CopyRegion to vertical retrace
> >
>
> This commit caused screen to stop redrawing. I use two monitors, laptop screen
> and external one. Works ok if I disconnect external monitor but it it's
> connected screen freezes.

Did you pull the updates after this commit? Eric fixed a few issues with this patch in a later commit...

If things are still broken with master, please open a new bug.

(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
> > > Author: Jesse Barnes <email address hidden>
> > > Date: Tue Jun 2 16:42:56 2009 +0100
> > >
> > > Sync DRI2 CopyRegion to vertical retrace
> > >
> >
> > This commit caused screen to stop redrawing. I use two monitors, laptop screen
> > and external one. Works ok if I disconnect external monitor but it it's
> > connected screen freezes.
>
> Did you pull the updates after this commit? Eric fixed a few issues with this
> patch in a later commit...
>
> If things are still broken with master, please open a new bug.
>

I used version updated up to commit
4698b3bd79452ae2066a3d195cf58dd5e30c93f3, so with those fixes.

I've found out what causes the problem. As I said before I have 2 monitors and I use them in extended desktop configuration:
xrandr --output VGA --right-of LVDS --auto.

The problem is that my LVDS is 1680x1050 and VGA is 1920x1200. So what I get after xrandr is virtual screen 3600x1200.

______________________
| | |
| S1 | S2 |
| | |
|_________| |
|XXXXXXXXX|___________|

if I instead did:

xrandr --output VGA --right-of LVDS --mode 1680x1050
_____________________
| | |
| S1 | S2 |
| | |
|_________|_________|

everything works fine.

So I believe the problem is when driver has to redraw area that is bigger then physical screen. Maybe then there is no MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW for
region which includes XXXXXXXX part (is partially below the screen).

(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
> > > Author: Jesse Barnes <email address hidden>
> > > Date: Tue Jun 2 16:42:56 2009 +0100
> > >
> > > Sync DRI2 CopyRegion to vertical retrace
> > >
> >
> > This commit caused screen to stop redrawing. I use two monitors, laptop screen
> > and external one. Works ok if I disconnect external monitor but it it's
> > connected screen freezes.
>
> Did you pull the updates after this commit? Eric fixed a few issues with this
> patch in a later commit...
>
> If things are still broken with master, please open a new bug.
>

Opened bug 22203.

Bryce Harrington (bryce) on 2009-06-19
Changed in linux:
status: New → Invalid
Changed in mesa:
status: New → Invalid
Changed in xorg-server:
status: New → Invalid
summary: - [i945gm] [RFC Karmic] DRI2 swapbuffers
+ [i945gm] (Needs kernel 2.6.31) DRI2 swapbuffers

Taking off the miestone list, 2.6.31 might not land in time for a3.

Changed in xserver-xorg-video-intel (Ubuntu Karmic):
milestone: karmic-alpha-3 → none
Eric Appleman (erappleman) wrote :

While I understand that Karmic is pretty much guaranteed to ship with 2.6.31, there needs to be a focus right now on making sure the other components (mesa, xorg, drm, intel, etc.) have necessary code merges in order to take advantage of the new kernel.

Eric Appleman (erappleman) wrote :

Here's a rather fascinating workaround(?) that can guarantee (on my laptop at the very least) tear-free playback in MPlayer without the need for any further tricks:

gconftool-2 --type bool --set /apps/metacity/general/compositing_manager false

Kernel: 2.6.30 (2.6.31-rc1 works too!)
Driver: Intel git master
Mesa: git master
DRM: git master
DRI: git master
Xorg: 1.6.1

Steve Langasek (vorlon) wrote :

Now that the kernel is at 2.6.31 (pre) in karmic, is there more to be done here on the userspace packages?

Changed in x11proto-dri2 (Ubuntu Karmic):
importance: Undecided → High
Martin Pitt (pitti) wrote :

Can people who affected by this please upgrade to latest karmic, reboot (to get Linux 2.6.31) and check if this is fixed, or the behavior changed? Thanks!

Martin Pitt (pitti) wrote :

This was fixed in the kernel, closing the other tasks (just confirmed with Bryce).

Changed in xserver-xorg-video-intel (Ubuntu Karmic):
status: Triaged → Invalid
Changed in x11proto-dri2 (Ubuntu Karmic):
status: New → Invalid
Changed in mesa (Ubuntu Karmic):
status: New → Invalid
Martin Pitt (pitti) wrote :

2.6.31rc1 has the upstream patch mentioned in the upstream bug report, so this should be fixed. Please yell here if you still have the problem in current Karmic. Thank you!

Changed in linux (Ubuntu Karmic):
status: Triaged → Fix Released
Eric Appleman (erappleman) wrote :

As far as I've heard, this bug, as a whole, is still far from being fixed.

Sure, the needed changes have been implemented at the kernel level, but the dri2 branches for dri2proto, mesa, xserver and xf86-video-intel are still not fully merged.

Martin Pitt (pitti) wrote :

Eric, indeed. These will trickle into Ubuntu when they are merged to upstream trunk. Reopening, but not as release critical.

Changed in mesa (Ubuntu Karmic):
status: Invalid → Won't Fix
Martin Pitt (pitti) on 2009-07-07
Changed in mesa (Ubuntu):
importance: Undecided → Wishlist
status: Invalid → Triaged
Changed in x11proto-dri2 (Ubuntu Karmic):
importance: High → Medium
status: Invalid → Won't Fix
Changed in x11proto-dri2 (Ubuntu):
importance: Medium → Wishlist
status: Invalid → Triaged
affects: xorg (Ubuntu Karmic) → xorg-server (Ubuntu Karmic)
Changed in xorg-server (Ubuntu Karmic):
status: Invalid → Won't Fix
Martin Pitt (pitti) on 2009-07-07
Changed in xorg-server (Ubuntu):
importance: Undecided → Wishlist
status: Invalid → Triaged
Changed in xserver-xorg-video-intel (Ubuntu Karmic):
status: Invalid → Won't Fix
Martin Pitt (pitti) on 2009-07-07
Changed in xserver-xorg-video-intel (Ubuntu):
importance: High → Wishlist
status: Invalid → Triaged
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xserver-xorg-video-intel - 2:2.7.99.902+git20090720.bb300738-0ubuntu1

---------------
xserver-xorg-video-intel (2:2.7.99.902+git20090720.bb300738-0ubuntu1) karmic; urgency=low

  * Update to git 20090720 (master branch) up to commit bb300738
    - Fix intel driver reports Couldn't find PLL settings on i915
      (LP: #312133)
    - Fix X freezing on intel 855GM
      (LP: #370292)
    - Implement vblank sync'd GL buffer swap
      (LP: #377090)

 -- Bryce Harrington <email address hidden> Mon, 20 Jul 2009 22:05:31 -0700

Changed in xserver-xorg-video-intel (Ubuntu Karmic):
status: Won't Fix → Fix Released
Timo Aaltonen (tjaalton) wrote :

dri2proto 2.1 is in karmic now.

Changed in x11proto-dri2 (Ubuntu):
status: Triaged → Fix Released
Timo Aaltonen (tjaalton) wrote :

sorry, I noticed that the swapbuffers-branch isn't merged to 2.1..

Changed in x11proto-dri2 (Ubuntu):
status: Fix Released → Triaged

This is still an issue with -intel 2.8 and i915. It is much better than before but still tears often during tracking shots.
So atm I have to disable KMS to use Overlay again.

(In reply to comment #15)
> This is still an issue with -intel 2.8 and i915. It is much better than before
> but still tears often during tracking shots.
> So atm I have to disable KMS to use Overlay again.
>

Try using Option "SwapbuffersWait" "true" in xorg.conf

Yeah, the option >>Option "SwapbuffersWait" "true"<< seems to fix the problem for me.

Many thanks!

Bryce Harrington (bryce) on 2009-08-21
Changed in mesa (Ubuntu):
status: Triaged → In Progress

This bug was fixed in the package mesa - 7.6.0~git20090817.7c422387-0ubuntu1

---------------
mesa (7.6.0~git20090817.7c422387-0ubuntu1) karmic; urgency=low

  [Bryce Harrington]
  * Checkout from git 20090817 (master branch) up to commit
    7c4223876b4f8a78335687c7fcd7448b5a83ad10
    + Add DRI2 support to -ati
      (LP: #329654, #404428, #327698, #321108)
    + Fix portion of MythTV Frontend does not work with RADEON DRI
      (LP: #341898)
    + Fix selection mode on RS482
      (LP: #273329)
    + Fix issue running 3D acceleration games on ATI chipsets
      (LP: #374590)
    + Provide DRI2 swap buffers
      (LP: #377090)
    + Fix blender unusable with UXA when DRI2 enabled
      (LP: #353763)
  * Drop 108_bo_assertion.patch (applied upstream)

  [Robert Hooker]
  * Only added debian/ tree from origin/ubuntu
  * Enable r600 driver. Note that it requires seperate drm modules
    not provided in this PPA or in ubuntu, and also does not work with
    KMS.

 -- Bryce Harrington <email address hidden> Fri, 21 Aug 2009 16:13:50 -0700

Changed in mesa (Ubuntu Karmic):
status: Won't Fix → Fix Released
Eric Appleman (erappleman) wrote :

Bryce, are the remaining components fixed upstream in the xorg-edgers or Sarvatt/xorg-testing PPA?

Mark Shuttleworth (sabdfl) wrote :

Bryce, this is interesting to me too. Could you check with Jesse Barnes about the state of the dri2-swapbuffer branch, and whether it's suitable for merging into our DRI2? And if there are any other bits required to make it all happy?

The kernel portion of this work is targeted at kernel 2.6.32 (Kristian Hogsberg has been posting the patches most recently). There are also libdrm, mesa, xserver and driver changes required, which should land in the Intel gfx Q3 release, and in the next stable X server release.

Bryce Harrington (bryce) wrote :

Hi Mark,

Sure thing. I checked with jesse; he posted the status in the previous comment, and in regards to the suitability, he said, "I wouldn't recommend it for karmic. It would be good to have in edgers though, but I'd just wait until it lands. Shouldn't be long now before those branches are merged into master of the various repos."

So it sounds like a good thing to look at for karmic+1, and would be worthwhile for us to integrate into xorg-edgers so people can begin testing on it.

summary: - [i945gm] (Needs kernel 2.6.31) DRI2 swapbuffers
+ [i945gm] (Needs kernel 2.6.32) DRI2 swapbuffers
Changed in xserver-xorg-video-intel (Ubuntu Karmic):
status: Fix Released → Incomplete
Changed in linux (Ubuntu Karmic):
status: Fix Released → Incomplete
Changed in mesa (Ubuntu Karmic):
status: Fix Released → Incomplete
Changed in x11proto-dri2 (Ubuntu):
status: Triaged → Incomplete
Changed in xserver-xorg-video-intel:
status: Fix Released → Incomplete
Changed in xorg-server (Ubuntu):
status: Triaged → Incomplete
Bryce Harrington (bryce) on 2009-08-27
Changed in mesa (Ubuntu Karmic):
status: Incomplete → Won't Fix
Changed in linux (Ubuntu Karmic):
status: Incomplete → Won't Fix
Changed in xserver-xorg-video-intel (Ubuntu Karmic):
status: Incomplete → Won't Fix

Thanks Bryce, Jesse, looking forward to this in K+1.

Changed in xserver-xorg-video-intel:
status: Incomplete → Fix Released
Bryce Harrington (bryce) on 2009-09-02
Changed in mesa (Ubuntu):
status: Incomplete → Confirmed
Bryce Harrington (bryce) on 2009-09-02
Changed in x11proto-dri2 (Ubuntu):
status: Incomplete → Confirmed
Changed in xorg-server (Ubuntu):
status: Incomplete → Confirmed
Bryce Harrington (bryce) on 2009-09-02
Changed in xserver-xorg-video-intel (Ubuntu):
status: Incomplete → Confirmed
Changed in xserver-xorg-video-intel:
status: Fix Released → Confirmed
Changed in xserver-xorg-video-intel:
status: Confirmed → Fix Released
Eric Appleman (erappleman) wrote :

BWU is wrong.

The intel driver will require additional patching. A lot has changed since this component of the bug was originally declared "fixed".

The option "SwapbuffersWait" prevents the tearing of long lines but there are still from time to time fractals like short rectangles slower than the rest which makes watching a movie still kind of annoying some times.
The main problem is that it isn't possible to use Overlay again with KMS.

Michal Charvát (dog.big) wrote :

Please fix it! It is critical!

Francisco Villalobos (belhor) wrote :

Jaunty & Karmic sucks because of this!

Again have slow rendering on Intel 945GM.

I install Kernel 2.6.32 and now have good performance.

Jeremy Foshee (jeremyfoshee) wrote :

Jesse / Eric,

Has anyone been able to verify if this fix has been released in the .32 kernel? I have added this to my list.

Thanks,

-JFo

Jeremy Foshee (jeremyfoshee) wrote :

Francisco,
     Are you able to definitively determine that this fix has solved your issue in the .32 kernel?

-JFo

Eric Appleman (erappleman) wrote :

Cannot confirm or deny. All I know is that Flash and fullscreen games stil tear regardless of whether vsync is activated or not.

Bryce Harrington (bryce) on 2010-03-02
summary: - [i945gm] (Needs kernel 2.6.32) DRI2 swapbuffers
+ [i945] [i945gm] (Needs kernel 2.6.32) DRI2 swapbuffers
Bryce Harrington (bryce) on 2010-03-02
summary: - [i945] [i945gm] (Needs kernel 2.6.32) DRI2 swapbuffers
+ [i945gm] (Needs kernel 2.6.32) DRI2 swapbuffers
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package x11proto-dri2 - 2.2-1

---------------
x11proto-dri2 (2.2-1) unstable; urgency=low

  [ Timo Aaltonen ]
  * New upstream release. (LP: #377090, closes: #569259)

  [ Julien Cristau ]
  * Rename the build directory to not include DEB_BUILD_GNU_TYPE for no
    good reason. Thanks, Colin Watson!
  * Remove myself from Uploaders

  [ Brice Goglin ]
  * Add myself to Uploaders.
 -- Robert Hooker <email address hidden> Wed, 10 Mar 2010 11:51:54 +0000

Changed in x11proto-dri2 (Ubuntu):
status: Confirmed → Fix Released
summary: - [i945gm] (Needs kernel 2.6.32) DRI2 swapbuffers
+ [i945gm] (Needs kernel 2.6.32) DRI2 swapbuffers and page flipping
Bryce Harrington (bryce) on 2010-03-31
tags: removed: needs-lspci-vvnn needs-xorglog
Zack Evans (zevans23) wrote :

For clarity - is this fixed in Lucid's kernel? Or is there still farther to go? I'd like to help you keep a lid on Intel-driver-bashing in the forum when Lucid is out, but can't figure out if you're expecting this to work or not.

Achim (ach1m) wrote :

No, doesn't work yet. You need at least xserver 1.8 and Mesa7.8.

tags: added: cherry-pick kernel-fs
tags: added: kernel-graphics
removed: kernel-fs
Robert Hooker (sarvatt) wrote :

Everything for this is now available in maverick.

Changed in linux (Ubuntu):
status: Incomplete → Fix Released
Changed in mesa (Ubuntu):
status: Confirmed → Fix Released
Changed in xorg-server (Ubuntu):
status: Confirmed → Fix Released
Changed in xserver-xorg-video-intel (Ubuntu):
status: Confirmed → Fix Released
Changed in xserver-xorg-video-intel:
importance: Unknown → Wishlist
Changed in xserver-xorg-video-intel:
importance: Wishlist → Unknown
Changed in xserver-xorg-video-intel:
importance: Unknown → Wishlist
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.