Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 02-02-07, 11: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, 589 views)
JaXXoN is offline   Reply With Quote
Old 02-03-07, 09:01 PM   #2
JaXXoN
Registered User
 
Join Date: Jul 2005
Location: Munich
Posts: 910
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

Hi, again!

While testing, i recongnized that xine is not working correctly
with the patch above.

It seems to be important to keep the Xserver locking/unlocking
code in XineramaQueryScreens(). Please find an updated patch,
that fixes that issue, attached.

regards

Bernhard
Attached Files
File Type: zip Xinerama-3displays-20070203.diff.zip (703 Bytes, 491 views)
JaXXoN is offline   Reply With Quote
Old 02-06-07, 05:13 PM   #3
am2020
Quadro4
 
Join Date: Aug 2002
Location: USA
Posts: 63
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

First of all, I would like to thank and congratulate you for taking on this task. I have teh exact same setup you describe, I only wish that my job would let me have enough free time to jump in and help here

Anyway, I wanted to ask you: have you tested your patched setup with Beryl ? Sounds like this might give me the solution to running 3 screens + Beryl.
am2020 is offline   Reply With Quote
Old 02-06-07, 08:38 PM   #4
JaXXoN
Registered User
 
Join Date: Jul 2005
Location: Munich
Posts: 910
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

Quote:
Originally Posted by am2020
have you tested your patched setup with Beryl ?
No, not yet! However, my understanding is that Beryl needs
composite extension enabled which causes problems with xinerama:
http://www.nvnews.net/vbulletin/showthread.php?t=78843

regards

Bernhard
JaXXoN is offline   Reply With Quote
Old 02-07-07, 11:07 PM   #5
JaXXoN
Registered User
 
Join Date: Jul 2005
Location: Munich
Posts: 910
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

Quote:
Originally Posted by JaXXoN
It seems to be important to keep the Xserver locking/unlocking
code in XineramaQueryScreens().
After more testing, i still experienced that xine may hang with
Fedora Core 4: the situation is that the quick&dirty compilation
as described above doesn't apply the right compiler flags.
So for Xorg-6.8.2, you need to run a full build ("make World")
to make this effect going away.

regards

Bernhard
JaXXoN is offline   Reply With Quote
Old 02-08-07, 08:54 AM   #6
am2020
Quadro4
 
Join Date: Aug 2002
Location: USA
Posts: 63
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

Actually, I have used Beryl with Composite extension enabled. The problem is the 3 monitors setup. Since I have to activate the server Xorg Xinerama (not the Twinview one) to make the 3 monitors act as one, the RandR gets disabled. This RandR is required by Beryl. Is there was a way of having 3 monitors, 1 desktop, withour server Xinerama that would be perfect...

So for now, I can use Beryl and lose 1 monitor... or use 3 monitors without fancy 3D effects. Lose-lose situation for me.
am2020 is offline   Reply With Quote
Old 02-08-07, 09:52 AM   #7
JaXXoN
Registered User
 
Join Date: Jul 2005
Location: Munich
Posts: 910
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

Quote:
Originally Posted by am2020
So for now, I can use Beryl and lose 1 monitor... or use 3 monitors without fancy 3D effects. Lose-lose situation for me.
Sorry, but the patch above won't solve your problem!

However, i just did a
Code:
find beryl -name "*.c" | xargs grep XRR
on the beryl source tree and it seems that XRR is actually
only used to query the refresh rate of connected displays
and to notify the windowmanager when a display has been
attached or detached.

So i guess you could easily get rid of Xrandr in Beryl.

regards

Bernhard
JaXXoN is offline   Reply With Quote
Old 02-08-07, 04:48 PM   #8
am2020
Quadro4
 
Join Date: Aug 2002
Location: USA
Posts: 63
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

Exactly my thought ! I might actually try patching it, inspired by your code diving.
am2020 is offline   Reply With Quote

Old 02-08-07, 07:26 PM   #9
JaXXoN
Registered User
 
Join Date: Jul 2005
Location: Munich
Posts: 910
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

Quote:
Originally Posted by am2020
I might actually try patching it
Just tried it: getting rid of Xrandr is easy (patch attached) and the
patched beryl still works with the usual setup. But when xinerama
is enabled, in addScreen(), the call to glXMakeCurrent() fails without
generating any of the defined error messages (see man page)
and the sub-sequent call to glGetString() causes a crash!
The parameters passed to glXMakeCurrent() look reasonable.
glXMakeCurrent() is part of nvidia's libGL.so, so it will be pretty
hard to track down the problem ...

regards

Bernhard
Attached Files
File Type: zip patch-beryl-core-0.1.9999.1-noxrandr.zip (1.2 KB, 377 views)
JaXXoN is offline   Reply With Quote
Old 02-25-07, 08:03 PM   #10
JaXXoN
Registered User
 
Join Date: Jul 2005
Location: Munich
Posts: 910
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

Faked Xinerama Information in xorg.conf

This patch for the Xserver will allow the user to manualy
define xinerama information in the xorg configuration file
(/etc/X11/xorg.conf). This is very usefull for i.e. triple-head
setups where the first two displays are running in twinview mode
and thus forming a single screen in a xinerama setup (which
is typically not what the user desires). This can also be very
helpfull if you have a truely big single display and you want to
artifically sub-devide it into smaller areas, so that when
maximizing a window, it will not maximize to the whole display.

The patch introduces a new option "XineramaInfo" for the
server layout section. The parameter of this option is
a comma seperated list of feked screen information of the form

Code:
<width>x<height>+<x-offset>+<y-offset>
Example

Here is an example entry for a 4800x1200 triple-head setup
with three 1600x1200 displays:

Code:
Section "ServerLayout"
  [...]
  Option "XineramaInfo" "1600x1200+0+0,1600x1200+1600+0,1600x1200+3200+0"
EndSection
The patch has been succesfully tested on Fedora Core 6
with xorg-x11-server-1.1.1-47.5, but the patch also applies
for the vanilla xorg-7.1 package and should also work
for other distributions.


Limitations

For the time being, only 16 faked screens can be defined.


Installation instructions

1) Install the source RPM package and prepare the build directory

Code:
rpm -i /tmp/xorg-x11-server-1.1.1-47.5.fc6.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -bc xorg-x11-server.spec
This make take a while because it will also cause a "make".

2) Apply the patch and build the Xserver

Code:
cd /usr/src/redhat/BUILD/xorg-server-1.1.1/
patch -p1 < /tmp/patch-xorg-server-X11R7.1-1.1.0-xineramainfo
make clean
make
This will again take a while.

3) Install the Xserver binary

Code:
cd hw/xfree86/
strip Xorg
chmod u+s Xorg
chmod go-r Xorg
mv /usr/bin/Xorg /usr/bin/Xorg.fc6
cp Xorg /usr/bin
Feedback appreciated

Bernhard
Attached Files
File Type: zip patch-xorg-server-X11R7.1-1.1.0-xineramainfo.zip (1.9 KB, 454 views)
JaXXoN is offline   Reply With Quote
Old 03-21-07, 12:05 AM   #11
llavalle
Registered User
 
Join Date: Mar 2007
Posts: 8
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

I'm looking forward to testing that...

currently running gentoo with xorg 1.1.1-r4
llavalle is offline   Reply With Quote
Old 03-25-07, 05:42 AM   #12
ulhume
Registered User
 
Join Date: Nov 2006
Posts: 4
Default Re: [PATCH] "faked" Xinerama information for a triple-head TwinView setup

Your patch is just great !!! Thank you very much for this. So far it's working nicelly on my layout (AGP with 2 panels and PCI with one).

Next step would be to have XRandR working again (this for beryl) or waiting for beryl correct multi-head implementation. Anyway it is fast again (comparing to 3 screens without twinview) and I'm really happy about that.

Thanks again.
ulhume is offline   Reply With Quote
Reply


Thread Tools

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


All times are GMT -5. The time now is 10:09 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.