LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-10-2006, 07:53 AM   #1
Tarrasque
LQ Newbie
 
Registered: Jul 2003
Distribution: Mandrake 9.1
Posts: 21

Rep: Reputation: 0
Run 2 different X servers


Hello everybody.

This is the "case study" of my problem:

I am going to run a sort of "game", where I will have to use visual aids, which I would like to project on a wall or something from my PC S-VIDEO out.

It would be great, for example, if I could run MPlayer (or any other video player, for that matter) such as the control GUI shows up on my primary (LCD) monitor and the video window shows up on the secondary (S-VIDEO) exit, so that the people will not see me shuffling through the files and things like that.

I was wondering if this is possible with Linux (I use Ubuntu) using more than one X Server.

The steps I broke the problem into are:

1) - Is it possible to run 2 X Servers so that they are completely unrelated (not just clones one of the other like you usually see in windows) and with different settings / resolutions?

2) - If point 1 is possible, can I configure MPlayer to have the GUI in one server and the video output in the other?

3) - If point 2 is not possible, can I et least launch an application FROM server 1 (by double clicking or command line, I don't care) so that it starts up ON server 2?

I was thinking of the third point as a sort of fall back, beacuse I am almost sure it can be done (though in my newbieness I don't remember HOW), and I think it would suffice for me to CTRL-C the player I launched from the main monitor to quit the output to the second monitor.

4) - alternatively, can I have TWO mice connected to my PC, in order to operate the first desktop with mouse 1 (and launch the applications ON the second sesktop, like in point 3 above) and use mouse 2 on the second desktop simply to pause / start / close the video player?

Thank you very much. I'm sorry for posting so much question, but since they are all related to the same problem I thought it was better to have them all together instead than scattered in many posts.

Plus, I'll eagerly wait for hints and suggestions to solve my problem, which I hope to have explained fully, in alternative ways.
 
Old 01-10-2006, 08:27 AM   #2
generic_genus
Member
 
Registered: Oct 2005
Distribution: Gentoo Unstable
Posts: 51

Rep: Reputation: 15
I've found 3 pages that are relevant:

http://gentoo-wiki.com/HOWTO_get_2_users_on_1_pc
http://cambuca.ldhs.cetuc.puc-rio.br/multiuser/
http://blog.chris.tylers.info/index....11R6.97.0.html

The third method looks to be the best at a quick glance but don't take my word for it

Let me know how you get on I may consider doing something similar myself. It would be REALLY nice if you ran mythTV (in conjuction with a tv card ofcourse) on the second display, so you'd have a full blown PC and a full blown PVR on one box working independently.

Last edited by generic_genus; 01-10-2006 at 08:53 AM.
 
Old 01-10-2006, 08:32 AM   #3
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
Certain points sound promising, others less so. Specifically, you can *definitely* have more than one pointing device (and graphics card, monitor etc) which you tie together in the "Section" part of an XF86Config/xorg.conf. If you can carry out all the other steps, attaching mouse 1 to display 1 and mouse 2 to display 2 should be simple.

I'm not sure if you can run two X servers at once on the same box; my feeling is that you can't, but you may be able to connect two different display to the same server (while keeping them distinct). I did a quick Google and found some promising hints but nothing concrete.

The main stumbling block though, and the point you'll probably want to address first, is whether you'll be able to redirect the output of a media player to a different display. Of course, this depends on some extent on the architecture of how multiple distinct screens would work under X, but if it's not directly supported in the application you'd basically have to patch the source code. If there's an option in the graphics output that looks something like localhost:0, you can probably change this to localhost:1 if you have a second display running on the same X server, which would be great. If it's possible to have two X servers running, you could probably still connect to the other screen though there might be more jiggery-pokery involved. (Hmm, on second thoughts a separate display will be a separate display no matter where it's hosted).

So if there's specific display support in your media player, then I think there's a high chance of this work. IIRC I don't recall seeing this in MPlayer or VLC's options. However, I'd be very surprised if there isn't *some* player that allows you to do this - and once you've got the means to redirect output, we can consider setting up somewhere to direct this output to.

Wishing you all the best in your project,
Andrzej

Last edited by Dtsazza; 01-10-2006 at 08:41 AM.
 
Old 01-10-2006, 08:34 AM   #4
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
In order to look into the screens part of the job, it'd be useful to know what version of X you're running (especially whether it's XFree86 or X.org). Of course, if one supports this idea and the other doesn't it's not too much trouble to switch.
 
Old 01-10-2006, 08:42 AM   #5
Tarrasque
LQ Newbie
 
Registered: Jul 2003
Distribution: Mandrake 9.1
Posts: 21

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Dtsazza
In order to look into the screens part of the job, it'd be useful to know what version of X you're running (especially whether it's XFree86 or X.org). Of course, if one supports this idea and the other doesn't it's not too much trouble to switch.
I'm using the latest Ubuntu, so I'm quite sure it's X.org (I think it's 6.8, but I'll have to check to be sure)

Thx for your answer.
 
Old 01-10-2006, 08:46 AM   #6
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
To add (unfortunately) another stumbling block, it seems that you must have one mouse, one keyboard and one graphics card-monitor combo per display. Presumably the last part isn't a problem, and with USB mice the mouse part shouldn't be an issue. However, attaching two keyboards to a computer at once might prove more tricky - there are of course USB and Bluetooth keyboards, but they're not that widespread. It seems you'll have to have one (unless there's some simpler way I've missed) for your "public" display, even if you don't intend to use it.
 
Old 01-10-2006, 08:51 AM   #7
Tarrasque
LQ Newbie
 
Registered: Jul 2003
Distribution: Mandrake 9.1
Posts: 21

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Dtsazza
Certain points sound promising, others less so. Specifically, you can *definitely* have more than one pointing device (and graphics card, monitor etc) which you tie together in the "Section" part of an XF86Config/xorg.conf. If you can carry out all the other steps, attaching mouse 1 to display 1 and mouse 2 to display 2 should be simple.
This would still be a step forward.

Is I told, it would not be the optimum, because, for the nature of the game, I'd like to keep the two servers as separated as possible, so that the players don't see which files I'm going to play and things like that.

Quote:
Originally Posted by Dtsazza
I'm not sure if you can run two X servers at once on the same box; my feeling is that you can't, but you may be able to connect two different display to the same server (while keeping them distinct). I did a quick Google and found some promising hints but nothing concrete.
I was quite sure you could do that. After all, a VNC server actually opens up a modified X server where the output is sent through the net to the client (or at least that's what I've been told once).

Quote:
Originally Posted by Dtsazza
The main stumbling block though, and the point you'll probably want to address first, is whether you'll be able to redirect the output of a media player to a different display. Of course, this depends on some extent on the architecture of how multiple distinct screens would work under X, but if it's not directly supported in the application you'd basically have to patch the source code. If there's an option in the graphics output that looks something like localhost:0, you can probably change this to localhost:1 if you have a second display running on the same X server, which would be great. If it's possible to have two X servers running, you could probably still connect to the other screen though there might be more jiggery-pokery involved. (Hmm, on second thoughts a separate display will be a separate display no matter where it's hosted).
Yes, this would be in facts the best option, and I'm looking around for more information about XINE, MPlayer and other media players. Still, as you correctly state, the capability of "splitting" GUI and output must be a feature of the application, but if I'm not able to run the 2 servers at once on my box it won't be of any help, so I think the primary point is still to answer to this question.

Quote:
Originally Posted by Dtsazza
So if there's specific display support in your media player, then I think there's a high chance of this work. IIRC I don't recall seeing this in MPlayer or VLC's options. However, I'd be very surprised if there isn't *some* player that allows you to do this - and once you've got the means to redirect output, we can consider setting up somewhere to direct this output to.
I'm sure there's a way of directing an application's graphic output to a remote server (I read something once, but I don't remember, I think it had to do with an environment variable called DISPLAY or something like that... bad memory...).

Problem is:

1) I don'r remember HOW

2) "remote" in this case means another server ON the same machine (since that's the only one I got)

Quote:
Originally Posted by Dtsazza
Wishing you all the best in your project,
Andrzej
Thank you very much for your advice.
 
Old 01-10-2006, 09:07 AM   #8
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
Quote:
Originally Posted by Tarrasque
Quote:
Originally Posted by Dtsazza
I'm not sure if you can run two X servers at once on the same box
I was quite sure you could do that.
Yes, it turns out that it's quite possible. I must have been getting mixed up with something else, probably all the terminology around screens and displays and servers etc...

man xinit gives some promising examples - for example, you can run xinit "as normal" to set up your main display, then pass it the arguments "-- /path/to/X/Server :1" to start another X server on display 1. As written there it'd probably fail as it'd try to use the default device (monitor-gfx card pairing) which would be in use. I think you'd have write a second XF86Config/xorg.conf for the "public" display, and pass it into the server via a "-config ~/my_second_xorg.conf" parameter (at least for X.org).

So if you have the resources to run both displays, you can set up two config files, and by swapping them on the go you can test that each display works individually. Then it's just a case of getting both servers running at once - as long as they're using distinct resources this shouldn't be a problem (but I somehow have misgivings about starting an X server from within X - it should be OK but we might need a shell script to spawn both servers at the same time).

It seems that finding the right media player is the only part left!
 
Old 01-10-2006, 09:19 AM   #9
bobbens
Member
 
Registered: Sep 2004
Location: Barcelona
Distribution: Debian, FreeBSD, Gentoo
Posts: 586

Rep: Reputation: 30
Quote:
Originally Posted by Dtsazza
man xinit gives some promising examples - for example, you can run xinit "as normal" to set up your main display, then pass it the arguments "-- /path/to/X/Server :1" to start another X server on display 1. As written there it'd probably fail as it'd try to use the default device (monitor-gfx card pairing) which would be in use. I think you'd have write a second XF86Config/xorg.conf for the "public" display, and pass it into the server via a "-config ~/my_second_xorg.conf" parameter (at least for X.org).
I'm pretty sure you can just use one xorg.conf but give it multiple server layouts and then run X using a different layout.

Well this looks interested, i should try again and see if i can get a second card to work this way. I was attempting to use xinerama with a radeon card and a mach64 in the same server layout, but you can't do that with a radeon, altough this would work . Was thinking about doing that a while ago, but if i can steal ideas from this thread it'd be great .
 
Old 01-10-2006, 09:22 AM   #10
Razze
Member
 
Registered: Dec 2004
Location: Espoo, Finland
Distribution: Gentoo, 2.6.16-gentoo-r11
Posts: 108

Rep: Reputation: 15
Hello!

This can be done, it only requires some fiddling with your xorg.conf. You did not say what hardware you are using, so I am not sure you display card can do the same.

I am using X.org 6.8.2, an old (cheap) nvidia GeForce MX 4000 and nvidia drivers. My setup is as follow:

Screen 0.0: My lcd display that I mainly use
Screen 0.1: TV output for movies, pictures etc

Both use the same mouse and keyboard (I just love my Logitech cordless desktop!), and I can use both simultaneosly. They also have completely different setup regarding to resolution and refresh rates etc, but DPMS (power save) settings are the same for both. I can NOT drag a window from one screen to the other, but the mouse moves between them. I can open programs in both windows. I even get 3D hardware acceleration (GLX) on the TV screen!

I am not using an GUI for my movies, so I can't help you on that one, but using command line the command
Code:
DISPLAY=:0.1 mplayer -fs  my_movie.avi
starts the movie in fullscreen mode in my TV.

I have the normal input device sections, monitor sections for both the TV and my LCD, and two device sections for the display card. The important line is BusID, and it is also good to specify which screen is which. Then I of course need to specify the screen resolutions and color depths for each screen, and in the ServerLayout I specify both screens and their positioning.

My complete xorg.conf can be found here

Hopefully this can be of some help for you

Razze
 
Old 01-10-2006, 09:37 AM   #11
Dtsazza
Member
 
Registered: Oct 2005
Location: Oxford, UK
Distribution: Debian Etch (w/ dual-boot XP for gaming)
Posts: 282

Rep: Reputation: 31
Ah, of course, I did think there was some way to specify multiple displays in a config file then have the server select one at runtime, but couldn't find the syntax for the "-screen" option.

Thanks, Razze, that's more or less it. You could try using the above command, Tarrasque, but changing 'mplayer' into 'gmplayer', though that might end up putting the GUI on the second screen as well. Another option may be to specify options to the output driver you use (with "-vo ..." or in preferences"), which hopefully will only affect playback.
 
Old 01-10-2006, 12:09 PM   #12
jon_k
Member
 
Registered: Jul 2003
Location: Fort Worth, Texas
Distribution: Mepis Linux 2004
Posts: 547

Rep: Reputation: 30
Quote:
I'm not sure if you can run two X servers at once on the same box; my feeling is that you can't, but you may be able to connect two different display to the same server (while keeping them distinct). I did a quick Google and found some promising hints but nothing concrete.
Yes you can. Lookup the usage of the command "startx" there should be a flag for display number.

IIRC it's something like:

$ startx -- :1 vt8

That should run X in virtual terminal 8. You can switch back and fourth between ther first and second X by pressing CTL ALT F7 and CTL ALT F8.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't run multiple X servers jojotx0 Linux - Software 3 08-12-2006 10:31 AM
what do enterprise servers run? SlipAway172 Linux - General 8 06-16-2005 10:19 AM
Question on users under which servers run keygrip Linux - Newbie 5 03-06-2004 12:27 PM
which distro do you run on your servers? groovin Linux - Networking 2 01-08-2004 11:05 PM
Making two servers run one website. Travis86 Linux - Networking 2 10-01-2003 11:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:49 PM.

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