Mint8: Direct Rendering for Mach64 Graphics Chipsets

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
Hlingler

Mint8: Direct Rendering for Mach64 Graphics Chipsets

Post by Hlingler »

REF: http://forums.fedoraforum.org/showthread.php?t=185162

The X.Org Mesa ATI Mach64 3D video driver is, and has been for many years, disabled on most or all Linux distros, by simple omission of one or more components, even though it exists and works. In addition, with the current migration of kernel driver interface module (kmod) code from X.Org DRM to the kernel source code, the Mach64 kmod code has been abandoned (http://sourceforge.net/mailarchive/mess ... .gmail.com). However, the code is still available for older X.Org DRM releases, such as that used in LinuxMint8 (libdrm-2.4.14). Although stale and in need of some "fixing", it can be made to compile on LinuxMint8. Since Mint8 ships with the X.Org Mesa Mach64 3D video driver itself (/usr/lib/dri/mach64_dri.so), the matching kmod for the running kernel is all that is needed to enable and use the driver. Plus a small tweak to create the special character device to access the driver. Since I'm cursed with two older machines having the subject graphics chipset, I'm motivated to make them work to their maximum capabilities. Therefore, I have successfully fixed the code and compiled the required kmods for the "stock" kernel-2.6.31-14-generic (x86 only) that ships with Mint8, and verified that they work on the target hardware. I am making them available for anyone who wishes to try them. Instructions for use follow.

In response to the inevitable question: "Is my card supported?", my answer is: "I have no idea. Check the list." Chipsets covered by Mach64 DRI 3D driver (http://dri.freedesktop.org/wiki/ATIMach64):
ATI Mach64

Status

DRI support for mach64 has been moved to the DRI and Mesa trunks. This means DRI works on any recent distribution as of 2007.

On Linux systems, the DRM module is not included in official kernels....

All mach64 chips with a triangle setup engine are supported. This includes the 3D Rage Pro, 3D Rage LT Pro, 3D Rage XL, 3D Rage XC, and 3D Rage Mobility. Cards without a triangle setup engine cannot be supported; this includes VT chips, 3D Rage, 3D Rage II/II+/IIc, and 3D Rage LT.

Code: Select all

mint@mint ~/Desktop $ cat /etc/lsb-release 
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=8
RELEASE_NOTES_URL=http://www.linuxmint.com/rel_helena.php
DISTRIB_CODENAME=helena
DISTRIB_DESCRIPTION="Linux Mint 8 Helena - Main Edition"
mint@mint ~/Desktop $ uname -a
Linux mint 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux
mint@mint ~/Desktop $ sudo lspci | grep VGA
01:00.0 VGA compatible controller: ATI Technologies Inc 3D Rage Pro AGP 1X/2X (rev 5c)
And the usual disclaimer: the software is provided in the hope that it will be useful, but comes with no warranty of any kind, including merchantability for any fit purpose. Use solely at your own risk. Caveat Emptor.

With that out of the way... .

If at any time you're unsure about how to proceed, or something goes wrong, STOP, and post back here with details.

It will be most useful later on to have a benchmark to measure the graphics performance. Unfortunately, there are no good ones readily available, so glxgears will have to do. Perform this test with no other load on your system. Open a terminal as any user and command: glxgears. You will see a pop-up window appear, with three spinning gears. Do not hide/cover/minimize the gearbox. Let run 30-60 seconds before closing (or kill with CTL-c from the console). The terminal output will list frames-per-second in 5-second increments. Make note of the average for later comparison.

Code: Select all

mint@mint ~ $ glxinfo | grep render
direct rendering: Yes
OpenGL renderer string: Software Rasterizer
mint@mint ~ $ glxgears
109 frames in 5.0 seconds
161 frames in 5.0 seconds
138 frames in 5.0 seconds
146 frames in 5.0 seconds
153 frames in 5.0 seconds
144 frames in 5.0 seconds
144 frames in 5.0 seconds
147 frames in 5.0 seconds
^C^C
!!!CAUTION!!! Failure to (properly) install all of the required, matching software may result in a failure of X11/GUI.

All of the following must be done with elevated permissions (sudo). In most cases, you should see no output from a command except a new command prompt line after executing each command (the commands will "silently succeed").
  1. First, download the TWO required kmods to a convenient location: NOTE: BOTH kmods are required (even though you already have a drm.ko, we will be replacing it).

    NOTE: All kernel modules are specific to one and only one kernel, and will not work for any other kernel(s).
  2. Second: move the existing drm.ko out of the way, backing it up "just in case":

    Code: Select all

    sudo mv -i /lib/modules/2.6.31-14-generic/kernel/drivers/gpu/drm/drm.ko /lib/modules/2.6.31-14-generic/kernel/drivers/gpu/drm/drm.ko.orig
  3. Next, create a folder for the Mach64 kmod:

    Code: Select all

    sudo mkdir -p /lib/modules/2.6.31-14-generic/kernel/drivers/gpu/drm/mach64/
  4. Now copy (or move) the kmods to the correct locations:

    Code: Select all

    sudo cp -i /mnt/shared/2.6.31-14-generic-i686-drm.ko /lib/modules/2.6.31-14-generic/kernel/drivers/gpu/drm/drm.ko
    sudo cp -i /mnt/shared/2.6.31-14-generic-i686-mach64.ko /lib/modules/2.6.31-14-generic/kernel/drivers/gpu/drm/mach64/mach64.ko
    NOTE: Use the correct PATH to wherever you downloaded the kmods. NOTE that the kernel version-release-arch number has been prepended to the file names for ease of identification, and is stripped.
  5. Inform the kernel that it has some new friends, and have it register their dependencies:

    Code: Select all

    sudo depmod -a
  6. Load the new kmods, DRM first:

    Code: Select all

    sudo modprobe drm
    sudo modprobe mach64
  7. Next, I simply copied my Fedora 11 xorg.conf file to the correct location (/etc/X11/xorg.conf). It worked as-is. I have attached it as an example (see attachments). NOTE: Do NOT use this file without first editing it as required for your hardware. I strongly recommend that you create and use a xorg.conf file, especially if you need to restrict screen resolution and/or color depth due to limited available VRAM. See the notes at the end for suggestions/limitations.
  8. Now create a DRI device folder and create the special character device so that X can access the driver, and then fix the ownership:

    Code: Select all

    sudo mkdir -p /dev/dri/
    sudo mknod /dev/dri/card0 -m 0600 c 226 0
    sudo chown mint:root /dev/dri/card0
    NOTE: If you are running on an installed OS, change the file ownership to match your intended user-name (in place of "mint"). I'm sure that there is a way to automate this, but I haven't yet gotten around to figuring it out. Otherwise, this step and the next must be repeated upon every re-boot.
  9. On Mint8 running "live" with the Main CD, all I had to do was logout of the desktop to re-start X. This automatically re-started X with the new features loaded. If X does not re-start, you must find a way to force it to do so (without re-booting, which will wipe out the special device node). Log in again to the desktop, and assess (NOTE: you MUST see BOTH "Yes" and the "Mesa DRI Mach64 ..." strings in the output):

    Code: Select all

    mint@mint ~/Desktop $ glxinfo | grep render
    direct rendering: Yes
    OpenGL renderer string: Mesa DRI Mach64 [Rage Pro] 20051019 AGP 2x x86/MMX
    mint@mint ~/Desktop $ glxgears
    1158 frames in 5.0 seconds
    958 frames in 5.0 seconds
    966 frames in 5.0 seconds
    989 frames in 5.0 seconds
    755 frames in 5.0 seconds
    254 frames in 5.0 seconds
    850 frames in 5.0 seconds
    1100 frames in 5.0 seconds
    1107 frames in 5.0 seconds
    1105 frames in 5.0 seconds
    1107 frames in 5.0 seconds
    1081 frames in 5.0 seconds
    1011 frames in 5.0 seconds
    ^C
    About a 10X increase in frame-rate here, albeit at a much reduced screen resolution and lower color depth.
NOTES:
If all that actually works, it is also highly recommended that you reduce display color depth to 16 bpp for best performance. Your available "Modes" will be dictated by your VRAM. The 3D DRI may inexplicably fail if you do not have enough VRAM to view the display at the desired resolution. For an ATI 3D Rage Pro Turbo AGP 2X on-board chip with 4 MB SGRAM, my glxgears FPS increased from ~25-30 to ~250 FPS maximum, and that's after reducing color depth to 16 bpp and resolution to 832x624 (which is the maximum capability for 4 MB VRAM). For an ATI 3D Rage Pro AGP 2X card with 8 MB SGRAM, I'm able to get 1024x768 @ 16 bpp, with very similar output running glxgears (or 24 bpp full color depth but with somewhat reduced frame-rates). The resolution setting itself has little effect on performance in this scenario.

Finally, don't expect too much out of this driver. Forget Compiz-Fusion, it's not going to happen (chipset lacks support for non-power-of-two rendering required by Compiz[-Fusion] and similar advanced effects). For basic effects, install (and use) xcompmgr (provides basic window shadows and translucency). You won't get anywhere near the output you might have gotten with the proprietary ATI driver for M$ Win*.

Questions/comments/feedback always welcome.

Enjoy,
V
Post Reply

Return to “Tutorials”