Subject: Re: controlling start of X servers with xdm
To: None <netbsd-users@NetBSD.org>
From: Frederick Bruckman <fredb@immanent.net>
List: netbsd-users
Date: 04/18/2004 12:15:59
On Sat, 17 Apr 2004, Hanspeter Roth wrote:

> I'd like to run two X sessions. At least one should be launched by
> xdm. When I run a second X session without xdm it may happen that
> after a while the two servers interfere with each other. So I'm using
> xdm to launch both X sessions.
>
> The Xservers file looks like:
>
> :1 local /usr/X11R6/bin/X vt06 :1 -nolisten tcp -xf86config XF86Config2
> :0 local /usr/X11R6/bin/X vt05 :0 -nolisten tcp
>
> This usually causes the server on display :0 to appear first. This is
> what is desired.
> However sometimes the server on display :1 appears first.
>
> Interestingly it seems that the setup phase of the second X server
> only starts running when the display is switched by ctl-alt-fx.

This is an old issue:

    http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=8128

> How can I make sure that the server on display :0 _always_ appears
> first?

The "vt" argument does nothing, by the way. With the recent XFree86,
the first available virtual terminal is always chosen. However,
because opening the virtual terminal is not the first thing the
Xserver does, there's a race condition, so it often happens that the
first server started gets the higer numbered terminal.

That should be the first clue that having two binaries attack the same
video card is not a good idea. It mostly works when you're only using
the frame buffer, because the inactive binary sleeps, and there's no
way to fatally corrupt a frame buffer that remapping the windows can't
fix, but if you use any other features (acceleration, X Video), some
card resource will eventually get corrupted and hang the system.

It would be neat, though, if the one Xserver binary were smart enough
to attach different virtual terminals as different screens on the same
display. You could have one login, but view programs in different
resolutions and depths on the other screens. The server would be
expected to lock resources as appropriate, or at least only make
certain resources available through selected screens. Just a thought.

Frederick