xfree86: belately init RandR12 if xinerama fails. (#24627)

On Fri, Dec 11, 2009 at 10:19:01AM -0800, Keith Packard wrote:
> On Wed, 9 Dec 2009 11:55:14 +1000, Peter Hutterer <peter.hutterer@who-t.net> wrote:
> > On Tue, Dec 08, 2009 at 05:24:06PM -0800, Aaron Plattner wrote:
> > > On Tue, Dec 08, 2009 at 03:52:27PM -0800, Peter Hutterer wrote:
> > > > Xorg +xinerama crashes immediately due to whacky dependency between Xinerama
> > > > and RandR12. The latter doesn't initialize if Xinerama is enabled, but if
> > > > only one screen is found, Xinerama is disabled again and RandR12 tries to
> > > > access data it never initialized.
>
> I'd sure like to have RandR get enabled when xinerama doesn't; is there
> an easy way of making that happen here? Perhaps having the RandR12 code
> disable Xinerama when only one screen is found? Or some other kludge?

you know the dependency better than I do so any hints are apreciated.
afaict, the screenInfo.numScreens (the check used by Xinerama) isn't
necessarily initialized at this point so we can't use the same check.
The following seems to work though:

From 670b3ebdb7312a6433a8f093d0820785db2aea20 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon, 14 Dec 2009 11:00:58 +1000
Subject: [PATCH] xfree86: if only one screen was found, disable Xinerama (#24627)

Xorg +xinerama crashes immediately due to whacky dependency between Xinerama
and RandR12. The latter doesn't initialize if Xinerama is enabled, but if
only one screen is found, Xinerama is disabled again and RandR12 tries to
access data it never initialized.

Dependency chain is:
- ProcessCommandLine sets noPanoramiXExtension to FALSE
- xf86RandR12Init() is a noop
- PanoramiXExtensionInit sets noPanoramiXExtension to TRUE
- xf86RandR12CreateScreenResources tries to use the devPrivates key it never
  initialized.

This hack checks if there's only one screen at the time RandR12 is
initialized. If so, we expect Xinerama to fail anyhow so we disable it
ourselves and proceed as planned.

X.Org Bug 24627 <http://bugs.freedesktop.org/show_bug.cgi?id=24627>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Peter Hutterer 2009-12-14 11:05:20 +10:00 committed by Keith Packard
parent 5f898ddbaa
commit faca1bc582
1 changed files with 6 additions and 1 deletions

View File

@ -871,7 +871,12 @@ xf86RandR12Init (ScreenPtr pScreen)
#ifdef PANORAMIX
/* XXX disable RandR when using Xinerama */
if (!noPanoramiXExtension)
return TRUE;
{
if (xf86NumScreens == 1)
noPanoramiXExtension = TRUE;
else
return TRUE;
}
#endif
if (xf86RandR12Generation != serverGeneration)