DRI User Guide : X Server Start-up
Previous: Prerequisite Software
Next: Using 3D Acceleration

5. X Server Start-up

This section describes the steps needed to start the X server with 3D acceleration support.

5.1. Kernel module

XFree86 4.0.1 added automatic kernel module loading to the X server. On Linux, the X server uses modprobe to load kernel modules. The DRM kernel modules should be in /lib/modules/KERNEL-VERSION/misc/ for automatic loading to work.

Optionally, DRM kernel modules can be loaded manually with insmod prior to starting the X server.

You can verify that the kernel module was installed with lsmod, checking the X server startup log, and checking that /proc/dri/0 exists.

5.2. XF86Config file

First, the XF86Config file must load the GLX and DRI modules:

	Section "Module"
	...
	# This loads the GLX module
	    Load       "glx"
	# This loads the DRI module
	    Load       "dri"
	EndSection
        

Next, the DRI section can be used to restrict access to direct rendering.

If you want all of the users on your system to be able to use direct-rendering, then use a simple DRI section:

	Section "DRI"
	     Mode 0666
	EndSection
        

This section will allow any user with a current connection to the X server to use direct rendering.

If you want to restrict the use of direct-rendering to a certain group of users, then create a group for those users by editing the /etc/group file on your system. For example, you may want to create a group called xf86dri and place two users (e.g., fred and jane) in that group. To do that, you might add the following line to /etc/group:

        xf86dri:x:8000:fred,jane
        

You have to be careful that the group id (8000 in this example) is unique.

Then you would use the following DRI section:

        Section "DRI"
             Group "xf86dri"
             Mode 0660
        EndSection
        

This would limit access to direct-rendering to those users in the xf86dri group (fred and jane in this example). When other users tried to use direct rendering, they would fall back to unaccelerated indirect rendering.

[Note that there is a known bug in XFree86 4.0 that prevents some changes to the DRI section from taking effect. Until this bug is fixed, if you change the DRI section, please also remove the /dev/dri directory with the rm -rf /dev/dri command.]

Next, the Device section of the XF86Config file must describe your particular hardware.

For example, here's the Device section for a 3dfx Voodoo3 card:

        Section "Device"
            Identifier  "Voodoo3"
            VendorName  "3dfx"
            Driver      "tdfx"
        EndSection
        

Here's the Device section for a Matrox G400 card:

	Section "Device"
	    Identifier  "G400"
	    VendorName  "Matrox"
	    Driver      "mga"
	    VideoRam    32768
	EndSection
        

Here's the Device section for an ATI Rage 128 card:

	Section "Device"
	    Identifier  "Rage128"
	    VendorName  "ATI"
	    Driver      "r128"
	EndSection
        

Here's the Device section for an Intel i810 motherboard:

	Section "Device"
	    Identifier  "i810"
	    VendorName  "Intel"
	    Driver      "i810"
	    VideoRam    10000
	EndSection
        

Finally, the Screen section of the XF86Config file may have to be specially configured as well. For example, Voodoo3 hardware acceleration is only available in 16bpp mode.

	Section "Screen"
	    Identifier  "Screen 1"
	    Device      "Voodoo3"
	    Monitor     "High Res Monitor"
	    DefaultDepth 16
	    Subsection "Display"
		Depth       16
		Modes       "1280x1024" "1024x768" "800x600" "640x480"
		ViewPort    0 0
	    EndSubsection
        EndSection
        

Replace Voodoo3 with G400 for Matrox G400.

Replace Voodoo3 with Rage128 for ATI Rage 128.

If there are errors in the XF86Config file, the X server will log errors to the file /var/log/XFree86.0.log

5.3. Memory usage

Using the 3D features of a graphics card requires more memory than when it's just used as a 2D device. Double buffering, depth buffering, stencil buffers, textures, etc. all require extra graphics memory. These features may require four times the memory used for a simple 2D display.

If your graphics card doesn't have a lot of memory (less than 16MB, for example), you may have to reduce your screen size and/or color depth in order to use 3D features.

The documentation included with your card should have information about maximum screen size when using 3D.


DRI User Guide : X Server Start-up
Previous: Prerequisite Software
Next: Using 3D Acceleration