[regression] Compiz: Visible tearing is worse in 11.10 than 11.04, even when "Sync To VBlank" is enabled, but only when Unity is active.

Bug #880707 reported by Daniel van Vugt on 2011-10-24
180
This bug affects 29 people
Affects Status Importance Assigned to Milestone
Compiz Core
High
Daniel van Vugt
Ubutter
Undecided
Unassigned
Unity
Fix Released
High
Daniel van Vugt
compiz (Ubuntu)
High
Daniel van Vugt
unity (Ubuntu)
High
Daniel van Vugt

Bug Description

You might expect that with "Sync To VBlank" enabled in compiz that video tearing doesn't happen. But it does, just less often.

This appears to be a regression in Ubuntu 11.10, because in 11.04 "Sync to VBlank" was working reliably and eliminated tearing.

Strangely, disabling just the Unity plugin in CCSM solves the problem and all tearing goes away. This seems to be related to bug 861061 where the Unity plugin also degrades application frame rates. Both issues are instantly solved by disabling just the Unity plugin.

WORKAROUND:

In CCSM, Workarounds, enable "Force full screen redraw (buffer swap) on repaint". With some graphics drivers like the NVIDIA proprietary one, this workaround may introduce stuttering and halve the framerate you see. That is expected with some drivers and is fixed by the same compiz fix that is proposed for this bug.

USERS OF THE NOUVEAU DRIVER:

If you are using the "nouveau" driver for NVIDIA chips, you will need to enable Sync To VBlank support in the driver options because nouveau has it disabled by default. You can do this by editing /etc/X11/xorg.conf and adding:

# For nouveau only:
Section "Device"
 Identifier "My Graphics"
 Option "GLXVBlank" "on"
EndSection

Then log out and in again for it to take effect.

USERS OF THE CATALYST (FGLRX) DRIVER:

The fglrx driver also disables Sync to VBlank support by default. To fix this:
1. Open Catalyst Control Center.
2. Go to 3D > More Settings.
3. Set "Wait for vertical refresh" to "On, unless application specifies".

----------------------

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: compiz 1:0.9.6+bzr20110929-0ubuntu5
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
Uname: Linux 3.0.0-12-generic x86_64
.tmp.unity.support.test.0:

ApportVersion: 1.23-0ubuntu3
Architecture: amd64
CompizPlugins: [core,bailer,detection,composite,opengl,compiztoolbox,decor,mousepoll,place,gnomecompat,resize,imgpng,move,wall,regex,grid,vpswitch,animation,session,resizeinfo,unitymtgrabhandles,expo,workarounds,fade,scale,ezoom,unityshell]
CompositorRunning: compiz
Date: Mon Oct 24 16:01:07 2011
DistUpgraded: Fresh install
DistroCodename: oneiric
DistroVariant: ubuntu
GraphicsCard:
 Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0102] (rev 09) (prog-if 00 [VGA controller])
   Subsystem: Dell Device [1028:047e]
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
MachineType: Dell Inc. OptiPlex 990
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_AU:en
 PATH=(custom, no user)
 LANG=en_AU.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.0.0-12-generic root=UUID=c9a0c042-2d94-4c4b-bb7f-756faf723ada ro quiet splash intel_iommu=on vt.handoff=7
SourcePackage: compiz
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 05/28/2011
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A05
dmi.board.name: 0D6H9T
dmi.board.vendor: Dell Inc.
dmi.board.version: A00
dmi.chassis.type: 15
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvrA05:bd05/28/2011:svnDellInc.:pnOptiPlex990:pvr01:rvnDellInc.:rn0D6H9T:rvrA00:cvnDellInc.:ct15:cvr:
dmi.product.name: OptiPlex 990
dmi.product.version: 01
dmi.sys.vendor: Dell Inc.
version.compiz: compiz 1:0.9.6+bzr20110929-0ubuntu5
version.ia32-libs: ia32-libs N/A
version.libdrm2: libdrm2 2.4.26-1ubuntu1
version.libgl1-mesa-dri: libgl1-mesa-dri 7.11-0ubuntu3
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 7.11-0ubuntu3
version.xserver-xorg: xserver-xorg 1:7.6+7ubuntu7
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.6.0-1ubuntu13
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:6.14.99~git20110811.g93fc084-0ubuntu1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.15.901-1ubuntu2
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:0.0.16+git20110411+8378443-1

Related branches

Daniel van Vugt (vanvugt) wrote :
Daniel van Vugt (vanvugt) wrote :

Subscribed smspillaz. I hope we can make progress on this issue eventually.

description: updated
Daniel van Vugt (vanvugt) wrote :

Screenshot of what to enable for a workaround.

description: updated
Daniel van Vugt (vanvugt) wrote :

I think that fixing this bug will also resolve bug 201342.

description: updated
Launchpad Janitor (janitor) wrote :

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

Changed in compiz (Ubuntu):
status: New → Confirmed

A small breakthrough today: I discovered the issue is not compiz, it's just the unity plugin. The tearing stops when you disable the unity plugin. The same is true for performance bug 861061.

Both issues seem to be caused by an unreasonable amount of overhead that the unity plugin introduces into compiz. And both issues are new in Ubuntu 11.10, so it's a regression.

description: updated
affects: compiz (Ubuntu) → unity (Ubuntu)
summary: - Video tearing still occurs in compiz (less so) when "Sync To VBlank" is
- enabled.
+ Visible tearing occurs even when "Sync To VBlank" is enabled, but only
+ when Unity is active.
tags: added: regression-release
Changed in unity (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
Daniel van Vugt (vanvugt) wrote :

Actually, I've now discovered a second root cause, this time in the composite plugin. So unity and composite are both responsible for triggering this bug.

I believe I have a fix for composite that works even without having to fix Unity. Coming soon...

Changed in compiz (Ubuntu):
assignee: nobody → Daniel van Vugt (vanvugt)
status: New → In Progress
Omer Akram (om26er) on 2011-11-17
Changed in compiz (Ubuntu):
importance: Undecided → Medium
Changed in unity (Ubuntu):
importance: Undecided → Medium
Changed in compiz-core:
assignee: nobody → Daniel van Vugt (vanvugt)
importance: Undecided → Medium
status: New → In Progress
Changed in unity (Ubuntu):
status: Confirmed → In Progress
Changed in unity:
status: New → In Progress
assignee: nobody → Daniel van Vugt (vanvugt)
Daniel van Vugt (vanvugt) wrote :

I have now proposed fixes in both unity and compiz. Either one works fairly well, but you will get the best performance and the least tearing when both fixes are applied.

summary: - Visible tearing occurs even when "Sync To VBlank" is enabled, but only
- when Unity is active.
+ [regression] Visible tearing occurs even when "Sync To VBlank" is
+ enabled, but only when Unity is active.
description: updated

Further testing shows that the proposed compiz fix contributes more toward reducing tearing than the related unity fix (fix-861061-trunk). But again, both fixes are incredibly useful.

description: updated
description: updated
summary: - [regression] Visible tearing occurs even when "Sync To VBlank" is
- enabled, but only when Unity is active.
+ [regression] Visible tearing is worse in 11.10 than 11.04, even when
+ "Sync To VBlank" is enabled, but only when Unity is active.
description: updated

What means are you using to determine "video tearing"? Seems a bit of a stretch to lay the cause of h. tearing solely on the unityshell plugin, certainly in the case of nvidia

Daniel van Vugt (vanvugt) wrote :

With respect to this bug, it is the tearing seen when dragging windows around when running Unity.

This bug is mainly about the fact that it got noticeably worse in 11.10 compared to 11.04. The precise reason why it got worse is detailed here:
https://code.launchpad.net/~vanvugt/unity/fix-861061-trunk/+merge/82861

So the trigger was a significant increase in latency inside unity's plugin painting code. The problem has been addressed two-fold:

1. In Unity, resolving the latency regression introduced in Ubuntu 11.10; and
2. In Compiz, improving frame timing so that it is more resistant to latency regressions in plugins.

I know there are many possible causes of tearing, and I'm not claiming to fix all of them. But these two fixes are a good start.

Doug McMahon (mc3man) wrote :

Will be interested to see the results, as far as tearing in video scenes prone to it &or tearing tests 11.10 is the 1st release I've never been able to totally remove, though it extends to all sessions.

Interesting about the 'latency regression', there is something i've seen on a nvidia laptop that's quite obvious in 11.10/unity, though I gather it doesn't bother many others (or doesn't happen

It's caused by what seems to be a slight delay in Powermizer's 'adaptive performance' mode clocking up when needed. Never saw before 11.10. Most obvious here when trying to move a window when the performance mode is at 0 (lowest
Windows 'stick' for a second till the adapter is upclocked

Have no idea if related, time will tell I guess..

Described here Bug 843383

Omer Akram (om26er) on 2011-11-27
Changed in unity:
importance: Undecided → High
Changed in unity (Ubuntu):
importance: Medium → High
Changed in compiz (Ubuntu):
importance: Medium → High
Daniel van Vugt (vanvugt) wrote :

When I was testing with the nvidia driver I did spend some time watching Powermizer to see if it was able to idle more often, but couldn't see an obvious improvement. Powermizer successfully clocked down to low power mode in all cases when /fairly/ idle, with or without the fix. No I haven't noticed the lag when the Powermizer raises the clock again. But I did only test nvidia for about an hour...

Changed in compiz-core:
importance: Medium → High
Changed in compiz-core:
milestone: none → 0.9.6
Daniel van Vugt (vanvugt) wrote :

Experimental fixes for this and related performance bugs are now available
for testing in ppa:vanvugt/compiz and ppa:vanvugt/unity. For the best
results I recommend trying both together. But testing them individually is
useful too.

IMPORTANT NOTES:

  * The fixes in ppa:vanvugt/compiz REQUIRE that "Sync To VBlank" is ENABLED
    in CompizConfig Settings Manager (OpenGL section).
    This is the default setting when Ubuntu 11.10 is installed.

  * When using ppa:vanvugt/compiz you should DISABLE the workaround
    "Force full screen redraws (buffer swap) on repaint" in
    CompizConfig Settings Manager (Workarounds section).
    This is the default setting when Ubuntu 11.10 is installed.

  * I don't claim to have fixed all tearing. I only claim that the amount of
    tearing in oneiric with the fix is no longer worse than in natty.

  * nouveau: If you are using the "nouveau" driver for NVIDIA chips you will
    need to enable sync-to-vblank support in the driver options because
    nouveau has it disabled by default. You can do this by editing
    /etc/X11/xorg.conf and adding:
       Section "Device"
           Identifier "My Graphics"
           Option "GLXVBlank" "on"
       EndSection
    Then log out and in again for it to take effect.

  * fglrx (Catalyst): The fglrx driver also disables sync-to-vBlank support
    by default. To fix this:
      1. Open Catalyst Control Center.
      2. Go to 3D > More Settings.
      3. Set "Wait for vertical refresh" to
         "On, unless application specifies".

  * Please don't try using the Benchmark plugin in compiz-plugins-extra
    because it is broken and misleading (bug 898548).

Please leave feedback in the relevant bug reports.

- Daniel

---

ppa:vanvugt/compiz | https://launchpad.net/~vanvugt/+archive/compiz
compiz (1:0.9.6+bzr20110929-0ubuntu6vv2) oneiric

  * Added proposed fix for inaccurate frame timing causing tearing and
    stuttering.
    (LP: #880707) (LP: #888039) (LP: #92599) (LP: #798868) (LP: #876575)

ppa:vanvugt/unity | https://launchpad.net/~vanvugt/+archive/unity
unity (4.24.0-0ubuntu2b1vv4) oneiric; urgency=low

  * Fix major performance regressions due to unnecessary UnityFBO binding
    (LP: #861061) (LP: #880707)
    UnityFBO was being bound even when not required. This caused major lag in
    glPaintOutput, which slowed down all rendering. This was seen in reduced
    framerates in apps (LP: #861061) and significantly worse screen tearing
    with Unity 4.x compared to 3.x (LP: #880707).

Daniel van Vugt (vanvugt) wrote :

I don't expect the compiz portion of this fix will be seen in an Ubuntu release until 12.04. No need for me to have it in progress. Still keeping the upstream portion in my name.

Changed in compiz (Ubuntu):
assignee: Daniel van Vugt (vanvugt) → nobody
status: In Progress → Confirmed
Changed in compiz (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Daniel van Vugt (vanvugt)
Matt Pharoah (mr-exuberant) wrote :

After a lot of fiddling, I finally found something that works for me:

Turn vysnc on in both NVIDIA and Compiz.
Do NOT turn on "undirect fullscreen windows". Leave that workaround UNCHECKED or you'll have tearing in fullscreen.

Then do either of the following
A) Turn "allow flipping" OFF in Nvidia settings, and set Compiz refresh rate to your monitor's refresh rate (probably 60 Hz)
OR
B) turn "allow flipping" ON, but set Compiz's refresh rate to double your monitors' (probably 120 Hz)

I would think option A would be better since I think option B is just wasting processing power rendering things that won't actually be drawn.

Leuke (leuke) wrote :

Thank you very much Daniel for your unity and compiz patches.

For me the situation is a little complicated, using a Nvidia ION platform I get:
 - heavy tearing using Unity and Unity-2d, kwin, Windows 7 with aero disabled
 - minor tearing using Gnome-shell (upper part of the screen).
 - zero tearing using Windows 7 aero enabled and any ubuntu desktop environment disabling composite. Zero tearing setting "Force fullscreen redraws on repaint" on Compiz as well, but in this case I get an inacceptable framerate drop.

In my case your patches reduced tearing and improved smoothness in Unity to the level I get in Gnome-shell.

tags: added: performance
Tomek Bury (tomek-bury) wrote :

Hi Daniel,

Thanks for pointing me to this bug and your patches. I can confirm that after installing them there's just occasional video tearing in Unity - similar to Gnome 2 and Gnome Shell.

Daniel van Vugt (vanvugt) wrote :

If you would like to eliminate the possibility of tearing then the best solution might be in CCSM:

Workarounds > "Force full screen redraw (buffer swap) on repaint" = ON
OpenGL > "Sync To VBlank" = OFF

(still using ppa:vanvugt/compiz ideally)

In my experience this config looks the nicest. But it's not enabled by default because it theoretically uses more CPU.

Tomek Bury (tomek-bury) wrote :

Hi Daniel,

This are my results:

1. OpenGL > "Sync To VBlank" = ON
Workarounds > "Force full screen redraw (buffer swap) on repaint" = ON
No tearing at all, but with this settings video playback is quite jittery and widow movement looks worst. It's very slow and windows lag behind mouse.

2. OpenGL > "Sync To VBlank" = OFF
Workarounds > "Force full screen redraw (buffer swap) on repaint" = ON
Heavy tearing in video playback, but widow movement is tear-free and faster than in previous setting (both ON)

3. OpenGL > "Sync To VBlank" = ON
Workarounds > "Force full screen redraw (buffer swap) on repaint" = OFF
Video playback is tears occasionally, window movement is similar to the previous setting

4. OpenGL > "Sync To VBlank" = OFF
Workarounds > "Force full screen redraw (buffer swap) on repaint" = OFF
Heavy tearing in video playback, window movement very fast but with tearing.

For me option 3 is least wrong of all.

Daniel van Vugt (vanvugt) wrote :

Tomek, that's good news. Your preferred configuration is the default configuration for compiz in Ubuntu.

Daniel van Vugt (vanvugt) wrote :

The theoretically perfect solution, for optimal performance and zero tearing, is proposed in bug 901097. However it's presently buggy and requires more work, possibly a lot more work.

Leuke (leuke) wrote :

In Gnome Shell adding this line to /etc/environment:
    CLUTTER_PAINT=disable-clipped-redraws:disable-culling
totally solves both tearing and performance issues in the same time on my configuration, Nvidia ION.
Though I don't know what exactly this line does, I hope this information can be useful for compiz development too.

Hamit Naiboglu (selo) wrote :

@ leuke

That really worked for me too, on my nvidia cart. This also could be a solution to bug #764330

Daniel van Vugt (vanvugt) wrote :

This bug is specifically about Compiz and Unity. Tearing in Gnome Shell should be discussed in a different bug.

Also, bug 764330 looks similar to some of the issues fixed by the fix to this bug, however it is actually very separate. Bug 764330 is about the compiz Move plugin only. A fix for that is available for testing in ppa:vanvugt/compiz too.

summary: - [regression] Visible tearing is worse in 11.10 than 11.04, even when
- "Sync To VBlank" is enabled, but only when Unity is active.
+ [regression] Compiz: Visible tearing is worse in 11.10 than 11.04, even
+ when "Sync To VBlank" is enabled, but only when Unity is active.
Leuke (leuke) wrote :

Of course. My intentions were not to discuss about a bug in Gnome Shell, but it's compositor and compiz had similar problems. Now a solution has been found for Gnome Shell's compositor and since it is open source I hope this helps for compiz too.

Daniel van Vugt (vanvugt) wrote :

No problem. Thanks for the info because I know it will help many people.

The Gnome workaround CLUTTER_PAINT=disable-clipped-redraws:disable-culling
sounds very similar to what the Compiz workaround in ccsm does:
Workarounds > "Force full screen redraw (buffer swap) on repaint" = ON

Daniel van Vugt (vanvugt) wrote :

The fix for the unity portion of this bug (the fix for bug 861061) is now committed to lp:unity r1816.

Changed in unity:
status: In Progress → Fix Committed
Daniel van Vugt (vanvugt) wrote :

I've deciphered some of the branching chaos and found the (unity) fix has slipped into lp:unity/4.0 already (r1726). Now I have created the missing branch links, it's more obvious.

Sam, please be careful. You obviously lost track of which bug fixes your merge proposals contained. But it's excellent to see the fixes for bug 861061 and bug 880707 actually being released.

This bug is now fix-released in unity 4.28.0 "SRU2". Could someone please fix the "unity" Milestone column to show this?

Changed in unity:
status: Fix Committed → Fix Released
Didier Roche (didrocks) on 2012-01-09
Changed in unity:
milestone: none → 5.0.0
status: Fix Released → Fix Committed
Daniel van Vugt (vanvugt) wrote :

Didier, I know the unity fix is not released for Unity 5.x yet, but it is definitely already Fix Released in Unity 4.28.0. Is there a more elegant way to represent this? The same goes for bug 861061.

Daniel van Vugt (vanvugt) wrote :

I now see the correct status should be like that of bug 887465.

Could someone please mark this bug as Fix Committed in unity 5.0.0, and Fix Released in 4.28.0 "SRU2"?

Didier Roche (didrocks) on 2012-01-12
Changed in unity:
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :
Download full text (6.0 KiB)

This bug was fixed in the package unity - 5.0.0-0ubuntu1

---------------
unity (5.0.0-0ubuntu1) precise; urgency=low

  [ Didier Roche ]
  * New upstream release.
    - compiz crashed with SIGSEGV in __dynamic_cast() (LP: #853038)
    - unity-panel-service crashed with SIGSEGV in panel_service_show_entry()
      (LP: #861144)
    - unity-panel-service crashed with SIGSEGV in
      panel_indicator_entry_accessible_get_n_children() (LP: #869816)
    - Launcher - Launcher icon for Dash does not highlight when the Alt+F1 key
      shortcut is pressed (LP: #849561)
    - compiz crashed with SIGSEGV in unity::PanelTray::FilterTrayCallback()
      (LP: #868868)
    - [regression] Compiz: Visible tearing is worse in 11.10 than 11.04, even
      when "Sync To VBlank" is enabled, but only when Unity is active.
      (LP: #880707)
    - [regression] All apps have a lower frame rate under Unity. (LP: #861061)
    - compiz crashed with SIGSEGV in
      nux::Property<nux::color::Color>::operator=() from
      unity::switcher::SwitcherController::OnBackgroundUpdate() (LP: #887465)
    - DashSearchBarSpinner.cpp:56: Conditional jump or move depends on
      uninitialised value(s) (LP: #901610)
    - quicklist shows in incorrect position when launched from workspace
      switcher (LP: #914251)
    - Build "show me the desktop" mini-app that adds a show desktop button to
      Launcher (LP: #681348)
    - Select quicklist items with just one right click (LP: #688830)
    - cannot change volume by scrolling on the icon when the SoundMenu is
      opened (LP: #722082)
    - [a11y] Unity launcher buttons are not Actionable (LP: #772573)
    - Ubuntu Start launcher item doesn't start dash with keyboard navigation
      (LP: #825037)
    - multimonitor , window management - Multi-Monitor Maximized Difficulty
      (LP: #843958)
    - [regression] Drag and drop inside dash is very slow with Active Blur
      activated (LP: #851172)
    - Activating an alt-tab icon that holds initially unminimized windows
      should unminimize all windows (LP: #854595)
    - Dash - The Dash category headers are positioned incorrectly
      (LP: #839467)
    - Missing global menu with a semi-maximized window dragged to the right.
      (LP: #861279)
    - Launcher - Dragging and dropping a running application in to the Trash
      should quit the application and (if the app is pinned to the Launcher)
      un-pin the application from the Launcher (LP: #870143)
    - top bar, integrated menu - when a application is first launched, the
      integrated menu should be displayed for 2 seconds before fading out of
      view (LP: #874254)
    - Window control buttons are not shown when an indicator is opened and the
      pointer is over the top-left corner (LP: #890970)
    - Quicklist item using some special chars doesn't show at all
      (LP: #899677)
    - PanelView.cpp:370: Conditional jump or move depends on uninitialised
      value(s) (LP: #901602)
    - unityshell.cpp:1982,1984: Conditional jump or move depends on
      uninitialised value(s) (LP: #901603)
    - Dash Search spinner sometimes doesn't spin at all (LP: #903090)
    - Point of tooltip is misaligned to focused ap...

Read more...

Changed in unity (Ubuntu):
status: In Progress → Fix Released
Daniel van Vugt (vanvugt) wrote :

Fix Released in oneiric: unity (4.28.0-0ubuntu1) oneiric-proposed; urgency=low

But as mentioned earlier, it was accidentally omitted from the changelog. As was bug 861061.

Changed in compiz-core:
status: In Progress → Fix Committed
Daniel van Vugt (vanvugt) wrote :

Fix released in:
compiz (1:0.9.7.0~bzr2995-0ubuntu1) precise; urgency=low

Changed in compiz (Ubuntu):
status: In Progress → Fix Released
Changed in compiz-core:
status: Fix Committed → Fix Released
Britt Yazel (bwyazel) wrote :

I have tried the workaround above by enabling "force full screen redraw", but it did not solve the problem at all. My computer still have pretty terrible screen tear while using the open sourced radeon drivers on a mobility radeon HD 4200

Changed in ubutter:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers