Results 1 to 9 of 9

Thread: HowTo: ATI Proprietary driver kernel module for legacy ATI cards/chipsets

  1. #1
    Member elazar's Avatar
    Join Date
    Sep 2007
    Posts
    217

    Default HowTo: ATI Proprietary driver kernel module for legacy ATI cards/chipsets

    As some of you know, ATI dropped support for some older chipsets/cards in their later driver releases for Linux. Specifically:

    Radeon 8500/9000/9100/9200/9250
    ATI Mobility Radeon 9000/9100/9200
    Radeon IGP 9000/9100/9200

    I have an IBM Thinkpad T42 which has the Radeon 9000(FireGL). The last release that supported these chipsets was 8.28.8. The problem is that this release will only build on kernel 2.6.12(I believe) and no later. So, after slogging through numerous posts, I found a patch (http://aur.archlinux.org/packages/at...l-2.6.20.patch) which patches firegl_public.c. I added a couple of more patches and combined it into one patch which builds on BT.

    Note:
    I have only been running this for a day or so with some light testing, so proceed with caution

    Q. Why would I want this?
    A. If you are running an older ATI chipset chances are OpenGL is handled by the Mesa Project OpenGL libraries. Using the proprietary ATI driver enables the hardware handling of OpenGL and enables hardware acceleration.

    Q. Are there any benefits?
    A. I have noticed a slight increase in KDE performance in respect to some styles that use OpenGL

    1. Download the 8.28.8 driver from ATI's website:
    http://ati.amd.com/support/drivers/l...-r-8-28-8.html

    You want the driver installer package(first choice).

    2. Set the execute permission on the package and install the it.

    3. The Patch

    Copy and paste this into a new file, save it as fglrx-2.6.20.patch

    Code:
     
    Common subdirectories: ./build_mod.back/2.6.x and ./build_mod/2.6.x
    diff -uN ./build_mod.back/agp3.c ./build_mod/agp3.c
    --- ./build_mod.back/agp3.c	2006-08-17 16:10:12.000000000 +0000
    +++ ./build_mod/agp3.c	2007-10-18 23:19:38.000000000 +0000
    @@ -55,13 +55,13 @@
      *
      */
     
    +#include <linux/utsrelease.h>
     #include <linux/version.h>
     #ifdef MODVERSIONS
     #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71)
     #include <linux/modversions.h>
     #endif
     #endif
    -#include <linux/config.h>
     #include <linux/module.h>
     #include <linux/pci.h>
     #include <linux/init.h>
    diff -uN ./build_mod.back/agpgart_be.c ./build_mod/agpgart_be.c
    --- ./build_mod.back/agpgart_be.c	2006-08-17 16:10:12.000000000 +0000
    +++ ./build_mod/agpgart_be.c	2007-10-18 23:20:23.000000000 +0000
    @@ -92,6 +92,7 @@
     #define EXPORT_SYMTAB 
     #endif /* Original AGPGART module */
     
    +#include <linux/utsrelease.h>
     #include <linux/version.h>
     #ifdef MODVERSIONS
     #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71)
    @@ -99,7 +100,6 @@
     #endif
     #endif
     
    -#include <linux/config.h>
     
     
     #include <linux/module.h>
    diff -uN ./build_mod.back/drm.h ./build_mod/drm.h
    --- ./build_mod.back/drm.h	2006-08-17 16:10:12.000000000 +0000
    +++ ./build_mod/drm.h	2007-10-18 23:18:17.000000000 +0000
    @@ -38,7 +38,6 @@
     #define _DRM_H_
     
     #if defined(__linux__)
    -#include <linux/config.h>
     #include <asm/ioctl.h>		/* For _IO* macros */
     #define DRM_IOCTL_NR(n)		_IOC_NR(n)
     #define DRM_IOC_VOID		_IOC_NONE
    diff -uN ./build_mod.back/drmP.h ./build_mod/drmP.h
    --- ./build_mod.back/drmP.h	2006-08-17 16:10:13.000000000 +0000
    +++ ./build_mod/drmP.h	2007-10-18 23:20:50.000000000 +0000
    @@ -42,7 +42,6 @@
      * can build the DRM (part of PI DRI). 4/21/2000 S + B */
     #include <asm/current.h>
     #endif /* __alpha__ */
    -#include <linux/config.h>
     #include <linux/module.h>
     #include <linux/kernel.h>
     #include <linux/miscdevice.h>
    @@ -51,6 +50,7 @@
     #include <linux/init.h>
     #include <linux/file.h>
     #include <linux/pci.h>
    +#include <linux/utsrelease.h>
     #include <linux/version.h>
     #include <linux/sched.h>
     #include <linux/smp_lock.h>	/* For (un)lock_kernel */
    diff -uN ./build_mod.back/firegl_public.c ./build_mod/firegl_public.c
    --- ./build_mod.back/firegl_public.c	2006-08-17 16:10:13.000000000 +0000
    +++ ./build_mod/firegl_public.c	2007-10-18 23:21:18.000000000 +0000
    @@ -22,6 +22,7 @@
     #endif /* !MODULE */
     
     // ============================================================
    +#include <linux/utsrelease.h>
     #include <linux/version.h>
     #ifdef MODVERSIONS
     #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71)
    @@ -69,7 +70,6 @@
     #ifdef CONFIG_MEM_MIRROR
     /* Prevent linux/config.h from being included again in subsequent
      * kernel headers as that would redefine CONFIG_MEM_MIRROR. */
    -#include <linux/config.h>
     #warning "Disabling CONFIG_MEM_MIRROR because it does not work with non-GPL modules."
     #warning "This will break page tracking when the fglrx kernel module is used."
     #undef CONFIG_MEM_MIRROR
    @@ -86,7 +86,6 @@
     #include <asm/unistd.h> /* for installing the patch wrapper */
     #include <linux/module.h>
     
    -#include <linux/config.h>
     #include <linux/kernel.h>
     #include <linux/fs.h>
     #include <linux/proc_fs.h>
    @@ -176,6 +175,70 @@
     int errno;
     #endif // __ia64__
     
    +#if defined(__i386__)
    +#define __syscall_return(type, res) \
    +do { \
    +        if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \
    +                errno = -(res); \
    +                res = -1; \
    +        } \
    +        return (type) (res); \
    +} while (0)
    +#define _syscall2(type,name,type1,arg1,type2,arg2) \
    +type name(type1 arg1,type2 arg2) \
    +{ \
    +long __res; \
    +__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
    +        : "=a" (__res) \
    +        : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)) \
    +        : "memory"); \
    +__syscall_return(type,__res); \
    +}
    +
    +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
    +type name(type1 arg1,type2 arg2,type3 arg3) \
    +{ \
    +long __res; \
    +__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
    +        : "=a" (__res) \
    +        : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
    +                  "d" ((long)(arg3)) : "memory"); \
    +__syscall_return(type,__res); \
    +}
    +#elif defined(__x86_64__)
    +#define __syscall_clobber "r11","rcx","memory" 
    +#define __syscall "syscall"
    +
    +#define __syscall_return(type, res) \
    +do { \
    +        if ((unsigned long)(res) >= (unsigned long)(-127)) { \
    +                errno = -(res); \
    +                res = -1; \
    +        } \
    +        return (type) (res); \
    +} while (0)
    +#define _syscall2(type,name,type1,arg1,type2,arg2) \
    +type name(type1 arg1,type2 arg2) \
    +{ \
    +long __res; \
    +__asm__ volatile (__syscall \
    +        : "=a" (__res) \
    +        : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)) : __syscall_clobber ); \
    +__syscall_return(type,__res); \
    +}
    +
    +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
    +type name(type1 arg1,type2 arg2,type3 arg3) \
    +{ \
    +long __res; \
    +__asm__ volatile (__syscall \
    +        : "=a" (__res) \
    +        : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \
    +                  "d" ((long)(arg3)) : __syscall_clobber); \
    +__syscall_return(type,__res); \
    +}
    +#endif
    +
     // int mlock(const void *addr, size_t len);
     _syscall2(int, mlock, const void *, addr, size_t, len )
     // int munlock(const void *addr, size_t len);
    @@ -1585,7 +1648,7 @@
     // To enable serial port debug message dumping,just define _KE_SERIAL_DEBUG in firegl_public.h file. 
     // Connect two PC with a null modern serial cable. run Hyper ternimal on the remote machine. 
     // It's useful to debug resume if network not works properly and serial port is not recovered 
    -// properly when fglrx resume hook is called...
    +// properly when fglrx resume hook is called...
      
      
     #define SER_DATA_PORT       0x3f8
    diff -uN ./build_mod.back/i7505-agp.c ./build_mod/i7505-agp.c
    --- ./build_mod.back/i7505-agp.c	2006-08-17 16:10:12.000000000 +0000
    +++ ./build_mod/i7505-agp.c	2007-10-18 23:21:35.000000000 +0000
    @@ -28,6 +28,7 @@
      * - Allocate more than order 0 pages to avoid too much linear map splitting.
      */
     
    +#include <linux/utsrelease.h>
     #include <linux/version.h>
     #ifdef MODVERSIONS
     #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71)
    diff -uN ./build_mod.back/make.sh ./build_mod/make.sh
    --- ./build_mod.back/make.sh	2006-08-17 16:10:12.000000000 +0000
    +++ ./build_mod/make.sh	2007-10-18 23:18:17.000000000 +0000
    @@ -203,9 +203,9 @@
     # ==============================================================
     # locate and verify contents of kernel include file path
     
    -# verify match with respective line in linux/version.h
    +# verify match with respective line in linux/utsrelease.h
     # sample: #define UTS_RELEASE "2.4.0-test7"
    -src_file=$linuxincludes/linux/version.h
    +src_file=$linuxincludes/linux/utsrelease.h
     if [ ! -e $src_file ];
     then
       echo "kernel includes at $linuxincludes not found or incomplete" | tee -a $logfile
    diff -uN ./build_mod.back/nvidia-agp.c ./build_mod/nvidia-agp.c
    --- ./build_mod.back/nvidia-agp.c	2006-08-17 16:10:12.000000000 +0000
    +++ ./build_mod/nvidia-agp.c	2007-10-18 23:21:54.000000000 +0000
    @@ -5,6 +5,7 @@
      * generci back port to 2.4 and module embedding by Alexander Stohr.
      */
     
    +#include <linux/utsrelease.h>
     #include <linux/version.h>
     #ifdef MODVERSIONS
     #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71)
    4. Copy the patch to /lib/modules/fglrx/build_mod

    5. Patch the files

    Code:
    patch -b -i fglrx-2.6.20.patch
    6. Before we build it, we need to add a line to an include. Locate mm.h in /lib/modules/2.6.20-BT.../build/include/linux/ and add the following line to the top:

    Code:
    #define VM_SHM             0x00000000      /* Means nothing: delete it later */
    7. Set the execute permission on make.sh and run it. It will complain about some stuff but it will build the module.

    8. Now, the module is in the 2.6.x directory under build_mod. I did not use the installer script, instead, I copied the module to /lib/modules/2.6.20-BT.../extra. You can do as you wish.

    9. Logout of KDE and run aticonfig --initial.

    10. Reboot.

    11. startx will load the kernel module, however, from what I have read, it is preferable to load it when the system boots(rc.local etc).
    dd if=/dev/urandom of=/mybrain

  2. #2
    Member Primey's Avatar
    Join Date
    Sep 2007
    Posts
    126

    Default

    yo elazar, this module only works for ati legacy cards? or it works for the new models as well?

    let me see if i can test it with my box, i run an ati x1650pro and i'll let you know

  3. #3
    Member elazar's Avatar
    Join Date
    Sep 2007
    Posts
    217

    Default

    It probably will, however if you are using a card that is supported by their latest driver release then you should go with that.
    dd if=/dev/urandom of=/mybrain

  4. #4
    Member elazar's Avatar
    Join Date
    Sep 2007
    Posts
    217

    Default

    Note: This may work with generic 2.6.20 kernels too, I haven't tested it though. If you have upgraded your kernel, most likely you have upgraded X too, which means this will not work, because X dropped support for the DRI modules used in this driver because those modules were compiled against an older version of X. Rule of thumb is, if you can install the ATI 8.28.8 driver, then this should work too.
    dd if=/dev/urandom of=/mybrain

  5. #5
    Member elazar's Avatar
    Join Date
    Sep 2007
    Posts
    217

    Default

    I ended up sticking with radeon driver from X, updated Mesa and the DRI libs(compiled Mesa 7.0.1 using make linux-dri-x86). glxgears reports 2100FPS(I don't know how accurate this is) but, it is faster than the legacy ATI driver, so unless you absolutely need hardware acceleration, this tutorial is moot...

    E
    dd if=/dev/urandom of=/mybrain

  6. #6
    Just burned his ISO
    Join Date
    Oct 2007
    Posts
    2

    Default

    Would this WalkThrough work with a Radeon 9200 and X.org 7.2 ?

  7. #7
    Just burned his ISO
    Join Date
    Oct 2007
    Posts
    2

    Default

    On patching the file, I get the following error :
    Code:
    patching file agp3.c
    patching file agpgart_be.c
    patching file drm.h
    patching file drmP.h
    patching file firegl_public.c
    Hunk #5 FAILED at 1648.
    1 out of 5 hunks FAILED -- saving rejects to file firegl_public.c.rej
    patching file i7505-agp.c
    patching file make.sh
    patching file nvidia-agp.c
    Hunk #1 succeeded at 5 with fuzz 1.
    Then on trying ./make.sh I get the following msg ...
    Code:
    [root@localhost build_mod]# ./make.sh
    ATI module generator V 2.0
    ==========================
    initializing...
    ./make.sh: line 518: [: =: unary operator expected
    cleaning...
    patching 'highmem.h'...
    assuming new VMA API since we do have kernel 2.6.x...
     Assuming default VMAP API
    doing Makefile based build for kernel 2.6.x and higher
    make -C /lib/modules/2.6.22.9-desktop-1mdv/build SUBDIRS=/lib/modules/fglrx/build_mod/2.6.x modules
    make[1]: Entering directory `/usr/src/linux-2.6.22.9-desktop-1mdv'
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/firegl_public.o
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘firegl_stub_open’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:622: warning: assignment discards qualifiers from pointer target type
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘__ke_pci_find_device’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:1827: warning: ‘pci_find_device’ is deprecated (declared at include/linux/pci.h:477)
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘__ke_request_irq’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:2539: warning: ‘deprecated_irq_flag’ is deprecated (declared at include/linux/interrupt.h:66)
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:2539: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘__ke_vm_map’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3222: error: ‘VM_SHM’ undeclared (first use in this function)
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3222: error: (Each undeclared identifier is reported only once
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3222: error: for each function it appears in.)
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘__ke_smp_call_function’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3927: warning: passing argument 1 of ‘smp_call_function’ from incompatible pointer type
    make[2]: *** [/lib/modules/fglrx/build_mod/2.6.x/firegl_public.o] Error 1
    make[1]: *** [_module_/lib/modules/fglrx/build_mod/2.6.x] Error 2
    make[1]: Leaving directory `/usr/src/linux-2.6.22.9-desktop-1mdv'
    make: *** [kmod_build] Error 2
    build failed with return value 2
    Thanks in advance for your help


  8. #8
    Member elazar's Avatar
    Join Date
    Sep 2007
    Posts
    217

    Default

    Did you download the correct version of driver? You should be using 8.28.8. Also, from the compiler output, it looks like you forgot to add VM_SHM to mm.h. As I previously posted, you are better off using the Xorg radeon driver...

    E
    dd if=/dev/urandom of=/mybrain

  9. #9
    Just burned his ISO
    Join Date
    Dec 2006
    Posts
    6

    Default

    Quote Originally Posted by James_vw View Post
    On patching the file, I get the following error :
    Code:
    patching file agp3.c
    patching file agpgart_be.c
    patching file drm.h
    patching file drmP.h
    patching file firegl_public.c
    Hunk #5 FAILED at 1648.
    1 out of 5 hunks FAILED -- saving rejects to file firegl_public.c.rej
    patching file i7505-agp.c
    patching file make.sh
    patching file nvidia-agp.c
    Hunk #1 succeeded at 5 with fuzz 1.
    Then on trying ./make.sh I get the following msg ...
    Code:
    [root@localhost build_mod]# ./make.sh
    ATI module generator V 2.0
    ==========================
    initializing...
    ./make.sh: line 518: [: =: unary operator expected
    cleaning...
    patching 'highmem.h'...
    assuming new VMA API since we do have kernel 2.6.x...
     Assuming default VMAP API
    doing Makefile based build for kernel 2.6.x and higher
    make -C /lib/modules/2.6.22.9-desktop-1mdv/build SUBDIRS=/lib/modules/fglrx/build_mod/2.6.x modules
    make[1]: Entering directory `/usr/src/linux-2.6.22.9-desktop-1mdv'
      CC [M]  /lib/modules/fglrx/build_mod/2.6.x/firegl_public.o
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘firegl_stub_open’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:622: warning: assignment discards qualifiers from pointer target type
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘__ke_pci_find_device’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:1827: warning: ‘pci_find_device’ is deprecated (declared at include/linux/pci.h:477)
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘__ke_request_irq’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:2539: warning: ‘deprecated_irq_flag’ is deprecated (declared at include/linux/interrupt.h:66)
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:2539: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘__ke_vm_map’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3222: error: ‘VM_SHM’ undeclared (first use in this function)
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3222: error: (Each undeclared identifier is reported only once
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3222: error: for each function it appears in.)
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘__ke_smp_call_function’:
    /lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3927: warning: passing argument 1 of ‘smp_call_function’ from incompatible pointer type
    make[2]: *** [/lib/modules/fglrx/build_mod/2.6.x/firegl_public.o] Error 1
    make[1]: *** [_module_/lib/modules/fglrx/build_mod/2.6.x] Error 2
    make[1]: Leaving directory `/usr/src/linux-2.6.22.9-desktop-1mdv'
    make: *** [kmod_build] Error 2
    build failed with return value 2
    Thanks in advance for your help

    Did you ever figure the problem out? I am also receiving the duplicate error.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •