Tuesday, January 18, 2011

Compiz-Fusion in FreeBSD 8.1


Since giving up (temporarily) on FreeBSD 8.2 RC2, I've been configuring FreeBSD 8.1 on my Dell E520.
Most things went well but I had a lot of problems getting the 3D effect that Compiz allows. Strangely, I already had it working well before but never bothered to write down what I had done.
Therefore, this time I'm going to record everything.
First, the FreeBSD Handbook outlines in splendid details how to get compiz working and, by-and-large, this is what I followed.
The first step is to install the correct driver to make sure the graphics driver you have supports 3D. I have an nVidia GeForce 7300 LE and was able to get the driver from the nVidia site..
Installing the nVidia driver on FreeBSD is a lot easier than it is in Linux. Once you have downloaded the driver, just open a terminal and CD to the directory where the driver is stored. Then, as ROOT, issue the following command:

tar xzf NVIDIA-FreeBSD-x86-260.19.29.tar.gz && cd NVIDIA-FreeBSD-x86-260.19.29 && make install

Very quickly, you will get a message saying the driver has been installed and you need to modify the /etc/X11/xorg.conf file (simply by changing the line "driver=nv" to "driver=nvidia").
Now, by default, FreeBSD 8.1 has no /etc/X11/xorg.conf file. So you need to make one.
This is easily done by the following command:
#X -configure

This command produces this file /root/xorg.conf.new. You can test this to see if it works correctly by issuing the following command:
#X -config /root/xorg.conf.new

If it works properly, you will see your normal desktop. If not, the screen may stay black (as happened to me).
If it doesn't work, you need to start changing some of the parameters in the xorg.conf file.
However, once it does work, move it to the /etc/X11/ directory with the following commend:
#mv /root/xorg.conf.new /etc/X11/xorg.conf

Now that thew xorg.conf file seems to work, remember to change the driver line from nv to nvidia.
Just for completeness, here's the full /etc/X11/xorg.conf file that works perfectly for me:

Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
ModulePath "/usr/local/lib/xorg/modules"
FontPath "/usr/local/lib/X11/fonts/misc/"
FontPath "/usr/local/lib/X11/fonts/TTF/"
FontPath "/usr/local/lib/X11/fonts/OTF"
FontPath "/usr/local/lib/X11/fonts/Type1/"
FontPath "/usr/local/lib/X11/fonts/100dpi/"
FontPath "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
Load "extmod"
Load "record"
Load "dbe"
Load "glx"
Load "dri"
Load "dri2"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
Option "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Device"
Identifier "Card0"
Driver "nvidia"
VendorName "nVidia Corporation"
BoardName "G72 [GeForce 7300 LE]"
BusID "PCI:1:0:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 24
Option "AddARGBGLXVisuals" "True"
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1920x1080"
EndSubSection
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection


Next, open another terminal as root, cd to /usr/ports/x11-wm/compiz-fusion and issue a "make install clean" command.
Then, prepare a simple script with the following input
#! /bin/sh
compiz --replace --sm-disable --ignore-desktop-hints ccp &
emerald --replace &

Save it to your home directory as compiz-start (or whatever), make it executable, add the compiz-start script to System>>Preferences>>StartUp Applications and that's it.
Now reboot and enjoy.

No comments:

Post a Comment