Novell Home

Xgl on SUSE 10.1 for Gnome and KDE with NVidia Graphics Cards

Novell Cool Solutions: Feature
By Scott M. Morris

Digg This - Slashdot This

Posted: 20 Apr 2006
 

ATTENTION: I had to take this article down because it is known to break some systems. Although it was tested with SUSE Linux 10.1 RC3, other systems have not been tested. I want to make this article available for those who find it useful. However, if you know of a platform that is not compatible with this article (i.e., using this article breaks the system), please let me know. I will include here a list of platforms with known incompatibility issues.

Applies to:

  • SUSE Linux 10.1
  • Gnome and/or KDE
  • NVidia Graphics Acceleration

Perhaps the most interesting eye-candy introduced to a mainstream Linux distribution is that of the Xgl 3D desktop environment. Naturally, when seen, it fosters the thought, "How can I do that on my own desktop?" I'll be honest with you, it's not quite as point-and-click as some of the other desktop niceties that we've discussed in the past, such as gdesklets or the gkrellm monitors. That in mind, if you're interested in getting Xgl installed and running on your desktop, you've found the right place. We'll take it a bit at a time and make sure we get you set up. First of all, I need to make sure that you are using this tutorial for a machine running either SUSE Linux 10.1 or SUSE Linux Enterprise Desktop 10, and that you have an NVidia video card. With that, let's get going.

Installing the NVidia Kernel Module

Rather than allowing yourself to become anxious because we're going to be messing with the kernel, just kind of take a deep breath and realize that every step I outline here will be very simple. Just read the given instruction and follow it the best that you can. We'll get it working: don't worry, be happy.

The next thing you need to do is install the make, gcc, and kernel-source packages are installed on your system.

Alrighty then. To do this, pop open YAST and type in your root password. Select SOFTWARE from the options on the left. Click SOFTWARE MANAGEMENT on the right side:

The famous YAST installation window appears. In the SEARCH box, type in make and click the SEARCH button. Your results appear at the right. Make sure the checkbox next to the make package is checked:

Back in the SEARCH box do a search for gcc. Make sure the checkbox next to the gcc package is checked:

Head back to the SEARCH box one more time and do a search for kernel-source. Check the box next to the kernel-source package:

Next, click the ACCEPT button in the lower-right corner of that window.

YAST will prompt you for the CDs it needs to install these packages, which you gladly provide.

When finished, YAST will save all the configurations and ask if you want to install or remove more packages. Click NO. With that, the window closes.

Now, we need to go get the NVidia drivers from the NVidia website. Head on over to http://www.nvidia.com/content/drivers/drivers.asp. To get the proper drivers for my card, I clicked on GRAPHICS DRIVER in the first column, GEFORCE AND TNT2 in the second column, and Linux IA32 in the 3rd column. You'll have to decide which options to select based on the card that you have. If you don't know, the options that I have selected seem to be what most people are using, so you can try doing what I did, here.

When you've made your selections, click GO. A new page appears. In the middle of the page, it says STEP 2, and has a link to download a driver. At the time of writing this tutorial, this driver is NVIDIA-Linux-x86-1.0-8756-pkg1.run. Download that file to your desktop or your home directory. Remember where you download it, you'll need to easily get to it later.

At this point, you may want to print this tutorial, because we need to log out of your X session (i.e., log out of Gnome, KDE, or whatever).

After you've logged out, you'll need to switch to one of the virtual terminals. You can easily do this by pressing CTRL + ALT + F1 all at the same time.

You'll then see a textual screen appear asking you to log in. You will just type in 'root' and press ENTER. Then, you'll type in your root password and press ENTER.

You should now be at command line:

linux-lab login: root
Password:
Have a lot of fun...
linux-lab:~ $ 

At this prompt, we'll shut down the whole X server with this short command:

linux-lab:~ $ init 3

After you hit ENTER, you'll see a bunch of output as the screen scrolls up.

After a few seconds, you will see a line very similar to the following, after which there will be no more output:

Master Resource Control: runlevel 3 has been
reached

When you see that line, just hit ENTER to get back your prompt:

Master Resource Control: runlevel 3 has been
reached
linux-lab:~ $ 

Next, we need to change directories to where we downloaded the NVidia drivers. Keep in mind that you are now root, so you cannot just do a simple "cd ~" and expect to get to your user's home directory. You have to specify the absolute location where the driver file is located:

linux-lab:~ # cd /home/scott
linux-lab:/home/scott #

Now, go ahead and install the driver. We'll do this with another simple command:

linux-lab:~ $  sh NVIDIA-Linux-x86-1.0-8756-pkg1.run -q

A screen will appear that looks something like this:

Notice that DO NOT ACCEPT is highlighted. Press the left arrow to highlight ACCEPT, and then press ENTER.

You'll see another screen appear that looks like this:

When you see this, you don't even need to read it. Just press ENTER.

After a few moments, the NVidia driver program then begins installing the drivers for your system:

Another few moments, and it announces success:

Just hit the ENTER key and you're dumped back to the command line from whence you came.

Last thing we need to do here: use sax2 to set up the X config file so that X is aware of the changes we just made. This is a fairly painless procedure. Run this short command:

linux-lab:~ $  sax2 -r -m 0=nvidia

Note: That is the number zero not the letter "O".

After a few seconds, you'll see a graphical environment load. It has a window in it called AUTOMATIC GRAPHICS SYSTEM SETUP. Just click the OK button in this window.

Alrighty, we're all done installing the NVidia kernel module. No sweat so far.

We can now start X back up with this command:

linux-lab:~ $  init 5

Your login screen appears (or it may log you in automatically). Go ahead and log in if you're not already.

Install xgl and compiz

Now that we have the NVidia driver installed, we can proceed to install xgl and compiz, the programs that make all the coolness possible.

To do this, we'll open up YAST, providing our root password. When it comes up, click on SOFTWARE on the left, and SOFTWARE MANAGEMENT on the right:

Search for xgl. When it appears in the results on the right side, check the box next to it:

Then, we'll search for compiz. When it appears in the results on the right side, check the box next to it:

Now, to finalize the deal, click on ACCEPT in the lower-right corner of the window.

Just like before, YAST asks you for the proper CDs. When it's done, it asks if you want to install other packages. Click NO.

Edit Config Files

Now, we have to edit some configuration files.

First off, open up a terminal window.

Switch to superuser (type 'su' and press ENTER):

linux-lab:~ $  su
Password:
linux-lab:/home/scott $

Now, we're going to open /etc/X11/xorg.conf. I'm going to use gedit, but you could just as easily use kate, vim, emacs, or whatever text editor you want:

linux-lab:~ $  gedit /etc/X11/xorg.conf

Look through the file for the "Device" section. It will look something like this:

Section "Device"
  BoardName    "GeForce4 MX 440 with AGP8X"
  BusID        "PCI:1@0:0:0"
  Driver       "nvidia"
  Identifier   "Device[0]"
  VendorName   "NVidia"
EndSection

We need to add one line to this section. That line will say: Option "NoFlip" "True", as in the following example:

Section "Device"
  BoardName    "GeForce4 MX 440 with AGP8X"
  BusID        "PCI:1@0:0:0"
  Driver       "nvidia"
  Identifier   "Device[0]"
  VendorName   "NVidia"
  Option       "NoFlip" "True"
EndSection

Note: Some people report that adding this line is not necessary. However, my sources at Novell recommend doing it, so I'm suggesting it here.

Don't close the file, yet. We need to add one more thing to it. Go down to the very bottom of the file and add this section:

Section "Extensions"
  Option       "Composite" "off"
EndSection

Now, you can save and close the file. Do not close the terminal window, however.

We have one more file to edit, /etc/sysconfig/displaymanager. Again, feel free to open this file with whatever text editor you wish. Open the file as root:

linux-lab:~ $  gedit /etc/sysconfig/displaymanager

Find the line that says DISPLAYMANAGER_XSERVER="Xorg". Instead of Xorg, we're going to tell it to use Xgl. So, change it to read thus:

DISPLAYMANAGER_XSERVER="Xgl"

Now, find the line that says DISPLAYMANAGER_XGL_OPTS="-accel glx:pbuffer -accel xv:pbuffer". We're going to change the pbuffer there at the very end to say fbo. So, it will look like this:

DISPLAYMANAGER_XGL_OPTS="-accel glx:pbuffer -accel xv:fbo"

Save and close the file, but not the terminal window. As superuser still, run SUSEconfig:

linux-lab:~ $  SUSEconfig

You'll see a bunch of output scrolling up the screen.

When that is finished, we have to remove a symbolic link and then create a new one. This is accomplished by running the following two commands:

linux-lab:~ $  rm /var/X11R6/bin/X
linux-lab:~ $  ln -s /usr/X11R6/bin/Xgl /var/X11R6/bin/X
linux-lab:~ $  

You can now close the terminal window.

We have done a lot of work to get this far, but none of it has been very difficult. We are now done installing Xgl and compiz and configuring the system. Now, we need to configure your desktop environment to run Xgl and compiz when it starts up. The following sections correspond to some of the major desktop environments and window managers. Skip straight to the one that interests you and proceed.

Configuring Gnome to Run Xgl

First, go ahead and log into Gnome.

Open up a terminal window and run the gnome-session-properties command:

linux-lab:~ $  gnome-session-properties

You'll see the SESSIONS window come up. Click on the STARTUP PROGRAMS tab:

Click on the ADD button. Type compiz --replace gconf into the box and click OK:

Again, click ADD. Type gnome-window-decorator into the box and click OK:

You should now see the two new additions in the SESSIONS window:

You can now close the SESSIONS window.

Once you're back in the terminal window, run the gconf-editor command:

linux-lab:~ $  gconf-editor

The CONFIGURATION EDITOR window appears:

In the left pane of this window, double-click to open each of the following items in this order: apps => compiz => general => allscreens => options. Then, in the right pane, double-click the ACTIVE_PLUGINS item to open it. We just want to make sure that the plugins are all set to load. You should see a list similar to this:

If you do not, you can add them all manually.

Now that we are sure all of the plugins are set to load, you should be able to log out of Gnome and then log back in. Once you do, you should be able to access the features of Xgl. To test this, open a window and move it around the screen. If it "wobbles", you are good to go.

When I have set this up, at this stage, I have to do a hard restart in X to get all of the settings to take properly. I have heard that this is not necessary. However, if you do not see Xgl working right here, you may need to do this, as well. To hard restart X, you just log out of Gnome. When you are logged out, press CTRL + ALT + BACKSPACE. X will shut down and restart. You can then log back in and everything should be full of coolness. Also, rebooting the computer may help things get freshly loaded and start up properly.

Congratulations. Your Gnome desktop environment should now be sporting all the great features of Xgl. To find out more about what Xgl can do, skip down to the XGL SHORTCUTS section, below.

Configuring KDE to run Xgl

First, make sure you are logged into KDE just like normal. We are going to create a quick config file so that KDE knows to load up compiz when X starts up. Open up your favorite editor. Copy and paste the following into a new text document:

[Desktop Entry]
Encoding=UTF-8
Exec=compiz --replace decoration wobbly fade minimize cube rotate zoom scale move resize place switcher & gnome-window-decorator &
GenericName[en_US]=
StartupNotify=false
Terminal=false
TerminalOptions=
Type=Application
X-KDE-autostart-after=kdesktop

Now, we just need to save it. You will need to save it in your /home/user/.kde/Autostart folder, where 'user' is your username. Name the file compiz.desktop. Once this is done, log out of KDE and log back in. You should have functioning Xgl on your shiny new K Desktop Environment.

Xgl Shortcuts

Some of the features of Xgl are executed when you perform certain functions. Mostly, this is some kind of key combination on your keyboard in addition to some button press and/or movement of your mouse. Below, I have provided a table with the different Xgl options and how to execute each one.

Window Operations
Move Window ALT + Left-Click and Drag
Move Window - Snap to screen CTRL + ALT + Left-Click and Drag
Resize Window ALT + Right-Click and Drag
Switch Windows ALT + TAB
Switch Windows (Scale Mode) F11
Wobbly Windows Left-Click Window and Drag
Translucency ALT + Mouse Up / Mouse Down
Cube
Rotate Cube - Next Desktop CTRL + ALT + Left or Right Arrow
Rotate Cube - Next Desktop Move Mouse cursor to extreme edge of desktop
Rotate Cube - Take Active Window CTRL + SHIFT + ALT + Left or Right Arrow
Manually Rotate Cube CTRL + SHIFT + Left-Click on Desktop and Drag
Zoom
Zoom Once Super-Key (Windows Key)
Zoom In Manually Mouse Wheel Scroll Up + Super-Key (Windows Key)
Zoom Out Manually Mouse Wheel Scroll Down + Super-Key (Windows Key)


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell