You are not logged in.

#1 2010-09-24 17:32:52

Rad3k
Member
From: Poland
Registered: 2009-05-09
Posts: 36

"Multiseat" gaming with multi-pointer X

Hello Arch gaming community,

recently I've discovered a decent way to play multiplayer games in multiseat (or pseudo split-screen) manner. It really works - I use it to play Myth II: Soulblighter (on Wine) with my brother wink

Short explanation:
In recent versions of Xorg (>= 1.7), there's a nice feature - it lets you plug another mouse and make it control a second pointer on the screen. Plug another keyboard, assign it to this pointer, and you can independently work with two windows at a time (each pointer getting it's own focus). Now, if you connect a second physical display and configure it to be a separate X screen belonging to the same X server, you can send your second pointer to that screen, virtually allowing both sets to be used independently. Now, run some game on first screen, then another instance on another, and you can play it multiplayer with your friend smile

What makes this approach better than a "true" multiseat:
Configuring a proper multiseat system (where each "seat" get's it's own login screen) is not easy, to start with. Often it won't let you use hardware acceleration on both displays unless they're connected to two separate video cards. Mutli-pointer approach lets you use both screens with hardware acceleration with just one dual-head graphics card (like most laptops have). Besides, it's much less painful to set up.

The downsides:
The multi-pointer feature of Xorg is still fairly new, and is not supported by any window manager that I know. Thankfully, it doesn't have to be explicitly supported by a WM in order to be used with it, but most WMs tend to get confused by it. Also, sometimes keyboard focus is not automatically assigned for the second pointer, and you have to explicitly assign it via command-line for the keyobard input to work.

So, how to do it?
The basic steps are:

  1. Prepare an alternative xorg configuration file for both displays (if you don't use both already)

  2. Start another X server with "xinit /usr/bin/xterm -- :1 vt8 -config [your dual screen xorg config file]" (so that when something goes bad, your main desktop won't suffer)

  3. Set up a secondary pointer with xinput utility

  4. Launch two instances of some game, one on each screen

  5. Use xinput with "set-cp" option to assign a second pointer to the window that will be operated by it

  6. Play!

You'll have to repeat all steps (except the first one) each time you want to play in this configuration. As you can see, it requires some tedious typing each time, so right now I'm writing scripts that automate the setup.

Here's one that lets you choose a mouse and keyobard and assign a second pointer to them (uses zenity, but can be adapted to use CLI only):

#/bin/bash
# vim: si ts=4 sw=4

shopt -s extglob

IFS=$'\n' DEVICE_LIST=( $(xinput list --short) )

for (( I=0; I<${#DEVICE_LIST[@]}; I++ )); do
    IFS=$'\t' INFO=( ${DEVICE_LIST[$I]} )
    [ "${INFO[2]:1:1}" = "s" ] || continue
    NAME="${INFO[0]:6}"
    NAME="${NAME%%*([[:blank:]])}"
    ID="${INFO[1]#id=}"
    [[ "$NAME" != *XTEST* ]] || continue
    case "${INFO[2]:8:1}" in
    "p" )
        POINTERS+=( "$ID"$'\t'"$NAME" )
        ;;
    "k" )
        KEYBOARDS+=( "$ID"$'\t'"$NAME" )
        ;;
    esac
done

POINTER="$( IFS=$'\t' zenity --title="Select device" --list --text="Choose a pointer" --column="Id" --column="Name" ${POINTERS[@]} )"
KEYBOARD="$( IFS=$'\t' zenity --title="Select device" --list --text="Choose a keyboard" --column="Id" --column="Name" ${KEYBOARDS[@]} )"

[ -n "$POINTER" ] && [ -n "$KEYBOARD" ] || exit 1

MASTER_NAME="second"
xinput create-master "$MASTER_NAME"
xinput reattach "$POINTER" "$MASTER_NAME pointer"
xinput reattach "$KEYBOARD" "$MASTER_NAME keyboard"

Don't ask me for more detailed instructions - I'll provide them when I have time.

Now I'm looking for suggestions where I could place them. Maybe a wiki page would be a good idea? I think it would also be easier to join efforts there. What do you think?

Offline

#2 2010-09-24 21:03:18

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: "Multiseat" gaming with multi-pointer X

Thanks for posting those instructions and the reference in the other thread.
I think a good starting point for a guide would be a new entry in the wiki (for example referenced by the Xorg entry).

A few things I could imagine:
- Using a dedicated xorg.conf for each screen. This way every "gamer session" would be limited to a certain screen. IMO this would mean less issues with fullscreen and so on.

- Using a second soundcard dedicated for the second gamer (e.g. one plays with onboard sound via speakers and one via usb sound card plus headset)

I will try out with Diablo 2 ASAP and report back.


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#3 2010-09-24 22:18:56

Rad3k
Member
From: Poland
Registered: 2009-05-09
Posts: 36

Re: "Multiseat" gaming with multi-pointer X

Darksoul71 wrote:

Thanks for posting those instructions and the reference in the other thread.
I think a good starting point for a guide would be a new entry in the wiki (for example referenced by the Xorg entry).

A few things I could imagine:
- Using a dedicated xorg.conf for each screen. This way every "gamer session" would be limited to a certain screen. IMO this would mean less issues with fullscreen and so on.

- Using a second soundcard dedicated for the second gamer (e.g. one plays with onboard sound via speakers and one via usb sound card plus headset)

I will try out with Diablo 2 ASAP and report back.

Hmm, any ideas on how the wiki article could be named? I'd use this thread title, but maybe someone has a better one?

As for dedicated xorg.conf for each screen - you mean starting one X server per display? If so, then it probably won't work, at least with single dual-head card and proprietary nvidia driver. If it worked, we wouldn't need the whole multi-pointer thing. It's used here as a workaround rather than proper solution. There's my xorg.conf.dual, you can use it as a reference:

Section "ServerLayout"
    Identifier    "Layout"
    Screen        "Screen0"
    Screen        "Screen1"    0 2048
EndSection

Section "ServerFlags"
    Option        "Xinerama"    "0"
EndSection

Section "Monitor"
    Identifier    "LaptopMonitor"
    Option        "DPMS"
EndSection

Section "Monitor"
    Identifier    "ExternalMonitor"
    HorizSync    30.0 - 80.0
    VertRefresh    50.0 - 75.0
    Option        "DPMS"
EndSection

Section "Device"
    Identifier    "Device0"
    Driver        "nvidia"
    BusID        "PCI:5:0:0"
    Option        "nologo"    "true"
    Screen        0
EndSection

Section "Device"
    Identifier    "Device1"
    Driver        "nvidia"
    BusID        "PCI:5:0:0"
    Option        "nologo"    "true"
    Screen        1
EndSection


Section "Screen"
    Identifier    "Screen0"
    Device        "Device0"
    Monitor        "LaptopMonitor"
    Option        "TwinView"    "0"
EndSection

Section "Screen"
    Identifier    "Screen1"
    Device        "Device1"
    Monitor        "ExternalMonitor"
    Option        "TwinView"    "0"
EndSection

There are two reasons why I use separate X screens (they can later be accessed as :1.0 and :1.1) instead of TwinView. One of them is hardware acceleration - with TwinView I wasn't able to get it working on both screens. The second reason is that I don't want mouse cursor to warp between screens (hence this screen layout in config file). When screens are separated, you can move pointers between them with "xdotool" utility (but it works only for the primary pointer - xdotool doesn't seem to understand multi-pointer) or TWM's bindings (works for both pointers).

And, one more thing - if you want to play using Wine, you'll need separate Wine directories (default is $HOME/.wine, you can set other with WINEPREFIX) for games running on each screen. Have fun! wink

Have fun wink

Offline

#4 2010-09-25 08:25:21

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: "Multiseat" gaming with multi-pointer X

Hm, hardware acceleration is soemthing I didn´t think about.
True, on a "dual screen" most cards and driver will work fine. I think in the first place I will experiment with wine and a fixed windowed desktop of 800x600. Hence not separate wineprefix required.

As for naming of the wiki entry:
How about "Xorg single host multiplayer" ?

BTW: Is there something special to pay attention to with multiple single games instances in WINE ?
I think running the game from two directories makes sense, doesn´t it ? And how about your network adapter ? Do your run the games at localhost ? Or your external IP ?

Yes yes, a lot of questions I know... thanks for any answer.

Edit: I find it strange that the MPX extension to Xorg is so, well, less documented.
At least I didn´t find a lot of howtos on this topic after 2 hrs searching....

Last edited by Darksoul71 (2010-09-25 08:34:29)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#5 2010-09-26 03:55:03

Rad3k
Member
From: Poland
Registered: 2009-05-09
Posts: 36

Re: "Multiseat" gaming with multi-pointer X

BTW: Is there something special to pay attention to with multiple single games instances in WINE ?
I think running the game from two directories makes sense, doesn´t it ? And how about your network adapter ? Do your run the games at localhost ? Or your external IP ?

When you run mutliple instances of the same game in Wine, it's best to have a separate $WINEPREFIX for each instance. Especially, when you run Wine in "virtual desktop" mode, because all applications that share the same Wine directory will share the same virtual desktop too. But you don't have to copy everything - you can always symlink game data files from one installation to another, so you won't use that much disk space.

I find it strange that the MPX extension to Xorg is so, well, less documented.
At least I didn´t find a lot of howtos on this topic after 2 hrs searching....

Yes, it seems that it hasn't received much attention yet. But there's just enough information to get going, so it's not that bad.


As a side note, I've just tested Unreal Tournament in "split screen" mode, and it worked! Now, given enough usb keyboards and mice, it's possible to play 4 players on one computer big_smile Heck, you could do even 9 or more, but I don't think it would comfortable with just one screen wink Hmm.... It would certainly be awesome to do this with a video projector, too bad I don't have one tongue

Offline

#6 2010-09-26 09:12:36

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: "Multiseat" gaming with multi-pointer X

This is cool smile. Definitely recommend a wiki page, that's the best place for it.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#7 2010-09-26 09:56:06

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: "Multiseat" gaming with multi-pointer X

Hihi...I think for more than 4 players you definitely need some highend card featuring 4-6 monitor outputs and a very performant host (e.g. 6-8 cores / 6 GB RAM).

For the wiki I guess another subsection of this one might fit best:
http://wiki.archlinux.org/index.php/Xorg_multiseat

While it is not perfectly "multiseat" in terms of a separate login shell for each user IMO it still is multiseat in terms of multiple users using the same host.


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#8 2010-09-26 11:08:15

Rad3k
Member
From: Poland
Registered: 2009-05-09
Posts: 36

Re: "Multiseat" gaming with multi-pointer X

ngoonee wrote:

This is cool smile. Definitely recommend a wiki page, that's the best place for it.

I started with creating a wiki page for Multi-pointer X. Later I'll do a more gaming-specific howto.

Darksoul71 wrote:

Hihi...I think for more than 4 players you definitely need some highend card featuring 4-6 monitor outputs and a very performant host (e.g. 6-8 cores / 6 GB RAM).

It depends on what games you'd want to run. I think that there won't be a problem running few instances of a pre-2000 game on today's hardware. Keep in mind that with split-screen, each instance has a smaller window to render it's graphics, and all instances combined won't have more pixels than whole screen. I'll try and see how many instances of UT99 I can run smoothly on my laptop and post the results later.

For the wiki I guess another subsection of this one might fit best:
http://wiki.archlinux.org/index.php/Xorg_multiseat

While it is not perfectly "multiseat" in terms of a separate login shell for each user IMO it still is multiseat in terms of multiple users using the same host.

I agree - in fact it is some kind of multiseat with limited possibilities. Maybe later I'll add a "See also" section to "Xorg multiseat" page and link to the page I've just created. But I won't be upset if someone else does this smile

Offline

#9 2010-09-26 11:58:52

Tes--
Member
Registered: 2009-11-13
Posts: 42

Re: "Multiseat" gaming with multi-pointer X

I tried this method today with Civilization 4, and it almost works.

When I tried to connect to the first instance from the second, I get a network error. Not giving up I configured another network interface and tried using ForceBindIP to bind both interfaces to a specific IP. Unfortunately, that just crashes Civ.

Last edited by Tes-- (2010-09-26 12:49:39)

Offline

#10 2010-09-26 12:40:45

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: "Multiseat" gaming with multi-pointer X

This is a very interesting topic. Unfortunately I have some lenghty encoding jobs running on my WinXP host which is as well my arch64 box. Hence I haven´t tried it lately.

Rad3k wrote:

It depends on what games you'd want to run. I think that there won't be a problem running few instances of a pre-2000 game on today's hardware. Keep in mind that with split-screen, each instance has a smaller window to render it's graphics, and all instances combined won't have more pixels than whole screen. I'll try and see how many instances of UT99 I can run smoothly on my laptop and post the results later.

Agreed, of course this really depends on your game. Running a few instances of older more demanding 3D shooters (Chasm, Shadow Warriors, Duke3D) in SVGA res will stress even a dual/quadcore more than running 12 instances of plain doom in 320x200.

I will try to run UT99 in windowed mode with some botmatch and FPS counter. I guess 3-4 session should be fine although the radeon driver for my HD4670 is not as performant as fglrx. May be I´ll do a quick video and upload it to youtube.

/me dreams:
Running a card such as the ATI FirePro 9800 (http://www.phoronix.com/scan.php?page=a … _pre&num=1) with 6 display ports and a fast 8 core system would make up a phantastic multiplayer single host system.


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#11 2010-09-26 12:43:14

Rad3k
Member
From: Poland
Registered: 2009-05-09
Posts: 36

Re: "Multiseat" gaming with multi-pointer X

@Tes--
Have you tried playing the game over LAN? Maybe it's just a Wine bug. I haven't tried many games (only Myth II and Unreal Tournament), but so far those that worked over LAN worked also with mutliple instances on a single host.

Offline

#12 2010-09-26 12:50:24

Tes--
Member
Registered: 2009-11-13
Posts: 42

Re: "Multiseat" gaming with multi-pointer X

Rad3k wrote:

@Tes--
Have you tried playing the game over LAN? Maybe it's just a Wine bug. I haven't tried many games (only Myth II and Unreal Tournament), but so far those that worked over LAN worked also with mutliple instances on a single host.

That was using the LAN option. I haven't tried the internet option, maybe that would have saved me a headache..

But I got it working anyway:

Looking on the internet I found a similar problem and a solution on http://forum.winehq.org/viewtopic.php?p=25422#25422, which used LD_PRELOAD, so I modified the script a bit to suit my needs:

/* This file is ditributed under the GPLv2 */

#define _GNU_SOURCE

#include <arpa/inet.h>
#include <netinet/in.h>
#include <dlfcn.h>
#include <stdlib.h>

int (*real_bind)(int fd, const struct sockaddr* add, socklen_t len);

void _init(void) {
    real_bind = dlsym(RTLD_NEXT, "bind");
}

int bind(int fd, const struct sockaddr* addr, socklen_t len) {
    struct sockaddr_in* sa;

    if(addr->sa_family==AF_INET) {
        sa = (struct sockaddr_in*) addr;
        char * ip = getenv("FORCEBINDIP");
        if (ip != NULL)
            inet_aton(ip, &sa->sin_addr);
    }
    return real_bind(fd, addr, len);
}

Compile it with

gcc -shared -ldl -fPIC bind_hack.c -o bind_hack.so -nostdlib -m32

Then run wine with

FORCEBINDIP=192.168.1.10 LD_PRELOAD=/path/to/bind_hack.so WINEPREFIX=/your/prefix wine application

Edit:
To get pulseaudio running on the second X-server, launch "ck-launch-session". I use padsp to launch wine, and now I can redirect game audio towards two bluetooth headsets.

Edit2:
Also, this is awsome! smile Thanks Rad3k, for bringing it to my attention.

Last edited by Tes-- (2010-09-26 14:47:21)

Offline

#13 2010-09-26 21:30:59

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: "Multiseat" gaming with multi-pointer X

Hi there,

ok, here is some feedback on Diablo 2 (my main target for multiseat gaming):
Runs fine right now in two different windowed desktops under wine (800x600). I am able to connect from one game instance to another game instance running on the same host with identical IP-adress (external IP). I had to use wineprefix to set up another "windows" since launching when Diablo 2 with the same wine configuration it died with a note that I am only allowed to run one copy of DIablo at the same time tongue

UT99 on the other hand currently has some issues with my lib32-wine and my radeon driver. It simply dies in D3D.
When I find some time to tinker around this week I will play around with the native Linux version of UT99. UT isn't pretty high on my list for multiseat gaming anyhow since my wife most like will play D2 with me.

Yeah...hack and slay on one machine...

Thanks arch...thanks Rad3k

Edit: Oh yes, and sound comes from both wine instances using ALSA as sound system (no JACK or PulseAudio involved).

Last edited by Darksoul71 (2010-09-26 21:33:26)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#14 2010-09-26 22:53:05

Rad3k
Member
From: Poland
Registered: 2009-05-09
Posts: 36

Re: "Multiseat" gaming with multi-pointer X

I'm glad you liked it smile

Figuring out how to separate sound outputs for each instance is also on my list. I'd like to take the most generic approach, so I'll be trying to do it with alsa.

@Darksoul71
UT99 can be configured to use OpenGL, you can check if it helps.


For me, the split-screen gaming friendliness was the only significant advantage of consoles over PCs. And now, it's no more. Isn't Linux fun? cool

Offline

#15 2010-09-28 19:08:20

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: "Multiseat" gaming with multi-pointer X

Ok, I now find some time to test. Diablo 2 runs fine from one game directory if you use separate wineprefixes to run each instance. I wrote a short shell script to launch two Diablo 2 instances automatically:

#!/bin/bash
cd "$HOME/games/Diablo II"

# Launch first Diablo2 instance:
export WINEPREFIX=$HOME/.wine-player1/
wine game.exe &

# Launch second Diablo2 instance:
export WINEPREFIX=$HOME/.wine-player2/
wine game.exe &

Please note that I keep all my games (be it DOS, Windows or Linux) inside $HOME/games for simplicity. There is of course no big difference if you install Diablo 2 from CD to each virtual drive C.

After using your script I selected a second attached USB mouse plus a mini USB keyboard and was able to control each Diablo 2 instance separately.

Cool big_smile

Being alone in front of my arch64 box, doing a true test game is currently hard to do but there will definetly be some hack and slay in the next days....

UT99 still has some issues since I updated arch but I currently have no time for further investigation. UT2k4 runs fine. Q3A does as well. So I am happy.

Last edited by Darksoul71 (2010-09-28 20:48:57)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#16 2010-09-29 20:30:04

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: "Multiseat" gaming with multi-pointer X

OK, after two hours of gaming D2 with my wife here is some update with a few questions & comments:

Comments:
D2 runs nicely in terms of performance. Even with lots of monsters in both instances I get no slowdowns. This is of course no big wonder but it cool nevertheless. Also sound keeps clean and does not lag. I had so separate the game directories for both instances because D2 had some issues when loading stored characters from the same game directory. I do not know what the problem was but some generated characters were simply not visible after startup. Using different dirs solved the problem.

Questions/problems:
I still have one issue to solve out:
When running D2 in windowed mode (emulated desktop) double mouse works fine but what somehow screws up is the second keyboard. At first the "second" keyboard works fine with the second window and after a while I guess both windows are switching back and forth from being focused. At least the window bar turns blue between both windows. Pretty similar to the behaviour you have with simply one mouse when you activate an inactive window.

Any ideas on this ? Should I run each game in fullscreen ? If yes what is the work around to avoid clone mode ? Do I need to start a new xserver for each D2 game where explicitely only one monitor is active ? Is there and option to "bind" the second input set to an xserver ?

Also strange is the output of xinput -list before I change anything:

⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ Logitech USB-PS/2 Optical Mouse             id=10    [slave  pointer  (2)]
⎜   ↳ ImPS/2 Generic Wheel Mouse                  id=12    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ Power Button                                id=6    [slave  keyboard (3)]
    ↳ Power Button                                id=7    [slave  keyboard (3)]
    ↳   USB Keyboard                              id=8    [slave  keyboard (3)]
    ↳   USB Keyboard                              id=9    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard                id=11    [slave  keyboard (3)]

I currently have a Kensington Trackball plus a PS2 keyboard attached to a KVM as main input device (that's ID10 and ID11 I guess). The second set for input is a compact USB keyboard and a Logitech USB mouse connected to my USB hub. Why do I see two entries for the USB keyboard ? (ID8 / ID9)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#17 2010-09-29 21:06:10

Cdh
Member
Registered: 2009-02-03
Posts: 1,098

Re: "Multiseat" gaming with multi-pointer X

Darksoul71 wrote:

I guess both windows are switching back and forth from being focused. At least the window bar turns blue between both windows. Pretty similar to the behaviour you have with simply one mouse when you activate an inactive window.

Any ideas on this ?

I think this is because the window manager can't propely handle two windows being focussed the same time.

There is this youtube video with compiz:
http://www.youtube.com/watch?v=nS06QjHlrwk
It seems like this compiz has some initial support for mpx and maybe it can handle focusses better?
But the standard compiz doesn't do that and I didn't find out much with google...

edit: oh and there is the original mpwm proof of concept window manager. But it didn't properly compile...
http://cgit.freedesktop.org/~whot/mpwm/

Last edited by Cdh (2010-09-29 21:07:51)


฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz

Offline

#18 2010-09-29 21:10:39

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: "Multiseat" gaming with multi-pointer X

Hm that sounds like a good explanation to me. Thanks for pointing out. I guess that is also what Rad3k talked about when he mentioned that current window managers sometime "have their issues" with multipointer support.

So my guess is that running each WINE instance in a separate XServer would help ? I mean this does eliminate any Window manager involved, doesn't it ?

Edit: /me stupid ! Rad3k mentioned a few posts above that he simply used a taylored xorg.conf with a separate screen entry for every monitor.
@Rad3k: Could you please elaborate this approach a bit more ?

Thanks...

Last edited by Darksoul71 (2010-09-29 21:14:14)


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#19 2010-09-29 22:03:15

Rad3k
Member
From: Poland
Registered: 2009-05-09
Posts: 36

Re: "Multiseat" gaming with multi-pointer X

Yes, most of WMs get confused by multiple pointers, because they don't recognize mutliple focuses. That's one of the reasons why I run games in a dedicated X server with a bare-bones TWM setup. I launch it with:

xinit ./xinitrc.dual -- :1 vt8 -config xorg.conf.dual

xinitrc.dual:

twm -f twmrc &
DISPLAY=:1.1 xterm &
xterm

twmrc (compacted):

NoDefaults
NoIconManagers
NoTitleFocus
NoTitleHighlight
NoHighlight
RandomPlacement
UsePPosition    "on"
OpaqueMove
DontMoveOff
NoTitle
BorderWidth 0
NoMenuShadows

# Bindings
Button1 = m4    : window|icon    : f.move
Button3 = m4    : window    : f.resize
Button1 =     : icon        : f.deiconify
"1"    = m4    : all        : f.warptoscreen "0"
"2"    = m4    : all        : f.warptoscreen "1"
"f"    = m4    : all        : f.focus
"Tab"    = m4    : all        : f.circleup
"Tab"    = m4|s    : all        : f.circledown
"n"    = m4    : window    : f.iconify

In this config there are no window decorations, and "Super" (the windows-logo key) is the general window-handling modifier.
Bindings explained:
Super+LMB - drag windows around
Super+RMB - resize windows
Super+1/2 - warp pointer to screen 0 or 1
Super+f - lock/unlock focus
Super[+Shift]+Tab - cycle between windows (more precisely, cycle their stacking order)
Super+n - iconify (minimize) window; iconified windows are restored by clicking on icons.

Why do I see two entries for the USB keyboard ? (ID8 / ID9)

It seems that some devices report themselves that way. Maybe they have some functions that should be logically separated, or something like that. Then, I think it's best to keep them under the same master device to avoid confusion. I've updated my zenity script to allow selecting more than one device:

#/bin/bash
# vim: si ts=4 sw=4

shopt -s extglob

IFS=$'\n' DEVICE_LIST=( $(xinput list --short) )

for (( I=0; I<${#DEVICE_LIST[@]}; I++ )); do
    IFS=$'\t' INFO=( ${DEVICE_LIST[$I]} )
    [ "${INFO[2]:1:1}" = "s" ] || continue
    NAME="${INFO[0]:6}"
    NAME="${NAME%%*([[:blank:]])}"
    ID="${INFO[1]#id=}"
    [[ "$NAME" != *XTEST* ]] || continue
    case "${INFO[2]:8:1}" in
    "p" )
        POINTERS+=( "$ID"$'\t'"$NAME" )
        ;;
    "k" )
        KEYBOARDS+=( "$ID"$'\t'"$NAME" )
        ;;
    esac
done

MASTER_NAME="$( zenity --title="Enter name" --entry --text="Enter name for new master" )"
[ -n "$MASTER_NAME" ] || exit 1

POINTER="$( IFS=$'\t' zenity --title="Select device" --list --multiple --text="Choose a pointer" --column="Id" --column="Name" ${POINTERS[@]} )"
[ -n "$POINTER" ] || exit 1

KEYBOARD="$( IFS=$'\t' zenity --title="Select device" --list --multiple --text="Choose a keyboard" --column="Id" --column="Name" ${KEYBOARDS[@]} )"
[ -n "$KEYBOARD" ] || exit 1

xinput create-master "$MASTER_NAME"

IFS="|"
for ID in $POINTER; do
    xinput reattach "$ID" "$MASTER_NAME pointer"
done

for ID in $KEYBOARD; do
    xinput reattach "$ID" "$MASTER_NAME keyboard"
done

@Darksoul71
This should be all you need. You can adapt my xorg.conf.dual (it's in one of my previous posts), but the way of configuring multiple screens can differ between display drivers, so you'll have to find out how to do it in your case.

EDIT: Forgot to mention:
@Darksoul71
As to you keyboard problem - do you set the client pointer for the second instance's window?

Last edited by Rad3k (2010-09-29 22:06:08)

Offline

#20 2010-09-30 15:45:11

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: "Multiseat" gaming with multi-pointer X

Hi Rad3k,

thanks for the quick reply !
I guess using TVM with a simple xinitrc is the best approach. May be even using a game specific xinitrc is a cool idea.
I will try and report back.

It seems that some devices report themselves that way. Maybe they have some functions that should be logically separated, or something like that. Then, I think it's best to keep them under the same master device to avoid confusion. I've updated my zenity script to allow selecting more than one device:

Agreed, the other USB keyboard features some "multimedia" keys, keys for starting you favourite e-mail program and so on.
May be those additional keys are reported as separate keyboard. I will assign both "USB keyboards" to the second master device. Thanks for updating your script accordingly.

You can adapt my xorg.conf.dual (it's in one of my previous posts), but the way of configuring multiple screens can differ between display drivers, so you'll have to find out how to do it in your case.

I guess adapting the xorg.conf for my ati radeon driver shouldn´t be too hard wink
I will post my xorg.conf as well if there are big differences.

As to you keyboard problem - do you set the client pointer for the second instance's window?

yes, I did so. Since the second keyboard & mouse set is on the right side of my main input set (keyboard plus trackball) I simply moved one of the D2 windows to my right screen and focused it with the usb mouse. At first (with less action) the second keyboard worked nice with the second window but after a while (and both windows switching back and forth with every mouse click) somehow only my main keyboard was able to control the window.
To make things even more strange (after the second keyboard became "inactive") my main keyboard was once focusing the first window and once the second window.
Well, I hope using TVM will fix this. Am I able to run both windows fullscreen when I launch wine explicitely on one screen ?
My usual observation is that my HD4670 switches to clone mode when I start a game fullscreen in dualhead mode. Because of this I made two scripts which switch to dual- and singlehead mode.
For running games I either run them in windowed mode or with the second monitor switched off. I would be happy if there is another simple solution for this.

Best regards,
D$


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

#21 2010-09-30 20:44:39

Rad3k
Member
From: Poland
Registered: 2009-05-09
Posts: 36

Re: "Multiseat" gaming with multi-pointer X

Darksoul71 wrote:

Well, I hope using TVM will fix this. Am I able to run both windows fullscreen when I launch wine explicitely on one screen ?
My usual observation is that my HD4670 switches to clone mode when I start a game fullscreen in dualhead mode. Because of this I made two scripts which switch to dual- and singlehead mode.
For running games I either run them in windowed mode or with the second monitor switched off. I would be happy if there is another simple solution for this.

There should be no problem if you use separate screens configuration - I play some games this way. Just make sure that you have Xinerama switched off in your Xorg config. If there are problems despite this, then it's probably a driver issue. Also, make sure that if the driver you use has some special mode for handling dual-head (like Nvidia's TwinView in my case), disable it and use plain two-screens configuration. This won't let you move windows between screens - every window is tied to the screen on which it was created, so there won't be situations like one window (whether fullscreen or not) spanning both screens.

EDIT:
BTW, it's TWM - Timeless Window Manager (one of the oldest ones, many others were forked from it) wink

Last edited by Rad3k (2010-09-30 20:46:59)

Offline

#22 2013-01-16 20:05:51

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: "Multiseat" gaming with multi-pointer X

sorry for necro-bumping, but i need some help.

I tried rad3k's solution with the xorg.conf.dual and .xinitrc.dual
I use awesome and my problem is that I have two pointers on the first screen and no pointers on the other screen

Offline

#23 2013-01-17 19:47:19

MrCode
Member
Registered: 2010-02-06
Posts: 373

Re: "Multiseat" gaming with multi-pointer X

AFAIK systemd already supports proper multiseat, even including a "wrapper" which handles multiple independent X displays (though I have no idea if this actually works well in practice, or with GPU acceleration on all displays).

Last edited by MrCode (2013-01-17 19:47:58)

Offline

#24 2013-01-17 20:10:18

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

Re: "Multiseat" gaming with multi-pointer X

hmmm, no i think that it won't work with the 3d acceleration etc.

Offline

#25 2013-01-18 00:05:05

Rad3k
Member
From: Poland
Registered: 2009-05-09
Posts: 36

Re: "Multiseat" gaming with multi-pointer X

@ttouch
In TWM you can warp mouse pointer to a specified screen with a key binding, but it works only for the first pointer. Can you do this with awesome?

Also, like I said, most WMs have issues with multipointer. Now I hear that gtk3 supports it, but it doesn't seem like WM support improved much since the time of the original post. Overall, I've found that TWM tends to mess it up the least.

@MrCode
AFAIK, hardware acceleration on more than one display in true multiseat is possible only with multiple gfx cards.

Last edited by Rad3k (2013-01-18 00:06:29)

Offline

Board footer

Powered by FluxBB