Bug 20664 - implement vblank sync'd GL buffer swap
Summary: implement vblank sync'd GL buffer swap
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: high enhancement
Assignee: Jesse Barnes
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-14 12:41 UTC by Sven Arvidsson
Modified: 2009-10-02 03:08 UTC (History)
12 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Sven Arvidsson 2009-03-14 12:41:22 UTC
As of bug 19635, video tearing has been fixed but only in a non-composited environment. As using compositing is very usual, this is quite a big problem.

haihao commented in bug 19635:
 "Jesse has some commits to eliminate  tearing when using composite manager, but
 he doesn't push them out now."

System environment:
-- chipset: G45 / ICH10R
-- system architecture: 32-bit
-- Linux distribution: Debian unstable
-- Machine or mobo model: Asus P5Q-EM
-- Display connector: DVI

-- xf86-video-intel: 4a0d19ef4f210cea9e60c5acc355df03723ef808
-- xserver: 1.5.99.901
-- mesa: 2305642b2e8edcebdc727f1181f7dbfcc78e8028
-- drm: 4a0d19ef4f210cea9e60c5acc355df03723ef808
-- kernel: drm-intel-next 126fd9c96d80260a1f2d8dfc72e444e572bcafb7
Comment 1 Gordon Jin 2009-03-14 17:59:15 UTC
I'm not sure who is working on this? (CCing bunch of people)
Comment 2 Michel Dänzer 2009-03-15 09:41:23 UTC
FWIW, at least compiz and xfwm4 can be configured to unredirect fullscreen windows.
Comment 3 Jesse Barnes 2009-03-30 17:33:29 UTC
*** Bug 19458 has been marked as a duplicate of this bug. ***
Comment 4 Jesse Barnes 2009-03-30 17:38:57 UTC
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.
Comment 5 unggnu 2009-03-30 23:53:21 UTC
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.
Comment 6 Jesse Barnes 2009-03-31 08:08:39 UTC
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.
Comment 7 unggnu 2009-05-04 00:44:56 UTC
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.
Comment 8 Jesse Barnes 2009-05-04 09:58:01 UTC
I just updated the patches to incorporate some feedback last week; I hope to have them integrated for this release.
Comment 9 Jesse Barnes 2009-06-02 08:47:08 UTC
commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Tue Jun 2 16:42:56 2009 +0100

    Sync DRI2 CopyRegion to vertical retrace
Comment 10 Lukasz Kurylo 2009-06-08 05:57:15 UTC
(In reply to comment #9)
> commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
> Author: Jesse Barnes <jbarnes@virtuousgeek.org>
> 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.
Comment 11 Jesse Barnes 2009-06-09 17:16:26 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
> > Author: Jesse Barnes <jbarnes@virtuousgeek.org>
> > 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.
Comment 12 Lukasz Kurylo 2009-06-10 03:32:54 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
> > > Author: Jesse Barnes <jbarnes@virtuousgeek.org>
> > > 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. 
Comment 13 Lukasz Kurylo 2009-06-10 05:55:43 UTC
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).

Comment 14 Lukasz Kurylo 2009-06-10 06:26:52 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > commit ec2fde7c8250fdc30984f16c8a1d3587d70b0144
> > > Author: Jesse Barnes <jbarnes@virtuousgeek.org>
> > > 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.
	

Comment 15 unggnu 2009-08-03 05:03:02 UTC
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.
Comment 16 Lukasz Kurylo 2009-08-04 05:00:09 UTC
(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
Comment 17 unggnu 2009-08-04 06:00:06 UTC
Yeah, the option >>Option "SwapbuffersWait" "true"<< seems to fix the problem for me.

Many thanks!
Comment 18 unggnu 2009-10-02 03:08:34 UTC
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.


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.