XGL-Ubuntu

From cchtml.com

Xgl/Compiz on Ubuntu Dapper - the Kombatant Way

So here we are, rewriting the whole guide, just because I found out a more bullet-proof way to do it. Before we start, I want to make clear that these instructions are targeted for those people using the ATI Proprietary Driver ("fglrx") and having WORKING 3D ACCELERATION. This is configured in your xorg.conf. To make sure you are "accelerated", running with the new driver, try typing fglrxinfo in a terminal and see what you get. If it talks about ATI then awesome... if it talks about Mesa, you still don't have your driver setup properly (xorg.conf). Your xorg.conf file doesn't need any special parametres - what I did was simply generate the default xorg.conf file with the command:

   sudo dpkg-reconfigure xserver-xorg

and replace the "ati" instance with "fglrx". Nothing more.

  • If you want the absolute newest stuff, then you're going to have to add some lines to your repositories. So open the /etc/apt/sources.list file as root, and add these lines in order to add the two repositories that are of interest here.
   #compiz Quinn's
   deb http://www.beerorkid.com/compiz dapper main
   deb http://xgl.compiz.info/ dapper main
   deb-src http://xgl.compiz.info/ dapper main
  • After you add the repos in the sources.list file, issue the following commands:
   wget http://www.beerorkid.com/compiz/quinn.key.asc -O - | sudo apt-key add -
   sudo apt-get update
   sudo apt-get install compiz xserver-xgl libgl1-mesa xserver-xorg libglitz-glx1 compiz-gnome
  • If during the apt-get installation you get the error "trying to overwrite `/usr/share/man/man1/Xserver.1x.gz', which is also in package xserver-xorg-core" issue the following two commands to continue:
   sudo dpkg-divert --package xserver-xorg-core --divert /usr/share/man/man1/Xserver.1x.gz.xgl --rename /usr/share/man/man1/Xserver.1x.gz
   sudo apt-get -f install
  • Instead of messing with gdm.conf and gdm.conf-custom, we're going to do something better. From the terminal, issue the command:
   sudo gedit /usr/bin/startxgl.sh

and add these as contents:

   Xgl -fullscreen :1 -ac -accel glx:pbuffer -accel xv:pbuffer & sleep 2 && DISPLAY=:1
   exec gnome-session

Save it, and then issue the command:

   sudo chmod 755 /usr/bin/startxgl.sh
  • From the terminal again:
   sudo gedit /usr/share/xsessions/xgl.desktop

and add this as its contents:

   [Desktop Entry]
   Encoding=UTF-8
   Name=XGl
   Exec=/usr/bin/startxgl.sh
   Icon=
   Type=Application
  • And again, from the terminal:
   sudo gedit /usr/bin/startcompiz

and inside it add the following:

   killall gnome-window-decorator
   wait
   gnome-window-decorator & DISPLAY=:1 LD_PRELOAD=/opt/mesa/libGL.so.1.2 compiz --replace gconf

and then from the command line

   sudo chmod 755 /usr/bin/startcompiz

I can already see some of you complaining: "Hey, there is no such thing as /opt/mesa/libGL thing!! Please carry on reading and everything will be cleared

  • So here's the trick. What we've done is to add a new session in gdm. This means that, when gdm loads, you can select the "Xgl" session instead of the normal session you usually use, and it'll load Xgl. It would be a good idea to either load /usr/bin/startcompiz from your System > Preferences > Sessions, in order for it to load automatically, or just add a link to your desktop and double-click it to work. That way, if something goes horribly wrong, you can simply reboot, and when gdm loads , you will be able to select your normal (and working) session again without editing files all the time.
  • And here comes the big part: the mesa libraries. I see many people having the well-known "compiz.real: GLX_EXT_texture from pixmap is missing" error, and they can't seem to find out why this happens. Well, the reason as simple and as complicated the message suggests: this certain extension is NOT supported by ATI's driver (nVidia doesn't support it either, so no need to go OMGATILOOSE etc ). So, in order to run compiz, you're going to have to resort to standard mesa libraries. But, I hear you ask, where should I find these? The answer is simple: package libgl1-mesa has them. Now read carefully: when you install this particular package via apt-get, it'll place a libGL.so.1.2 inside your /usr/lib, and a symlink file called libGL.so.1 which points to the libGL.so.1.2 file. Now, if you install the ATI drivers by using the installer, these files will be replaced by symlinks to ATI's libGL.so.1.2 which resides inside /usr/lib/fglrx. So what do you do? After installing libgl-mesa and before installing ATI's drivers, create a directory called /opt/mesa and copy the file there, like this:
   sudo mkdir /opt/mesa
   sudo cp /usr/lib/libGL.so.1.2 /opt/mesa/libGL.so.1.2

Now install ATI's drivers; it will replace the files inside /usr/lib, but you'll already have the libGL file you are interested in saved in the location we created.

  • If you have already installed ATI's drivers, and then installed libgl1-mesa, ATI's symlinks will be lost. So proceed to create /opt/mesa and copy the file there as normal; then create the two symlinks by hand, like this:
   sudo rm /usr/lib/libGL.so.1
   sudo rm /usr/lib/libGL.so.1.2
   sudo ln -sf /usr/lib/fglrx/libGL.so.1.2 /usr/lib/libGL.so.1
   sudo ln -sf /usr/lib/fglrx/libGL.so.1.2 /usr/lib/libGL.so.1.2
  • After all that, we are ready. Reboot your machine and when gdm loads, look at the sessions; if you see an "Xgl" session there, everything's going according to plan. Load it up, and hopefully everything will be working On my occassion, the login screen is a little slow, so don't panic if you see something like that. Everything should be quick once compiz is loaded. You'll also notice that the window decoration has changed; again, this is normal, for now, this is the only window decoration available. I am certain proper support for the Metacity window decorations will be added soon. When you login, you should have a "apps/compiz" section in gconf-editor. If you don't, don't worry about it; I don't either, and the effects work like a charm.
  • To get around the problem with <Shift> and <Backspace> enter this in your terminal whenever you login:
   xmodmap /usr/share/xmodmap/xmodmap.<language>

where <language> refers to your country's code. For the US, it would be:

   xmodmap /usr/share/xmodmap/xmodmap.us

Or, of course, append it to the .gnomerc file.

Once everything is running along happily, this is a good appendix for the commands for using the nifty stuff compiz gives you: http://en.opensuse.org/Compiz

Hopefully somebody will find all these useful - I will also update this with more suggested information and tips, to cover more potential problems/configurations. Any additional suggestions will be more than welcome.


<<< The stuff about the mesa libs is not required. Please check this link for an easier method, which WORKS: http://www.ubuntuforums.org/showthread.php?t=168618

Main differences:

  • startcompiz:
   killall gnome-window-decorator 
   wait
   gnome-window-decorator & DISPLAY=:1
   compiz --replace gconf
   #fixes the shift-backspace bug
   xmodmap /usr/share/xmodmap/xmodmap.us

(us should be your countrycode)

   sudo apt-get install gset-compiz

(nice interface for plugins!!!)

  • xorg.conf:
   Section "Device"
   	Identifier	"ATI Technologies, Inc. M24 1P [Radeon Mobility X600]"
      	Driver		"fglrx"
   	BusID		"PCI:1:0:0"
   	Option		"UseFBDev"		"true"
   	Option "OpenGLOverlay" "off" #this isn't necessary for me
   	Option "UseInternalAGPGART" "no"
   	Option "KernelModuleParm" "agplock=0"
   EndSection

(the three last lines in the device section must be added or there is always hardware lockup after about 30 seconds)

  • Create a desktop script for easy startup of compiz after logging in:
   sudo gedit ~/Compiz
   #!/bin/bash
   gnome-window-decorator &
   compiz --replace $1 gconf &
   xmodmap /usr/share/xmodmap/xmodmap.be

(be should be your country code)

   sudo chmod +x ~/Desktop/Compiz

Now, after choosing Xgl Session from gdm, and being logged in, just double-click the compiz icon and a new world opens!!! (click on http://en.opensuse.org/Compiz for a good manual by the makers of Compiz/Xgl)