No announcement yet.

Multiple X servers on one card?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple X servers on one card?


    I hope this is an appropriate place to ask questions like this (found it by searching for "linux nvidia forum"). Apologies if I'm mistaken.

    I have an old GeForce FX 5700 in a Fedora 8 machine. The card has an s/video out as well as a regular vga connector. I currently have things set up so that when the system boots up, gdm displays on the monitor and nothing displays on the tv/svideo. When I log in, two desktops are created for that user: one on the monitor and one on the tv.

    What I want to happen is this:

    When the system starts up, an X server is started on the svideo only, running a desktop as a particular user (I want to use it for displaying videos, youtube, etc). On the monitor, gdm would display as normal.

    So, basically, I want to have X logins as two separate users, one on the monitor and one on the tv. Does anyone know if this is possible? I'm linux-savvy enough that I'll understand xorg.conf snippets/examples, I just haven't ever tried something like this before.

    Thanks in advane for any responses!

  • #2
    You can easily run 2 (or more) Xservers on one card, even with tvout. I'm not sure how you would go about setting up the configuration you describe though. Probably there's at least a couple of ways.

    Before you start, make a copy of ~/.nvidia-settings-rc - you may want it for future reference of auto-detected settings for your TV, to include in scripts.

    For multiple Xservers at least, if you add a ServerLayout section to your xorg.conf (assuming you have another display already configured with existing Device, Monitor and Screen sections), you can start a new Xserver on a second display with the options :1 and -layout.

    Add this to your server flags section(or the whole thing if you don't have a server flags section):
    Section "ServerFlags"
           Option   "DefaultServerLayout" "default"
    And make sure the value matches the Identifier of your current, working ServerLayout.

    Then add a server layout for your tv that doesn't include your monitor:
    Section "ServerLayout"
        Identifier  "TV"
        Screen      "TV"
        InputDevice "mouse" "CorePointer"
        InputDevice "keyboard" "CoreKeyboard"
        InputDevice "lirc-mouse"
    Obviously you should use the indentifier for the Screen section of your xorg.conf that corresponds to your TV, and the devices that are actually defined in your own xorg.conf.

    Now remove the reference to your TV in the default ServerLayout, so that your monitor is the only display device listed there.

    This way gdm will start on the display defined in the DefaultServerLayout option (without the second desktop on the TV) and you should be able to then launch a new Xserver on VT8 to your TV with:
    $X :1 -layout TV
    The default layout is on display :0 so the new one needs to be on :1(or rather just not on :0). If you started another on a third display it would be on :2. For comparison, in your current setup, the monitor is :0 and the TV is :0.1 (a second display device attached to display :0 ). The -layout option needs to match the identifier for your TV's ServerLayout. In my example the identifier is TV so that's what I used here.

    I use TVout this way to open an empty Xserver on my tv and then run MPlayer on it. You can use it to start an Xserver and run pretty much whatever you want on it, but there is a quirk of this setup - when I launch the new Xserver to watch a video on the TV, my monitor shuts off (that's how I like it though). I can VT-switch back to VT7 and the monitor comes back up, but the TV goes blank until I go back to VT8. When I quit MPlayer or it quits itself at the end of a video, the script I use kills the second Xserver and the monitor starts back up with my KDE session where I left it.

    Now you could login on the monitor and launch a script like this:
    X :1 -layout TV &
    export DISPLAY=:1.0
    pkill -f "layout TV"
    This starts the new Xserver, sets all subsequent commands to be run on display :1, starts KDE on it (I'm pretty sure that's the command, you may have to read up on manually starting KDE like that), and then when KDE exits it will kill the Xserver. However I have a feeling if you're already running KDE you might run into problems starting another copy of KDE as the same user. It's just an example - you could substitute 'startkde' with any X program really (like MPlayer for example).

    If you set the DefaultServerLayout option to the ServerLayout for your TV, gdm will start up on the TV, and you could launch an Xserver to the monitor the same way as above, but specifying the name of your monitor's ServerLayout with the -layout option instead of the TV's. However I haven't the foggiest how you would then get it to run gdm on the monitor if you've already logged in to an Xserver on the TV(gdm would already be running). edit: I suspect it could involve tweaking /etc/inittab or an initscript, but I wouldn't mess around with those unless I was sure about it. Maybe you could add a new session to gdm's list that launches on another display.. idk this edit is all supposition so take it with a grain of salt or something /edit

    That's the closest I can come to a solution that resembles what you asked for without serious thought and research. I'm not sure you can have 2 simultaneously active, independent displays for one user with the same input devices. I would look at the manpage for gdm (more specifically at the various config files it hopefully references, I say hopefully because I've only got KDM's to look at myself) for info on ways to get gdm to start where you want it. KDE has the "Start New Session" option on the Kmenu, I'm sure GNOME has a similar one. This gives me a new KDM login screen on VT8. If you can tweak that somehow to get the new session to start on another display then you could set the default layout to your TV's and just hit "start new session" whenever you wanted to login through the monitor. I don't know how you'd do that though.

    I'm sure however that you can have mulitple simultaneous users with their own sets of input and display devices. It may be possible to jury rig something without a separate keyboard/mouse and just lirc maybe, but I really don't know for certain.

    Check out this guide on building a six-headed, six-user system, I think that information coupled with mine may be enough to get you something awful close to what you're thinking about. I'll try to help if I can but I think I've imparted just about all I know on this subject already. I hope I haven't complicated things too much in the explanation, good luck usernamenumber.

    special note:
    add these lines to any script you use to watch video on the TV when it's setup in the way I described. They should prevent tearing of your video.
    nvidia-settings -a :1.0/SyncToVBlank=1 &
    nvidia-settings -a :1.0/AllowFlipping=1 &
    nvidia-settings -a :1.0/XVideoTextureSyncToVBlank=1 &
    nvidia-settings -a :1.0/XVideoBlitterSyncToVBlank=0 &
    Last edited by oblivious_maximus; 29 January 2008, 11:42 AM.