Configuring TV-out with an nVidia GeForce 2 under Mandrake Linux

This was one of those things that turned out to be fairly straightforward, after hours of hacking around. The one thing that held me up was that I couldn't find a complete, working example of an XF86config-4 file. I eventually got this working by bringing together bits of info from various sources around the web, together with nVidia's own documentation. This should work with any of nVidia's GeForce series (apparently). I've had it working with Mandrake 9.0 and using PAL televisions (although I've not found anything much to suggest that there's much difference between NTSC and PAL for the purposes of most of this config). As usual with these things, caveat emptor :-)

  1. Download the drivers from nVidia's site at http://www.nvidia.com/view.asp?IO=linux_display_archive. You will most likely want to select the most recent driver available. You will need two files from the list of available items: one named NVIDIA_kernel-nnnn.osarch.i586.rpm (nnnn is the version number, osarch will be dependent upon OS and architecture), and another named NVIDIA_GLX-nnnn.i386.rpm (where nnnn should match the version number of the kernel file). Note: because nVidia do not release these drivers under the GPL, they will taint your kernel, and you will get a warning to this effect when installing them.
  2. Install the kernel file first (e.g. rpm -i NVIDIA_kernel-1.0-4191.mdk90up.i586.rpm), followed by the GLX rpm). Your mileage may vary depending upon your favourite method of installing RPMs - this is not meant to be a comprehensive guide to installing stuff.
  3. The tricky bit is modifying /etc/X11/XF86Config-4. Make a backup of your existing config (in case, or when, everything goes tits-up). The important bits to change are the sections dealing with Monitor, Device, Screen and ServerLayout. My configurations happen to be a 19" Sun monitor plus TV and a Dell Ultrascan plus TV. It does *not* use TwinView, but you may be able to work out how to do that from this and the nVidia documentation that should have been installed into /usr/share/doc/NVIDIA_GLX-1.0/.

Note for cut-n-pasters: any backslashes (\) below are used in the Unix-sense of a continuing line break, and should probably not be included in your final config file.


Section "Monitor"
    Identifier "monitor1"
    VendorName "Dell UltraScan"
    ModelName "1280x1024 @ 74 Hz"
    HorizSync   31.5 - 79.0
    VertRefresh 50-70

    # Sony Vaio C1(X,XS,VE,VN)?
    # 1024x480 @ 85.6 Hz, 48 kHz hsync
	ModeLine "1024x480"    65.00 1024 1032 1176 1344  \
             480  488  494  563 -hsync -vsync

    # TV fullscreen mode or DVD fullscreen output.
    # 768x576 @ 79 Hz, 50 kHz hsync
    ModeLine "768x576"     50.00  768  832  846 1000   576  590  595  630

    # 768x576 @ 100 Hz, 61.6 kHz hsync
    ModeLine "768x576"     63.07  768  800  960 1024   576  578  590  616
EndSection

Section "Monitor"
    Identifier "tv"
    VendorName "Beko cheapo-TV"
    HorizSync 30.0-50.0
    VertRefresh 60
    ModeLine "640x480PAL"   29.50       640  675  678  944  480  530  535  625
    ModeLine "720x576PAL"   27.50       720  744  800  880  576  581  583  625
    ModeLine "800x600PAL"   36.00       800  818  820  960  600  653  655  750

EndSection

The first section is more-or-less the original section from the installed config - you may want to rename the Identifier to make things easier later. Add in a second monitor section with the above details. If you have a 100Hz Widescreen TV, you may be able to modify some of these numbers by trial and error, but these will work for any standard TV. Note: I was tempted to change the VertRefresh to 50 as I assumed that this originally referred to NTSC's frame rate (which is 60Hz, compared to PAL/SECAM's 50). However, this appears to be not so, so leave it at 60.

More details on the modes you TV can support can be found in your X log file by running in verbose mode (see the nVidia README for more on this). All TVs should at least be able to do 640x480 and 800x600.

Section "Device"
    Identifier "nvidia0"
    VendorName "nVidia Corporation"
    BoardName "NVIDIA GeForce2 DDR (generic)"
    Driver "nvidia"
    BusID  "PCI:1:0:0"
    #Option "DPMS"
    Screen 0
EndSection

Section "Device"
    Identifier "nvidia1"
    VendorName "nVidia Corporation"
    BoardName "NVIDIA GeForce2 DDR (generic)"
    Driver "nvidia"
    BusID  "PCI:1:0:0"
    #Option "DPMS"
    Screen 1
EndSection

Next, copy the existing Device section and rename the two appropriately. You may need to add the BusID and Screen lines, and comment out the DPMS option. Also note, that the Driver name should be "nvidia" in order to use the TV out features of your card. The standard distro "nv" driver does not appear to support these extra goodies.

Section "Screen"
    Identifier "screen0"
    Device "nvidia0"
    Monitor "monitor1"
    DefaultColorDepth 24

    Subsection "Display"
        Depth 8
        Modes "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480"
    EndSubsection

    Subsection "Display"
        Depth 15
        Modes "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480"
    EndSubsection

    Subsection "Display"
        Depth 16
        Modes "1280x1024" "1280x960" "1152x864" "1024x768" "800x600" "640x480"
    EndSubsection

    Subsection "Display"
        Depth 24
        Modes "1152x864" "1280x960" "1152x864" "1024x768" "800x600" "640x480"
    EndSubsection
EndSection

Section "Screen"
    Identifier "screentv"
    Device "nvidia1"
    Monitor "tv"
    DefaultColorDepth 24
    Option "TVStandard" "PAL-I"
    Option "TVOutFormat" "COMPOSITE"
    Option "ConnectedMonitor" "TV"
    Subsection "Display"
        Depth 16
        Modes "800x600PAL" "640x480PAL"
    EndSubsection
    Subsection "Display"
        Depth 24
        Modes "1024x600PAL" "800x600PAL" "640x480PAL"
    EndSubsection
EndSection

This section is the good bit. Again, the first section is mostly as-is from the existing installation, but with the renamed Identifier, Device and Monitor. This should tie in with your main monitor configuration. The second section is the important bit for getting your TV going - make sure that Identifier, Device and Monitor all tie in with your TV-related sections. You will also need to add the three Options:

Note also how your Modes should correspond to the ModeLines defined above in your TV monitor section (which are also named explicitly to avoid any confusion with similar modes on the CRT).

Section "ServerLayout"
    Identifier "layout1"
    InputDevice "Keyboard1" "CoreKeyboard"
    InputDevice "Mouse1" "CorePointer"
    Screen 0 "screen0"
    Screen 1 "screentv" rightOf "screen0"
EndSection

The final section to modify tells X what to do with the additional monitor. This installation runs each monitor as a separate X desktop, which are not connected as a TwinView set up would be. However, this has some advantages in that it's easier to target your TV explicitly when you're running batch stuff (e.g. /usr/bin/mozilla --display=:0.1 http://myscreensaver.com/).

Finally...

On both boxes I've tried this out on (a 1GHz Celeron server, 768MB memory with an nVidia GeForce 2 MX and a 1.33GHz AMD Athlon, 512MB with nVidia GeForce 2 MX DDR workstation) I've needed to do a reboot in order to fully activate the new drivers. If everything has installed successfully, you should see the nVidia logo flash briefly when your X sessions start up. You may also need to ensure that the TV is connected and turned on to ensure that the graphics card detects it on startup. Finally, expect some crashing and rebooting (this is where having an ext3 filesystem comes in handy). Make sure you have backed up anything important first :-) Whilst experimenting with this I had numerous system crashes, one of which finally "encouraged" me to upgrade from Mandrake 8.2 to 9 after I could no longer access important bits of the system. This may have been an unlucky crash, rather than a dodgy driver as it's been working fine since, at least on 9.0

Cop-out section: I hereby absolve myself of anything to do with anything, ever. I cannot be held responsible for phases of the moon, bad weather, stock market crashes or anyone blowing up their favourite server together with 5 years' worth of illegally downloaded MP3s and DivXs by trying this out. It's here as a possible aid for fellow drifters through life.