Gentoo Wiki


Merge-arrows.gifIt has been suggested that this article be Merged into one article with AIGLX. Most information also applies to AIGLX. Nominate this page for deletion after having merged it because XGL is not under development anymore (see [1]).    (Discuss)

Eye Candy


Window Managers

X Configuration

Wikipedia has an article on:



Xgl is an X server that uses OpenGL for its drawing operations. Together with a compositing window manager such as Compiz or newer versions of Metacity, it allows for excellent quality 3D and 2D desktop effects. Xgl relies on an extension to Mesa, GLX_EXT_texture_from_pixmap, that is present only in Mesa >= 6.5.

Please note that the newest closed-source drivers from nVidia (version 1.0.9xxx) have XGL-like features onboard. There is no need to install anything else. If you don't want to use the newest drivers or you are using the legacy drivers, then you can follow this guide to gain GL desktop features. For information on using nVidia 9xxx drivers, please see HOWTO nVidia GL Desktop Effects.

Warning: This software isn't yet considered stable, but it works well in most situations. Use with caution anyway.

Hardware Prerequisites

See this page, if your graphics card is known to work.

Installing Xgl

Software Prerequisites

Modular X.Org and Subversion are required for an XGL installation.

Install X.Org 7.x:

Install Subversion: You will need to merge Subversion with webdav support, which means you can NOT have the nowebdav flag. Add a line to /etc/portage/package.use:

File: /etc/portage/package.use
dev-util/subversion -nowebdav
Window sorting feature
Window sorting feature
# emerge -nav subversion

Check Out A Portage Overlay

XGL is not currently in Portage because there are some dependency issues. For more information on these dependency issues. See bug #135329.

However, we can still install Xgl using a Portage overlay which contains ebuilds for Xgl.

For more information, see HOWTO Gentoo xeffects.

Unmasking Relevant Packages

Many packages are marked as unstable and need to be unmasked so that portage will install them. Add the following to both /etc/portage/package.keywords and /etc/portage/package.unmask

File: /etc/portage/package.keywords
# Dependencies

#XGL Package

Ensure the glitz and svg USE flags are enabled for Cairo. You will need to add the following line to package.use:

File: /etc/portage/package.use
x11-libs/cairo glitz svg X

Installing Xgl

Cube plugin without 'in' setting and moving a window across desktops
Cube plugin without 'in' setting and moving a window across desktops

The first thing we will do is emerge Cairo.

# emerge --ask --verbose cairo 

Rebuild pango and gtk+ against the newly built Cairo package.

# emerge --ask --verbose pango gtk+

Verify glproto and libdrm are installed. Install them if necessary:

# emerge --ask --verbose --noreplace glproto libdrm

Change to your overlay directory:

# cd /usr/local/portage

Use SVN to checkout the repository to the subdirectory "xeffects".

# svn co svn://

Add this path to your PORTDIR_OVERLAY:

File: /etc/make.conf
PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage/xeffects/trunk /usr/local/portage/xeffects/experimental"

Emerge Xgl and Mesa:

# emerge --ask --verbose --noreplace mesa
# emerge --ask --verbose xgl

Note: XGL is no longer in the portage tree. You will have to find an Overlay to get it.

Try the ARCON portage layer, to get Xgl and all the necessary stuff as Compiz Fusion

Then nVidia users should reinstall their driver package:

# emerge nvidia-drivers
Note: If xgl fails to compile fbmmx.c or fbedge.c, try removing the "-fforce-addr" flag from your CFLAGS. Have a look at

When everything is done, Cairo should be present on your system as dependency. Check it with equery, a program contained in gentoolkit:

# equery d -o -p cairo

You should now have a functional Xgl installation.

Updating Xgl

Compiz Alt+Tab replacement
Compiz Alt+Tab replacement

Layman Update

Updating the overlay files with Layman is easy:

# layman -s xeffects

Manual Update

Place the following script into the xeffects overlay directory:

File: /usr/local/portage/xeffects/
# svn update and print log changes
REV="$(svn info | grep Revision | awk '{ print $2 }')"
echo "Update from revision ${REV} ..."
svn update "$@"
NEWREV="$(svn info | grep Revision | awk '{ print $2 }')"
  [["${REV}" -ne "${NEWREV}"]]   && \
    svn log --verbose --revision "HEAD:$((${REV} + 1))"

Make it executable:

# chmod +x /usr/local/portage/xeffects/

Then change to the directory and execute it:

# cd /usr/local/portage/xeffects/
# ./

The Beryl SVN repository has recently changed it's web address, and as a result, old copies of SVN distfiles will block new compiles of -9999 ebuilds.

!!! subversion.eclass: ESVN_REPO_URI (or specified URI) and working copy's URL are not matched.


rm -rf /usr/portage/distfiles/svn-src/*

Running Xgl

Transparent Mplayer over desktop and programs - by neppakyo
Transparent Mplayer over desktop and programs - by neppakyo

Configure a Compositing Window Manager

You may choose Compiz or Beryl. Please see those pages for more information.

Note: Warning: both projects have been merged as compiz-fusion. For more information see Compiz Fusion and [2].

Windowed Mode

Running Xgl in this manner creates an X-Nest window containing the Xgl server. This is an excellent way to test out your installation before attempting to start it in fullscreen mode.

To try it out as another window on an already running X server:

Code: For ati users
Xgl :1 -ac -accel glx:pbuffer -accel xv:pbuffer -fp /usr/share/fonts/misc,/usr/share/fonts/other_fonts
Code: For nvidia users
Xgl :1 -ac -accel glx:pbuffer -accel xv -fp /usr/share/fonts/misc,/usr/share/fonts/other_fonts

Xgl will not read the configuration of FontPath in xorg.conf, thus it's better to append the font paths separated by comma with -fp option. You can also use this script to get all font paths automatically from xorg.conf:

 grep -i fontpath /etc/X11/xorg.conf | egrep -v "[:space:]*#" | sed "s/.\+\"\(.\+\)\"/\1,/g" | xargs echo | sed "s/\ //g" | sed "s/,\$//"

To test your configuration, start a compositing window manager, then an xterm. Follow directions for each individual window manager, while remembering to prepend the command with DISPLAY:1 to start on your windowed X session.

Then start your xterm:

# DISPLAY=:1 xterm &

If this was successful, we can now configure your system to start Xgl with your graphical login manager. You will need to follow the instructions for whichever graphical login system you use. This is the last step required in order to fully use Xgl.


If you usually boot to console and use startx to start Xorg server and .xinitrc to load your desktop manager at DISPLAY:0, you can alternatively create startxgl to start Xgl server and .xglinitrc to load the desktop manager at DISPLAY:1. This will not replace your current configuration, so you can return to the normal XOrg server at your convenience.

1) Copy startx (cp /usr/bin/startx /usr/local/bin/startxgl) and modify 2 lines:

File: /usr/local/bin/startxgl
 ## userclientrc=$HOME/.xinitrc

 ## xinit $clientargs -- $serverargs -deferglyphs 16 &
 # ATI
 xinit $clientargs -- /usr/bin/Xgl :1 $serverargs -ac -accel xv -accel glx:pbuffer -deferglyphs 16 &
 xinit $clientargs -- /usr/bin/Xgl :1 $serverargs -ac -accel xv -accel glx:fbo -deferglyphs 16 &

2) create ~/.xglinitrc (vi ~/.xglinitrc)

File: ~/.xglinitrc
 sleep 2 # give Xgl some extra time to start
 # setxkbmap fi # Use if keyboard does not work properly
 ##------KDE USERS------
 #DISPLAY=:1 KDEWM=compiz-decorator exec startkde
 DISPLAY=:1 KDEWM=beryl-manager exec startkde
 ##------GNOME USERS------
 #DISPLAY=:1 WINDOW_MANAGER=compiz-decorator exec gnome-session
 #DISPLAY=:1 WINDOW_MANAGER=beryl-manager exec gnome-session

If you experience dbus problems, e.g. while using banshee, simply add dbus-launch to the DISPLAY line

File: ~/.xglinitrc
 DISPLAY=:1 WINDOW_MANAGER=beryl-manager exec dbus-launch gnome-session

3) To start your desktop manager with XOrg use startx, to start it with Xgl use startxgl.


Simply replace the reference to the standard X server with the Xgl server:

File: /etc/X11/xdm/Xservers
:0 local /usr/bin/Xgl vt7

KDM (for KDE users)

KDM can start Xgl by default with a couple configuration file changes.

The ServerCmd entry controls how the X server is called. We'll change this to reflect the Xgl server:

File: /usr/kde/<your version>/share/config/kdm/kdmrc
# NVidia Command
ServerCmd=/usr/bin/Xgl -br -ac -accel glx:pbuffer -accel xv
# ATI Command
ServerCmd=/usr/bin/Xgl -br -ac -accel glx:pbuffer -accel xv:pbuffer

You will also have to change the ServerTimeout setting in the same section since Xgl might take a little longer to start up than normal X:

File: /usr/kde/<your version>/share/config/kdm/kdmrc

GDM (for GNOME users)

You must do three things to have Xgl work with GDM and have Compiz load automatically when you log in.

  1. Configure GDM to wait long enough for Xgl to start before assuming it is defunct.
  2. Configure GDM to use the Xgl server.
  3. Setup your GNOME-session to automatically load your compositing window manager.

Configuring GDM to Wait Longer for Xgl to Start

GDM is configured, by default, to kill an Xserver that has taken longer than 10 seconds to start up. Unfortunately, newer versions of Xgl can take longer than this. Due to the work of Gentoo Xgl users, Gdm (as of version 2.14.1) can now be configured to wait longer than 10 seconds.

# emerge --ask --verbose >=gdm-2.14.1

Add/modify the following commands to the section of /usr/share/gdm/defaults.conf. The line:

File: /usr/share/gdm/defaults.conf

Configuring GDM to Use the Xgl Server

Using gdmsetup
  • First, back up your gdm.conf file *AND* custom.conf
# cp /usr/share/gdm/defaults.conf /usr/share/gdm/defaults.conf.bak
# cp /etc/X11/gdm/custom.conf /etc/X11/gdm/custom.conf.bak
  • Run gdmsetup
  • Select the Security tab
  • Click the Configure X Server button found at the bottom right of the tab

First we delete the entry for the standard X server

  • Click on the standard server that appears in the Servers to Start list
  • Click the Remove Button

Now we create a new entry for the Xgl server

  • Click the Add/Modify button
  • Set the new server to use VT 1. Use Standard for the Server option — this indicates which profile to use for the server, ideally we could create a new "Xgl" profile here but at the present time we cannot create a new profile using gdmsetup, so we'll just modify the settings for the Standard profile. Don't enter any options here. Click Ok when done.
  • Under Server Settings change the Server Name to "Xgl"
  • Enter your Xgl command in the Command box, for example, ATI users would type:
/usr/bin/Xgl :1 -ac -accel glx:pbuffer -accel xv:pbuffer
Note: If the above fails with an error about "vt8" try this: use VT 0 instead of VT 1 above, and for the Xgl command also replace the 1 with 0 .
  • NVIDIA users should use:
/usr/bin/Xgl -br -ac -accel glx:pbuffer -accel xv
  • Change the Launch dropdown to Greeter
  • Check the Logins are handled by this computer box
  • Check the Flexible (on demand) box
  • Save and Close
  • Restart GDM
  • First, back up your gdm.conf file *AND* custom.conf
# cp /usr/share/gdm/defaults.conf /usr/share/gdm/defaults.conf.bak
# cp /etc/X11/gdm/custom.conf /etc/X11/gdm/custom.conf.bak
  • Now open /usr/share/gdm/defaults.conf in a text editor and search for the section. This should be near the end of the file.
  • Comment out 0=Standard and add a new line that reads 0=inactive and one that reads 1=Xgl.
  • Add the server information for the Xgl server, remember to substitute the correct Xgl server command! The one below is for ATI cards.

The modified /usr/share/gdm/defaults.conf:

File: /usr/share/gdm/defaults.conf

# Definition of the Xgl X server.
command=/usr/bin/Xgl -br -ac -accel glx:pbuffer -accel xv:pbuffer
  • Restart GDM

Alternative Run Methods

You can find more possible methods of running Xgl incomplete, here: XGL/Alternative Run Methods. Those methods are not included in this article because they are either incorrect, uncommon, or outdated.

More Information

XGL/Tips and Tricks

Last modified: Sun, 28 Sep 2008 05:23:00 +0000 Hits: 10,473