Fixing mtrr to run fglrx on Dell Optiplex 755

About

The new SoC's Dell Optiplex 755 has an ATI 2400 and 4GB of ram. On linux (Fedora 8), using fglrx with ATI binary driver locks up the computer completely. 

Why

AFAIK, to address the memory on the video card, linux on this system tries to access the memory at around 3.5GB, which is fine when you have < 4GB of memory. However, things break terribly if you have 4GB of RAM, which fortunately/unfortunately is the case with this system.

How?

Fix mtrr

To take a look at the mtrr,

# cat /proc/mtrr
reg00: base=0x00000000 (   0MB), size=65536MB: write-back, count=1
reg01: base=0xcff00000 (3327MB), size=   1MB: uncachable, count=1
reg02: base=0xd0000000 (3328MB), size= 256MB: uncachable, count=1
reg03: base=0xe0000000 (3584MB), size= 512MB: uncachable, count=1

This is the default mtrr that comes with the system. But here's what you want:

# cat /proc/mtrr
reg00: base=0x00000000 (   0MB), size=2048MB: write-back, count=1
reg01: base=0x80000000 (2048MB), size=1024MB: write-back, count=1
reg02: base=0xc0000000 (3072MB), size= 256MB: write-back, count=1
reg05: base=0xe0000000 (3584MB), size= 128MB: write-combining, count=1
reg06: base=0xe8000000 (3712MB), size= 128MB: write-combining, count=1
reg07: base=0x100000000 (4096MB), size=1024MB: write-back, count=1

And to create that,

# echo "disable=0" >| /proc/mtrr
# echo "disable=1" >| /proc/mtrr
# echo "disable=2" >| /proc/mtrr
# echo "disable=3" >| /proc/mtrr
# echo "base=0x00000000 size=0x80000000 type=write-back" >| /proc/mtrr
# echo "base=0x80000000 size=0x40000000 type=write-back" >| /proc/mtrr
# echo "base=0xC0000000 size=0x10000000 type=write-back" >| /proc/mtrr
# echo "base=0xD0000000 size=0x08000000 type=write-back" >| /proc/mtrr
# echo "base=0xD8000000 size=0x08000000 type=uncachable" >| /proc/mtrr
# echo "base=0xE0000000 size=0x08000000 type=write-combining" >| /proc/mtrr
# echo "base=0xE8000000 size=0x08000000 type=write-combining" >| /proc/mtrr
# echo "base=0x100000000 size=0x40000000 type=write-back" >| /proc/mtrr

However, the changes will be lost when you boot up. To ensure that you can boot up with the changed mtrr, you will have to create a init  file that runs all that commands. Use this:

[root@yipwp-1 ~]# vim /etc/init.d/fix_mtrr

#!/bin/bash
# chkconfig: 35 7 10
# description:  Fix wrong MTRR

. /etc/rc.d/init.d/functions

case "$1" in
  start)
    echo "disable=0" >| /proc/mtrr
    echo "disable=1" >| /proc/mtrr
    echo "disable=2" >| /proc/mtrr
    echo "disable=3" >| /proc/mtrr
    echo "base=0x00000000 size=0x80000000 type=write-back" >| /proc/mtrr
    echo "base=0x80000000 size=0x40000000 type=write-back" >| /proc/mtrr
    echo "base=0xC0000000 size=0x10000000 type=write-back" >| /proc/mtrr
    echo "base=0xD0000000 size=0x08000000 type=write-back" >| /proc/mtrr

    # System devices: 3456-3584
    echo "base=0xD8000000 size=0x08000000 type=uncachable" >| /proc/mtrr
    # AGP Apeture: 3584-3712 128M
    echo "base=0xE0000000 size=0x08000000 type=write-combining" >| /proc/mtrr
    # Video Card: 3712-3968 128M
    echo "base=0xE8000000 size=0x08000000 type=write-combining" >| /proc/mtrr

    # System highmem
    echo "base=0x100000000 size=0x40000000 type=write-back" >| /proc/mtrr
    RETVAL=0
  ;;
esac

exit $RETVAL

Now, exit and use chkconfig to make sure this gets run at bootup.

# chkconfig --add fix_mtrr

To test, you can reboot now. After rebooting, check your /proc/mtrr again and make sure that it is the way it should be. If it is, you are done for the most part! Buy yourself a beer! :)

Install fglrx

First you will have to pull in livna repos

# rpm -Uvh http://rpm.livna.org/livna-release-8.rpm

Then, install the binary drivers packaged by livna

 yum install kmod-fglrx

Enable fglrx

# fglrx-config-display enable

Fix grub

IMPORTANT! Fix grub so that it wouldn't boot up into rhgb a.k.a graphical buffer console

# vim /boot/grub/grub.conf

In the line

        kernel /vmlinuz-<something>.fc8 ro root=/dev/VolGroup00/LogVol00 rhgb quiet

Make it so that it now shows, without rhgb

        kernel /vmlinuz-<something>.fc8 ro root=/dev/VolGroup00/LogVol00 quiet

Done!

There! You're done now. Reboot and you should see the X11 comes up.

# fglrxinfoCC
display: :0.0  screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Radeon HD 2400 XT
OpenGL version string: 2.1.7537 Release