Log in

No account? Create an account

Previous Entry | Next Entry

Road to upstream

I have been working on porting radeon kernel modesetting to new ttm developed at VMware by Thomas Hellstrom. Just to avoid confusion ttm is used inside the driver the API we expose to userspace is the GEM api. I cleaned up the radeon code along the way and i feel it's now ready for wider range of tester ! Few words on the code itself, there is now a split between old drm path and new kernel modesetting path, i did so in order to avoid breaking old path while also being able to have a clean design & code for new kernel modesetting path. I am quite happy with how the code looks now, of course i am not the only one guilty about all this work Dave Airlie and Alex Deucher did lot of the original modesetting work, Dave also worked hard in last few month on mesa radeon rewrite which has root into Nicolai Haehnle initial work. Big kudos to Maciej Cencora (aka Osiris) for all improvement he done on the code. So here is a screenshot of what you can get with kernel modesetting, a decent ddx and proper mesa (radeon-rewrite branch) :

radeon newttm screenshot

So if you feel adventurous here are things you need:

git clone git://people.freedesktop.org/~glisse/drm-next
cd drm-next
git branch drm-next-radeon origin/drm-next-radeon
git checkout drm-next-radeon
Then usual kernel configuration just enable fbcon,ttm and radeon kernel modesetting.

git clone git://anongit.freedesktop.org/git/mesa/drm
cd drm
git branch modesetting-gem origin/modesetting-gem
git checkout modesetting-gem
./autogen.sh --prefix=/usr --libdir=/usr/lib64
(libdir is only needed if on x86-64)
sudo make install

git clone git://people.freedesktop.org/~glisse/xf86-video-ati
cd xf86-video-ati
git branch radeon-gem-cs3 origin/radeon-gem-cs3
git checkout radeon-gem-cs3
./autogen.sh --prefix=/usr --libdir=/usr/lib64
(libdir is only needed if on x86-64)
You also need the Xorg dev package from you distribution sudo yum-builddep xorg-x11-drv-ati.x86_64 (on fedora)
sudo make install

git clone git://anongit.freedesktop.org/git/mesa/mesa
cd mesa
git branch radeon-rewrite origin/radeon-rewrite
git checkout radeon-rewrite
./autogen.sh --prefix=/usr --libdir=/usr/lib64 --with-dri-drivers=radeon,r200,r300
(libdir is only needed if on x86-64)
sudo make install

Now once you reboot under new kernel you need to load radeon module with modeset=1, then your userspace should be all set, i know this needs many things to build but hopefully soon we could start merging little by little thing upstream and so it should end up in your distro. Anyway if you own an x200 (igp) or x1250/x1200 with intel CPU i would love to know if you got any issues with this code. Early tester are always appreciated and i would like to thanks spstarr, dilex, osiris, ... for their early testing and reporting on this code.

Forget to mention that suspend/resume should work flawlessly even if you are in a middle of quake3 game while spinning compiz cube (don't think it's a normal use case but you never know).

Of course performance are not yet what it used to be, but here is my todo list which should also bring us back somewhere near old performance and maybe even outperform old path :
-erase memory on bo allocation (security needed before upstreaming)
-more check on command stream (security needed before upstreaming)
-port & cleanup Dave's page allocator to avoid heavy cache flushing (performances)
-buffer swapping (performances)
-buffer tiling (performances)


( 43 comments — Leave a comment )
Apr. 30th, 2009 07:15 pm (UTC)
Problems with RS690

X doesn't start and I get the following messages in my xorg.conf

Too big adjustment 32
[drm:radeon_cp_init_kms] *ERROR* invalid ioctl with kms radeon_cp_init_kms
[drm:radeon_cp_init_kms] *ERROR* invalid ioctl with kms radeon_cp_init_kms
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
Too big adjustment 32
hda-intel: Invalid position buffer, using LPIB read method instead.
hda-intel: IRQ timing workaround is activated for card #1. Suggest a bigger bdl_pos_adj.
[drm:radeon_cp_init_kms] *ERROR* invalid ioctl with kms radeon_cp_init_kms
[drm:radeon_cp_init_kms] *ERROR* invalid ioctl with kms radeon_cp_init_kms

X boots up with with a vanilla 2.6.29 kernel but not with the drm-2.6 rawhide kernel branch

It does however work if I pass the boot parm radeon.modeset=0

Let me know if you'd like any more info / logs


Apr. 30th, 2009 10:39 pm (UTC)
Re: Problems with RS690
You didn't properly install the ddx or didn't compiled the right branch of the ddx or the right branch of libdrm (hard to say which one is not properly installed here).
Re: Problems with RS690 - ext_184748 - May. 1st, 2009 10:49 am (UTC) - Expand
Re: Problems with RS690 - swulf - May. 7th, 2009 08:21 pm (UTC) - Expand
Re: Problems with RS690 - ext_184748 - May. 8th, 2009 06:13 am (UTC) - Expand
May. 1st, 2009 12:35 am (UTC)
[drm] Initialized drm 1.1.0 20060810
[drm] radeon kernel modesetting enabled.
ACPI: PCI Interrupt Link [APC5] enabled at IRQ 16
radeon 0000:01:00.0: PCI INT A -> Link[APC5] -> GSI 16 (level, low) -> IRQ 16
[drm] radeon: Initializing kernel modesetting.
[drm] register mmio base: 0xD1000000
[drm] register mmio size: 65536
[drm] GPU reset succeed (RBBM_STATUS=0x10000140)
[drm] Detected VRAM RAM=512M, BAR=256M
[drm] RAM width 256bits DDR
agpgart-amd64 0000:00:00.0: AGP 3.0 bridge
agpgart-amd64 0000:00:00.0: putting AGP V3 device into 4x mode
radeon 0000:01:00.0: putting AGP V3 device into 4x mode
[drm] Limit VRAM to 256M
radeon: VRAM 256M
radeon: VRAM from 0x00000000 to 0x0FFFFFFF
[drm] radeon: GTT 512M
[drm] radeon: GTT from 0x20000000 to 0x3FFFFFFF
[drm] GART: num cpu pages 0, num gpu pages 0
[drm] Clocks initialized !
[drm] radeon: irq initialized.
TTM available graphics memory: 1005 MiB
TTM available object memory: 1005 MiB
[drm] radeon: 256M of VRAM memory ready
[drm] radeon: 512M of GTT memory ready.
[drm] radeon: 3 pipes initialized.
[drm:radeon_invalid_rreg] *ERROR* Invalid callback to read register 0x0010
------------[ cut here ]------------
Kernel BUG at ffffffffa00bce2b [verbose debug info unavailable]
invalid opcode: 0000 [#1] SMP
last sysfs file: /sys/class/drm/version
Modules linked in: radeon(+) ttm drm unionfs squashfs fuse usbhid ohci_hcd ehci_hcd amd64_agp usbcore agpgart
Pid: 4251, comm: modprobe Not tainted 2.6.29 #1
RIP: 0010:[] [] 0xffffffffa00bce2b
RSP: 0018:ffff880078c89c88 EFLAGS: 00010292
RAX: 000000000000004e RBX: ffff88007ce88000 RCX: 0000000000003fff
RDX: ffff880001029000 RSI: 0000000000000046 RDI: ffffffff806961d4
RBP: 0000000000000000 R08: 0000000000007cd6 R09: 00000000ffffffff
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88007f01c800
a R13: 0000000000000019 R14: ffffffffa011f140 R15: ffff88007f945370
FS: 00007fff14c00730(0000) GS:ffff880001029000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 000000000067d078 CR3: 0000000078cad000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process modprobe (pid: 4251, threadinfo ffff880078c88000, task ffff88007c7f9cc0)
0000000000000000 ffffffffa00db89f ffff88007ce88000 ffffffffa00de436
ffff88007ce88000 ffffffffa00bd6ad ffff88007f945000 ffff88007f945000
ffff88007ce88000 0000000000400019 ffffffffa011d200 ffffffffa00be0be
Call Trace:
[] ? 0xffffffffa00db89f
[] ? 0xffffffffa00de436
[] ? 0xffffffffa00bd6ad
[] ? 0xffffffffa00be0be
[] ? 0xffffffffa0081f6b
[] ? 0xffffffff803a9032
[] ? 0xffffffff803a98e4
[] ? 0xffffffff80426b3a
[] ? 0xffffffff80426c50
[] ? 0xffffffff80252fcd
[] ? 0xffffffff80426de3
[] ? 0xffffffff80426d50
[] ? 0xffffffff8042644b
[] ? 0xffffffff80425c22
[] ? 0xffffffffa0128000
[] ? 0xffffffffa0128000
[] ? 0xffffffff804270ae
[] ? 0xffffffffa0128000
[] ? 0xffffffff803a9b8c
[] ? 0xffffffff8020904b
[] ? 0xffffffff8025fa5f
[] ? 0xffffffff8020b31b
Code: fe 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 89 f2 48 83 ec 08 48 c7 c6 80 dc 10 a0 48 c7 c7 e8 75 11 a0 31 c0 e8 42 11 47 e0 <0f> 0b eb fe 90 41 56 b8 ed ff ff ff 41 55 41 54 41 89 f4 55 48
RIP [] 0xffffffffa00bce2b
May. 1st, 2009 12:35 am (UTC)
Re: segfault
my video:
01:00.0 VGA compatible controller: ATI Technologies Inc Radeon X1950 GT (rev 9a) (prog-if 00 [VGA controller])
Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 16
Memory at c0000000 (32-bit, prefetchable) [size=256M]
I/O ports at a000 [size=256]
Memory at d1000000 (32-bit, non-prefetchable) [size=64K]
[virtual] Expansion ROM at d0000000 [disabled] [size=128K]
Capabilities: [50] Power Management version 2
Capabilities: [58] AGP version 3.0
Capabilities: [80] MSI: Mask- 64bit+ Count=1/1 Enable-
Re: segfault - jglisse - May. 1st, 2009 09:21 am (UTC) - Expand
Re: segfault - nikespawn - May. 1st, 2009 01:11 pm (UTC) - Expand
Re: segfault - nikespawn - May. 1st, 2009 01:40 pm (UTC) - Expand
Re: segfault - jglisse - May. 1st, 2009 08:15 pm (UTC) - Expand
Re: segfault - nikespawn - May. 2nd, 2009 12:40 am (UTC) - Expand
May. 2nd, 2009 08:51 am (UTC)
Basic kernel compile issues
I had trouble with compiling for x86_64 that I fixed with the patch listed here:

Now I'm having trouble with errors like the following:
drivers/gpu/drm/radeon/atombios_crtc.c:29:26: error: radeon_fixed.h: No such file or directory

Am I just too n00b to do this, or is this an x86_64 issue again?
May. 2nd, 2009 08:35 pm (UTC)
Re: Basic kernel compile issues
Re: Basic kernel compile issues - mefcon1 - May. 3rd, 2009 05:15 am (UTC) - Expand
May. 4th, 2009 08:22 pm (UTC)
KMS and "No Signal"
After loading radeon module with option modeset=1
monitor doesn't get any signal from card(No Signal).
Output from dmesg(drm debug=1)
It also contains output from blindly starting X(gdm actually).
Log from X:

Radeon X1650 pro
Philips 200VW
Asus M2A-VM
May. 4th, 2009 10:31 pm (UTC)
Re: KMS and "No Signal"
maybe forgot enable console fb in kernel? (like me :) )
Re: KMS and "No Signal" - ext_171321 - May. 4th, 2009 11:07 pm (UTC) - Expand
Re: KMS and "No Signal" - ext_171321 - May. 5th, 2009 11:24 am (UTC) - Expand
Re: KMS and "No Signal" - ext_171321 - May. 5th, 2009 12:55 pm (UTC) - Expand
Re: KMS and "No Signal" - ext_171321 - May. 7th, 2009 03:43 pm (UTC) - Expand
Re: KMS and "No Signal" - jglisse - May. 7th, 2009 08:49 pm (UTC) - Expand
May. 5th, 2009 07:49 pm (UTC)
git repository access over http?
I'm behind a firewall that doesn't allow git traffic. It seems like normally I can just swap "git://" for "http://" and make that work, but it doesn't seem to work for several of the git repositories listed here.

Is there anything I can do to make this work over http?

$ git clone http://people.freedesktop.org/~glisse/drm-next
Initialized empty Git repository in .../drm-next/.git/
fatal: http://people.freedesktop.org/~glisse/drm-next/info/refs not found: did you run git update-server-info on the server?
May. 7th, 2009 02:01 pm (UTC)
Excellent work!
Some feedback on your excellent work.

Thinkpad T60p, FireGL V5200, 1600x1200

Framebuffer console at full resolution, very fast, a lot faster than vesafb.

Compiz works with no problems whatsoever, very fast, no visible tearing

glxgears on a spinning cube and with wobbliness

Smooth scrolling in Firefox, Fast Konsole in KDE


Wolfenstein/Quake worked on first try, then crashed ingame. Second start comes up with unplayably slow graphics.

Video: XV does not scale correctly. Only shows part of the picture in the video, no matter whether in window mode or fullscreen. I suspect that a video at 1600x1200 would play perfoct with -vo xv.

However: This will please you:

[swscaler @ 0x896d350]SwScaler: 720x576 -> 1024x576
VO: [gl2] 1024x576 => 1024x576 BGR 24-bit [fs] [zoom]
IRQ's not enabled, falling back to busy waits: 2 0
[gl2] You have OpenGL >= 1.2 capable drivers, GOOD (16bpp and BGR is ok!)
[gl2] antialiasing off
[gl2] bilinear linear

and a perfectly smooth video.

Just my first impressions. Could you give some hints as to how to update the individual bits and when to do so? I am not that familiar with git and its update mechanism.

Anyway, thanks for the great, excellent work!
May. 22nd, 2009 02:12 am (UTC)
Re: Excellent work!
Not sure if it'll help to mention this here, since the relevant parties are probably in communication with each other, but I found a diff/patch over in the Phoronix forums that might help a bit:


I applied it against my copy of radeon-rewrite, and the video window is improved, but I'm still getting major cropping. It's probably going down the right path though.
Re: Excellent work! - awatry - May. 22nd, 2009 01:53 pm (UTC) - Expand
Re: Excellent work! - ext_186272 - May. 30th, 2009 03:01 pm (UTC) - Expand
Re: Excellent work! - ext_186272 - Jun. 2nd, 2009 08:21 pm (UTC) - Expand
May. 10th, 2009 01:55 pm (UTC)
modeset failed on my 3850 AGP
I'm not so lucky. With jglisse's drm-next tree, radeon modeset failed.

I have X86, VIA KT600 and HD3850 AGP.
X.Org X Server git://anongit.freedesktop.org/git/xorg/xserver
libdrm: git://anongit.freedesktop.org/git/mesa/drm:modesetting-gem

kernel command lines: (both failed)
root=/dev/sda5 read-only hpet=force fbcon=scrollback:128K drm.debug=1 radeon.modeset=1
root=/dev/sda5 read-only hpet=force fbcon=scrollback:128K drm.debug=1 radeon.modeset=1 radeon.agpmode=-1


Linux agpgart interface v0.103
agpgart: Detected VIA KT400/KT400A/KT600 chipset
agpgart-via 0000:00:00.0: AGP aperture is 256M @ 0xc0000000
[drm] Initialized drm 1.1.0 20060810
[drm] radeon kernel modesetting enabled.
radeon 0000:01:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
[drm:drm_get_minor] new minor assigned 64
[drm:drm_get_minor] new minor assigned 0
[drm] radeon: Initializing kernel modesetting.
[drm] Forcing AGP to PCIE mode <--- with agpmode=-1
[drm:radeon_driver_load_kms] *ERROR* Failed to initialize radeon, disabling IOCTL
[drm:drm_put_minor] release secondary minor 0
radeon 0000:01:00.0: PCI INT A disabled
radeon: probe of 0000:01:00.0 failed with error -22

Airlied's drm-2.6 tree with same config is more successfull with radeon modeset.
[drm:drm_get_minor] new minor assigned 0
[drm:radeon_driver_load] AGP card detected
[drm] Forcing AGP to PCIE mode
[drm:drm_addmap_core] offset = 0xe0020000, size = 0x00010000, type = 1
[drm:radeon_get_bios] ATOMBIOS detected
ATOM BIOS: 113-AB43300-104 RV670 GDDR3_16MX32 256BIT 512MB 669E/829M
[drm:radeon_get_vram_type] RAM width 128 bits DDR
[drm] Detected VRAM RAM=524288K, accessible=262144K, BAR=262144K
[drm:radeon_get_atom_connector_info_from_object_table] *ERROR* record type 1
[drm:radeon_get_atom_connector_info_from_object_table] *ERROR* record type 2
[drm:radeon_get_atom_connector_info_from_object_table] *ERROR* record type 4
[drm:drm_sysfs_connector_add] adding "DVI-I-1" to sysfs

After this I have fb console with resolution 1280x1024 75Hz only - EDID failed. Xorg has no problem with EDID.

On KMS enabled kernels I have slideshow with xf86-video-ati 6.12.2 and 9999 (git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ati:master) ;)
With xf86-video-ati from git://people.freedesktop.org/~airlied/xf86-video-ati:radeon-gem-cs3 or git://people.freedesktop.org/~glisse/xf86-video-ati:radeon-gem-cs3, I ended with black screen, with cursor blinking in the upper left corner. :(

[6] 0 0 0x000b8000 - 0x000bffff (0x8000) MS[B]
[7] -1 0 0x0000ffff - 0x0000ffff (0x1) IX[B]
[8] -1 0 0x00000000 - 0x00000000 (0x1) IX[B]
[9] 0 0 0x000003b0 - 0x000003bb (0xc) IS[B]
[10] 0 0 0x000003c0 - 0x000003df (0x20) IS[B]
(II) Setting vga for screen 0. <--- this is the end of Xorg.0.log

Do you have an idea why jglisse's drm-next failed on my AGP radeon?
And why xorg failed too?
May. 22nd, 2009 11:25 am (UTC)
Re: modeset failed on my 3850 AGP
There is no support for r6xx/r7xx (so your card is not supported) hw yet.
Re: modeset failed on my 3850 AGP - qjim - May. 22nd, 2009 12:14 pm (UTC) - Expand
May. 15th, 2009 02:40 am (UTC)
non-x86 build issue
hi. i've been trying to get it working on a ppc32 machine, and it appears the current radeon module is effectively x86-bound through indirect inclusion of the arch-specific header asm/iomap.h:

CC [M] drivers/gpu/drm/radeon/radeon_device.o
In file included from drivers/gpu/drm/radeon/radeon.h:51,
from drivers/gpu/drm/radeon/radeon_device.c:33:
include/linux/io-mapping.h:24:23: error: asm/iomap.h: No such file or directory
make[4]: *** [drivers/gpu/drm/radeon/radeon_device.o] Error 1
make[3]: *** [drivers/gpu/drm/radeon] Error 2
make[2]: *** [drivers/gpu/drm] Error 2
make[1]: *** [drivers/gpu] Error 2
make: *** [drivers] Error 2

now, my understanding is that asm/iomap.h should be only included through asm/io.h, rather than directly, as it the case above. actually, io-mappings.h already includes asm/io.h. so i patched the offending inclusion from it and the module built fine on ppc. i still haven't finished with the rest, so i cannot report anything from actually trying to run the edge, but hopefully i will soon.

an rv280 user here.
May. 27th, 2009 02:10 am (UTC)
Re: non-x86 build issue
first results from the ppc32 front:

while the kernel modesetting part works flawlessly, resulting in a fully-operational fbcon, the drm part fails at drmOpenDevice (Xorg.log applied)


dmesg has next to nothing on the subject aside from the following two consecutive lines:

Re: non-x86 build issue - b1u - Jun. 18th, 2009 03:10 am (UTC) - Expand
May. 15th, 2009 01:52 pm (UTC)
Problems with suspend
Works fine on Thinkpad T60, radeon x1300, except that coming back from suspend leaves the display blank (disk still active due to a compile running when I suspended). If i switch to other VTs from this state then the screen flashes garbage.

This is on debian 5 with xorg from unstable, 32-bit.

Oh, with mesa (radeon-rewrite, DRI2), there are seams of black pixels between triangles. For example in glxgears you can see the component triangles of the gears due to these artifacts. Otherwise GL performance is ok.
May. 22nd, 2009 12:44 am (UTC)
Re: Problems with suspend
Agreed. I was having some, probably, unrelated issues with video acceleration (slideshow) and decided to try to suspend. The laptop suspended successfully, but when I resumed, I had a bunch of random garbage characters on screen. By switching back and forth from a VT to X, the pattern of junk characters changed, but the system was unusable.

I rebooted and tried to suspend again, got the same results. I'm trying to dig up some debug info from the logs, and it looks like the only useful bit of info is from dmesg...


[ 237.098166] [drm] [radeon_suspend_kms 682]
[ 237.179813] [drm:radeon_bo_move] *ERROR* CP is not ready use memcpy.

There's another radeon_bo_move error on resume from suspend as well.

There is nothing that I see as relevant in the Xorg.0.log, but here that is as well:

Dell Inspiron 6000
Intel Pentium M 2.13Ghz
ATI Radeon Mobility x300 128MB (M22?)

Ubuntu 9.04
Re: Problems with suspend - ext_186272 - May. 30th, 2009 03:06 pm (UTC) - Expand
Jun. 10th, 2009 12:00 am (UTC)
KMS ioctrl failed
after last _big_ commit not work Xorg - no screen found
reinstall all..
messages http://pastebin.com/m158421c9
xorg.log http://pastebin.com/m2ed0ab89
Jun. 11th, 2009 03:32 pm (UTC)
Re: KMS ioctrl failed
I know one of the previous commits broke my X as well, but then I realized that the Xv patch that I had applied was preventing part of the git update process from completing. I'm not saying that this is necessarily the case for you, but it might be worth checking if there's a merge conflict of some sorts if you've applied any 3rd party patches.
Re: KMS ioctrl failed - nikespawn - Jun. 12th, 2009 11:08 am (UTC) - Expand
Re: KMS ioctrl failed - nikespawn - Jun. 13th, 2009 12:59 am (UTC) - Expand
Re: KMS ioctrl failed - nikespawn - Jun. 13th, 2009 03:02 pm (UTC) - Expand
Jun. 19th, 2009 07:19 am (UTC)
MESA EGL support help

I have an RS690 (x1200) device and the acceleration appears to be working ok for me following all the steps. what i would like to do though is to get the MESA EGL driver running. It compiles ok, but i have a problem running the test apps in mesa/progs/egl. An example being the eglscreen test. These appear to be initially developed for Intel drivers but presumably should work with any card so i modified the file to connect to the "EGL_r300" driver. The program has a problem on calling eglShowScreenSurfaceMESA, which goes down to an ioctl to DRM_IOCTL_MODE_SETCRTC to the kernel. This kills the screen although i see no errors reported and the only way to recover is to reboot the PC. Any ideas if this should work??

( 43 comments — Leave a comment )