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

Introduction

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 libXinerama.so 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
Code:
wget http://ftp.gwdg.de/pub/x11/x.org/pub/X11R7.1/src/lib/libXinerama-X11R7.0-1.0.1.tar.bz2
tar -xjf libXinerama-X11R7.0-1.0.1.tar.bz2
2. Patch and compile libXinerama
Code:
cd libXinerama-X11R7.0-1.0.1
patch src/Xinerama.c < ../Xinerama-3displays.diff 
./configure
make
3. Backup the original libXinerama and install the new one
Code:
mv /usr/lib/libXinerama.so.1.0.0 /usr/lib/libXinerama.so.1.0.0-orig
cp src/.libs/libXinerama.so.1.0.0 /usr/lib/

Fedora Core 4

1. Download and unpack the Xorg sources
Code:
wget http://ftp.gwdg.de/pub/x11/x.org/pub/X11R6.8.2/src-single/X11R6.8.2-src.tar.bz2
tar -xjf X11R6.8.2-src.tar.bz2
2. Patch and compile libXinerama
Code:
cd xc/lib/Xinerama
patch Xinerama.c < ../../../Xinerama-3displays.diff
gcc -O2 -shared -o libXinerama.so.1.0 Xinerama.c ../Xext/extutil.c ../Xext/globals.c
3. Backup the original libXinerama and install the new one
Code:
mv /usr/X11R6/lib/libXinerama.so.1.0 /usr/X11R6/lib/libXinerama.so.1.0-orig
cp libXinerama.so.1.0 /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!

regards

Bernhard
Attached Files
File Type: zip Xinerama-3displays.diff.zip (649 Bytes, 581 views)
JaXXoN is offline   Reply With Quote