How to speed up Unity Gaming Performance

unity1210

It is widely known that Ubuntu 12.10 has a major problem with Unity and gaming performance. In case you haven’t noticed, there is dramatic regression in performance compared to other Desktop environments. Doing the math or so, Unity costs about 10% in frame rate performance drop when running a game. Well, that doesn’t sound really nice especially in Valve’s  ears who is about to release Steam for Linux (beta is already out). In a matter of fact, there couldn’t be worst moment for this to happen in Ubuntu community. If Valve releases Steam in 2012, then based on Unity performance,  these guys are going to be the pioneers of Linux gaming, and the same time they will be the first ones who suck on that. Okay, I admit that this sounds a bit harsh…

Diving into details, there is a 9-10% drop in performance between compiz 0.9.7 and compiz 0.9.8 where FBO rendering is enabled (check our benchmarks). Unfortunately, there were reports (back in September, when 12.10 was in beta phase) saying that glmark and glxgears report 80-96% lower frame rates!!! This regression was allowed in compiz 0.9.8.0 because it is generally only visible in benchmark results. Meanwhile, physical compiz rendering performance (as reported by the compiz Benchmark plugin) is higher in compiz 0.9.8.0 than previous versions, in most cases.  However, if you edit the OpenGL plugin to explicitly disable the FBO code and buffer swapping then it is fast again (since I have the fix for bug 1037411).

Additionally, comparing graphics performance in a two-monitor configuration, the gles2 branch is 25-40% slower than trunk. This would not normally be surprising, however the slowdown REMAINS even when you turn off the new rendering features in the gles2 branch: framebuffer_object, vertex_buffer_object, always_swap_buffers

But… the problems don’t seem to have an end for Ubuntu 12.10 and Gaming, due to recent critical (high) bug found in nVIDIA drivers.  As a result, currently the usage of XSync is very inefficient, and on drivers which likely send the command queue over the protocol, this can kill performance. Neutering XSync usage throughout compiz had the effect of lifting framerates from 30fps to 50fps. Obviously we require synchronous operation for certain things, for example:

  1. Updating clients on new window positions and stack positions if they are reparented
  2. Ensuring tear-free window pixmap updates
  3. Ensuring tear-free damage repair.

Anyway, let’s focus on the first and main bug that affects all Ubuntu 12.10 users.

The main fix for this problem is to turn off compositing for fullscreen windows. That’s a feature that is already present, but it’s not reliable enough to recommend anyone try until Compiz 0.9.8.4 has been released (Update: Done!).

The feature can be enabled here:

   CCSM > General > Unredirect Fullscreen Windows 

It’s not enabled by default because:

  1.    It’s not yet tested across all the major graphics drivers; and
  2.    It’s still not as seamless as it should be.

The driver bugs are all listed here:
https://bugs.launchpad.net/ubuntu?field.tag=unredirect

The compiz bugs are all listed here:
https://bugs.launchpad.net/compiz/+bugs?field.tag=unredirect

It is likely the “Unredirect Fullscreen Windows” option will be usable for most people when Ubuntu 12.10 is released, but unlikely to be enabled as default by then, due to the above issues. The fixes can be backported to Ubuntu 12.04 LTS in the future.

So the main problem is:
https://bugs.launchpad.net/compiz/+bug/1024304
and the primary intended solution is:
https://bugs.launchpad.net/compiz/+bug/1063690

Performance changes for raring
  • - Compiz unredirect fullscreen: ON by default, OFF automatically for nouveau and intel (override by the gsettings key)
  • - Unity: paging of results from the dash search results
  • - Unity: UBUS enhancements (already in)
  • - Unity: full screen dash window to detect the click out. Solution for not doing it and just querying the window manager for focused window
  • - Nux: Texturing all the components in just one spot, not a draw call for every components, every time. (Launcher first, then panel). Texture harness. (like css sprites)
  • - Nux automatically queuing and relayouting parents when it’s just needed.
  • - Previews transition on dash on big screens: inefficient.
  • - Automated measurement/benchmark of precise interactions -> Rick mentioned QA team for it.
  • - BAMF synchronous calls to check that they are in UI-drawing thread safe

Could compiz be consuming gl resources before the game launches into full screen? If unredirect is on this isn’t a big issue. We hope that new Ubuntu Gaming Launchpad team will eventually save the day before Valve’s Steam release. If you are interested in Benchmarking, then join the team and help us !

SHARE THIS POST

  • Facebook
  • Twitter
  • Google Buzz
  • Reddit
  • Stumnleupon
  • Delicious
  • Digg
  • Technorati
  • Joeman1

    This is why you don’t use Unity AT ALL! Gnome 3 is much better, but KDE is light years better!

    I have been gaming with KDE and get better fps scores than Windows 7 on the same machine (Phoronix has also confirmed this.)

    Even using Crossover to play Windows games, I see better performance using KDE.

    STOP USING UNITY AND GNOME 3 and use a REAL, tried-tested, stable DE!!!!!

    I could not believe when I tested Gnome and Unity on 12.04 and 12.10 – consistent crashes and performance issues! Why do people put themselves though the pain! Just use something that works!

    Joe

    • http://www.ubuntuxtream.com/ Panos Georgiadis

      If you want to make a fair comparison between the two OSes (Linux vs Windows), use Unigine Heaven or any other cross platform 3D benchmark with same settings ;)

      Simply put: “Less the effects, more the performance”

      Hence, even if you use KDE (with plasma), you might have a slight performance regression rather than using plain KDE (without any extra bling-bling effects). It is really shame that Canonical dropped the support for Unity 2D. Now, the whole community is in PAIN. Ouch…

      Joeman1, what distro are you using ?

      • damien duncan

        Nice article,however, on the subject of fairness “The goal of the Steam client project is a fully-featured Steam client running on Ubuntu 12.04. ” Not 12.10 Infact ill go as far as saying its probably best Valve only support steam on LTS releases for now.

    • benmichael

      If you are looking for performance, using Unity, Gnome or KDE is a mistake. LXDE (LUbuntu if you want it out of the box), XFCE (XUbuntu if you want that out of the box), or even Enlightenment are all much better options. They may not be as shiny, but they are easy to use and will give you excellent performance. You could go even lighter with OpenBox, FluxBox or something similar, but those are not really an option for someone not familiar with Linux.

      Of course if you want Ubuntu and Unity, you could install any of those other Desktop Environments from the Ubuntu Software Center (or whichever package manager you prefer) and from the login screen, select a lighter environment for when you need better performance and switch back when you want your shinies.

      I do agree with the article however. There is no excuse for dropping performance by 10% with a new version.

      • Alexandra Pagkrati

        Have you tried Cinammon ? It’s very lightweight and easy to use.

        • benmichael

          I have tried Cinnamon, it is excellent. I really enjoyed using it for the couple of months that I did. It also feels more responsive than Unity, Gnome3 or KDE. However it is Gnome3 under the hood.

          Gnome Shell (the default Gnome3 Shell) is one shell on top of Gnome3, Cinammon is another created by the team at Linux Mint because they didn’t like Gnome Shell. Originally it was a set of tools on top of Gnome Shell, until that started becoming too bloated, and the wrote the Cinnamon shell.

          As it is Gnome3 I still wouldn’t use it for running games (but then I am a bit of a purist). Mate is also very nice, and lighter than Unity, Gnome3, Cinnamon or KDE. It is a fork of Gnome2, renamed so that the libraries didn’t clash with Gnome3. It looks and feels exactly like the old Gnome2, and they are actively developing improvements. In terms of performance, it sits between the heavy group and the lighter LXDE, XFCE etc.

          I have always spent time getting to know different desktop environments, and again since the Gnome3 debacle, I have spent several months with each of the desktop environments and window managers that I’ve mentioned in these posts. They each have their pros and cons. It really is a matter of preference, and the choice is one of the beauties of Linux.

          • http://www.ubuntuxtream.com/ Panos Georgiadis

            well said! I couldn’t agree more with your taste for DEs,

  • http://www.cerebrux.net/ Salih Emin

    It is very interesting to see how things going to change in Ubuntu now that Valve and Graphics card manuf. are raising the bar of drivers and OS quality/performance.
    For years we were proud of fancy and most beautiful desktop environments that are available on the linux ecosystem… Now we are faced with new challenges that were never existed before and most of the code needs to be re-written to satisfy the need of a better gaming experience.
    I am exited that we are living maybe the greatest era on Linux platform…

  • Eduardox123

    This just improve the performance in games? or in any situation? Because I don’t use my PC for games

    • Alexandra Pagkrati

      Only in games. In desktop there is no any improvement yet.