Broken 3D Acceleration for S3 Savage Cards in Linux 2.6.20

I have a Thinkpad T23 with an S3 SuperSavage card in it. After upgrading to kernel 2.6.20, I discovered that 3D acceleration was broken. This is a known bug in the 2.6.20 kernel, which doesn’t seem to have been addressed yet.

You can test if you have this problem by running the glxgears program and looking for an error message about indirect rendering:

you@yourmachine:~$ glxgears
libGL error: drmMap of framebuffer failed (Invalid argument)
libGL error: reverting to (slow) indirect rendering

To fix, you’ll need to check out and build the latest drm module from the freedesktop.org project. Make sure you have cogito installed, along with at least the headers for your kernel.

git clone git://anongit.freedesktop.org/git/mesa/drm
cd drm/linux-core/
make DRM_MODULES="savage"

It may have been fixed now, but I experienced a compile error during the make from drm_compat.c (an override method declared statically in the module, but non-static in the kernel). If you get this error, apply this patch:

diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c
index 9ac5658..e330aa0 100644
--- a/linux-core/drm_compat.c
+++ b/linux-core/drm_compat.c
@@ -185,7 +185,7 @@ static int drm_pte_is_clear(struct vm_area_struct *vma,
        return ret;
-static int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
+int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
                  unsigned long pfn)
        int ret;

(Basically, you’re removing the static modifier from the beginning of the vm_insert_pfn method and resaving the drm_compat.c file)

Rerun the make command and you should be good to go.

Next replace the modules in your kernel with the newly built ones, then run depmod to update the module list. Finally, reboot your machine.

mv *.ko /lib/modules/`uname -r`/kernel/drivers/char/drm
depmod -a

After rebooting, try glxgears again and all should be well, working 3D acceleration!

I was hoping to use beryl on this machine, but unfortunately the Savage driver/hardware doesn’t support non-power-of-two textures and that’s pretty much a showstopper. Poo. :-(