Linux X, DRI, X-Video, V4L Notes

X - XFree86 X server
DRI - Direct Rendering Infrastructure - 3D graphics hardware support
X-Video - TV Tuner support
V4L - Video for Linux - with experimental km-module capture for ATI

Base distribution - RedHat 7.2

KDE - K Desktop Environment display manager - kdm

For konsole, the option --ls starts up shells as login shells. To set this, edit the properties for konsole.desktop as follows: (right-click) Konsole icon > Preferences (wait ...) > Properties for konsole.desktop > Execute > Command: konsole --ls %i %m > OK.

Does KDE startup hang or fail, ex., on dcopserver startup?  Make sure that the environment variable DISPLAY is set to a working value in your shell .profile or .bash_profile, etc., and that the program startkde can be found in your $PATH.

themes, icons,
   panel: add application
        1) browse to application
        2) drag application to panel
        3) in popup dialog, click icon, select icon, OK
        1) K > Configure Pane l > Menu Editor, New Item ...
        2) click icon, select icon, OK
        3) Apply
        4) File > Quit (or window close)
    icons: xpm - 48x48 (use about 44x44)
        $ giftoppm youricon.gif | ppmtoxpm > youricon.xpm
        photoshop to PNG via gimp to xpm

Display Power Management System (DPMS)

If you have a monitor with DPMS, enable it by editing XF86Config-4 as below, and then restart the X server:

Section "Monitor"
        Option "DPMS"

K>Control Center>
    [+]Look & Feel>Screensaver
        x    Enable screensaver
            Screen Saver
                Wait for 10 min (select time to screen saver startup)
    [+]Power Control>Energy>
        x    Enable Display Energy Saving
        Suspend after: 20 min (select time to screen blank)
        Power Off after: 30 min (select time to power saving mode)

For XDM (login screen):

xset +dpms
xset dpms 0 0 300 # turns the display off after 300 seconds (5 minutes)

gnome display manager

For gnome-terminal, the option --login starts up shells as login shells. To set this, (right-click) Terminal Emulation Program icon >> Launcher Properties >> Basic >> Command >> gnome-terminal --use-factory --start-factory-server --login >> Close.

icons: PNG - 48x48 (use about 44x44) photoshop to PNG

XFree86 4.X

Ctrl+Alt+Backspace (exit X server)
Ctrl+Alt+F1..F7 (switch virtual console - F7 for X)
Ctrl+Alt+Keypad-Plus   (step forward in video mode list)
Ctrl+Alt+Keypad-Minus  (step backwards in video mode list)

Release 4 also included the long-awaited integration of the DRI (Direct Rendering Infrastructure). This upgrade into the code base gives XFree86 the abilities of accelerated direct 3-D graphics rendering, used widely in games and other visualization programs.

Current Status - XFree86 4.1.99.X (CVS)

Kernel: Linux 2.4.17
CPU GPU Motherboard X Version date
Driver date
Driver date Depth 16
glxgears with DRI FPS
Depth 16
glxgears w/o DRI FPS
Depth 24 glxgears with DRI FPS Depth 24 glxgears w/o DRI FPS xawtv window comments
AMD Athlon 1.1GHz/266 ATI All-In-Wonder Radeon 32MB DDR Asus A7M266 20011230 ati.2 checkpoint_3 1132
!full screen
xawtv full screen kills X-server
Intel Pentium III 800MHz/133 ATI All-In-Wonder Radeon 32MB DDR Asus CUSL2 20011230 ati.2 checkpoint_3
!full screen
xawtv full screen kills X-server
AMD Athlon 1.0GHz/266 Matrox Marvel G450 eTV 32MB DDR Asus A7M266 4.1.0-3 mga 699
AMD Athlon 800MHz/200 ATI All-in-Wonder 128 16MB Asus K7V
OK kdm dialog box gray with DRI
Intel Pentium III 800MHz/133 [Intel i815e 32MB] Asus CUSL2 20011230 i810  
Intel Pentium III 1GHz/133 [S3 Savage4 32MB] Shuttle FV24
savage na
Hauppauge WinTV-radio
Intel Pentium Pro 200MHz ATI All-In-Wonder Pro PCI 8MB Intel VS440FX 2.4.17
ati.2 checkpoint_3

The Radeon DRI driver has rendering errors that leave bitblit tracks for more distant objects in the center of the screen.  This seems to be identical to behavior in older Windows/98 drivers that was fixed in more recent Windows drivers from ATI.  The xbench tests in the comments column above result in crashing or hanging.

S3 Savage 4 Configuration

S3 Savaage driver 1.1.19 binary (driver included with XFree86 4.1.0 crashes), DRI is not yet available, s3switch utility
Reboot > DEL > CMOS Setup Utility > Advanced Chipset Features > Frame Buffer Size > 32M
XF86Config: Section "Device" - VideoRam 32768


AMD751 - SourceForge: Detail: 221904 Radeon + AMD Irongate (fixed in 2.4.10)
xkb conf - http://www.it.linuxvideo.org/lists/livid-gatos/2001-June/msg00081.html
DRI - http://dri.sourceforge.net/


Reconfigure kernel with DRM

Linux 2.4.X kernel - HOWTO

# VER=2.4.16 # >= 2.4.10 necessary for AMD761
Configure and install with Direct Rendering Manager (DRM) as per kernel page - see kernel.html

Build and install X

 XFree86 - ftp://ftp.xfree86.org/pub/XFree86/4.1.0/
# XF=xfree86-4.x
# D=2001-12-30
# mkdir $XF && cd $XF
# cvs -d:pserver:anoncvs@anoncvs.xfree86.org:/cvs login
CVS password: anoncvs
# cvs -d:pserver:anoncvs@anoncvs.xfree86.org:/cvs -z3 checkout  -D $D -P xc
# cd xc
# make World > make-World.log 2>&1
    (search for errors tagged with ***)
# (cd /usr/lib; gzip libGL.so.1.*; rm libGL.so.1; ln -s /usr/X11R6/lib/libGL.so.1 .) # important -  bypass non-DRI libraries!
# rm -fr /etc/X11/xkb /usr/X11R6/lib/X11/xkb # for RedHat 7.x
# make install > make-install.log 2>&1
    (search for errors tagged with ***)
# ldconfig

Build and install GATOS

http://gatos.sourceforge.net/ - new location as of 12/12/2001
visit here for information, binaries, source, and mailing lists
ati.2 devel is needed for kmultimedia (km) video capture
Download GATOS from CVS
# cd ../..
# GATOS=gatos-checkpoint_3
# R=checkpoint_3 # or R=devel
# mkdir $GATOS && cd $GATOS
# cvs -d:pserver:anonymous@cvs.gatos.sourceforge.net:/cvsroot/gatos login  # press the Enter key when promted for CVS password
# cvs -d:pserver:anonymous@cvs.gatos.sourceforge.net:/cvsroot/gatos -z3 co -P -r $R drm-kernel ati.2 km
# cvs -d:pserver:anonymous@cvs.gatos.sourceforge.net:/cvsroot/gatos -z3 co -P avview
Development tree requires correct DRM kernel modules
Note that there are 3 possible sources for the DRM kernel modules, which can result in compatibility problems between kernel, X, and GATOS versions.  You must choose compatibile DRM kernel modules and X drivers, so GATOS supplies drm-kernel as well.  Make sure that you use the matching -r "revision" tag for both drm-kernel/ati.2/km.  All three sources are listed here for completeness, in case you have to back out to a working compatible configuration.
  1. kernel

  2. # cd /usr/src/linux-$VER; make modules modules_install
  3. X

  4. # cd $XF/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
    # make -f Makefile.linux TREE=/usr/src/linux-$VER/include
    # cp gamma.o tdfx.o r128.o radeon.o mga.o i810.o i830.o /lib/modules/$VER/kernel/drivers/char/drm
    # depmod
  5. GATOS

  6. # cd $GATOS/drm-kernel
    # make -f Makefile.linux TREE=/usr/src/linux-$VER/include
    # cp gamma.o tdfx.o r128.o radeon.o mga.o i810.o i830.o /lib/modules/$VER/kernel/drivers/char/drm
    # depmod
Make and install ati.2 driver
# cd $GATOS/ati.2
# xmkmf ../../$XF/xc
# make
# make install

Configure XFree86

# MOD=radeon # or MOD=r128, etc.
# init 3
# rmmod $MOD # remove any installed module
# insmod $MOD # install the newly compiled module
# sync # safety first!
# XFree86 -configure
# XFree86 -xf86config /root/XF86Config.new
# cp /root/XF86Config.new /etc/X11/XF86Config-4

Configure the config file /etc/X11/XF86Config-4 for your hardware.
Mouse1 example is for Logitech First/Pilot Wheel Mouse USB.
Mouse1 line in Section "ServerLayout" enables/configures second/dual mouse.
Note that /dev/mouse is a symbolic link, ex., /dev/psaux or /dev/input/mice; it may be changed by mouse config tools.
make sure to put in the appropriate HorizSync and VertRefresh values for your monitor
examples - for my own reference:
Manufacturer Model Name Model # Size HorizSync VertRefresh Max Resolution Dot Pitch
NEC MultiSync 6FG   20" 27.0-79.0 55.0-90.0 1280x1020@75Hz 0.28mm
Nokia 445XiPlus   21" 30.0-110.0 50.0-150.0 1600x1200@88Hz 0.22mm
Samsung SyncMaster 17GLs   17" 30.0-82.0 50.0-120.0 1600x1280@60hz 0.26mm
Sony Multisync 17s CDP-17SF1  17" 31.5-64.3 50.0-120.0 1280x1024@60Hz 0.25mm
Sony Multisync 20seII GDM-20SE2 20" 30.0-96.0 48.0-160.0 1600x1200@75Hz 0.28mm
Viewsonic 17EA   17" 30.0-64.0 50.0-120.0 1280x1024@65Hz 0.28mm

XF86Config-4 (click for example)

# ed /etc/X11/XF86Config-4
# sync # safety first!

Debugging and Testing

# XFree86
Ctrl+Alt+Backspace (exit X server)
# init 5

X server log file - file:/var/log/XFree86.0.log
    Are there undefined symbols for drm related module?  Check /usr/lib/libGL*.so.1 to verify pointers to the proper libraries in /usr/X11R6/lib/.
X session log file - file:~/.xsession_errors
xdypinfo - display information utility for X
glxgears - simple GL performance test
xbench - xstones benchmarks - http://ibiblio.org/pub/X11/contrib/utilities/
xvinfo - print X-Video configuration
DRI Users Guide: Using 3D Acceleration - http://www.xfree86.org/4.1.0/DRI8.html
Guide to debugging DRI installation - http://www.linuxvideo.org/gatos/dri-debug.html

xawtv TV application

xawtv-3.66 latest version
xawtv-3.54 RedHat 7.2 /usr/bin/xawtv

# ./configure --x-include=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
# make
# make install
# xawtv
configure for [US] TV viewing - right click
    TV norm: ntsc
    Video source: tuner
    Frequency table: us-cable-hrc
    Capture: overlay
    Volume: (drag to 100%)

Loki Games

 http://www.lokigames.com/ - good test for DRI


km - kmultimedia X v4l capture - experimental

# cd ../$GATOS/km
# rm -f /usr/src/linux; ln -s /usr/src/linux-$VER /usr/src/linux; ls -l /usr/src/linux # needed by the Makefile
# make
# make install
# depmod
# sync # safety first!
# more README

GATOS Sourceforge CVS - http://gatos.sourceforge.net/

On Mon, 15 Oct 2001 volodya@mindspring.com wrote:

You will need XFree86 4.1.0, Radeon All-in-Wonder, recent ati.2 drivers (binaries are ok), xv_stream (get it from linuxvideo CVS) and km (from sourceforge CVS). Further instructions are in the km README file. (Hint: the order of steps there might be important..)

xawtv -noxv -noscale will not work with km, because xawtv expects the device to be able to produce RGB video stream and we only have YUV. This is a design fault in xawtv which was created as a player application for bt848 chips.. Hence ffmpeg, xv_stream and dd are the only choices at the moment.


 http://sourceforge.net/projects/ffmpeg/ -

# cvs -d:pserver:anonymous@cvs.ffmpeg.sourceforge.net:/cvsroot/ffmpeg login # press the Enter key when promted for CVS password
# cvs -d:pserver:anonymous@cvs.ffmpeg.sourceforge.net:/cvsroot/ffmpeg -z3 co ffmpeg

# ./configure; make; make install


 http://www.alsa-project.org/ -

tar jxf ...

# ./configure; make; make install


# nice -n -20 ffmpeg -y -t 15 \
-f rawvideo -i /dev/video0 -s 640x240 -r 60 \
-vcodec mpeg1video -s 360x240 -r 30 -b 1000 -deinterlace \
-f pcm -i /dev/dsp -ar 44100 -ac 1 \
-acodec ac3 -ab 64 \

Input #0, rawvideo, from '/dev/video0':
  Stream #0.0: Video: rawvideo, yuv420p, 160x128, 25.00 fps
Input #1, pcm, from '/dev/dsp':
  Stream #1.0: Audio: pcm, 44100 Hz, mono
Output #0, mpeg, to 'cap.mpeg':
  Stream #0.0: Video: mpeg1video, 360x240, 30.00 fps, 1000 kb/s
  Stream #0.1: Audio: ac3, 44100 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #1.0 -> #0.1
Segmentation fault      (core dumped)


To restore RedHat 7.0 desktop configuration, restore the following files

NoBell Home - gjm - last update 1/11/2002