Compiz frame rate decreases if application frame rates are too high (unthrottled)

Bug #1007299 reported by Daniel van Vugt
54
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Compiz
Fix Released
High
Daniel van Vugt
compiz (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

When a graphics app is rendering at a sensible frame rate close to the monitor refresh rate or within a couple hundred FPS, compiz keeps up and renders the screen perfectly smoothly. If however a graphics app is allowed to render unthrottled then compiz can slow down and its frame rate can halve.

A simple example, that works with intel graphics for me is glxgears. By default, the intel graphics driver enables sync to vblank, so glxgears only renders 60 FPS. And compiz can keep up perfectly. If however I allow glxgears to render as fast as possible:
    env vblank_mode=0 glxgears
then glxgears reports 5500 FPS, and compiz (benchmark) slows to 30 FPS.

The same is true for OpenGL benchmarks and games. Such apps are typically designed to render as fast as possible. And even if they're not they often still will render unthrottled because many drivers disable sync to vblank by default (nouveau, fglrx, and more recently nvidia).

Related branches

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fix committed into lp:compiz at revision 3239

Changed in compiz:
status: In Progress → Fix Committed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fix reverted in lp:compiz revision 3240. I can see a potential race condition.

Changed in compiz:
status: Fix Committed → In Progress
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This bug is now harder to reproduce since two other optimizations have been committed:
  bug 1005569
  bug 1006335

With those fixes, this bug has become less noticeable. Even though it still exists.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I take that back. I had accidentally removed the important part of this fix so it wasn't working. Now it is working again and making a huge difference.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in compiz (Ubuntu):
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (7.6 KiB)

This bug was fixed in the package compiz - 1:0.9.8+bzr3249-0ubuntu1

---------------
compiz (1:0.9.8+bzr3249-0ubuntu1) quantal-proposed; urgency=low

  * New upstream snapshot.
    - Fall back to a refresh rate that is more likely to look correct; 60Hz.
      (LP: #1009338)
    - Benchmark plugin should consume its key binding, and not pass the key to
      the underlying window. (LP: #1009320)
    - Avoid needless STL operations leading to expensive heap operations.
      (LP: #1006335)
    - Fix a typo that was causing (LP: #1002606)
      (widthIncBorders/heightIncBorders)
    - Check if the window is decorated before trying to change its event window
      states (which won't exist if not decorated) (LP: #1007754)
    - Use the XDamage extension more efficiently (the way it was designed to be
      used). This dramatically reduces CPU usage, reduces wakeups, and
      increases frame rates. It also solves at least one observed performance
      bug (LP: #1007299) and probably several more.
    - Avoid constructing and destructing lots of strings on every single event,
      which was wasting lots of CPU (LP: #1005569)
    - md LINGUAS doesn't exist, it's mnk (Mandinka in ISO 639-3)
    - Move grid plugin to google test and don't depend on the plugin for the
      test (LP: #1005009)
    - Don't read plugin.Initialized and test the value. (LP: #1004848)
    - libcompizconfig's install () commands were still using the old includedir
      and libdir variables rather than their libcompizconfig_* variants.
      (LP: #1005176)
    - Execute the cmake files separately to ensure that DESTDIR is respected.
      (LP: #1005177)
    - Don't set_target_properties on a target that might not exist
      (LP: #1005008)
    - Don't allow windows which we weren't even tracking as decoratable to
      become decorated if they try and change their hints. (LP: #963794)
    - Change the mouse pointer while dragging windows in expo. Just like the
      ubuntu branches do. (LP: #987647)
    - Fix uninitialized memory use (LP: #1004338)
    - Fix uninitialized variable (LP: #1004335)
    - Delay unbinding of pixmaps until then next rebind (LP: #729979)
      (LP: #1002602)
    - Don't drop plugins from the list to try and load before you've even tried
      to load them. Doing so makes missing plugins silently ignored instead of
      an error message (LP: #1002715). It also means valid plugins in more
      unusual, but real locations in LD_LIBRARY_PATH will never get loaded
      (LP: #1002721).
    - If running test cases under a real X server, we don't care if Xvfb is
      missing (LP: #994841)
    - Don't assume pkg_check_modules always sets _PREFIX (LP: #993608)
    - Don't clear selections in ~PrivateScreen because it causes a race between
      the existing and the new compiz instances, breaking --replace and
      non-replace behaviour. (LP: #988684) (LP: #989545)
    - Always paint with infiniteRegion as the clip region if the window is
      transformed and always use the supplied region if painting with offset or
      on transformed screen. (LP: #987639)
    - Add synchronization primitives to the decoration protocol so that there
      isn't a r...

Read more...

Changed in compiz (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The previous message is a mistake. The fix for this bug is not released or even committed anywhere yet.

Changed in compiz (Ubuntu):
status: Fix Released → Triaged
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fix committed into lp:compiz at revision 3265

Changed in compiz:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (7.9 KiB)

This bug was fixed in the package compiz - 1:0.9.8+bzr3319-0ubuntu1

---------------
compiz (1:0.9.8+bzr3319-0ubuntu1) quantal-proposed; urgency=low

  [ Didier Roche ]
  * debian/patches/ubuntu-config.patch:
    - refresh with latest trunk
  * debian/*docs:
    - remove the TODO copy now removed upstream
  * debian/compiz-plugins.install:
    - install stackswitch, trip plugins
  * debian/rules, debian/control:
    - remove the compiz gnome-control-center key sedding through metacity.
      Compiz now directly ships them.
    - we do not need metacity-common anymore as a build-dep then
  * debian/compiz-gnome.migrations, debian/control:
    - build-dep on dh-migrations and ship gconf -> gsettings migration file

  [ Matthieu Baerts (matttbe) ]
  * Update apport hook for python3 ; thanks to Edward Donovan (LP: #1013171)

  [ Timo Jyrinki ]
  * New upstream snapshot.
    - Fix Compiz crash in movementWindowOnScreen (LP: #1015151)
    - Start window decorator when decor plugin starts (LP: #1014461)
    - Fixed: Crash in compiz::wall::movementWindowOnScreen (LP: #1015151)
    - Don't waste memory leaving /bin/sh running (LP: #1015422)
    - Add reliable detection of the compiz bin directory (LP: #1015898)
    - Check if the window would actually paint before painting the shadow,
      since it is possible that another plugin could be inhibiting paint of
      the dock window. (LP: #1012956)
    - Don't insert the window into the server list above the window it was
      created above. (LP: #1008020) (LP: #886605)
    - makes compiz enhanced zoom and show mouse plugins considerably
      smoother to use (LP: #930783)
    - Don't set decoration contexts on undecorated windows, since that
      might be read later and code will assume the window is decorated when
      it isn't. (LP: #1015593)
    - Fix potentially unterminated string leading to an uninitialized memory
      read (LP: #1018302)
    - Lift the 31/32 character restriction on key names that was causing so
      many warnings. It's now 1024 characters according to glib. (LP: #1018730)
    - Don't print the result of BUILD_DEB. It prevents ccsm et al from
      installing. (LP: #1018916)
    - Use the XDamage extension more efficiently (the way it was designed to be
      used). This dramatically reduces CPU usage, reduces wakeups, and
      increases frame rates. It also solves at least one observed performance
      bug (LP: #1007299) and probably several more.
    - Do the initial work to get libcompizconfig under test. (LP: #990690)
    - Add support for initiating window picker in other than nomal mode. For
      now added only the additional 'All windows' picker (LP: #933776)
      (LP: #955035)
    - Fixes (LP: #1018602) : An invalid read when using g_variant_iter_loop.
    - Don't allow unbinds of textures kept around for animations in any case,
      not just resizing. (LP: #1016366)
    - Wait for the server to finish processing requests before doing a bind
      (LP: #1016367)
    - Using the next/previous bindings the wall plugin didn't calculate
      correctly the next workspace when it reaches the begin or the end of a
      row of workspaces, so it didn't jump to the n...

Read more...

Changed in compiz (Ubuntu):
status: Triaged → Fix Released
Changed in compiz:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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