View Single Post
Old 02-02-07, 10:48 PM   #1
Registered User
Join Date: Jul 2005
Location: Munich
Posts: 910
Default [PATCH] "faked" Xinerama information for a triple-head TwinView setup


For a triple head setup where two displays are configured as TwinView,
the Xinerama extension doesn't provide convenient information to
applications. This post provides a quick&dirty hack to that problem.

What's actually the problem?

Let's assume two 1600x1200 LCDs are connected to a video card and are
configured as TwinView (Screen 0). A third 1600x1200 LCD is connected
to a second video card (Screen 1). When you now configure a single
Xinerama screen, then the Xinerama Extension reports two screens:
Screen 0 with 3200x1200 and screen 1 with 1600x1200. This might be
ok for certain environments, but users typically would prefer to
have three screens reported with 1600x1200 each. This is the behaviour
for a Xinerama setup with three screens (in that case, two screens
are defined for the first video card rather than using TwinView).

So why not configuring three seperate screens, instead?

Dragging a window amongst screens causes refresh events for the window
when it is "between" screens. This is typically not a problem for "simple"
applications, but may cause an annoying performence drop for Firefox
and OpenOffice. TwinView can avoid that problem, at least for the first
two screens. Depending on your working habits, this might reduce the
annoyance factor by a magnitude (but when applying TwinView,
then the wrong Xinerama Information is suppied).

How to optain correct Xinerama information with TwinView?

For a dual-head TwinView setup, the nvidia graphics driver provides it's
own Xinerama extension, but when adding a third display with a second
video card using Xinerama, then the Xinerama extension of the X-server
is used, instead (loosing the Xinerama information for TwinView).

The cleanest way to get back that information would probably be to
modifiy the X-server to provide the correct information to the clients.
However, this doesn't seem to be a truely easy task - and nobody
seems to have it done, yet :-)

A way more simpler variant is to modify the function XineramaQueryScreens()
in the library to provide the desired ("faked") Xinerama
information, instead.

Please note that the current patch does only take triple-head setups with
equaly sized displays into account! However, this is typically the most
common case anyway. The patch is very simple to understand and
XineramaQueryScreens() can be easily modified to fit your very special
needs if realy necessary. It is planned that the "faked" Xinerama information
can be fully configurable in xorg.conf in future releases of the patch.

The patch has not yet been heavily tested, but seems to work pretty nice.

Installation Instructions

Please find below the installation instructions for Fedora Core 6 (Xorg 7.1)
and Fedora Core 4 (Xorg 6.8.2). However These procedures should be
easily applyable to other distributions.

Fedora Core 6

1. Download and unpack the libXinerama sources
tar -xjf libXinerama-X11R7.0-1.0.1.tar.bz2
2. Patch and compile libXinerama
cd libXinerama-X11R7.0-1.0.1
patch src/Xinerama.c < ../Xinerama-3displays.diff 
3. Backup the original libXinerama and install the new one
mv /usr/lib/ /usr/lib/
cp src/.libs/ /usr/lib/

Fedora Core 4

1. Download and unpack the Xorg sources
tar -xjf X11R6.8.2-src.tar.bz2
2. Patch and compile libXinerama
cd xc/lib/Xinerama
patch Xinerama.c < ../../../Xinerama-3displays.diff
gcc -O2 -shared -o Xinerama.c ../Xext/extutil.c ../Xext/globals.c
3. Backup the original libXinerama and install the new one
mv /usr/X11R6/lib/ /usr/X11R6/lib/
cp /usr/X11R6/lib/
For Fedora Core 4, you my consider applying "XineramaScreen=1"
to /etc/X11/gdm/gdm.conf in order to get the login prompted
on the center display (I couldn't yet easily figure out how to
do that for FC6).

Feedback is highly appreciated!


Attached Files
File Type: zip (649 Bytes, 605 views)
JaXXoN is offline   Reply With Quote