In this page I explain how to obtain the 3D acceleration from the Asus A4K Ati Radeon 9700 mobility. To obtain this result a little fix in the MTRR registers is needed.

Some times ago I’ve found a solution to this problem and I wrote a guide on my Italian blog to set up this notebook.. I think i was the first one on the web who wrote how to solve this MTRR problem, then someone requested a translation of this part, and I’ve finally written it.

I’m still not very good with English, so if you have some correction they will be welcome :)

So.. here we are!

Overview

lspci

00:00.0 Host bridge: nVidia Corporation nForce3 Host Bridge (rev a4)
00:01.0 ISA bridge: nVidia Corporation nForce3 LPC Bridge (rev f6)
00:01.1 SMBus: nVidia Corporation nForce3 SMBus (rev a4)
00:02.0 USB Controller: nVidia Corporation nForce3 USB 1.1 (rev a5)
00:02.1 USB Controller: nVidia Corporation nForce3 USB 1.1 (rev a5)
00:02.2 USB Controller: nVidia Corporation nForce3 USB 2.0 (rev a2)
00:06.0 Multimedia audio controller: nVidia Corporation nForce3 Audio (rev a2)
00:06.1 Modem: nVidia Corporation nForce3 Audio (rev a2)
00:08.0 IDE interface: nVidia Corporation nForce3 IDE (rev a5)
00:0a.0 PCI bridge: nVidia Corporation nForce3 PCI Bridge (rev a2)
00:0b.0 PCI bridge: nVidia Corporation nForce3 AGP Bridge (rev a4)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:00.0 VGA compatible controller: ATI Technologies Inc RV350 [Mobility Radeon 9600 M10]
02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller (rev 13)
02:01.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev b3)
02:01.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C552 IEEE 1394 Controller (rev 08)
02:01.2 Generic system peripheral [0805]: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 17)
02:01.3 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 08)

Amd64 (K8) 3200+ with 512 MB of ram (i upgraded it to 2 GB) 400DDR, Ati Mobility Radeon 9700 with 128 MB of video ram, chipset nVidia nForce3 as audio card, agp bridge and usb controller. (Win)Modem 56k Conexant (Linuxant). Firewire IEEE 1394 e CARD Reader (SD/SDIO/MMC/MS…). 4 usb 2.0 ports e embedded usb wireless card.

Graphic Card

Open Drivers (radeon)

With the open drivers we can see some bad visual artifacts, the 3d acceleration seems to work, and have good results in some case, but miss some feature that lead to a fallback in software rendering in some case!

Here an example of the “visual artifacts” i was talking aboug: they happen at random, sometimes they aren’t there, sometimes worst then what you see here (click on the image to see it at full size)

Difetti Video Asus A4K con Driver Open

Fallback to software rendering happen when a not implemented OpenGL function is needed by an application, and all the 3d rendering is computed by the processor as if you don’ t have any 3d accelerated graphic card. Anyway open drivers keep getting better, it’s now possible to play games like Quake 3 or Tremulous without big problems.

They doesn’t support the SVIDEO TV output.

AIGLX + Compiz works (cube + wobble windows), but don’t expect all the plugins to work. Actually the windows resizing is very slow and the whole system become really slow with some effects.

GL_VERSION: 1.3 Mesa 6.5.1
GL_VENDOR: Tungsten Graphics, Inc.
GL_RENDERER: Mesa DRI R300 20060815 AGP 1x TCL

as you can see here the 1x AGP is used :/

Proprietary Drivers (fglrx)

For many use you need the ATI proprietary drivers (fglrlx), they support all the OpenGL features but the Composite extension (needed for AIGLX to work), they have some problem too as we will see later.

Go and take the fglrx drivers, then install as you like. The following part explain a way to install this driver, but you can use the way you like.

Installing the driver on Debian using apt-get and module assistant

I’ve Debian so i used apt-get (or you can use synaptic if you prefer a graphical interface):

$ apt-get install fglrx-driver fglrx-kernel-src fglrx-control fglrx-control-qt3 module-assistant

the last package (modul-assistant) is useful to compile the module
using module-assistant:

$ m-a a-i fglrx

this should compile and install the module driver for you graphic card

now edit /etc/X11/xorg.conf and change the driver from “radeon” to “fglrx

Section “Device”
Identifier “ATI Technologies Inc RV350 [Mobility Radeon 9600 M10]“
Driver “fglrx”
# Driver “radeon”
BusID “PCI:1:0:0″
Option “TVFormat” “PAL-B” # Italian Standard TV (for the SVIDEO output)

EndSection

restart X or reboot the system.

The 3D MTRR problem

at this point the visual artifacts are gone, but no 3d acceleration.. how can you check it?

i propose 2 way:

$ glxinfo
name of display: :0.0
display: :0 screen: 0
direct rendering: No <————————— no 3d acceleration

or

$ fglrxinfo
display: :0.0 screen: 0
OpenGL vendor string: Mesa project: www.mesa3d.org
OpenGL renderer string: Mesa GLX Indirect
OpenGL version string: 1.2 (1.5 Mesa 6.4.2)

MESA are software OpenGL drivers wich doesn’t use the graphic card.

now notice

$ dmesg

[fglrx] Maximum main memory to use for locked dma buffers: 1899 MBytes.
[fglrx] module loaded – fglrx 8.27.10 [Jul 27 2006] on minor 0
ACPI: PCI Interrupt Link [LNKE] enabled at IRQ 11
ACPI: PCI Interrupt 0000:01:00.0[A] -> Link [LNKE] -> GSI 11 (level, low) -> IRQ 11
mtrr: no more MTRRs available
[fglrx:firegl_addmap] *ERROR* mtrr allocation failed (-28)
[fglrx] Internal AGP support requested, but kernel AGP support active.
[fglrx] Have to use kernel AGP support to avoid conflicts.
[fglrx] AGP detected, AgpState = 0x1f00421b (hardware caps of chipset)
mtrr: no more MTRRs available
[fglrx:firegl_unlock] *ERROR* Process 4540 using kernel context 0

and /var/log/Xorg.0.log contains:

(II) fglrx(0): [drm] register handle = 0×00004000
(EE) fglrx(0): [agp] unable to acquire AGP, error “xf86_ENOSPC”
(EE) fglrx(0): cannot init AGP
(II) fglrx(0): [drm] removed 1 reserved context for kernel
(II) fglrx(0): [drm] unmapping 8192 bytes of SAREA 0×2000 at 0xb71af000
(WW) fglrx(0): ***********************************************
(WW) fglrx(0): * DRI initialization failed! *
(WW) fglrx(0): * (maybe driver kernel module missing or bad) *
(WW) fglrx(0): * 2D acceleraton available (MMIO) *
(WW) fglrx(0): * no 3D acceleration available *
(WW) fglrx(0): ********************************************* *

and here the problem:

$ cat /proc/mtrr
reg00: base=0×00000000 ( 0MB), size= 16MB: write-back, count=1
reg01: base=0×01000000 ( 16MB), size= 16MB: write-back, count=1
reg02: base=0×02000000 ( 32MB), size= 32MB: write-back, count=1
reg03: base=0×04000000 ( 64MB), size= 64MB: write-back, count=1
reg04: base=0×08000000 ( 128MB), size= 128MB: write-back, count=1
reg05: base=0×10000000 ( 256MB), size= 256MB: write-back, count=1
reg06: base=0×20000000 ( 512MB), size= 512MB: write-back, count=1
reg07: base=0×40000000 (1024MB), size=1024MB: write-back, count=1

understanding the problem

now…. many of you will ask ourself: what the hell is MTRR? more or less i asked myself the same question sometimes ago.. (it token me a lot of time to figure out the problem was here). Briefly: it’s a technology to control the way the processor access to memory areas; it can boost the writing/reading performance of data from memory up to 250%. This is very useful to access the AGP and the video ram.

So… where’s the problem? There are 8 available register for MTRR on any system, in my ( your?) system they are all busy! I’ve 2 GB of Ram, the first 7 ones are taken by the first GB, and the last one for the second GB.

When the X server get loaded ( graphic server) it try to automatically load the agp modules for your video card; each module will try to add MTRR registers for is own memory, if all register are busy it will give some error and the will disable all the stuff that need MTRR to work leaving you without a 3D acceleration.

i take one of this register to explain its meaning:

reg01: base=0×01000000 ( 16MB), size= 16MB: write-back, count=1

register 1 (the 2nd, it start from zero)

it refers to the memory area from address “base” to “base+size“.

now, the memory address are usually are written in hexadecimal format: so 0×01000000 in hexadecimal is the Byte 16777216 in decimal, you can check this by using the calculator of your system. If you divide that number by 1024 for two times you will get the MBytes… guess what is that number? 16 MB, is the one written between the brackets.

this mean it start from 16 MB and has a size of 16 MB; now check all the registers, they are a remapping of the first 2 GB, in other words: the first register start at 0 MB and go until 16 MB, the second start from 16 MB and go to 32 MB, the third register start at 32MB and go to 64MB, and so on, without a blank space between one register to the next one. And they all are of the same type (write-back, count=1 )

NOTE: since only 2 register are needed for the agp and graphic card probably you suffer of this problem only if you have more then 512MB. If you have 512MB of Ram you should have 2 register free, either case the patch doesn’t hurt :)

Now i show you how to solve the problem…

How to solve the problem

The best solution I’ve found is to reconstruct the MTRR registers structure adding a script at boot time to fix them. Copy and paste this script in /etc/init.d/ ( let’s call it fix-mtrr )then create a simbolic link in /etc/rcS.d/ to start this soon after “mountkernfs.sh”. ( ln -s /etc/init.d/fix-mtrr /etc/rcS.d/S03fix-mtrr ). Reboot and you should have a working 3D using the MTRR boost up. Here the script, YOU HAVE TO ADAPT IT TO YOUR RAM AMOUNT as explained down here

#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          mtrr-fix
# Required-Start:    mountkernfs
# Required-Stop:
# Default-Start:     S
# Default-Stop:
### END INIT INFO

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

. /lib/lsb/init-functions

case "$1" in
start)
	log_action_begin_msg "Fixing MTRR..."
	for i in 1 2 3 4 5 0 6 7;
	do
		echo "disable=$i" >| /proc/mtrr;
	done;
	echo "base=0x00000000 size=0x80000000 type=write-back" >| /proc/mtrr
	log_action_end_msg 0
	;;

*)
	echo "Usage: /etc/init.d/fix-mtrr {start}"
	exit 1
	;;
esac

exit 0

if for any reason this script didn’t work try this out

#!/bin/sh
for i in 1 2 3 4 5 0 6 7;
do
	echo "disable=$i" >| /proc/mtrr;
done;
echo "base=0x00000000 size=0x80000000 type=write-back" >| /proc/mtrr

any script you chose.. pay attention to this line:

for i in 1 2 3 4 5 0 6 7;

this is good if you have 2GB of RAM, if you have 1 GB you have to delete the number “7″, if you have 512 you have to remove numbers “6″ and “7″.

how can you understand how to do it generally? from the output of “cat /proc/mtrr“, the numbers in that line should be the ones of type “write-back” in the mtrr table

now pay attention to this line too:

echo “base=0×00000000 size=0×20000000 type=write-back” >| /proc/mtrr

Change the bold value to match your RAM amount, ( I’m talking of your system RAM, NOT the Video Ram), you can use this list to found out what’s the right number for you.

128 MB = 0×08000000
256 MB = 0×10000000
512 MB = 0×20000000
1 GB = 0×40000000
2 GB = 0×80000000

Step by step:

  1. create a new text file and copy the script above in it
  2. adapt the script to your amount of ram following the instructions above
  3. save the file and call it “fix-mtrr”
  4. now give that file the execution permission ( chmod +x fix-mtrr ) and copy it in /etc/init.d/ ( you will need root rights to copy it in this directory )
  5. now create a symbolic link to get it automatically launched at boot time: ln -s /etc/init.d/fix-mtrr /etc/rcS.d/S03fix-mtrr
  6. reboot

now your 3D acceleration should work

$ fglrxinfo
display: :0.0 screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: MOBILITY RADEON 9700 Generic
OpenGL version string: 2.0.6011 (8.28.8)

Alternative / old / harder / worst method

this method disable the mtrr in the fglrx driver, this means you will NOT have the 250% boost up of the MTRR technology. This was my first solution.. I wrote this here to remember it and to give a more complete understanding of “how it work” to the reader

you need to manually modify and recompile the fglrx module for this to work, so alternative/automatic method will not work with this solution :)

in the directory of the source code of the module /usr/src/modules/fglrx-kernel/fglrx/build_mod/

edit the file firegl-public.c substituting all occurrences of CONFIG_MTRR with XCONFIG_MTRR. (if you use Vim you can do this with this command “:%s/CONFIG_MTRR/XCONFIG_MTRR/g“)

what this editing does? it makes the fglrx module to think that kernel doesn’t have an MTRR support build into it. The driver got compiled in a different way that doesn’t use the MTRR this way.

Some consideration

I think the MTRR problem is due to a bug in the bios. But I’m not sure about it

the following doesn’t depend on the MTRR problem/fix, they depends on the Ati fgrlx drivers, and could be different in each version of the drivers, they are referred to the 8.28.8 drivers

The fglrx driver sometimes lead my system to a complete crash. This happen at random.. and not very often if you don’t use 3D screensavers, but is really annoying… please.. ATI.. write a decent driver!

Clone Screen (TV out) work out of the box.. you just have to restart X server or reboot when you connect a TV to the SVIDEO output. If you have a PAL TV (cause you live in Europe for example) you will see in Black and White.. just add Option “TVFormat” “PAL-B” to your xorg.conf. I didn’t find a way to change the primary screen, so if you use the XV extension for video playback you have to disable it to see your films/video on the TV, i usually use the GL extension

Aiglx doesn’t work because ATI doesn’t want to support the Composite Extension needed by Aiglx for now. This mean you can have Compiz or Beryl running using the proprietary Driver, unless you decide to install XGL, and this isn’t really user friendly.

I’m not upgrading my fglrx driver because last time i tried the TV out stopped to work.

Hope this will be helpful to someone

24 Risposte a “AsusA4K MTRR Solution – Eng”


  1. [...] You can find the MTRR solution part English translation here [...]

  2. Susanne Says:

    hi Mastro,
    despite your excellent HowTo I couldn’t succeed…
    I did everything as you described it – created the script by copying, put it into /etc/init.d, made it executable, created the link in ./rcS.d, attached the fix-mtrr command to my “depend-start” (I’m running a Suse10.2) – but nothing happens – I can’t find any hint in boot.msg or messages that the script worked. The mtrrs are unchanged.
    I also tried to copy the script directly into boot.local, but then I got an error: it said “write error” when trying to execute that line
    echo “base=0×00000000 size=0×20000000 type=write-back” >| /proc/mtrr
    so, with all mtrrs disabled and no ones set the system is no longer accessable in a reasonable manner…

    I have also a Fedora7 on my machine and tried it there too. But there is no directory “rcS.d” so I put the link into “rc5.d”
    my knowledge is too low to estimate this being the right place… anyway, the script will be started, but not executed because of error message regarding the line
    echo “Usage: /etc/init.d/fix-mtrr {start}”
    obviously the system doesn’t know what to do with “Usage”…

    so, I must say, I’m lost now… it was not my first attempt in fixing that ugly mtrr problem – I tried almost evrything I could find on the internet – finally I rebuilt my memory to 512 MB again…
    If you have any idea what I could try further I would be thankful otherwise I think it’s better to give up…
    thanks a lot anyway for your effort, this was very kind of you!
    best regards
    Susanne

  3. mastro Says:

    Susanne said,

    Agosto 31, 2007 a 21:10

    Mastro,
    I tried to post into the english part, it seems not to work…

    i’m sure it works
    probably you missed something

    tell me the output of
    cat /proc/mtrr
    and the output of
    fglrxinfo

    maybe a
    dmesg | tail
    could be useful too

  4. mastro Says:

    @susanne
    i think i found out the problem
    wordpress do some crap with the article when the “pre” tag is used…
    i fixed the script

    try to recreate it and re-modify it now :)
    sorry

  5. mastro Says:

    @susanne
    i think i know what the problem is..

    may be this script doesn’t work if you havent a debian system..

    i never thinked about this..
    but i will write a script that work with ANY system :)

    for now try the one up here.. i’ve fixed some crap that wordpress build in..

    thanks for your testing :D

    and.. i swear it.. it work.. i’m using it right now with 2GB ram :)

  6. Susanne Says:

    so I will be patient…:-) thanks a lot Mastro
    will go to bed now
    cheers
    Susanne


  7. [...] Here i explain how to fix this problem, it’s a translation of my italian article on my laptop. [...]

  8. Susanne Says:

    Mastro,
    it works !!!! :-) :-) :-) :-)
    I had to experiment a bit… most strange thing is, that, despite having only 1280 MB RAM I have to put in 0×80000000 (instead of 0×50000000, what I would expect being correct).
    I put the script in my boot.local, started and – voila :-) it worked.
    thanks a lot once more, you gave me the last drive to try it once more :-)
    all the best to you
    Susanne

  9. mastro Says:

    @Susanne
    that’s strange :D
    but i’m happy it work now!

    did you used the “short version” of the script?

    anyway.. i’m happy you have 3d acceleration now

  10. Maximus Says:

    I would like to see a continuation of the topic

  11. mastro Says:

    @Maximus
    what do you mean with “continuation of the topic” ?
    do you want me to translate the other part of my italian article too?

  12. kvik lån Says:

    Wonderful blog! I found it while browsing on
    Yahoo News. Do you have any tips on how to get listed
    in Yahoo News? I’ve been trying for a while but I never seem to get there! Many thanks

  13. Låne Penge Says:

    Heya i’m for the primary time here. I came across this board and I to find It really useful & it helped me out a lot. I hope to give one thing again and help others like you helped me.


  14. Herbal nutritional supplements can be purchased without any prescription and
    they are known to boost the body’s immune system. Using natural methods to treat acne severe General, and soon returned quickly to get your skin clean. ” Even as adults we can end up making trips to the emergency room to get treated for a painful – and sometimes dangerous – infection in our ears.

  15. Kris Says:

    Wow, that’s what I was looking for, what a information! existing here at this blog, thanks admin of this web site.

  16. Darin Says:

    It’s very straightforward to find out any matter on net as compared to textbooks, as I found this piece of writing at this web site.


  17. Which brings me to my First Tip when it comes to Teaching An Older Child the Alphabet
    and English Words: Do not assume that an older adopted child is the
    same as an ESL (English as a Second Language) Child.
    You can move to next challenge after that and can
    face other grammatical problems. Which places and which teachers offer you
    the best value for money, and which are the ones to stay away from.

  18. ipad 3 pris Says:

    I really like your blog.. very nice colors & theme. Did
    you make this website yourself or did you hire someone to do
    it for you? Plz answer back as I’m looking to construct my own blog and would like to know where u got this from. appreciate it

  19. Loretta Says:

    Thanks for any other informative web site. The
    place else may I get that type of information written in such an ideal way?

    I’ve a mission that I am simply now operating on, and I have been on the look out for such info.


  20. Deciding If You Should Buy Topsoil Or Stick With What
    You Have Now Choosing The Right Mulch For Your Garden – 3 Factors To Consider


  21. Asking questions are truly pleasant thing if you are not understanding something
    entirely, however this piece of writing offers nice understanding even.


  22. Also, while you’re waiting for your files to download, you can entertain yourself with one of the site’s music videos.

    With this, you might be of the knowledge that a lot of research is needed in knowing the best ones.
    com: his is the place to go if you want to get free downloadable music for MP3
    players.


  23. Good day I am so thrilled I found your blog, I really found you by
    mistake, while I was looking on Askjeeve for something else, Anyhow I am here
    now and would just like to say thanks for a fantastic post and a all round interesting blog (I also love the theme/design),
    I don’t have time to read it all at the moment but I have saved it and also included your RSS feeds, so
    when I have time I will be back to read a great deal more,
    Please do keep up the excellent work.


  24. I’m more than happy to uncover this site. I wanted to thank you for ones time due to this wonderful read!! I definitely enjoyed every bit of it and I have you book-marked to check out new information on your website.

Lascia un Commento

Fill in your details below or click an icon to log in:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Connessione a %s...

Iscriviti

Ricevi al tuo indirizzo email tutti i nuovi post del sito.