PDA

View Full Version : Installing latest xf86-video-ati for r500 on Gentoo


JumJum
06-30-2008, 05:24 AM
For the first time since I bought my notebook (over two years ago), I now finally have what I consider a perfect linux install thanks to the r500 support in the xf86-video-ati-drivers.

The biggest advantages over the fglrx driver, when it comes to the r500 cards, are
1. HD video playback using xv without tearing. (Yay!)
2. Smooth Compiz-Fusion with AIGLX.
3. No need to run old kernel versions just because of video driver compatibility!
4. No more proprietary junk in /opt!

Some fglrx driver versions had decent xv, others had decent aiglx support. None of them have worked as well as should be expected.


This is development software which can and probably will mess stuff up for some people. It worked flawlessly for me, but don't try this if you're not willing to spend some time sorting out the quirks.

I started out with a baselayout without X and a vanilla 2.6.26-rc8 with the following config:
CONFIG_AGP=m
CONFIG_AGP_INTEL=m
CONFIG_DRM_RADEON=m

To get all the goodies we want and avoid dependency hell, we need to be running a newer version of xorg than the one in portage. The easiest way to to this is by adding the x11 overlay using layman.
layman -a x11

The git versions of xf86-video-ati and the xorg components and dependencies have to be unmasked by:
1. Adding the following to /etc/portage/package.keywords
#### xorg-server dev
x11-base/xorg-server **
=x11-libs/libpciaccess-0.10.2
=x11-proto/xproto-7.0.13
=x11-proto/inputproto-9999
=x11-apps/xauth-1.0.3
=x11-libs/libX11-9999
=x11-proto/xproto-9999
=x11-libs/libXrender-0.9.4
=x11-proto/renderproto-0.9.3
=x11-proto/xextproto-7.0.3
=x11-misc/xkeyboard-config-1.3
=x11-apps/xinit-1.0.8-r3
=x11-apps/rgb-1.0.3
=media-libs/mesa-9999
=x11-proto/dri2proto-1.1
=x11-libs/libXext-9999
=x11-proto/xextproto-9999
=x11-libs/xtrans-1.2
=x11-libs/libXi-9999
=x11-libs/pixman-0.11.4
=x11-libs/libXfont-1.3.2
=x11-drivers/xf86-video-ati-9999
=x11-drivers/xf86-input-mouse-9999
=x11-drivers/xf86-input-keyboard-9999
=x11-drivers/xf86-input-evdev-9999
=sys-apps/hal-0.5.11-r1
=dev-python/pyxf86config-0.3.34-r1
=app-misc/hal-info-20080310
=x11-proto/xf86driproto-9999
=x11-libs/libxcb-9999
=dev-lang/python-2.5.2-r5
=x11-proto/xcb-proto-9999
####

2. Adding the following to /etc/portage/package.unmask
#### xorg-server dev
=x11-proto/dri2proto-1.1
=x11-libs/pixman-0.11.4
=x11-drivers/xf86-video-ati-9999
=x11-libs/libdrm-9999
=media-libs/mesa-9999
=x11-drivers/xf86-input-keyboard-9999
=x11-base/xorg-server-9999
=x11-proto/xproto-9999
=x11-libs/libXext-9999
=x11-libs/libXi-9999
=x11-proto/xextproto-9999
=x11-drivers/xf86-input-mouse-9999
=x11-drivers/xf86-input-evdev-9999
=x11-libs/libX11-9999
=x11-libs/libXft-9999
=media-libs/fontconfig-9999
=x11-proto/inputproto-9999
=x11-proto/xf86driproto-9999
####

Make sure you have the line VIDEO_CARDS="radeon" in your /etc/make.conf and then install xorg (xf86-video-ati will be pulled in as a dependency)
emerge -av xorg-server

Edit your /etc/X11/xorg.conf to your liking. I'm using
Section "ServerLayout"
Identifier "X.Org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "USB Mouse" "AlwaysCore"
EndSection

Section "Module"
Load "ddc"
Load "vbe"
Load "GLcore"
Load "dbe"
Load "dri"
Load "extmod"
Load "glx"
Load "bitmap"
Load "freetype"
EndSection

Section "ServerFlags"
Option "AllowMouseOpenFail" "true"
Option "IgnoreABI" "on"
Option "AIGLX" "true"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "se"
Option "XkbVariant" ",winkeys,winkeys"
Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"
EndSection

Section "InputDevice"
Identifier "USB Mouse"
Driver "mouse"
Option "Device" "/dev/input/mice"
Option "SendCoreEvents" "true"
Option "Protocol" "IMPS/2"
Option "ZAxisMapping" "4 5"
Option "Buttons" "5"
EndSection

Section "Monitor"
Identifier "LVDS"
Option "VendorName" "Monitor"
Option "ModelName" "Generic"
Option "DPMS" "true"
EndSection

Section "Device"
Identifier "X1600"
Driver "ati"
Option "AGPMode" "8"
Option "AccelMethod" "EXA"
Option "ColorTiling" "on"
Option "EnablePageFlip" "true"
Option "TripleBuffer" "true"
Option "DMAForXv" "true"
Option "GARTSize" "64"
Option "DynamicClocks" "on"
EndSection

Section "Screen"
Identifier "Screen0"
Device "X1600"
Monitor "LVDS"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection

Section "DRI"
Mode 0666
EndSection

Section "Extensions"
Option "Composite" "true"
Option "DAMAGE" "true"
Option "RENDER" "true"
EndSection

Section "Files"
FontPath "/usr/share/fonts/util"
FontPath "/usr/share/fonts/encodings"
FontPath "/usr/share/fonts/misc"
FontPath "/usr/share/fonts/corefonts"
FontPath "/usr/share/fonts/default"
FontPath "/usr/share/fonts/100dpi"
FontPath "/usr/share/fonts/75dpi"
FontPath "/usr/share/fonts/default/ghostscript"
EndSection

Start up X and make sure everything seems to work ok

#dmesg | grep drm
[drm] Initialized drm 1.1.0 20060810
[drm] Initialized radeon 1.29.0 20080528 on minor 0
[drm] Loading R500 Microcode

#glxinfo | grep direct
direct rendering: Yes

#xvinfo | grep Adaptor
Adaptor #0: "Radeon Textured Video"

#grep AIGLX /var/log/Xorg.0.log
(**) Option "AIGLX" "true"
(**) AIGLX enabled


And just like that, two years of frustration come to an end.
To everybody who has ever worked on this driver, thank you, thank you, thank you! :)

Vighy
06-30-2008, 08:45 AM
The same happened to me when I switched to radeon on my old r200 XD

I hope will happen on my r600 soon XD (RadeonHD isn't an option for now)

torfbolt
07-03-2008, 02:22 AM
I did all the installation on my T60 and in principle, the driver works. But I've got a very annoying configuration issue: Xorg doesn't start up if I don't attach an external monitor to the VGA output. Here's my conf file:
#Section "ServerLayout"
# Identifier "ATI"
# Screen "Screen0" 0 0
# InputDevice "Mouse1" "CorePointer"
# InputDevice "USBMouse" "SendCoreEvents"
# InputDevice "Keyboard1" "CoreKeyboard"
#EndSection
Section "ServerLayout"
Identifier "R500"
Screen "Screen1" 0 0
InputDevice "Mouse1" "CorePointer"
InputDevice "USBMouse" "SendCoreEvents"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection



Section "Files"

EndSection

Section "Module"
SubSection "extmod"
Option "omit xfree86-dga" # don't initialise the DGA extension
EndSubSection
EndSection

Section "ServerFlags"
Option "AIGLX" "on"
EndSection

Section "Extensions"
Option "Composite" "on"
# Option "DAMAGE" "true"
EndSection

Section "InputDevice"
Identifier "Keyboard1"
Driver "kbd"
# Option "AutoRepeat" "500 30"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "de"
# Option "XkbVariant" "nodeadkeys"
Option "XkbOptions" "lv3:ralt_switch"
# Option "CustomKeycodes" "on"
EndSection

Section "InputDevice"
Identifier "Mouse1"
Driver "synaptics"
Option "Device" "/dev/input/mouse0"
Option "Protocol" "auto-dev"
Option "SHMConfig" "true"
Option "TouchpaddOff" "0"

# How fast the two-finger scrolling scrolls. The lower, the faster.
Option "VertScrollDelta" "100"
Option "HorizScrollDelta" "350"

# Location of the touchpad edges
# Option "RightEdge" "1120"
# Option "BottomEdge" "1050"
# Option "TopEdge" "50"
# Option "LeftEdge" "100"

# Touch and "untouch" thresholds
# Option "FingerLow" "25"
# Option "FingerHigh" "50"

# We DO NOT want palm triggering middle/right mouse
# button events, so a tap has to be quite fast
# Option "MaxTapTime" "100"
# Option "MaxTapMove" "30"
# Option "MaxDoubleTapTime" "250"
# Option "MaxTripleTapTime" "250"
# Option "SingleTapTimeout" "150"

# Disable two finger scrolling, as we have the edge scrolling enabled already
Option "VertTwoFingerScroll" "1"
Option "HorizTwoFingerScroll" "0"

# Fast taps
Option "FastTaps" "0"

# Disable tapping of the touchpad (excluding the corners, of course)
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"

# Movement speed settings
# Option "MinSpeed" "0.5"
# Option "MaxSpeed" "1"
# Option "AccelFactor" "0.3"

EndSection


Section "InputDevice"
Identifier "Mouse2"
Driver "mouse"
Option "Device" "/dev/input/mouse1"
Option "Protocol" "PS/2"
EndSection

Section "InputDevice"
Identifier "USBMouse"
Driver "mouse"
Option "Device" "/dev/input/mice"
Option "Protocol" "Auto"
EndSection

Section "Monitor"
Identifier "LVDS"
HorizSync 30.0 - 90.0
VertRefresh 55.0 - 75.0
Option "DPMS"
EndSection

Section "Monitor"
Identifier "VGA-0"
Option "Enable" "false"
EndSection

Section "Device"
Identifier "R500"
Driver "ati"
Option "AGPMode" "8"
Option "AccelMethod" "EXA"
Option "ColorTiling" "on"
Option "EnablePageFlip" "true"
Option "TripleBuffer" "true"
Option "DMAForXv" "true"
Option "GARTSize" "64"
Option "DynamicClocks" "on"
# Driver "radeon"
# Driver "radeonhd"
# Option "AccelMethod" "XAA"
# Option "XAANoOffscreenPixmaps" "true"
# Option "ShadowFB" "true"
# Option "DRI"
# VendorName "ATI"
# BoardName "Fire GL Mobility X1400"
# BusID "PCI:1:0:0"
EndSection

Section "Device"
Identifier "ATI"
Driver "fglrx"
# === Video Overlay for the Xv extension ===
Option "VideoOverlay" "on"
Option "TexturedVideo" "on"
# === OpenGL Overlay ===
Option "OpenGLOverlay" "off"
Option "EnableMonitor" "auto"
Option "XAANoOffscreenPixmaps" "true"
EndSection

Section "Screen"
Identifier "Screen0"
Device "ATI"
Monitor "LVDS"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1400x1050" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 32
Modes "1400x1050" "1024x768" "800x600" "640x480"
EndSubSection
EndSection

Section "Screen"
Identifier "Screen1"
Device "R500"
Monitor "LVDS"
DefaultDepth 24
SubSection "Display"
Depth 16
Modes "1400x1050" "1024x768" "800x600" "640x480"
Virtual 2800 1050
EndSubSection
SubSection "Display"
Depth 24
Modes "1400x1050" "1024x768" "800x600" "640x480"
Virtual 2800 1050
EndSubSection
EndSection

Section "DRI"

# Access to OpenGL ICD is allowed for all users:
# Access to OpenGL ICD is restricted to a specific user group:
# Group 100 # users
# Mode 0660
Mode 0666
EndSection

The last line in my Xorg.log says
(II) RADEON(0): Output: VGA-0, Detected Monitor Type: 0

and after that, the server terminates.

tormod
07-03-2008, 05:09 AM
The last line in my Xorg.log says
(II) RADEON(0): Output: VGA-0, Detected Monitor Type: 0

and after that, the server terminates.

You'll need to map monitor outputs with monitor identifiers inside your Device section. See http://wiki.debian.org/XStrikeForce/HowToRandR12 for how to do this properly.

agd5f
07-03-2008, 12:15 PM
I did all the installation on my T60 and in principle, the driver works. But I've got a very annoying configuration issue: Xorg doesn't start up if I don't attach an external monitor to the VGA output.


The last line in my Xorg.log says
(II) RADEON(0): Output: VGA-0, Detected Monitor Type: 0

and after that, the server terminates.

The driver should detect your panel since this is a laptop. pastebin your xorg log and I'll take a look.

yoshi314
07-04-2008, 03:26 AM
i think the same thread was on gentoo forums. so i'll just re-iterate what i wrote there.

two notes (valid only until 2.6.26 comes out)
do not build in-kernel drm ,and use x11-drm ebuild from x11 overlay to build kernel drm modules.

it installs more up-to date drm modules. x11-drm installs them into different location ( /lib/modules/<kernel>/x11-drm ) than in-kernel modules ( /lib/modules/<kernel>/kernel/drivers/char/drm ). it's likely that kernel will load the old modules, so either delete them or don't have them built at all, to avoid possible issues. 2.6.26 will have more up-to date drm modules, so this will be optional.

you need only these git-packages :
libdrm
dri2proto
libdrm
mesa
xf86-video-ati

the first four packages are only for 3d. you can have only xf86-video-ati if you just need 2d and decent video playback.

the rest can be from current non-git x.org (meaning from ~arch gentoo).

torfbolt
07-04-2008, 05:15 AM
The driver should detect your panel since this is a laptop. pastebin your xorg log and I'll take a look.

Problem solved, Xorg had used the older, manually compiled version of the radeon driver instead of the emerged one. Thank you anyway.

duby229
07-05-2008, 10:18 PM
Hey guys, I managed to get my hands on a 1950Pro. My card died on me, and my father was kind enough to loan me his old card.

Anyhow, I followed this guide to get hardware acceleration working, and I have found that there is a memory leak somewhere. The problem is that I have no clue how to figure out where. All I know for sure is that after several hours the memory becomes full, and starts swapping out. Then after several more hours the swap becomes full, and the system becomes totally unresponsive. If I restart X both the swap and memory suddenly become normal again, but then it starts filling up again.

I have no idea how to identify and pin point the memory leak. Any advise would be awesome. Thanks in advance guys.

Also I have found that if I hit ctrl-alt-f1, or whatever to try and change to a different VT the monitor goes into standby and the computer becomes totally unresponsive.

Also if I try to use Xv in mplayer the screen just goes black. I can use x11 and that works good. I can also use gl and gl2 and those seem to work good as well

Anyhow the biggest problem I have is the memory leak. If you guys can think of any information that you need, I'll gladly provide it. Thank you so much for this. Imagine an Open Source driver that provides functional 3D support on decent hardware. I am very impressed. Thank you.

duby229
07-06-2008, 12:12 AM
Hey guys I'm just replying to myself. I managed to get the memory leak solved. I dont know how, or why, but it seems to be working fine now. After reading a few benches on the front page that Micheal did comparing EXA and XAA, I enable EXA support in the xorg.conf. Then after erstarting X the memory leak went away. Prior to adding EXA to the xorg.conf, I didnt have anything specified in there for 2d acceleration. So I'm assuming that whatever is used for 2D acceleration by default is what is causing the memory leak. In any case adding EXA to the make.conf seems to have solved that problem.

The second problem with Xv support seems to be solved as well, though I get what can only be described as "tearing" when watching video in mplayer. To enable Xv support I had to add DMAForXv to the xorg.conf. After restarting xorg, Xv seems to work now, but when playing video back in mplayer it has straight lines that pass through the video especially on high motion scenes like when the camera pans across an image. It's not like a line though, it's almost as if the image is cropped at a certain point and the part above that line is slightly ahead of the part below it. It's almost like the image is torn. The best word for it is "tearing"

Then also the third problem with switching to a virtual terminal still persists, but after updating the radeon driver to the newest git checkout it no longer freezes the whole system. Now it'll let me switch back to VT7. When I switch to any other VT the monitor just goes into standby, though unlike with the last checkout, this time it will allow me to switch back to VT7.

bridgman
07-06-2008, 12:57 AM
I believe the tearing you are describing is caused by lack of "sync to vblank" support in the driver stack, so the new frame can be drawn part way through the screen refresh. Don't *think* there is a workaround for this today.

DragonionS
07-15-2008, 12:53 PM
Thanks a lot! I have ATI Mobility Radeon X1600 and now I have a well working my videocard! This is amazing! :) xf86-video-ati is a great driver that is much better than fglrx. 3.3 Mb is the weight of open source driver and it is working much better than fglrx with its 56 Mb.
I know that xf86-video-ati has no full support of ATI Radeon opportunities and they have a lot of work to do but now I can just use it and not switch to metacity every time when I want to watch some video. :)

Thank you! :)

RealNC
07-27-2008, 04:54 AM
Very promising driver. It works on my X1950XT (R580) with compiz fusion while fglrx doesn't.

However, I've encountered a bug and wonder if anyone else is getting it too. I've filed a but report about it: http://bugs.freedesktop.org/show_bug.cgi?id=16850

I'll recap here: Switching from X (plain 2D or in Compiz) to a console results in the kernel spitting out those:

do_IRQ: 0.83 No irq handler for vector
do_IRQ: 0.83 No irq handler for vector
do_IRQ: 0.83 No irq handler for vector

Trying to do opengl vsync (vlank_mode 1) results in glxgears running at exactly 0.333 FPS and saying:

do_wait: drmWaitVBlank returned -1, IRQs don't seem
to be working correctly.

Also, I just found out that driconf complains with:

IRQ's not enabled, falling back to busy waits: 0 24

When changing fthrottle_mode ("Method to limit rendering latency").

Does someone know what's going on? Anyone else getting those or just me?

bridgman
07-27-2008, 12:49 PM
RealNC, I have seen this mentioned in the last few days on one of the IRC channels, probably dri-devel. I'll see if I can find it. Seems like a recent regression, possibly related to some of the vblank / IRQ work being done over the last couple of weeks. You can see the pain if you read through the dri-devel mailing list archives -- this is a pretty complex part of the code.

RealNC
07-27-2008, 03:46 PM
Meanwhile, I've built a kernel with DRM completely disabled and ran fglrx on X.Org 1.4.2. The warnings were still there. So it might be entirely a kernel 2.6.26-only issue?

Also, disabling MSI (Message Signaled Interrupt support: CONFIG_PCI_MSI) replaces each "do_IRQ" warning with:

+------ PCI-Express Device Error ------+
Error Severity : Uncorrected (Non-Fatal)
PCIE Bus Error type : Transaction Layer
Flow Control Protocol : First
Receiver ID : 0010
VendorID=1106h, DeviceID=a208h, Bus=00h, Device=02h, Function=00h
Broadcast error_detected message
Broadcast mmio_enabled message
Broadcast resume message
AER driver successfully recovered

See http://bugs.freedesktop.org/show_bug.cgi?id=16850

bridgman
07-27-2008, 04:07 PM
RealNC, are you getting these messages with fglrx or one of the open drivers ? I thought you were talking about the open driver.

Reading again I think you're saying you get the messages with both open *and* closed drivers ?

RealNC
07-27-2008, 04:42 PM
Yes, with both. (And *only* with a 2.6.26 kernel.) So I guess it's a kernel problem.

I wonder if vsync with opengl (vblank_mode 1) is actually supposed to work at all with xf86-video-ati 6.9.0. If not, then I guess I can live with the warnings :D

Edit:
I hope it's not due to my card not being recognized correctly; it's a somewhat rare one. A 512MB X1950XT (Sapphire). lspci seems to think it only has 256MB, not 512.

agd5f
07-28-2008, 12:49 AM
I hope it's not due to my card not being recognized correctly; it's a somewhat rare one. A 512MB X1950XT (Sapphire). lspci seems to think it only has 256MB, not 512.

lspci doesn't show the size of vram, rather it shows the size of the PCI BAR. This often, but not always, corresponds to the amount of vram on the card. The max PCI BAR size is 256 MB that's the largest aperture you can map. For cards with more the 256 MB of vram, only 256 MB can be mapped for access by the CPU. The GPU, however, can access the entire amount of vram.

RealNC
07-28-2008, 01:06 AM
Thanks for the explanation. Do you know if vsync in OpenGL (vblank_mode 1) is supposed to work with R500 chips yet?