blino's website

Free software developer and more

This week-end, I decided to buy a new PCI-E video card, with a passive cooling solution, since the default ATI fan of my ASUS EAX550 was really noisy. So, it took my rollers to go rue Montgallet and find a silent one. The first shop tried to sell me the exact same card as silent, but of course, I didn't "bought" it :-p

Most shops only had passive cooling cards from Nvidia, but I preferred to get an ATI one, since they're usually better supported by free-software drivers. Finally, I bought a cheap (55 euros) MSI RX2400PRO card, with a big heat sink, but also with 256MB of memory and a lot of HDTV features that I'll probably never use...

Though, at first boot, harddrake automatically configured the card to use the fbdev driver, which was not a good sign regarding support in free-software drivers /o\

X didn't start with the free radeon driver, and it even failed with ATI's proprietary fglrx driver (8.39.4). Adam's post on cooker reminded me about the avivo driver. It supports r5xx chipsets only, while mine is a r610 HD 2400 chipset (device ID 0x94c3). According to the avivo developpers, it should be possible to make this driver support r6xx cards (daniels post).

This post also mentions how to further debug the driver, using these tools:

  • avivotool
  • xresprobe (hacked by airlied)
  • valgrind (hacked version), (it has to be patched to build with glibc-2.6, for example with a rediffed version of the gentoo patch)

An article on Phoronix (AMD Radeon HD 2000 Series & Linux) showed that it won't be that easy to get r6xx support in avivo. Following the same track, I patched the avivo driver to list my chipset device ID, but I got the same error message when starting X:

xf86MapVidMem: Could not mmap framebuffer (0xb0000000,0x0) (Invalid argument)

So, I hopped in the #dri-devel channel to bug the driver developpers (mainly Jerome Glisse). The initial advice was that the radeon memory size register was not at the same offset in the BIOS anymore. Eek. And that I could grep for the memory size in a BIOS dump. Eek.

Actually, I just had to use the radeondump tool (radeondump HOWTO), and search for my memory size in the registers. It appeared to be in kB, so I grepped 0x00040000 (256*1024, since the card has 256MB) in the dump. It gave a few hits, and 0x168 was apparently the correct offset.

(II) avivo(0): No connector table in BIOS
(EE) avivo(0): No valid modes.

Trying ./avivotool/avivotool romtables shows the same No connector table in BIOS error message (after fixing avivotool check for mmap() return code). Even if the BIOS header reads ATOM, it seems that the format is different from other r4xx/r5xx chipsets. So, a new video BIOS format, fun in prospect!

I saved the BIOS rom in a file to make debugging easier:

$ lspci | grep VGA
01:00.0 VGA compatible controller: ATI Technologies Inc Unknown device 94c3
# cp /sys/bus/pci/devices/0000:01:00.0/rom r610.rom
# ./avivotool/avivotool romtables r610.rom

Besides the source code of avivotool, I used some other Radeon BIOS dumps (r420, r520, r530, r580) as examples to guess the BIOS format, and notably to find where the connector table is hidden in my BIOS. The HowVideoCardsWork article from Xorg wiki was quite handy to get basic information about CRTC and connectors, since I'm a total n00b here.

I had to do some hex maths, so I used bc as hexadecimal calculator (tips about base modes) (more tips about hexadecimal). Maybe I could have used emacs-calc, or pixel's hexedit, but anyway I ended writting a lot of debug code to show hex numbers in the format I wanted to guess connectors offset. But so far, I have not found any relevant pattern :-/

Yesterday, I knew nothing about all this stuff, and here I am, parsing hex numbers (and again following warly's steps :-p)... I can't believe me, I should really take a break. Someday.



blosxom Optimised for standards.
Olivier Blin (2005)