Ubuntu users have reported (e.g. in this forum post) that the issue can be resolved by running Compiz as your window manager with its Sync to VBlank setting enabled. I tested this on Ubuntu and Gentoo and the results were markedly better in Ubuntu. The reason appears to be that Ubuntu is running the latest release of Compiz (0.9.10.2) whereas the version available through portage is 0.8.8 (described as "the latest stable release" on compiz.org). There are more display setting options in the later version and, possibly because of this, it works better with Flash videos.
It's important to note that the procedure described here shouldn't be followed if it's critical you don't break your system. I use my Gentoo installation as a sandbox as well as a working tool, a way of keeping up to date with, and learning new, Linux skills. Hence it's not critical if something breaks. This being said, I have ended up with a useful and fully-functioning Compiz desktop under Gentoo.
To install the latest release of compiz you have to remove all Compiz components if they have been installed through Portage. In my case:
* dev-python/compizconfig-python
* x11-libs/compiz-bcop
* x11-libs/compizconfig-backend-gconf
* x11-libs/compizconfig-backend-kconfig4
* x11-libs/libcompizconfig
* x11-plugins/compiz-plugins-extra
* x11-plugins/compiz-plugins-main
* x11-plugins/compiz-plugins-unsupported
* x11-wm/compiz
* x11-wm/compiz-fusion
* x11-apps/ccsm
* x11-apps/simple-ccsm
Note that simple-ccsm (simple Compiz Configuration Settings Manager) is not currently available for the latest version of Compiz.
Fortunately, all the sources for Compiz have now been merged into one repository, which makes configuration, compilation and installation much easier.
Obtaining the latest source code is straightforward as described here:
bzr branch lp:compiz
This creates a compiz directory in the location where you have entered this command. Now:
mkdir build
and
cd build
Next is the configuration stage. You need to run cmake with flags indicating the location of the installation and the options and plugins to install. Currently on Gentoo the 0.9.10.2 default compile configuration won't work because of a missing header file kdecorationbridge.h. I worked around this by disabling the KDE window decorator option:
-DUSE_KDE4=false
You also have to nominate a location for the installation which by default will otherwise be /usr/local. I installed in the standard location to avoid having to set additional library paths:
-DCMAKE_INSTALL_PREFIX=/usr
Hence in the build directory the full configuration command was:
cmake -DUSE_KDE4=false -DCMAKE_INSTALL_PREFIX=/usr ..
I found with the subsequent make install command the code compiled without a hitch on Gentoo.
A useful initial way of testing if the compiz command is running is:
compiz --version
which should give the output:
compiz 0.9.12.0
Next you need a working desktop running Compiz. I decided to make this as lightweight as possible by running Compiz alongside the excellent fbpanel (which can be emerged through Portage for this purpose). In the directory /etc/X11/Sessions on Gentoo I have a compiz file containing:
#!/bin/sh
xsetbg /home/my_name/.fluxbox/backgrounds/sid_fluxbox.jpg
setxkbmap gb
fbpanel &
exec /usr/bin/compiz ccp
This sets a background, the keyboard to British, runs the Fluxbox panel in the background and then calls compiz. Note that, contrary to the guidance in this Archlinux wiki the ccp switch is still necessary otherwise settings in ccsm appear to have no effect.
Next, to create a user-selectable desktop option in a graphical login manager (I use lightdm) I have the following compiz-session.desktop file in /usr/share/xsessions:
[Desktop Entry]
Encoding=UTF-8
Name=Compiz
Comment=dynamic window manager
Exec=/etc/X11/Sessions/compiz
TryExec=/usr/bin/compiz ccp
Icon=
Type=Application
I achieved good results in Adobe flash with the following configuration:
- the nouveau video driver (the proprietary Nvidia driver still caused screen tearing)
- the following options:
- In cssm General => OpenGL => Sync to VBlank
- In /etc/X11/xorg.conf:
- Option "GLXVBlank" "True" #as described here
This setup produced significantly better results in Flash videos (including the the test Youtube video) than the same videos run under a different window manager.
Tip: following recent development work on the nouveau driver, Nvidia cards can be re-clocked to some degree. Add nouveau.pstate=1 to your kernel line in Grub. In my case I then use the command:
cat /sys/class/drm/card0/device/pstate
which results in the output:
20: core 350 MHz shader 350 MHz memory 532 MHz
--: core 200 MHz shader 0 MHz memory 401 MHz *
To re-clock based on this output, in root:
echo 20 > /sys/class/drm/card0/device/pstate
resulting in:
20: core 350 MHz shader 350 MHz memory 532 MHz *
--: core 351 MHz shader 0 MHz memory 532 MHz