Post early, post often, right?

In the interest of getting a non-broken (i.e. non-tearing) GL stack w/DRI2 
I've been working on making SwapBuffers use page flipping for full screen 
clients (like compositing managers).  This saves a full screen blit so should 
be a little faster than the current code.  There's a big downside though: 
small copies aren't sync'd, so they'll still tear.

I'd like to get some feedback on the idea in general before trying to fix up 
the code much more (there are leaks, broken rotation, too much 
synchronization, and other problems I'm sure).

As I said, the basic idea here is to use a simple page flip if we get a 
SwapBuffers request for a full screen buffer.  This means queueing the flip, 
updating X's view of the front buffer, and returning the new front & back 
DRI2Buffers info to the client.  I've hard coded the new SwapBuffers request 
to 2 buffers for now, but it could be extended to include a count so that we 
could do triple buffering in the future (or swap out other buffers, though 
I'm not sure why we'd need to do that).

To really make the request asynchronous though, I'll need to remove the wait 
event emission and somehow block rendering on the new back buffer until the 
flip is complete, but still allow other clients private backbuffer rendering 
to continue.  oga suggested a new swap domain to handle this; I'll look into 
it.

We'll definitely want something similar for the CopySubBuffer extension too; 
right now it just blits to the real front buffer w/o any synchronization.  
But doing that properly will require a kernel queue and some cancellation 
code (what do we do if we try to cancel a queued blit due to cliprect changes 
but it's too late to remove it from the queue?).  CopySubBuffer can be a bit 
friendlier power-wise, though if you have a fairly quiet display (no blinking 
cursors), SwapBuffers won't be horrible during idle.

All these caveats aside, compiz does look pretty cool when you don't have 
tearing.  I haven't tested video, but textured outputs should also not tear 
with these hacks, since they'll be rendered offscreen and then displayed by 
compiz at SwapBuffers time.

-- 
Jesse Barnes, Intel Open Source Technology Center

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to