Fun with Xorgby Dru Lavigne
Chapter 5 of the FreeBSD Handbook provides an excellent overview for understanding and configuring the X Window system. Today's article goes beyond the Handbook to demonstrate some of the cool things you can do with your FreeBSD system and other systems running X.
Getting the Most out of your Video Card
Xorg -configure does a good job of configuring video cards, the X drivers don't provide automatic support for DRI (Direct Rendering Interface), DRM (Direct Rendering Manager), or OpenGL (OPEN Graphics Library)--meaning you're probably not getting the most out of your video hardware.
linux_dri packages provide these missing features by installing FreeBSD kernel loadable modules for several cards:
Note: if you have a NVidia card and want to use the binary-only driver, instead
make install the nvidia-driver port as it needs to compile against your kernel.
Depending upon the software you have installed, these DRI modules may already be on your system. Check with the command:
# pkg_info | grep dri
If you receive your prompt back with no output, or the output mentions only
linux_dri, install the
# pkg_add -r dri
Once you have it installed, add a few lines to the end of /etc/X11/xorg.conf:
Section "DRI" Mode 0666 EndSection
Note: if that file doesn't exist, then:
# cp /root/xorg.conf.new /etc/X11/xorg.conf
Finally, double-check that Xorg will load
glx; if these lines don't exist, add them to the
Section "Module" portion of /etc/X11/xorg.conf:
# grep dri /etc/X11/xorg.conf Load "dri" # grep glx /etc/X11/xorg.conf Load "glx"
Loading and Testing the Kernel Module
Now you're ready to determine which kernel module to load. First, figure out which video card Xorg wants to use:
# grep Name /etc/X11/xorg.conf VendorName "IBM" ModelName "IBM G72" VendorName "ATI Technologies Inc" BoardName "Rage 128 Pro Ultra TF"
Compare that output to the earlier table. This system needs to use the
r128 module. If I issue this command at
F1 (the console), a successful driver load will display as bright white text:
# kldload r128 drm0: <ATI Rage 128 Pro Ultra TF (AGP)> port 0xd000-0xd0ff mem 0xf4000000-0xf7ff ffff,0xfbefffff irq 10 at device 0.0 on pci1 info: [drm] AGP at 0xf0000000 64MB info: [drm] Initialized r128 2.5.0 20030725
Once your driver successfully loads, start an X session as a regular user and check the OpenGL rendering capabilities from within the GUI:
% glxinfo | grep rendering direct rendering: Yes
Once you have rendering enabled, add a line to /boot/loader.conf as the superuser so the driver automatically loads when the system boots. My line looks like:
r128 with the module name for your video card and double-check the file for typos.
3d-Desktop is an
xgl-ish desktop switcher and a cool way to test your DRI:
# pkg_add -r 3ddesktop
Once installed, run it from the GUI as a regular user:
Use your arrow keys to rotate the cube of desktops and
Space to bring a desktop into the foreground.
When you install X, you get a whole suite of interesting utilities, many of which you may not be aware of. One of these is
Xnest, which allows you to run multiple window managers simultaneously. Confirm that you have
Xnest installed with:
# pkg_info|grep nest xorg-nestserver-6.9.0_1 Nesting X server from Xorg
If you just get your prompt back, install the program with the command:
# pkg_add -r xorg-nestserver
Here is an example of how to use
Xnest. On a system already configured for KDE, I installed three additional window managers:
# pkg_add -r windowmaker # pkg_add -r xfce # pkg_add -r fluxbox
Once installed, start the GUI as a regular user. In my case, I see the KDE desktop. I can use
Xnest to start
windowmaker, which will appear as just another window with "Windowmaker" in the title bar:
% Xnest :1 -ac -name Windowmaker & wmaker -display :1
Note: X assigns the first window manager you start (in my case, KDE) a display number of
:0. In this example,
windowmaker gets the second display,
Xnest nests within the original display.
To start two more window managers, bump up the display number and specify the name of the window manager:
% Xnest :2 -ac -name XFCE & xfce -display :2 % Xnest :3 -ac -name Fluxbox & fluxbox -display :3
Figure 1 shows all four window managers running simultaneously.
Pages: 1, 2