S-Video

From Gentoo Linux Wiki

(Redirected from Twinview Example)
Jump to: navigation, search
Note: We are using nvidia as an example here - please update the article if things are different for different cards

This article focuses on using a TV plugged into the S-VIDEO port on your Video card.

There are multiple ways to utilise your TV.

  • As a second monitor, positioned above, below, left or right of your main monitor
  • As a your main monitor
  • As a temporary replacement for your second monitor, when you want to watch media on your TV and still be able to use your primary montior for linux stuff.


This section assumes you already have your card working, read the appropriate guides to manage that.

What you can also do is to be able to retain use the dual head LCD/CRT monitors, only using the TV, when required.

So, using a combination of

Contents

[edit] Options

Current nvidia cards cannot output to two monitors and S-Video at the same time.

Your options are to:

  • Run a script which uses mplayer to play the movie on your PC but displays it on the TV - leaving the PC useless till the movie ends, other than keyboard controls of the media player. Both monitors on your computer go black (no signal) whilst the TV is being used.
  • Run a script which runs up a second X session with on the LCD console with the TV as a second screen, which you can direct mplayer to play on. The original X session with the dual head config is still running, just not displayed - You can switch back to it using CTRL-ALT-F7 - but that turns off the TV.

[edit] Configuring X.org

Basically, the default, on boot up, is to start up in Dual Head mode (DualSingleDesktop), as configured in the "ServerFlags" section.

The second configuration, TV only (tv), which, if X is started with this, will display only on the TV.

A third configuration continues to use the Prime LCD as the prime display and the TV as a second one (DualHeadTv) - the one we use if we startup the fluxbox instance.

[edit] The xorg.conf file

The /etc/X11/xorg.conf file is as follows :-

Code: /etc/X11/xorg.conf
Section "Module"
  SubSection     "extmod"
    Option         "omit xfree86-dga"   # don't initialise the DGA extension
  EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "enable"
EndSection

Section "ServerLayout"
    Identifier     "DualSingleDesktop"
    Screen      0  "Screen[0]-Dual-Head" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "ServerLayout"
    Identifier     "tv"
    Screen      0  "Screen[1]-TV" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "ServerLayout"
    Identifier     "DualHeadTv"
    Screen	0  "Screen[3]-TV" Absolute 0 0
    Screen      1  "Screen[2]-CMV" RightOf "Screen[3]-TV"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "ServerFlags"
    Option         "DefaultServerLayout" "DualSingleDesktop"
    Option         "AutoAddDevices" "true"
    Option         "AutoEnableDevices" "true"
EndSection

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "keyboard"
EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol"
    Option         "Device" "/dev/input/mice"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

# Dual head, single desktop, spanning both
Section "Screen"
    Identifier     "Screen[0]-Dual-Head"
    Monitor        "Monitor[0]-CMV"
    Device         "Device[0]"
    DefaultDepth    24
    Option         "NoLogo" "true"
    Option         "AddARGBGLXVisuals" "true"
    Option         "UseEvents" "false"
    Option         "RenderAccel" "true"
    Option         "HWcursor"
    Option         "TwinView"
    Option         "MetaModes" "1280x1024,1280x1024; 1280x1024; 1024x768,1024x768; 1024x768; 800x600,800x600; 800x600"
    Option         "TwinViewOrientation" "RightOf"
    Option         "SecondMonitorHorizSync" "UseEdidFreqs"
    Option         "SecondMonitorVertRefresh" "UseEdidFreqs"
    SubSection     "Display"
        Viewport    0 0
        Virtual     2560 1024
        Depth       24
        Modes      "1280x1024"
    EndSubSection
EndSection

# TV Only, monitors go blank
Section "Screen"
    Identifier     "Screen[1]-TV"
    Monitor        "Monitor[2]-TV"
    Device         "Device[1]-TV"
    DefaultDepth    24
    SubSection     "Display"
        Viewport    0 0
        Virtual     800 600
        Depth       24
        Modes      "800x600"
    EndSubSection
EndSection

# Dual head, 2 separate desktops, CMV and TV
Section "Screen" # work in progress.
    Identifier     "Screen[2]-CMV"
    Device         "Device[2]-Monitor-Only"
    Monitor        "Monitor[0]-CMV"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
        Modes      "1280x1024"
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen[3]-TV"
    Device         "Device[3]-TV-Only"
    Monitor        "Monitor[2]-TV"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
        Modes      "800x600"
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen[4]-LG"
    Device         "Device[2]-Monitor-Only"
    Monitor        "Monitor[1]-LG"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
        Modes      "1280x1024"
    EndSubSection
EndSection

Section "Monitor"
    Identifier     "Monitor[0]-CMV"
    Option         "VendorName" "CMV"
    Option         "ModelName" "CT-934D"
    Option         "DPMS" "true"
EndSection

Section "Monitor"
    Identifier     "Monitor[1]-LG"
    Option         "VendorName" "LG"
    Option         "ModelName" "Studioworks 900B"
    Option         "DPMS" "true"
EndSection

Section "Monitor"
    Identifier     "Monitor[2]-TV"
    Option         "VendorName" "Mitsubishi"
    Option         "ModelName" "Diva"
    HorizSync	    30-60
    VertRefresh	    60
EndSection

Section "Device"
    Identifier     "Device[0]"
    Driver         "nvidia"
    Screen          0
EndSection

Section "Device"
    Identifier     "Device[1]-TV"
    Driver         "nvidia"
    Option	    "TVStandard" "PAL-B"
    Option	    "TVOutFormat" "SVIDEO" # or "COMPOSITE"
    Option	    "UseDisplayDevice" "TV-0"
EndSection

Section "Device"
    Identifier     "Device[2]-Monitor-Only"
    Driver         "nvidia"
    VendorName     "Leadtek nVidia"
    BoardName      "geForce GTS 250"
    BusID          "PCI:01:00:0"
    Screen	    1
EndSection

Section "Device"
    Identifier     "Device[3]-TV-Only"
    Driver         "nvidia"
    VendorName     "Leadtek nVidia"
    BoardName      "geForce GTS 250"
    BusID          "PCI:01:00:0"
    Option	    "TVStandard" "PAL-B"
    Option	    "TVOutFormat" "SVIDEO" # or "COMPOSITE"
    Option	    "UseDisplayDevice" "TV"
    Screen	    0
EndSection

The TVStandard and TVOutFormat values can be determined by referencing the nVidia documentation (/usr/share/doc/nvidia-drivers-180.29/README.bz2)

[edit] Option 1: Disable One Monitor for S-Video

Code: Script to play a movie on the TV
#!/bin/bash

if [ "$1" = "nox" ]
then
    shift
    DISPLAY=":1.0" /usr/bin/mplayer -stop-xscreensaver -fs -vo vx "$@"
else
    exec /usr/bin/xinit /usr/bin/xterm -ut -e \
      /usr/bin/mplayer -stop-xscreensaver -fs -vo sdl "$@" -- /usr/X11R6/bin/X :1 -layout tv
fi

The above script takes 1 or 2 parameters. If the first parameter is 'nox', it assumes that X is already running in DualHeadTv layout and will start playing the second parameter using mplayer, on the second display. If there is only 1 parameter, it starts up the second instance of X that displays using the (tv) config and then starts playing the 2nd parameter using mplayer. In the second case, once the movie ends, the X instance quits and the normal Dual Head display returns.

[edit] Options 2: Separate X Screen

Code: Start FluxBox with TV Enabled
#!/bin/bash

/usr/bin/xinit /usr/bin/fluxbox -- /usr/X11R6/bin/X :1 -layout DualHeadTv &

The above script which simply starts up fluxbox using the (DualHeadTV) configuration. Within this fluxbox, I can then run the first script with 'nox' and have the movies play on the TV.

Once you quit the FluxBox session, your original session will return. You can switch back and forth between your normal session using CTRL-ALT-F7 and CTRL-ALT-F8. If you switch back to your normal session, the TV will cease to display.

Personal tools