LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Radeon kms works! (https://www.linuxquestions.org/questions/slackware-14/radeon-kms-works-760963/)

dolphin77 01-07-2010 09:22 AM

1) Kernel part
Slackware current now has kernel 2.6.32.2. KMS is disabled by default. So in order to use KMS we need to rebuild the kernel with CONFIG_DRM_RADEON_KMS=y (this could be found in Device Drivers --->[*] Staging drivers --->[*] Enable modesetting on radeon by default.

But at least for R600 based chips kernel 2.6.32.2 will not work. There is a bug in this version. We can use 2.6.32.3 (which was released yesterday) instead.

/slackware64-current/source/k/config-generic-2.6.32.2 is a good start. Copy it to /usr/src/linux-2.6.32.3/.config.
Code:

cd /usr/src/linux-2.6.32.3/
make oldconfig

After that make menuconfig and switch on KMS for radeon as described above. It is also recommended that all the framebuffer devices are disabled the only FB options left in kernel:
Code:

root@darkstar:/# grep FB /usr/src/linux/.config |grep [m,y]
CONFIG_IFB=m
CONFIG_VIDEO_FB_IVTV=m
CONFIG_FB=y
CONFIG_FB_CFB_FILLRECT=m
CONFIG_FB_CFB_COPYAREA=m
CONFIG_FB_CFB_IMAGEBLIT=m
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_TILEBLITTING=y
CONFIG_FB_UDL=m

Code:

make bzImage modules modules_install
cp arch/x86_64/boot/bzImage /boot/vmlinuz-generic-2.6.32.3
cp System.map /boot/System.map-generic-2.6.32.3
cp .config /boot/config-generic-2.6.32.3

do not forget to makeinitrd for your root fs module.

and create appropriate lilo section in /etc/lilo.conf

next step is to blacklist radeon frame buffer and radeon modules. We need to do this to avoid firmware initialisation problem, if it is not accessable before rrot FS is mounted. This should be added to /etc/modprobe.d/blacklist.conf:
Code:

blacklist radeonfb
blacklist radeon

And then we will load module from /etc/rc.d/rc.modules:
Code:

/sbin/modprobe radeon
2) Libdrm, Mesa and xf86-video-ati from git.

lets create a directory, where all the scripts and source will live. For example /usr/src/dri/. There will be two subdirectories /usr/src/dri/src and /usr/src/dri/packages. One for source trees and one for ready packages.

Code:

# cd /usr/src/dri/src
# git clone git://cgit.freedesktop.org/mesa/drm
# git clone git://cgit.freedesktop.org/git/mesa/mesa
# git clone git://cgit.freedesktop.org/git/xorg/driver/xf86-video-ati
# git clone git://anongit.freedesktop.org/git/xorg/util/macros

We will need to update util-macros in order to be able to build git version of xf86-video-ati.

util-macros.SlackBuild:

Code:

#!/bin/sh

PKGNAM=util-macros
VERSION=$(date +%Y%m%d)_git
ARCH=${ARCH:-x86_64}
BUILD=${BUILD:-1}

NUMJOBS=${NUMJOBS:--j8}
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-util-macros

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

rm -rf $PKG
mkdir -p $TMP $PKG
cd src/macros
git pull
#git checkout

# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  -exec chmod 755 {} \; -o \
  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  -exec chmod 644 {} \;
make clean

./autogen.sh

CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --build=$ARCH-slackware-linux

make $NUMJOBS
make install DESTDIR=$PKG

mkdir -p $PKG/install

cd $PKG
/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
mv $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz  $CWD/packages

run the script and upgrade the package.
upgradepkg packages/util-macros*.t?z

Now we are ready to build the important staff. Here are the same scripts, slightly modified (mesa now corrected as in slackware64-current.

libdrm.SlackBuild:
Code:

#!/bin/sh

PKGNAM=libdrm
VERSION=$(date +%Y%m%d)_git
ARCH=${ARCH:-x86_64}
NUMJOBS=${NUMJOBS:-" -j7 "}
BUILD=${BUILD:-1_vt}

CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-${PKGNAM}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
fi

rm -rf $PKG
mkdir -p $TMP $PKG
cd src/drm
git pull
#git checkout

# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  -exec chmod 755 {} \; -o \
  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  -exec chmod 644 {} \;

make clean

# Configure:
CFLAGS="$SLKCFLAGS" \
./autogen.sh \
  --prefix=/usr \
  --enable-radeon-experimental-api \
  --disable-intel \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --build=$ARCH-slackware-linux
 

CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --enable-radeon-experimental-api \
  --disable-intel \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --build=$ARCH-slackware-linux

# Build and install:
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1

# Strip binaries:
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null

mkdir -p $PKG/install

cd $TMP/package-${PKGNAM}
/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz

mv $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz  $CWD/packages/


xf86-video-ati.SlackBuild:
Code:

#!/bin/sh

PKGNAM=xf86-video-ati
VERSION=$(date +%Y%m%d)_git
ARCH=${ARCH:-x86_64}
BUILD=${BUILD:-1.vt}

NUMJOBS=${NUMJOBS:--j8}
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-xf86-video-ati

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

rm -rf $PKG
mkdir -p $TMP $PKG
cd src/$PKGNAM
git pull
#git checkout

# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  -exec chmod 755 {} \; -o \
  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  -exec chmod 644 {} \;
make clean

./autogen.sh

CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --build=$ARCH-slackware-linux

make $NUMJOBS
make install DESTDIR=$PKG

mkdir -p $PKG/install

cd $PKG
/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
mv $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz  $CWD/packages/


mesa.SlackBuild:
Code:

#!/bin/sh

PKGNAM=mesa
VERSION=$(date +%Y%m%d)_git
ARCH=${ARCH:-x86_64}
BUILD=${BUILD:-1_vt}

# Be sure this list is up-to-date:
DRI_DRIVERS="r600,swrast"

NUMJOBS=${NUMJOBS:--j8}

CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-mesa

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

rm -rf $PKG
mkdir -p $TMP $PKG
cd src/mesa
git pull
#git checkout

# Make sure ownerships and permissions are sane:
chown -R root:root .
find . \
  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  -exec chmod 755 {} \; -o \
  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  -exec chmod 644 {} \;
make clean
CFLAGS="$SLKCFLAGS" \
./autogen.sh \
  --prefix=/usr \
  --sysconfdir=/etc \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --mandir=/usr/man \
  --docdir=/usr/doc/mesa-$VERSION \
  --with-dri-driverdir=/usr/lib${LIBDIRSUFFIX}/xorg/modules/dri \
  --with-dri-drivers="$DRI_DRIVERS" \
  --disable-gallium \
  --enable-debug \
  --build=$ARCH-slackware-linux


CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --mandir=/usr/man \
  --docdir=/usr/doc/mesa-$VERSION \
  --with-dri-driverdir=/usr/lib${LIBDIRSUFFIX}/xorg/modules/dri \
  --with-dri-drivers=r600 \
  --enable-debug \
  --disable-gallium \
  --build=$ARCH-slackware-linux

make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1

# Install gears and glinfo:
mkdir -p $PKG/usr/bin
cp -a progs/demos/gears $PKG/usr/bin/gears
cp -a progs/demos/glinfo $PKG/usr/bin/glinfo

# Install some "demos":
( cd progs/xdemos
  cp glthreads glxcontexts glxdemo glxgears glxgears_fbconfig glxheads \
    glxinfo glxpbdemo glxpixmap \
    $PKG/usr/bin
)

# Strip binaries:
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null

mkdir -p $PKG/install

cd $PKG
/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
mv $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz  $CWD/packages/

And the script to build and upgrade all the a.m. packages. Let's call it build.sh:
Code:

./libdrm.SlackBuild && upgradepkg --reinstall packages/libdrm-`date +%Y%m%d`_git-x86_64-1_vt.t?z
./xf86-video-ati.SlackBuild && upgradepkg --reinstall packages/xf86-video-ati-`date +%Y%m%d`_git-x86_64-1_vt.t?z
./mesa.SlackBuild && upgradepkg --reinstall packages/mesa-`date +%Y%m%d`_git-x86_64-1_vt.t?z

Make all the above scripts executable. And now to build and install everything, simply run:
./build.sh


To check if the above git trees updated, without building all the packages, I use the script which look like this:
Code:

cd src
for i in drm mesa xf86-video-ati ;
 do cd $i ; make clean ; cd  .. ;
done

for i in drm mesa xf86-video-ati ;
 do echo 'Checking' $i; cd $i ; git pull; cd  .. ;
done

cd ..


Josh000 01-07-2010 12:55 PM

Awesome update :)

Just a quick question, but why should FB devices be disabled? I quite like having a high res console display..., can you have this with KMS without an fb?

adamk75 01-07-2010 01:09 PM

You need to disable all the specific framebuffer drivers, but enable the framebuffer console option, just as dolphin77 said. The DRM radeon kernel module is the driver that will hook into the framebuffer console.

dolphin77 01-07-2010 01:45 PM

alright. here comes a bit more. I tried for a long time to test 2.6.33-rc branch. But up till now there was a problem for my chipset with horizontal flickering lines (5-10mm) all over the screen. Today updated 2.6.33-rc3-git2 already solves this problem.

The reason to try 2.6.33 stuff - it has interrupt support. But if you want to try, you have to download this firmware files:
http://people.freedesktop.org/~agd5f/radeon_ucode/

and put them into /lib/firmware/radeon. Otherwise when you reboot with this kernel, it will hang for abt 20-30 seconds and complain about missing firmware.

BrZ 01-07-2010 08:31 PM

Xorg-server 1.7.4 was released:
Quote:

X.Org X Server 1.7.4
Release Date: 2010-01-08
X Protocol Version 11, Revision 0
Build Operating System: Slackware 13.0 Slackware Linux Project
Current Operating System: Linux 2.6.32.3 #1 PREEMPT Thu Jan 7 19:41:22 BRST 2010 x86_64
Kernel command line: BOOT_IMAGE=Linux-2 ro root=803 vt.default_utf8=0 resume=/dev/sda2
Build Date: 07 January 2010 11:54:09PM
Just waiting for 2.6.33 to try KMS... You guys (and gals) are awesome. Thanks.

forum1793 01-07-2010 10:02 PM

Quote:

Originally Posted by Josh000 (Post 3817813)
Awesome update :)

Just a quick question, but why should FB devices be disabled? I quite like having a high res console display..., can you have this with KMS without an fb?

Yes, you can get the same resolution in console as you get in X. It can be so tiny you can't barely see it. Since your basically at the higher resolution already, starting X should be faster. I can attest that exiting X back to console is almost instant.

My only issue so far is that with 2.6.33 you can get sound over hdmi but in both -rc2 and -rc3 I have audio stuttering in xine but not mplayer. Whereas sound over hdmi with both programs using catalyst with 2.6.29.6 worked fine. It also worked fine using the prekms drm/mesa/...ati packages from git. Also no stuttering using the headphones with xine. Truly odd.

Old_Fogie 01-08-2010 02:53 AM

I'm not using kms, just stock radeon from xorg for my 9600xt.

Was wondering two things:

1. can anyone here get unreal tournament 2004 to play with kms? as it won't run with stock xorg radeon driver. will the game even launch?

2. if the performance is less with kms, then what advantage is there?

dolphin77 01-08-2010 03:16 AM

If you have LCD panel (most laptops do have), then with KMS runs console on native resolution of your panel. If you find letters to small, just pick up bigger font (terminus from slackbuilds.org is excelent choice and have a lot of different sizes. It is better solution than to change resolution down, since each pixel is drown with three thin film transistors (red, green, blue) without 'interlapping'


For the games - no i didn't try and don't have time to build and try this. Maybe on weekend will try for my kid.

to BzR:
I didn't get it. You built new Xorg yourself?

adamk75 01-08-2010 03:49 AM

I've played ut2004 with and without KMS on a radeon 4350, radeon x850, and radeon x1900.

Adam

gtludwig 01-08-2010 04:27 AM

1 Attachment(s)
hello,

I followed dolphin77 post #91 to the letter on a fresh -current install. But something went wrong. I just can't build ATi's proprietary video driver.

The excerpt from # lspci that tells what video card I got is:
Code:

01:05.0 VGA compatible controller: ATI Technologies Inc Radeon 3100 Graphics
I edited kernel 2.6.32.3 so its .config returns:
Code:

root@cpc-5564:/home/gtl# grep FB /usr/src/linux/.config |grep [m,y]
CONFIG_IFB=m
CONFIG_VIDEO_FB_IVTV=m
CONFIG_FB=y
CONFIG_FB_CFB_FILLRECT=m
CONFIG_FB_CFB_COPYAREA=m
CONFIG_FB_CFB_IMAGEBLIT=m
CONFIG_FB_MODE_HELPERS=y
CONFIG_FB_TILEBLITTING=y
CONFIG_FB_UDL=m

Attached is the new kernel (2.6.32.3) .config file.

Maybe this helps too:
Code:

root@cpc-5564:/home/gtl# less /var/log/Xorg.0.log | grep EE
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(II) Loading extension MIT-SCREEN-SAVER
(EE) fglrx(0): atiddxDriScreenInit failed, GPS not been initialized.
(EE) fglrx(0): XMM failed to open CMMQS connection.
root@cpc-5564:/home/gtl# less /var/log/Xorg.0.log | grep WW
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(WW) The directory "/usr/share/fonts/local" does not exist.
(WW) The directory "/usr/share/fonts/CID" does not exist.
(WW) Falling back to old probe method for fglrx
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:17:0) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:18:0) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:18:1) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:18:2) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:19:0) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:19:1) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:19:2) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:20:0) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:20:2) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:20:3) found
(WW) fglrx: No matching Device section for instance (BusID PCI:0@0:20:4) found
(WW) fglrx(0): board is an unknown third party board, chipset is supported
(WW) fglrx(0): Hasn't establisted DRM connection
(WW) fglrx(0): No DRM connection for driver fglrx.
(WW) fglrx(0): could not detect X server version (query_status=-1)
(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): ********************************************* *
(WW) fglrx(0): Textured Video not supported without DRI enabled.
(WW) fglrx(0): Option "VendorName" is not used
(WW) fglrx(0): Option "ModelName" is not used



Please advice! Thanks in advance!

gtludwig

adamk75 01-08-2010 05:19 AM

Well, first, fglrx does not work with 2.6.32.*, last I heard.

Second, KMS is part of the open source driver infrastructure. You can't mix the open source and closed source drivers.

Adam

gtludwig 01-08-2010 05:39 AM

well, doesn't that just makes sense? lol! a bit more reading on my part might've spared us all of this post (and of my trouble!).

I switched "fglrx" to "radeon" on /etc/X11/xorg.conf and font rendering *seems* a little better, but still got no 3D acceleration.

Is this right? What am I missing here?

Thanks in advance!
gtludwig

adamk75 01-08-2010 05:44 AM

3D acceleration should work if everything is setup properly and up-to-date with the versions dolphin77 outlined. Show us your /var/log/Xorg.0.log file.

Adam

gtludwig 01-08-2010 06:24 AM

Well, I decided on a different (and temporary!) approach - I've to work a little and I'll play with this later. =)

I had a different image entry on /etc/lilo.conf for kernel panic case.

Now I'm keeping everything on -current tree BUT kernel packages, which are 13.0's. This way 3D acceleration works with proprietary drivers.

On my lunch break, I'll bring kernel to -current later, boot it and post /var/log/Xorg.0.log file in a few hours.

Thanks!
gtludwig

TSquaredF 01-08-2010 05:53 PM

Having seen post 91, I was intent on updating my kms installation. Fortunately, I didn't start until this morning, after I read post 97, so was able to start with 2.6.33-rc3-git2. I followed the instructions in post 91 almost to the letter, only changing the output locations for makepkg, so I wouldn't have to copy the package anywhere. Everything installed OK, but I get the following in my Xorg.0.log:
Code:

(EE) RADEON(0): [dri] RADEONDRIGetVersion failed because of a version mismatch.
[dri] This chipset requires a kernel module version of 1.17.0,
[dri] but the kernel reports a version of 2.0.0.[dri] If using legacy modesetting, upgrade your kernel.
[dri] If using kernel modesetting, make sure your module is
[dri] loaded prior to starting X, and that this driver was built
[dri] with support for KMS.
[dri] Disabling DRI.

Anybody able to give me a clue as to how to load dri?
Regards.
Bill


All times are GMT -5. The time now is 01:07 AM.