Wednesday, November 28, 2012

Game performance improvement for Ubuntu available for testing

Unity, which uses Compiz and Nux for drawing, recently had a regression with full screen gaming speeds (LP: #1024304). While the performance of Compiz itself was improved significantly in Ubuntu 12.10, the big changes like full OpenGL ES support brought in some regressions at least from benchmarking point of view. Unity/Compiz has had a small performance impact also in Ubuntu 12.04 LTS depending on what it's being compared to. Any compositing method will necessarily bring some performance hit, but there's another option...

Many people know already about enabling the setting "Unredirect Fullscreen Windows" in Compiz's Composite plugin, but having to enable it manually meant that most people didn't get to use it. The feature detects when an application is running full screen, and simply takes compositing out of the equation, improving performance. Getting the feature work fluently has required fixes in both Compiz and drivers, which is why it hasn't been enabled by default before (LP: #1063690).

But things are progressing now. The Unity team's SRU PPA now has a test build of the new Compiz 0.9.8.6 for Ubuntu 12.10, which enables this feature by default:

ppa:unity-team/sru

Since Phoronix is a frequent reporter on Linux gaming performance, I (very) quickly run phoronix-test-suite's Open Arena test on my Sandy Bridge machine with the stock Ubuntu 12.10 (quantal) Compiz and with Compiz upgraded from the PPA: 18% increase in fps! (test1_1 has older compiz, test1_2 the newer, no settings touched)

The idea is to get the new Compiz into quantal-proposed after the previous snapshot release 1:0.9.8.4+bzr3412-0ubuntu0.1 gets its bug fixes properly verified via the Stable Release Updates process. Note that also this previous snapshot contains all the needed fixes for unredirecting fullscreen windows, the final tagged 0.9.8.6 version just switches the default to be enabled.

For Ubuntu 12.04 LTS (precise) there will be two steps. First of all, Daniel van Vugt has just backported the required Compiz fixes to the 0.9.7 branch of Compiz that the 12.04 LTS uses and tagged the 0.9.7.10 release. Also in the case of precise, there is an earlier snapshot release in the SRU system, but that one does not yet include the needed backports even though it includes many other fixes. The 0.9.7.10 will be available in the same SRU PPA soon. Secondly, once the fixes are in but the feature is not yet enabled by default, the X.org driver team will need to look at additional fixes for the drivers before enabling the Unredirect Fullscreen Windows by default. But after that, Ubuntu 12.04 LTS should also see a Compiz release with this feature turned on by default.

11 comments:

Br. Jack+, LC said...

Thanks for the information. I really appreciate the backport to 12.04.

Ethan Anderson said...

And with this, Ubuntu officially becomes the best gaming OS on earth :-)

Unknown said...

Is that "Unredirecting" per screen? I mean, I have a fullscreen Application on my secondary monitor but not on the Notebook Screen, is Compositing disabled on one screen? Or is that not possible?
example Use case: Lightworks

Brandon said...

Tested the build. Unredirect fullscreen windows causing tearing when watching fullscreen videos on ivybridge...

xynopsis said...

It's almost the end of 2012. I'm surprised Compiz just had this feature. Many years ago, the meego compositor (responsible for swipe effects on Nokia N9) saw that it's pointless and resource-intensive to redirect full-screen windows and has by default, always made sure that full screen are rendered directly.

TJ said...

Philipp: not sure, Daniel would know better, but I think it should be possible for separate physical screens. There have also been thoughts in the air for future that actually all foreground windows could be drawn unredirected... but that might easily pose too much regression potential.

Brandon: that's https://bugs.launchpad.net/compiz/+bug/1051802 - basically a driver or application issue depending on the perspective, since when unredirected nothing is using the glXSwapBuffers anymore explicitly, and Intel tear-free depends on it for its SwapbuffersWait feature. I don't experience tearing on AMD (and I'd think the same would apply to NVIDIA), nor on Intel if I use eg. Xbmc which uses OpenGL shaders as default or Vlc with OpenGL output, or any VA-API playback application. Intel driver and/or default video apps should be looked at, preferably the driver. I'll check with the X.org team.

xynopsis: it's much easier to be regression-free when one controls the whole stack and dictates usage of a single toolkit to build all applications. but true, this feature in general is the right thing to do, and it works great on N9 ;)

Unknown said...

Should simple ticking "unredirect fullscreen windows" checkbox in CCSM be enough to gain mentioned performance boost?
Ubuntu 12.10, NVIDIA 310.14 driver from proposed

Brandon said...

@Timo Jyrinki

I experienced the issue wth both totem and vlc. And I did try using opengl output in vlc. The tearing was always near the top of the screen only.

Brandon said...

@Timo.

Yeah, this does appear to be a problem with the intel driver/hardware. Basically with intel sandybridge+ the driver/hardware is not capable of having tear-free output unless you are using a page-flipping compositor (like compiz). So if you bypass compiz with unredirect fullscreen windows you are now depending on the application to pageflip, so you *will* get tearing with intel sandybridge+ if this option is enabled and the video player isn't smart enough to page flip on its own. (And as I mentioned before this issue affects totem, the default player as well as vlc with opengl output enabled).

There's a relevent bug report for vlc: https://trac.videolan.org/vlc/ticket/7702#comment:12

It also effects flash player 11.2 in firefox. With unredirect enabled fullscreen flash tears.

However it does not effect pepper flash 11.5 in google chrome as long as opengl rendering is enabled in chrome:flags.

Intel's driver issues aside this compiz build is working wonderfully for me :) It fixes two annoying bugs (grid not working with gedit/empathy, and spread not showing window titles)

Would there be a way to blacklist certain cards from having the feature on by default? Probably don't want to introduce tearing for intel users in flash and totem.

mniess said...

I'm not sure if there's a fix for this, but as soon as I enable "unredirect fullscreen" I get screen tearing (especially in videos).

TJ said...

Blacklisting unredirecting for Intel users - one way or another - might be the way to go, unless a driver fix can be found. There's also another bug #1084401 Daniel is working on that needs to be included.