LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-12-2007, 12:40 AM   #1
mageus
LQ Newbie
 
Registered: Jan 2004
Posts: 11

Rep: Reputation: 0
Dual head in X - dynamically enable/disable screens?


My Setup
- NV 7600GT video card
- Dell monitor connected to DVI
- Vizio plasma TV connected through an RGB->DVI adapter
- Ubuntu Edgy 6.10

My Goal:

- I want to use the LCD by itself during normal use.
- I want to dynamically enable the Vizio TV in order to watch a movie on it, and then disable it afterwards.
- Therefore, I don't want a single screen (a la TwinView). I want 2 separate desktops

My Current Ideas:

- Separate Screens
I set up the two displays as 2 separate screens, with a server layout that specifies the Dell as screen 0, and the Vizio as screen 1 (RightOf screen 0). This forces me to always have the TV 'on' and the mouse go off the right side of the Dell.
Also, although the mouse reliably move between screens, I can't get reliable keyboard input on windows displayed on the TV.

- Swap xorg.conf files
I have separate xorg.conf files for a 1-display (Dell only) situation and the 2-display situation. I have to kill gdm, swap the xorg.conf files, and then restart gdm. This is inelegant

Questions:

1) Is there way to start with just the Dell enabled, but then dynamically 'turn on' the Vizio?

2) Could I just start with the Dell enabled, but then start a new X server on the Vizio when I want to watch a movie? If so, how would I set up the screens in xorg.conf, and what command would I use to start the new server up?
Would both x servers display simultaneously, or would I have to switch between them?

3) Is there a way to setup gdm to use different xorg.conf files? Or maybe I could specificy different server layouts in xorg.conf, and then have gdm refer to the relevant layout?


I will post config and log files at request.

TIA.
 
Old 03-16-2007, 11:33 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hi there. I will try to shed a little light on the situation, but no guarantees
I use an nVidia dual head card, and I have a TV connected to the second output.
I have it set up as "2 separate X screens" using the "Xinerama" option. This is NOT Twinview; twinview didn't give me what I wanted.
While I have read somewhere about being able to use different xorg.conf files during boot depending on what was connected, I cannot recall the details. I'm sure if you Google around you will find some info on that.
If you click my username and perhaps view all posts by me, there are two in particular where I have posted my xorg.conf file, configured for the monitor and television. One of the posts is in Slackware Forum and is called something like "One computer with 4 screens", and the other I think is in the Newbie forum, and has nVidia in the title.
As for dynamically enabling the second screen, I'm not sure about it, but what would be wrong with simply leaving the television NOT on the video-in connected to the videocard?
I have both outputs going all the time, and there is no noticeable difference in performance or any thing; if I want to watch a movie, I just set the television to Video-2 and presto, there is the desktop for my screen # 2, ready to go.
I am not sure what would be the result of having multiple server sections in the .conf file, as I have never tried it.
One thing is for sure though: One physical computer can only run one instance of the X server at a time. Also, in order to change the config settings or whatever, the X server does have to be restarted/reset.
Are you using the AGP driver from nVidia? If so, you should have somewhere in your system menu the nVidia-settings controller.
You may want to look into that and see if it has an option or button to enable/disable one of the screens on the fly; it does allow for *some* things to be adjusted while X is running, but it often tells me that I have to save the config and restart X for any changes to take effect.
Hope this helps; If you need further help or cannot find my xorg.conf file, feel free to ask and I will post it here again.
Sasha

Last edited by GrapefruiTgirl; 03-16-2007 at 11:36 AM.
 
Old 03-17-2007, 01:46 AM   #3
mageus
LQ Newbie
 
Registered: Jan 2004
Posts: 11

Original Poster
Rep: Reputation: 0
GrapefruiTgirl - thank you for your thoughtful reply.

I'm doing what you're doing - 2 separate x screens.
Here's the bottom of my xorg.conf:

Section "ServerLayout"
Identifier "Standard"
Screen 0 "7600dvi"
Screen 1 "7600crt" RightOf "7600dvi"
InputDevice "Generic Keyboard"
InputDevice "Marble Mouse"
InputDevice "LIRC Mouse"
EndSection

Since I manually start a window manager on the second screen, it normally starts up with the grey X background with 'X' cursor - minimal memory & CPU usage.

BUT - now my mouse is going off right side of the screen into 'nothingness' when the TV is off. This is not optimal for daily use.


If I do something like:

Screen 0 "7600dvi"
Screen 1 "7600crt"

how do I get the mouse to jump to the second screen? I guess I can send programs to the second screen using the terminal and use the IR remote to control things (see the LIRC mouse entry). But it would be nice to use the mouse in the second screen.


Also, once I launch programs into the second screen using the DISPLAY= switch or export DISPLAY cmd, all further terminal commands get sent to the second screen.
 
Old 03-17-2007, 08:42 AM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hmmm.. As for the mouse going off the screen into nothingness, it *may* be a necessary evil, because whether the TV is on or off, the desktop to the right is *virtually there* all the time, at least the way I have mine set up.
One thing I did to get around this, was to experiment with the orientation of the two screens; First, I put my second screen (the TV) ABOVE my monitor, and next I tried it BELOW the monitor, instead of the 'RightOf" method you are using.
While both of these worked fine, and kept the mouse from going off the sides of the monitor, I came back to the first way, having the TV off to the right. The reason was this:
1) With the TV on top, at a resolution of 1024x768, it seems my mouse-cursor size got applied at that resolution, so appeared larger than I like when it was on the monitor.
and
2) With the TV below the monitor, I was having difficulty dragging windows down to the TV screen, I believe it was because the taskbar was preventing windows from being dragged down across it.
So.. I came back to the first way, with the TV to the right, and I am happy with this; I don't have any grudge about mousing off the monitor on occasion, it isn't a noticeable inconvenience.

Now, as for your having to do that 'DISPLAY = switch' I don't know what to say on that; I just do one of 2 things to use the screen to the right (the TV):
1) Drag a window or application off the monitor and onto the TV with the mouse, or...
2) In the case of Xine for example (the media player) I have Xine configged to display by default on screen :0.1, so when I open it, the movie window opens on the TV; then I mouse over and hit Full-Screen, and it maximizez on the TV screen.

Another suggestion: I didn't quite get the performance I wanted by using the RightOf option. Instead, I did it like this:
Code:
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" 1600 0
Where in this example, Screen0 is my monitor, at 1600x1200, and the TV is Screen1, which starts at x=1600, y=0. When I go to my Desktop Control Panel, It shows Both screens, each with its own wallpaper..
I use KDE, and in the menu when I right click the desktop, there is a tab for "multiple Monitors", where I can set several parameters related to how windows operate relative to the 2 screens. I enabled all 4 or 5 checkboxes, and everything works in a way I am quite happy with.
I can use the computer with my monitor, while watching a movie on the TV. I can bring the movie control panel up on my monitor and control the movie playing on the TV, and if I want, I can mouse over onto the TV screen if I want.
If there is anything else I can help you with RE: the dual screens, or with your config file, just ask away
Take care.
Sasha

Last edited by GrapefruiTgirl; 03-17-2007 at 08:44 AM.
 
Old 03-19-2007, 10:39 PM   #5
mageus
LQ Newbie
 
Registered: Jan 2004
Posts: 11

Original Poster
Rep: Reputation: 0
Good ideas. Here's some thoughts:

- Having the second screen off the main monitor has problems with 'hot corners'

I use the top-right 'close box' all the time, throw the mouse to the top corner to hit it. This rules out 'above' and 'right of'.
I keep my taskbar in the bottom, so the 'start menu' button is bottom right, which rules out 'below' and 'right of'

Now, I use a hot-key for the 'start menu' so I might try 'left' or 'below' and see how that works.


- Where do you set the config to default open an app to a certain screen (e.g. your xine)? I was just thinking of using a command line switch (DISPLAY) in the shortcut.


>> I didn't quite get the performance I wanted by using the RightOf option. Instead, I did it like this:
>> Code:
>> Screen 0 "Screen0" 0 0 Screen 1 "Screen1" 1600 0

- This is what I alluded to in my previous post. I use IceWM as my window manager, and don't use any of the KDE (or Gnome) control panel apps. If I try using the above server layout, I get 2 separate screens that are physically independent of each other, and the mouse won't go into the second screen.
Maybe I'll play with nvidia-settings or try to launch the kde monitors control panel and see if I can do anything with that.
Or maybe I'll just have to switch to KDE raw (non-Kubuntu).


Thanx. I'll let you know what I come up with.
 
Old 03-25-2007, 10:19 PM   #6
mageus
LQ Newbie
 
Registered: Jan 2004
Posts: 11

Original Poster
Rep: Reputation: 0
The nvidia-settings and kde control panels were useless for what I'm trying to do. You can't change the number of screens used once X is launched. Here's my final setup:

I've set up separate screens, but not connected. That means no 'right of' or 'left of'. You can't mouse between screens. My xorg.conf server sections looks like this.

Screen 0 "7600dvi"
Screen 1 "7600crt"

I have an X10 remote that I've set up with LIRC.

Watching movies is tedious. From a terminal on my LCD monitor, I use the DISPLAY option to launch vlc and the movie title from the command line. Since I can't use the mouse in the second screen, I control VLC with the remote. When I'm done watching a movie I ctrl-C from the command line to kill it. Very inelegant.

I've also set up MythTV to launch into the 2nd screen (the plasma). This actually works quite well with the remote control.

2 problems remain:

- The plasma only accepts 1024x768, although it's 16:10 aspect ratio. So everything looks stretched. MythTV has aspect ratio settings to get a widescreen image onto a 4:3 screen, but doesn't seem to have a setting to fit a 4:3 image onto a widescreen TV (VLC does this quite easily)

- MythTV keeps crashing, and freezing the kernel (which is scary, since I've _never_ crashed the kernel since installing Ubuntu).
 
Old 03-26-2007, 05:52 AM   #7
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Rep: Reputation: 35
It is possible for one physical machine to run multiple X servers. My desktop/monitor gets one X server/screen by default and when I want to watch something on my TV, I use a script that launches a new X server, which loads on VT8(and my TV) and my monitor shuts down until I switch back. I use MPlayer myself, but I'm sure it would work with any media player. Here's the relevant bits:

TV's device section:
Code:
Section "Device"
    Identifier   "TV"
    Driver       "nvidia"
    BusID        "PCI:3:0:0"
    Option       "NoLogo" "1"
    Option       "TVOutFormat" "SVIDEO"
    Option       "TVStandard" "NTSC-M"
    Option       "ConnectedMonitor" "TV" # see NOTE 1
EndSection
NOTE 1: this option is essential for me to use tv-out in a single-head fashion - at least with analogue TV and S-Video. Without it, VT8/DISPLAY:1 gets loaded to my monitor. You may have to peruse the xorg.conf manpage (or more likely) the Nvidia readme for info. Specifically, Appendix H now suggests you use the "UseDisplayDevice" option instead of "ConnectedMonitor". Take a look in /var/log/Xorg.0.log for a line like this to find the right device name to use (detailed somewhat in Appendix R):
(II) NVIDIA(0): Connected display device(s): CRT-0, DFP-0"


server flags/layout sections
Code:
Section "ServerFlags"
       Option   "DefaultServerLayout" "default"
EndSection

Section "ServerLayout"
    Identifier  "default"
    Screen      "CRT" 0 0
    InputDevice "mouse" "CorePointer"
    InputDevice "keyboard" "CoreKeyboard"
EndSection

Section "ServerLayout"
    Identifier  "TV"
    Screen      "TV"
    InputDevice "mouse" "CorePointer"
    InputDevice "keyboard" "CoreKeyboard"
EndSection
I'm assuming here that actually enabling TV out is not the issue. If you want me to post more sections, just ask. However I haven't the foggiest clue what's needed (different from an analogue set) for a plasma.


and the script that makes the magic happen:
Code:
#!/bin/sh

/usr/X11R6/bin/X :1 -layout TV &

export DISPLAY=:1.0

xbindkeys &
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 &
nvidia-settings -a :1.0/XVideoSyncToDisplay=256 & # see NOTE 2
nvidia-settings -a :1.0/TVOverScan[TV-0]=20 & # see NOTE 3

mplayer -fs -softvol -softvol-max 500 "$1" &&
pkill -f "layout TV" #see NOTE 4
NOTE 2: this and all the above nvidia-settings commands are to keep the video on the TV from tearing

NOTE 3: xbindkeys is called to facilitate running this command (and variations of it like =15) easily while the server is running - not necessary with the 9755 driver, finally. previously VT-switching and returning to the TV would cause the overscan to reset to default. Nvidia finally fixed this though.

NOTE 4: kills the new X server when MPlayer quits. MPlayer (the non gui version) quits automatically when it reaches the end of a file. If VLC doesn't behave that way, the final line will be useless. Unless you bind a key on your remote to VLC's quit command that is, which would bring down the server with VLC and your monitor should come back to life.


Now you don't say what your Distro is (that I can see), so YMMV with the following. Generally what happens the first time you try to launch the second X server(and run anything on it) is you get an error (Xlib: connection to ":1.0" refused by server, etc). At least that's the error you get if you try to run the launch script in a console. When I was running Slackware, I just edited startx so it creates 2 magic cookies on startup instead of just one. Like so:

find the following line in startx:
authdisplay=${display:-:0 }

and make it look like this:
authdisplay=${display:-:0 :1}

but I believe that's useless if you're using kdm/gdm/xdm.


another way is to create a script that runs at (desktop, KDE/Gnome) startup:
Code:
#!/bin/sh

xauth add  :1 . `mcookie`
You can check that this worked by running "xauth list" and looking for an entry with :1

Neither of these seems to work for me in Debian. (I was under the impression that the xauth script was working when I ran Gnome, but the fact that I'm not using it now in KDE makes me think this script was not doing anything for me. As I said, YMMV).

This is what's presently working for me: edit /etc/X11/Xwrapper.config from:
allowed_users=console
to
allowed_users=anybody

neither of the 2 previous methods do anything for me on Debian Etch anymore, only editing Xwrapper.config does anything. There are hordes and hordes of google hits about solving the "connection to ":1.0" refused by server" problem though.

I think the serverlayouts (and the 1 serverflag) and the script pretty much speak for themselves and I've probably already explained them more than needed so I'll stop here. If I've left something out, let me know.


I believe X.org 7.3 is going to start really improving the on-the-fly adjustment capabilities of X. But we're not quite there yet.

edit: oh yeah, once it's all set up and working, you can set the launch script as one of the apps that can run video. In the file associations config for KDE, add the script to the list of apps for .avi .mpeg .mpg .wmv etc etc(maybe taking care not to have the script at the top of the list if you don't want to launch the TV X server with double-click/enter type execution of video files). I prefer to access the file associations by the properties window of a specific file. Now you can right click on the video you want to watch, and the tvout script should appear in the "Open With" menu.

Last edited by lurko; 03-26-2007 at 06:06 AM.
 
Old 04-10-2007, 11:39 PM   #8
mageus
LQ Newbie
 
Registered: Jan 2004
Posts: 11

Original Poster
Rep: Reputation: 0
lurko, thanx for the reply.

Actually, I'm basically doing what you're doing. I'm running Ubuntu with an Nvidia 7600GT (see the top of my first post).

Fortunately, with dual-head you can do something like:

Code:
Section "ServerLayout"
	Identifier	"default"
	Screen		0	"7600dvi"
	Screen		1	"7600crt"
	InputDevice	"Generic Keyboard"
	InputDevice	"Marble Mouse"
EndSection
which does the same thing you are trying to do but actually starts X on both screens (the LCD and TV) at the same time. It displays IceWM on the LCD but a blank desktop on the TV.

I can launch Icewm or vlc into the TV by using the 'export DISPLAY=:1.0' command, like you've listed, and running subsequent apps from within that terminal.


What I'd like to do is have some way to make the mouse switch from the LCD to the TV screen but not by having the 2 desktops connected.

For now, I'm just using the command line to launch my video player and Myth. I'm pretty much using Myth exclusively since I can control it completely with my X10 remote.
 
Old 04-11-2007, 02:40 AM   #9
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Rep: Reputation: 35
glad to hear(read) you've got something sorted mageus. I originally had a similar setup to what you're using now, but if memory serves the video on the second screen (tv) was always tearing, and I guess I just like the way I do it now, with nothing on the TV when I'm not using it.

I'm afraid I can't help with redirecting input from one screen to the other, I remember briefly reading about it when I first switched to linux but never found any really concrete info. The way I do things I have to VT-switch from the tv to the monitor(if I want to use the computer mid-video) and whichever one I'm using leaves the other with a blank screen.

You could certainly whip up a script to launch your video player on the TV pretty easily as I do, but I guess that depends on what (if any) program-launching-by-file-association scheme IceWM has.

Are you saying you've got a window manager on your monitor and just a bare X server on the TV? I'd be curious how you set that up? - or is the desktop on your TV part of the IceWM instance on your monitor(I know how to do that).
 
Old 04-11-2007, 11:52 PM   #10
mageus
LQ Newbie
 
Registered: Jan 2004
Posts: 11

Original Poster
Rep: Reputation: 0
I figure I'll keep what I've got now, since I can live with MythTV. I'll keep your setup in mind (with the separate VT's) if I need to use the mouse.

The way my server section of the xorg.conf is setup, X actually starts up on both screens. But these are completely independent - i.e. the mouse cannot pass from one to another (unlike when you use the 'RightOf' flag.

So, yes, there is just a bare X server on the TV. I can use 'export' with any command and it launches it on the TV. No need to run startx (I'm using xorg).

I think the reason that IceWM only displays on my LCD is that it's only aware of the first screen. It may be because IceWM is a primitive window manager, so I should probably test this behaviour in KDE or Gnome to see if it does the same thing.

However, if I use the export command to start a new icewm session on the TV, it works just like a second, independent desktop.

If I use the 'RightOf' flag in my xorg.conf server section, the behaviour is exactly as above, except that the mouse can move between screens. However, apps, windows, etc. cannot move between screens.
 
Old 04-12-2007, 04:29 AM   #11
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Rep: Reputation: 35
ahh, I see - I should have noticed the absence of the "RightOf" option. Thanks for clearing things up for me
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dual-head with X: Second (VIA) Head Dead Dria Linux - Hardware 2 11-26-2006 10:55 AM
What is HOQ (Head of QUEUE ) How to disable it . vijay1020102 Linux - Enterprise 0 05-26-2006 12:31 AM
Dual head - move application between screens rottie Linux - Software 5 12-12-2004 01:40 PM
Multi-monitor Issues on RH9, Geforce 4 Ti Dual Head + TNT2 Single Head the letter b Linux - Newbie 3 12-04-2004 11:23 PM
x86 Solaris 9 XSun and Matrox G550 dual-head... one head down, one to go. finegan Solaris / OpenSolaris 4 03-11-2003 12:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration