Saturday, June 11, 2011

Accidental success - Working DRI on iBook G4

I upgraded the Ubuntu installation my iBook G4 recently to 10.10 version (Maverick Meerkat). Ubuntu has worked pretty well on this laptop considering that powerpc is not officially supported architecture.
Compared to 10.04 the video/graphics performance is certainly better in 10.10. There are no blocking artifacts in video playback with totem/VLC. The one thing I wanted to test is if DRI works. Unfortunately it does not work by default. AFAIK this is because the radeonfb driver is built in the kernel and it doesn't allow the radeon driver to take over. This also means that hardware acceleration is not enabled.


onkar@iBook:~$ dmesg |grep radeon # radeonfb module loaded, not radeon
[    0.629237] radeonfb 0000:00:10.0: enabling device (0006 -> 0007)
[    0.824915] radeonfb 0000:00:10.0: Invalid ROM contents
[    0.824925] radeonfb (0000:00:10.0): Invalid ROM signature 0 should be 0xaa55
[    0.824934] radeonfb: Retrieved PLL infos from Open Firmware
[    0.824942] radeonfb: Reference=27.00 MHz (RefDiv=12) Memory=190.00 Mhz, System=183.00 MHz
[    0.824947] radeonfb: PLL min 12000 max 35000
[    1.734848] radeonfb: Monitor 1 type LCD found
[    1.734852] radeonfb: EDID probed
[    1.734856] radeonfb: Monitor 2 type no found
[    1.734870] radeonfb: Using Firmware dividers 0x000600ad from PPLL 0
[    1.873860] radeonfb: Dynamic Clock Power Management enabled
[    1.916986] radeonfb: Backlight initialized (radeonbl0)
[    1.916991] radeonfb (0000:00:10.0): ATI Radeon 5c63 "\c"
[    6.978088] [drm] radeon defaulting to kernel modesetting.
[    6.978102] [drm] radeon kernel modesetting enabled.
[   72.399727] radeonfb 0000:00:10.0: Invalid ROM contents
[   72.399919] radeonfb 0000:00:10.0: Invalid ROM contents
onkar@iBook:~$ glxinfo |grep -i render # No hardware acceleration
direct rendering: Yes
OpenGL renderer string: Software Rasterizer
    GL_NV_conditional_render, GL_NV_depth_clamp, GL_NV_fragment_program,
onkar@iBook:~$ ls -l /dev/dri*
ls: cannot access /dev/dri*: No such file or directory
onkar@iBook:~$ cat /proc/fb
0 ATI Radeon 5c63


After looking through some search results in google I decided to try a simple kernel parameter - video=ofonly.
And it works. Following is result of same commands after booting.


onkar@iBook:~$ dmesg |grep radeon # radeon module loaded, radeonfb nowhere in the scene
[    5.863269] [drm] radeon defaulting to kernel modesetting.
[    5.863283] [drm] radeon kernel modesetting enabled.
[    5.863409] radeon 0000:00:10.0: enabling device (0006 -> 0007)
[    5.898390] radeon 0000:00:10.0: Invalid ROM contents
[    5.898411] radeon 0000:00:10.0: Invalid ROM contents
[    5.898419] [drm:radeon_get_bios] *ERROR* Unable to locate a BIOS ROM
[    5.898454] [drm:radeon_agp_init] *ERROR* Unable to acquire AGP: -19
[    5.898477] radeon 0000:00:10.0: VRAM: 128M 0x98000000 - 0x9FFFFFFF (32M used)
[    5.898485] radeon 0000:00:10.0: GTT: 512M 0x78000000 - 0x97FFFFFF
[    5.898550] [drm] radeon: irq initialized.
[    5.898751] [drm] radeon: 32M of VRAM memory ready
[    5.898757] [drm] radeon: 512M of GTT memory ready.
[    5.920977] [drm] radeon: ring at 0x0000000078000000
[    5.921436] [drm] radeon: ib pool ready.
[    6.566905] fb: conflicting fb hw usage radeondrmfb vs OFfb ATY,Via_B - removing generic driver
[    6.568244] fb1: radeondrmfb frame buffer device
[    6.568431] [drm] Initialized radeon 2.5.0 20080528 for 0000:00:10.0 on minor 0
onkar@iBook:~$ glxinfo |grep -i render # Direct rendering working, cheers. :-)
direct rendering: Yes
OpenGL renderer string: Mesa DRI R200 (RV280 5C63) 20090101 PowerPC/Altivec TCL DRI2
onkar@iBook:~$ ls -l /dev/dri*
total 0
crw-rw----+ 1 root video 226,  0 2011-06-08 22:15 card0
crw-rw----  1 root video 226, 64 2011-06-08 22:15 controlD64
onkar@iBook:~$ cat /proc/fb
0 OFfb ATY,Via_A
1 radeondrmfb


Caveats:
1. In boot sequence, after few text messages the screen goes completely blank for about 1 minute. It looks as if the screen is dead. But in the end the gdm shows up fine.
2. The consoles accessed through Ctrl + Alt + F1-F6 are no more available. When trying to access them the screen simply freezes and mouse cursor disappears. Good thing is that pressing Ctrl + Alt + F7 makes the display alive.

Notes:
The same kernel parameter does not work on Debian (testing). After the message about 'conflicting fb hw usage' appears on screen the boot process stops completely.

Next steps:
1. Now that hardware acceleration works, try Ubuntu 11.04 with it's infamous Unity interface (using live CD for now).
2. Try to rebuild the kernel to make radeonfb a module instead of being built in the kernel. Then check if DRI works without the special kernel parameter.

1 comment:

Anonymous said...

This is actually very ugly; if radeonfb is NOT built into the kernel, then suspend breaks, https://bugs.launchpad.net/bugs/779110

Rock, meet hard place.

-jh