Adding S3TC Support to DRI
Last Update: Wednesday, June 23 2004
Please notify me of any corrections or suggested additions
Jonathan A. Zdziarski
jonathan@nuclearelephant.com

Need for Speed: Underground
Radeon Mobility 7500 DRI, Cedega v4.0
|
NOTE: This article has been obsoleted by Roland Scheidegger's, which
includes links to the latest patches. His article can be found here.
What is S3TC
S3TC is a texture compression technology used to improve the quality of
3D textures by providing higher-resolution detail, but compressing it to
conserve video memory. The approach was designed by S3, Inc. S3TC is presently
supported by most manufacturer drivers, but not the DRI drivers. This is
because there is both a patent for S3TC and the specification for S3TC makes
the claim of intellectual property. The developers of DRI have not yet been
able to procure permission to include S3TC in their drivers, and so it has been
left out for fear of IP encumbrances.
This presents an issue if you are stuck using the DRI drivers.
Unfortunately, S3TC is required by some modern 3D games and applications
such as Unreal Tournament 2004 and Need for Speed: Underground
(which of course, must run under Cedega to play). Fortunately, a patch is
available for the DRI drivers to add S3TC support.
Installing the S3TC Extensions
The first step in adding S3TC support is to compile and install the extension.
The extension is maintained by Roland Scheidegger and a link to the latest
version is below:
http://homepage.hispeed.ch/rscheidegger/dri_experimental/libtxc_dxtn040524.tar.gz
Step 1: Download and extract the extensions library
gunzip libtxc_dxtn040524.tar.gz; tar -xf libtxc_dxtn040524.tar
Step 2: Compile the library.
cd txc_dxtn
make
Step 3: Install the library.
su
make install
Activating the S3TC Extension in DRI
In order to use the extension, it must be activated in the DRI drivers. To
do this, you'll need to download, patch, and build the DRI drivers from
CVS.
Step 1: Download all the necessary source code
You'll need to download the DRI, DRM, and Mesa (GL) source trees. This can
be done from CVS. The latest version of the S3TC patch is against CVS 040617,
so you'll want to download the CVS tree for that date in order to insure the
patch works correctly. It's best to create a directory to hold the CVS tree.
mkdir build; cd build
cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/dri login
cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/dri co -D "Jun 17 2004" xc
cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/dri co -D "Jun 17 2004" drm
cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/mesa login
cvs -z3 -d:pserver:anonymous@dri.freedesktop.org:/cvs/mesa co -D "Jun 17 2004" Mesa
Step 2: Applying the S3TC Patch
The S3TC patch must be applied to the Mesa source tree in order to activate
the S3TC extension. The latest version of the S3TC patch can be downloaded
here:
http://homepage.hispeed.ch/rscheidegger/dri_experimental/mesa_r200_radeon_i830_txc_cvs040617.diff.gz
Download the patch file, and then uncompress and apply it this way:
gunzip mesa_r200_radeon_i830_txc_cvs040617.diff.gz
cd Mesa
mkdir a; mv a src
patch -p0 < ../mesa_r200_radeon_i830_txc_cvs040617.diff
mv a/src .
rm -r a
One hunk of the patch will fail. Don't worry about this - it was already
applied to CVS.
Step 3: Compiling and Installing
Follow the instructions at http://dri.sourceforge.net/cgi-bin/moin.cgi/Building to
build and install DRI with Mesa for your platform. You may also wish to
build drm if you have an older kernel module installed.
Step 4: Testing
Once you have compiled and installed the patched DRI and Mesa drivers, restart
your X session or reboot. You can check to see if it was successful by
looking for the s3tc extensions:
$ glxinfo|grep s3tc
Mesa: software DXTn compression/decompression available
GL_EXT_texture, GL_EXT_texture3D, GL_EXT_texture_compression_s3tc,
GL_SGIS_texture_edge_clamp, GL_SGIS_texture_lod, GL_S3_s3tc
If you only see the "Mesa:" informational line, but do NOT see the extensions,
then something has gone awry. Make sure the source tree matched the date of
the patch and try again. If you do see the extensions, then congratulations!
You're now ready to play some games that use S3TC!
|