xserver: Branch 'xorg-server-1.6-apple' - 38 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Tue Feb 17 23:26:08 PST 2009


 Xext/panoramiX.h                          |    3 
 config/x11-input.fdi                      |   14 +
 configure.ac                              |   15 -
 dix/dixfonts.c                            |    3 
 glx/glxdri.c                              |   10 +
 glx/glxscreens.c                          |  235 ++++++++++--------------------
 glx/glxserver.h                           |    2 
 hw/xfree86/common/xf86Bus.c               |   22 +-
 hw/xfree86/common/xf86Config.c            |  144 +++++++-----------
 hw/xfree86/common/xf86Configure.c         |   12 +
 hw/xfree86/common/xf86Globals.c           |    1 
 hw/xfree86/common/xf86Init.c              |    7 
 hw/xfree86/common/xf86Priv.h              |    1 
 hw/xfree86/common/xf86pciBus.c            |    6 
 hw/xfree86/dixmods/glxmodule.c            |   15 -
 hw/xfree86/modes/xf86Crtc.c               |  128 +++++++++++-----
 hw/xfree86/modes/xf86Crtc.h               |   10 +
 hw/xfree86/modes/xf86RandR12.c            |   21 ++
 hw/xfree86/modes/xf86Rotate.c             |   45 +++--
 hw/xfree86/os-support/linux/int10/linux.c |    3 
 hw/xfree86/os-support/linux/lnx_init.c    |   60 +++----
 hw/xfree86/parser/Files.c                 |    9 +
 hw/xfree86/parser/xf86Parser.h            |    1 
 hw/xfree86/parser/xf86tokens.h            |    1 
 hw/xquartz/GL/indirect.c                  |    2 
 include/dixfont.h                         |   43 +++++
 include/xkbfile.h                         |   29 ---
 mi/mieq.c                                 |    4 
 mi/mipointer.c                            |    9 +
 randr/randr.c                             |    2 
 randr/randrstr.h                          |    2 
 randr/rrcrtc.c                            |   41 ++---
 randr/rrinfo.c                            |   10 +
 randr/rroutput.c                          |    5 
 randr/rrscreen.c                          |   21 +-
 randr/rrtransform.c                       |   39 ++++
 randr/rrxinerama.c                        |   23 +-
 37 files changed, 530 insertions(+), 468 deletions(-)

New commits:
commit dc212ecab7e32ee8adb941fb79eca7edd306e4fb
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Tue Feb 17 23:26:02 2009 -0800

    1.5.99.903-apple1

diff --git a/configure.ac b/configure.ac
index f08bf63..800d13d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.5.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.5.99.903-apple1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE
commit 43967514cd57ad836d7fb85c8c9e58ada07e0232
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Tue Feb 17 23:25:14 2009 -0800

    configure.ac: Support version strings like W.X.Y.Z-XXXXXX

diff --git a/configure.ac b/configure.ac
index 3946ff3..f08bf63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -411,7 +411,7 @@ XORG_RELEASE_VERSION
 dnl augment XORG_RELEASE_VERSION for our snapshot number and to expose the
 dnl major number
 PVMAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
-PVS=`echo $PACKAGE_VERSION | cut -d . -f 4`
+PVS=`echo $PACKAGE_VERSION | cut -d . -f 4 | cut -d - -f 1`
 if test "x$PVS" = "x"; then
 	PVS="0"
 fi
commit 066b17028a35956a089815716e38571f305469c5
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Tue Feb 17 23:24:25 2009 -0800

    XQuartz: Don't need GlxSetVisualConfig any more
    
    Fixes build failure resulting from 516f8e2cad1311a09764e2633644188d1e3c31bb

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 517ab1a..0a60672 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -723,8 +723,6 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
     screen->base.fbconfigs = CreateConfigs(&screen->base.numFBConfigs, 
 					   pScreen->myNum);
     
-    GlxSetVisualConfig(GLX_ALL_VISUALS);
-
     __glXScreenInit(&screen->base, pScreen);
 
     /* __glXScreenInit initializes these, so the order here is important, if we need these... */
commit 3384276e9dbf7284ef63f60a85163c2bfea17c15
Merge: 7e99b55... eca523e...
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Tue Feb 17 22:34:30 2009 -0800

    Merge commit 'origin/server-1.6-branch' into xorg-server-1.6-apple

commit eca523e7e7e267728a1f5ec346e012ada3debba0
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Feb 17 22:17:41 2009 -0800

    Bump to 1.5.99.903

diff --git a/configure.ac b/configure.ac
index e8a76ea..35450da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,12 +26,12 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.5.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.5.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE
 
-RELEASE_DATE="2009-1-30"
+RELEASE_DATE="2009-2-17"
 
 dnl this gets generated by autoheader, and thus contains all the defines.  we
 dnl don't ever actually use it, internally.
commit a86dd529e9deaba61aee220d79ac607abbcb5dc6
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Feb 6 06:34:35 2009 +0100

    Eliminate the shadow clear on transform change
    
    When the crtc transformation changes, the entire crtc must be repainted.
    This was being done by clearing the shadow and then painting the rectangle
    containing the screen image; the clear being required as the screen image
    may not fill the crtc. When changing the transform rapidly, this leads to
    flashing. Eliminate the clear by painting the entire crtc instead of just
    the screen rectangle.
    
    (cherry picked fom commit 5394b7e66224d20888dd4020f5cb8ca930720fb4)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 6761f6e..0a596bc 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -337,6 +337,10 @@ struct _xf86Crtc {
     BoxRec          panningTotalArea;
     BoxRec          panningTrackingArea;
     INT16           panningBorder[4];
+    /**
+     * Clear the shadow
+     */
+    Bool	    shadowClear;
 };
 
 typedef struct _xf86OutputFuncs {
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 66d97a9..9f57394 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -113,22 +113,33 @@ xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
 	SetPicturePictFilter (src, crtc->filter,
 			      crtc->params, crtc->nparams);
 
-    while (n--)
+    if (crtc->shadowClear)
     {
-	BoxRec	dst_box;
-
-	dst_box = *b;
-	dst_box.x1 -= crtc->filter_width >> 1;
-	dst_box.x2 += crtc->filter_width >> 1;
-	dst_box.y1 -= crtc->filter_height >> 1;
-	dst_box.y2 += crtc->filter_height >> 1;
-	pixman_f_transform_bounds (&crtc->f_framebuffer_to_crtc, &dst_box);
 	CompositePicture (PictOpSrc,
 			  src, NULL, dst,
-			  dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
-			  dst_box.x2 - dst_box.x1,
-			  dst_box.y2 - dst_box.y1);
-	b++;
+			  0, 0, 0, 0, 0, 0,
+			  crtc->mode.HDisplay, crtc->mode.VDisplay);
+	crtc->shadowClear = FALSE;
+    }
+    else
+    {
+	while (n--)
+	{
+	    BoxRec	dst_box;
+
+	    dst_box = *b;
+	    dst_box.x1 -= crtc->filter_width >> 1;
+	    dst_box.x2 += crtc->filter_width >> 1;
+	    dst_box.y1 -= crtc->filter_height >> 1;
+	    dst_box.y2 += crtc->filter_height >> 1;
+	    pixman_f_transform_bounds (&crtc->f_framebuffer_to_crtc, &dst_box);
+	    CompositePicture (PictOpSrc,
+			      src, NULL, dst,
+			      dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
+			      dst_box.x2 - dst_box.x1,
+			      dst_box.y2 - dst_box.y1);
+	    b++;
+	}
     }
     FreePicture (src, None);
     FreePicture (dst, None);
@@ -192,7 +203,7 @@ xf86CrtcDamageShadow (xf86CrtcPtr crtc)
     DamageRegionAppend (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
 			&damage_region);
     REGION_UNINIT (pScreen, &damage_region);
-    xf86CrtcShadowClear (crtc);
+    crtc->shadowClear = TRUE;
 }
 
 static void
commit 5946d603e76206105bea41a8beeb116daf209964
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Feb 9 13:09:11 2009 +0100

    Add XkbDir to Files config file section
    
    The XKB base directory was not configuable through the config file.
    
    (cherry picked from commit 76f18b94bd2719a8199334742d021c4d0806187d)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index fb41423..17223a1 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -668,6 +668,11 @@ configFiles(XF86ConfFilesPtr fileconf)
 
   xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath);
 
+  if (!xf86xkbdirFlag && fileconf && fileconf->file_xkbdir) {
+    XkbBaseDirectory = fileconf->file_xkbdir;
+    xf86Msg(X_CONFIG, "XKB base directory set to \"%s\"\n",
+	    XkbBaseDirectory);
+  }
 #if 0
   /* LogFile */
   /*
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 57142be..04a96cb 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -177,6 +177,7 @@ Bool xf86sFlag = FALSE;
 Bool xf86bsEnableFlag = FALSE;
 Bool xf86bsDisableFlag = FALSE;
 Bool xf86silkenMouseDisableFlag = FALSE;
+Bool xf86xkbdirFlag = FALSE;
 #ifdef HAVE_ACPI
 Bool xf86acpiDisableFlag = FALSE;
 #endif
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 236c00b..f029915 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1844,6 +1844,13 @@ ddxProcessArgument(int argc, char **argv, int i)
        FatalError("Invalid isolated device specification\n");
     }
   }
+  /* Notice cmdline xkbdir, but pass to dix as well */
+  if (!strcmp(argv[i], "-xkbdir"))
+  {
+    xf86xkbdirFlag = TRUE;
+    return 0;
+  }
+
   /* OS-specific processing */
   return xf86ProcessArgument(argc, argv, i);
 }
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 5de48ac..41ca8f5 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -56,6 +56,7 @@ extern Bool xf86sFlag;
 extern Bool xf86bsEnableFlag;
 extern Bool xf86bsDisableFlag;
 extern Bool xf86silkenMouseDisableFlag;
+extern Bool xf86xkbdirFlag;
 extern Bool xf86acpiDisableFlag;
 extern char *xf86LayoutName;
 extern char *xf86ScreenName;
diff --git a/hw/xfree86/parser/Files.c b/hw/xfree86/parser/Files.c
index 3777432..2f77c0e 100644
--- a/hw/xfree86/parser/Files.c
+++ b/hw/xfree86/parser/Files.c
@@ -72,6 +72,7 @@ static xf86ConfigSymTabRec FilesTab[] =
 	{MODULEPATH, "modulepath"},
 	{INPUTDEVICES, "inputdevices"},
 	{LOGFILEPATH, "logfile"},
+	{XKBDIR, "xkbdir"},
 	{-1, ""},
 };
 
@@ -180,6 +181,11 @@ xf86parseFilesSection (void)
 				Error (QUOTE_MSG, "LogFile");
 			ptr->file_logfile = val.str;
 			break;
+		case XKBDIR:
+			if (xf86getSubToken (&(ptr->file_xkbdir)) != STRING)
+				Error (QUOTE_MSG, "XkbDir");
+			ptr->file_xkbdir = val.str;
+			break;
 		case EOF_TOKEN:
 			Error (UNEXPECTED_EOF_MSG, NULL);
 			break;
@@ -255,6 +261,8 @@ xf86printFileSection (FILE * cf, XF86ConfFilesPtr ptr)
 		}
 		fprintf (cf, "\tFontPath     \"%s\"\n", s);
 	}
+	if (ptr->file_xkbdir)
+		fprintf (cf, "\tXkbDir		\"%s\"\n", ptr->file_xkbdir);
 }
 
 void
@@ -268,6 +276,7 @@ xf86freeFiles (XF86ConfFilesPtr p)
 	TestFree (p->file_inputdevs);
 	TestFree (p->file_fontpath);
 	TestFree (p->file_comment);
+	TestFree (p->file_xkbdir);
 
 	xf86conffree (p);
 }
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index fd6cc53..1c7b285 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -75,6 +75,7 @@ typedef struct
 	char *file_inputdevs;
 	char *file_fontpath;
 	char *file_comment;
+	char *file_xkbdir;
 }
 XF86ConfFilesRec, *XF86ConfFilesPtr;
 
diff --git a/hw/xfree86/parser/xf86tokens.h b/hw/xfree86/parser/xf86tokens.h
index 6e4fdea..8091f09 100644
--- a/hw/xfree86/parser/xf86tokens.h
+++ b/hw/xfree86/parser/xf86tokens.h
@@ -100,6 +100,7 @@ typedef enum {
     MODULEPATH,
     INPUTDEVICES,
     LOGFILEPATH,
+    XKBDIR,
 
     /* Server Flag tokens.  These are deprecated in favour of generic Options */
     NOTRAPSIGNALS,
commit 39eb1bee84b520cfa45981c445c4c976d63ab03d
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Feb 17 12:59:16 2009 -0500

    RANDR: Fail softly on GetPanning if the screen can't do it.
    
    Just return a zeroed-out reply in that case.  This is unambiguous, and
    distinguishes "you didn't name a CRTC" from "you named a CRTC that can't
    do panning".
    (cherry picked from commit 123093996507c4d3b6dc457240ce00f8ac42f410)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 6214b86..7edae52 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1015,30 +1015,31 @@ ProcRRGetPanning (ClientPtr client)
     pScreen = crtc->pScreen;
     pScrPriv = rrGetScrPriv(pScreen);
 
-    if (!pScrPriv || !pScrPriv->rrGetPanning)
+    if (!pScrPriv)
 	return RRErrorBase + BadRRCrtc;
 
+    memset(&rep, 0, sizeof(rep));
     rep.type = X_Reply;
     rep.status = RRSetConfigSuccess;
     rep.sequenceNumber = client->sequence;
     rep.length = 1;
     rep.timestamp = pScrPriv->lastSetTime.milliseconds;
 
-    if (! pScrPriv->rrGetPanning (pScreen, crtc, &total, &tracking, border))
-	return RRErrorBase + BadRRCrtc;
-
-    rep.left          = total.x1;
-    rep.top           = total.y1;
-    rep.width         = total.x2 - total.x1;
-    rep.height        = total.y2 - total.y1;
-    rep.track_left    = tracking.x1;
-    rep.track_top     = tracking.y1;
-    rep.track_width   = tracking.x2 - tracking.x1;
-    rep.track_height  = tracking.y2 - tracking.y1;
-    rep.border_left   = border[0];
-    rep.border_top    = border[1];
-    rep.border_right  = border[2];
-    rep.border_bottom = border[3];
+    if (pScrPriv->rrGetPanning &&
+	pScrPriv->rrGetPanning (pScreen, crtc, &total, &tracking, border)) {
+	rep.left          = total.x1;
+	rep.top           = total.y1;
+	rep.width         = total.x2 - total.x1;
+	rep.height        = total.y2 - total.y1;
+	rep.track_left    = tracking.x1;
+	rep.track_top     = tracking.y1;
+	rep.track_width   = tracking.x2 - tracking.x1;
+	rep.track_height  = tracking.y2 - tracking.y1;
+	rep.border_left   = border[0];
+	rep.border_top    = border[1];
+	rep.border_right  = border[2];
+	rep.border_bottom = border[3];
+    }
 
     if (client->swapped) {
 	swaps(&rep.sequenceNumber, n);
commit 69a2728891e92da6a674d7313f3bb47c629b38dc
Author: Paulo Cesar Pereira de Andrade <pcpa at mandriva.com.br>
Date:   Wed Jan 7 19:37:03 2009 -0200

    Default to use standard bitmap fonts, with builtins as fallback
    
      The builtin-fonts configure option was removed, as it at best should
    have been a runtime option. Instead, now it always register all "font
    path element" backends, and adds built-ins fonts at the end of the
    default font path.
      This should be a more reasonable solution, to "correct" the most
    common Xorg FAQ (could not open default font 'fixed'), and also don't
    break by default applications that use only the standard/historical
    X Font rendering.
    (cherry picked from commit 49b93df8a3002db7196aa3fc1fd8dca1c12a55d6)
    
        Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index 61b8b12..e8a76ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -503,9 +503,6 @@ AC_ARG_ENABLE(install-libxf86config,
 				[Install libxf86config (default: disabled)]),
 				[INSTALL_LIBXF86CONFIG=$enableval],
 				[INSTALL_LIBXF86CONFIG=no])
-AC_ARG_ENABLE(builtin-fonts,  AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: yes)]),
-                                [BUILTIN_FONTS=$enableval],
-                                [BUILTIN_FONTS=yes])
 AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]),
                                  [NULL_ROOT_CURSOR=$enableval],
                                  [NULL_ROOT_CURSOR=no])
@@ -958,11 +955,6 @@ if test "x$DPMSExtension" = xyes; then
 	AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
 fi
 
-if test "x$BUILTIN_FONTS" = xyes; then
-       AC_DEFINE(BUILTIN_FONTS, 1, [Use only built-in fonts])
-       FONTPATH="built-ins"
-fi
-
 if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
    AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
    REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateproto"
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 416adb3..719bca4 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1907,12 +1907,9 @@ InitFonts (void)
 {
     patternCache = MakeFontPatternCache();
 
-#ifdef BUILTIN_FONTS
     BuiltinRegisterFpeFunctions();
-#else
     FontFileRegisterFpeFunctions();
     fs_register_fpe_functions();
-#endif
 }
 
 int
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 6db925c..fb41423 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -110,8 +110,6 @@ extern DeviceAssocRec mouse_assoc;
 #define PROJECTROOT	"/usr/X11R6"
 #endif
 
-static char *fontPath = NULL;
-
 static ModuleDefault ModuleDefaults[] = {
     {.name = "extmod",   .toLoad = TRUE,    .load_opt=NULL},
     {.name = "dbe",      .toLoad = TRUE,    .load_opt=NULL},
@@ -586,90 +584,55 @@ xf86ConfigError(char *msg, ...)
 static void
 configFiles(XF86ConfFilesPtr fileconf)
 {
-  MessageType pathFrom = X_DEFAULT;
-  int countDirs;
-  char *temp_path;
-  char *log_buf;
-
-  /* FontPath */
-  /* Try XF86Config FontPath first */
-  if (!xf86fpFlag) {
-   if (fileconf) {
-    if (fileconf->file_fontpath) {
-      char *f = xf86ValidateFontPath(fileconf->file_fontpath);
-      pathFrom = X_CONFIG;
-      if (*f) {
-        if (xf86Info.useDefaultFontPath) {
-          char *g;
-          xf86Msg(X_DEFAULT, "Including the default font path %s.\n", defaultFontPath);
-	  g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
-          strcpy(g, f);
-          strcat(g, ",");
-          defaultFontPath = strcat(g, defaultFontPath);
-          xfree(f);
-        } else {
-          defaultFontPath = f;
-        }
-      } else {
-	xf86Msg(X_WARNING,
-	    "FontPath is completely invalid.  Using compiled-in default.\n");
-        fontPath = NULL;
-        pathFrom = X_DEFAULT;
-      }
-    } 
-   } else {
-      xf86Msg(X_DEFAULT,
-	    "No FontPath specified.  Using compiled-in default.\n");
-      pathFrom = X_DEFAULT;
-   }
-  } else {
-    /* Use fontpath specified with '-fp' */
-    if (fontPath)
-    {
-      fontPath = NULL;
+    MessageType	 pathFrom;
+    Bool	 must_copy;
+    int		 size, countDirs;
+    char	*temp_path, *log_buf, *start, *end;
+
+    /* FontPath */
+    must_copy = TRUE;
+
+    temp_path = defaultFontPath ? defaultFontPath : "";
+    if (xf86fpFlag)
+	pathFrom = X_CMDLINE;
+    else if (fileconf && fileconf->file_fontpath) {
+	pathFrom = X_CONFIG;
+	if (xf86Info.useDefaultFontPath) {
+	    defaultFontPath = Xprintf("%s%s%s",
+				      fileconf->file_fontpath,
+				      *temp_path ? "," : "", temp_path);
+	    must_copy = FALSE;
+	}
+	else
+	    defaultFontPath = fileconf->file_fontpath;
     }
-    pathFrom = X_CMDLINE;
-  }
-  if (!fileconf) {
-      /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
-       could be static, so we make a copy. */
-    char *f = xnfalloc(strlen(defaultFontPath) + 1);
-    f[0] = '\0';
-    strcpy (f, defaultFontPath);
-    defaultFontPath = xf86ValidateFontPath(f);
-    xfree(f);
-  } else {
-   if (fileconf) {
-    if (!fileconf->file_fontpath) {
-      /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
-       could be static, so we make a copy. */
-     char *f = xnfalloc(strlen(defaultFontPath) + 1);
-     f[0] = '\0';
-     strcpy (f, defaultFontPath);
-     defaultFontPath = xf86ValidateFontPath(f);
-     xfree(f);
-    }
-   }
-  }
-
-  /* If defaultFontPath is still empty, exit here */
-
-  if (! *defaultFontPath)
-    FatalError("No valid FontPath could be found.");
-
-  /* make fontpath more readable in the logfiles */
-  countDirs = 1;
-  temp_path = defaultFontPath;
-  while((temp_path = index(temp_path, ',')) != NULL) {
-    countDirs++;
-    temp_path++;
-  }
-  log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1);
-  if(!log_buf) /* fallback to old method */
-    xf86Msg(pathFrom, "FontPath set to \"%s\"\n", defaultFontPath);
-  else {
-    char *start, *end;
-    int size;
+    else
+	pathFrom = X_DEFAULT;
+    temp_path = defaultFontPath ? defaultFontPath : "";
+
+    /* ensure defaultFontPath contains "built-ins" */
+    start = strstr(temp_path, "built-ins");
+    end = start + strlen("built-ins");
+    if (start == NULL ||
+	!((start == temp_path || start[-1] == ',') && (!*end || *end == ','))) {
+	defaultFontPath = Xprintf("%s%sbuilt-ins",
+				  temp_path, *temp_path ? "," : "");
+	must_copy = FALSE;
+    }
+    /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
+    temp_path = must_copy ? XNFstrdup(defaultFontPath) : defaultFontPath;
+    defaultFontPath = xf86ValidateFontPath(temp_path);
+    free(temp_path);
+
+    /* make fontpath more readable in the logfiles */
+    countDirs = 1;
+    temp_path = defaultFontPath;
+    while ((temp_path = index(temp_path, ',')) != NULL) {
+	countDirs++;
+	temp_path++;
+    }
+
+    log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1);
     temp_path = log_buf;
     start = defaultFontPath;
     while((end = index(start, ',')) != NULL) {
@@ -685,7 +648,6 @@ configFiles(XF86ConfFilesPtr fileconf)
     strcpy(temp_path, start);
     xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf);
     xfree(log_buf);
-  }
 
 
   if (fileconf && fileconf->file_inputdevs) {
diff --git a/include/dixfont.h b/include/dixfont.h
index d61dd7e..0f3df97 100644
--- a/include/dixfont.h
+++ b/include/dixfont.h
@@ -142,4 +142,47 @@ extern void InitGlyphCaching(void);
 
 extern void SetGlyphCachingMode(int /*newmode*/);
 
+/*
+ * libXfont/src/builtins/builtin.h
+ */
+extern void BuiltinRegisterFpeFunctions(void);
+
+/*
+ * libXfont stubs.
+ */
+extern int client_auth_generation(ClientPtr client);
+
+extern void DeleteFontClientID(Font id);
+
+extern FontResolutionPtr GetClientResolutions(int *num);
+
+extern int GetDefaultPointSize(void);
+
+extern Font GetNewFontClientID(void);
+
+extern int init_fs_handlers(FontPathElementPtr fpe,
+				      BlockHandlerProcPtr block_handler);
+
+extern int RegisterFPEFunctions(NameCheckFunc name_func,
+					  InitFpeFunc init_func,
+					  FreeFpeFunc free_func,
+					  ResetFpeFunc reset_func,
+					  OpenFontFunc open_func,
+					  CloseFontFunc close_func,
+					  ListFontsFunc list_func,
+					  StartLfwiFunc start_lfwi_func,
+					  NextLfwiFunc next_lfwi_func,
+					  WakeupFpeFunc wakeup_func,
+					  ClientDiedFunc client_died,
+					  LoadGlyphsFunc load_glyphs,
+					  StartLaFunc start_list_alias_func,
+					  NextLaFunc next_list_alias_func,
+					  SetPathFunc set_path_func);
+
+extern void remove_fs_handlers(FontPathElementPtr fpe,
+					 BlockHandlerProcPtr blockHandler,
+					 Bool all);
+
+extern int StoreFontClientFont(FontPtr pfont, Font id);
+
 #endif				/* DIXFONT_H */
commit 444127f9f408d2f517fdfab0092bd67b29073373
Author: Alan Hourihane <alanh at vmware.com>
Date:   Fri Feb 13 13:45:08 2009 +0000

    glx: fix retval checks when failures occur for drawable creation.
    (cherry picked from commit a26c77ff432d2e85a2665fc36fca25143460c476)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/glx/glxdri.c b/glx/glxdri.c
index 090e7ef..223b06e 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -647,7 +647,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 	if (visual->vid == glxConfig->visualID)
 	    break;
     if (i == pScreen->numVisuals)
-	return GL_FALSE;
+	return NULL;
 
     context->hwContextID = FakeClientID(0);
 
@@ -656,6 +656,9 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 			      context->hwContextID, &hwContext);
     __glXleaveServer(GL_FALSE);
 
+    if (!retval)
+    	return NULL;
+
     context->driContext =
 	screen->legacy->createNewContext(screen->driScreen,
 					 config->driConfig,
@@ -707,6 +710,11 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
 			       pDraw, &hwDrawable);
     __glXleaveServer(GL_FALSE);
 
+    if (!retval) {
+    	xfree(private);
+    	return NULL;
+    }
+
     /* The last argument is 'attrs', which is used with pbuffers which
      * we currently don't support. */
 
commit 4302a32391711ea86051c7e6d90cb018c79beec2
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Jan 30 14:19:41 2009 -0800

    Make crtc_notify wrap/unwrap code do nothing unless mode code is inuse
    
    Drivers not using the new hw/xfree86/modes code would crash in DRI due to
    that code trying to monitor CRTC changes.
    
    (cherry picked from commit ea309e47457156b60aadbf113f04e5b6851029c8)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index c35eba7..f09b9b8 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2987,22 +2987,29 @@ xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
 xf86_crtc_notify_proc_ptr
 xf86_wrap_crtc_notify (ScreenPtr screen, xf86_crtc_notify_proc_ptr new)
 {
-    ScrnInfoPtr		scrn = xf86Screens[screen->myNum];
-    xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn);
-    xf86_crtc_notify_proc_ptr	old;
-    
-    old = config->xf86_crtc_notify;
-    config->xf86_crtc_notify = new;
-    return old;
+    if (xf86CrtcConfigPrivateIndex != -1)
+    {
+	ScrnInfoPtr		scrn = xf86Screens[screen->myNum];
+	xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn);
+	xf86_crtc_notify_proc_ptr	old;
+	
+	old = config->xf86_crtc_notify;
+	config->xf86_crtc_notify = new;
+	return old;
+    }
+    return NULL;
 }
 
 void
 xf86_unwrap_crtc_notify(ScreenPtr screen, xf86_crtc_notify_proc_ptr old)
 {
-    ScrnInfoPtr		scrn = xf86Screens[screen->myNum];
-    xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn);
-
-    config->xf86_crtc_notify = old;
+    if (xf86CrtcConfigPrivateIndex != -1)
+    {
+	ScrnInfoPtr		scrn = xf86Screens[screen->myNum];
+	xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn);
+    
+	config->xf86_crtc_notify = old;
+    }
 }
 
 void
commit 09cde70a6b3a05c28014862db19b36650412c2f3
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Mon Feb 2 12:30:57 2009 -0800

    XQuartz: GLX: Fix accidental exclusion of glBlitFramebufferEXT on Leopard
    (cherry picked from commit 8620579483789ae9ac1b68dbefe32b70011386de)
    (cherry picked from commit 0dbc356795bbab3889b5f1684f55bd193757d0c9)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 687d531..517ab1a 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -855,7 +855,7 @@ static void setup_dispatch_table(void) {
   SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT);
   SET_BlendFunc(disp, glBlendFunc);
   SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT);
-#if MAC_OS_X_VERSION_MIN_REQUIRED > 1050
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
   SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT);
 #endif
   SET_BufferDataARB(disp, glBufferDataARB);
commit 6bbe98f01d1fc66b6b853bdcdd62edf87a91627d
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Feb 1 15:08:02 2009 -0800

    XQuartz: GLX: OpenGL.framework on Tiger doesn't have glBlitFramebufferEXT
    (cherry picked from commit e01662cadcaa4052e3a5aa82cbaed00a2d0220e0)
    (cherry picked from commit fd08be749e0b3c5de02a6ae8b3d21f92c5986157)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 01cf0c6..687d531 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -855,7 +855,9 @@ static void setup_dispatch_table(void) {
   SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT);
   SET_BlendFunc(disp, glBlendFunc);
   SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT);
+#if MAC_OS_X_VERSION_MIN_REQUIRED > 1050
   SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT);
+#endif
   SET_BufferDataARB(disp, glBufferDataARB);
   SET_BufferSubDataARB(disp, glBufferSubDataARB);
   SET_CallList(disp, glCallList);
commit 519ae3a0dfc61fc55370abec75551aa2615643fb
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Jan 11 16:34:36 2009 -0800

    XQuartz: Don't need explicit Activate/EnableDevice in InitInput
    (cherry picked from commit b1d29784410b3b93037e5636f336ba608d8ad6e3)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index c104589..f016682 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -511,17 +511,6 @@ void InitInput( int argc, char **argv )
 
     darwinTabletCurrent = darwinTabletStylus;
 
-    ActivateDevice(darwinKeyboard);
-    ActivateDevice(darwinPointer);
-    ActivateDevice(darwinTabletStylus);
-    ActivateDevice(darwinTabletCursor);
-    ActivateDevice(darwinTabletEraser);
-    EnableDevice(darwinKeyboard);
-    EnableDevice(darwinPointer);
-    EnableDevice(darwinTabletStylus);
-    EnableDevice(darwinTabletCursor);
-    EnableDevice(darwinTabletEraser);
-    
     DarwinEQInit();
 
     QuartzInitInput(argc, argv);
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index eb79366..215a4a9 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -54,7 +54,6 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
 extern darwinKeyboardInfo keyInfo;
 extern pthread_mutex_t keyInfo_mutex;
 void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
-void DarwinKeyboardInit(DeviceIntPtr pDev);
 int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
 int DarwinModifierNXKeyToNXKeycode(int key, int side);
 int DarwinModifierNXKeyToNXMask(int key);
commit ada58b69ca0a5e674cda7ae59a53061645621888
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Fri Jan 30 21:44:08 2009 -0800

    x11-input.fdi: Add options needed to handle adding USB devices on Solaris
    (cherry picked from commit 60bcdd687040db76490851d4b459284ce37020e0)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/config/x11-input.fdi b/config/x11-input.fdi
index af14781..9e629cb 100644
--- a/config/x11-input.fdi
+++ b/config/x11-input.fdi
@@ -61,6 +61,13 @@
              string="Linux">
         <merge key="input.x11_driver" type="string">evdev</merge>
       </match>
+      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
+             string="SunOS">
+       <match key="input.device" contains="usb">
+        <merge key="input.x11_options.StreamsModule" type="string">usbms</merge>
+        <merge key="input.x11_options.Protocol" type="string">VUID</merge>
+       </match>
+      </match>
     </match>
 
     <match key="info.capabilities" contains="input.keys">
@@ -75,6 +82,13 @@
         <merge key="input.x11_driver" type="string">evdev</merge>
         <merge key="input.x11_options.XkbModel" type="string">evdev</merge>
       </match>
+      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
+             string="SunOS">
+       <match key="input.device" contains="usb">
+        <merge key="input.x11_options.StreamsModule" type="string">usbkbm</merge>
+        <merge key="input.x11_options.Protocol" type="string">VUID</merge>
+       </match>
+      </match>
 
       <merge key="input.x11_options.XkbLayout" type="string">us</merge>
 
commit 516f8e2cad1311a09764e2633644188d1e3c31bb
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Feb 8 13:00:15 2009 +0100

    glx: Replace broken GLX visual setup with a fixed "all" mode.
    
    With trying to match depths so that you didn't end up with a depth 24
    fbconfig for the 32-bit composite visual, I broke the alpha bits on the depth
    24 X visual, which angered other applications.  But in fixing that, the
    pickFBconfigs code for "minimal" also could end up breaking GLX visuals if
    the same FBconfig was chosen for more than one X visual.
    We have no reason to not expose as many visuals as possible, but the old
    "all" mode didn't match any existing X visuals to GLX visuals, so normal
    GL apps didn't work at all.
    
    Instead, replace it with a simple combination of the two modes: Create GLX
    visuals by picking unique FBconfigs with as many features as possible for
    each X visual in order.  Then, for all remaining FBconfigs that are
    appropriate for display, add a corresponding X and GLX visual.
    
    This gets all applications (even ones that aren't smart enough to do FBconfigs)
    get all the options to get the visual configuration they want.  The only
    potential downside is that the composite ARGB visual is unique and gets a
    nearly full-featured GLX visual (except that the root visual might have taken
    the tastiest FBconfig), which means that a dumb compositing manager could
    waste resources. Write compositing managers using FBconfigs instead, please.
    (cherry picked from commit c40bad88475debf7a1774e22dce835577ad32154)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 33a8d58..027afb8 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -242,44 +242,6 @@ GLint glxConvertToXVisualType(int visualType)
 	? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
 }
 
-
-static void
-filterOutNativeConfigs(__GLXscreen *pGlxScreen)
-{
-    __GLXconfig *m, *next, **last;
-    ScreenPtr pScreen = pGlxScreen->pScreen;
-    int i, depth;
-
-    last = &pGlxScreen->fbconfigs;
-    for (m = pGlxScreen->fbconfigs; m != NULL; m = next) {
-	next = m->next;
-	depth = m->redBits + m->blueBits + m->greenBits;
-
-	for (i = 0; i < pScreen->numVisuals; i++) {
-	    if (pScreen->visuals[i].nplanes == depth) {
-		*last = m;
-		last = &m->next;
-		break;
-	    }
-	}
-    }
-
-    *last = NULL;
-}
-
-static XID
-findVisualForConfig(ScreenPtr pScreen, __GLXconfig *m)
-{
-    int i;
-
-    for (i = 0; i < pScreen->numVisuals; i++) {
-	if (glxConvertToXVisualType(m->visualType) == pScreen->visuals[i].class)
-	    return pScreen->visuals[i].vid;
-    }
-
-    return 0;
-}
-
 /* This code inspired by composite/compinit.c.  We could move this to
  * mi/ and share it with composite.*/
 
@@ -387,125 +349,52 @@ initGlxVisual(VisualPtr visual, __GLXconfig *config)
     visual->offsetBlue = findFirstSet(config->blueMask);
 }
 
-typedef struct {
-    GLboolean doubleBuffer;
-    GLboolean depthBuffer;
-    GLboolean stencilBuffer;
-} FBConfigTemplateRec, *FBConfigTemplatePtr;
-
 static __GLXconfig *
-pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template,
-	     VisualPtr visual)
+pickFBConfig(__GLXscreen *pGlxScreen, VisualPtr visual)
 {
-    __GLXconfig *config;
+    __GLXconfig *best = NULL, *config;
+    int best_score;
 
     for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
+	int score = 0;
+
 	if (config->redMask != visual->redMask ||
 	    config->greenMask != visual->greenMask ||
-	    config->blueMask != visual->blueMask ||
-	    config->rgbBits != visual->nplanes)
+	    config->blueMask != visual->blueMask)
 	    continue;
 	if (config->visualRating != GLX_NONE)
 	    continue;
 	if (glxConvertToXVisualType(config->visualType) != visual->class)
 	    continue;
-	if ((config->doubleBufferMode > 0) != template->doubleBuffer)
-	    continue;
-	if ((config->depthBits > 0) != template->depthBuffer)
+	/* If it's the 32-bit RGBA visual, demand a 32-bit fbconfig. */
+	if (visual->nplanes == 32 && config->rgbBits != 32)
 	    continue;
-	if ((config->stencilBits > 0) != template->stencilBuffer)
-	    continue;
-
-	return config;
-    }
-
-    return NULL;
-}
-
-static void
-addMinimalSet(__GLXscreen *pGlxScreen)
-{
-    __GLXconfig *config;
-    VisualPtr visuals;
-    int i, j;
-    FBConfigTemplateRec best = { GL_TRUE, GL_TRUE, GL_TRUE };
-    FBConfigTemplateRec good = { GL_TRUE, GL_TRUE, GL_FALSE };
-    FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE, GL_FALSE };
-
-    pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals,
-				  sizeof (__GLXconfig *));
-    if (pGlxScreen->visuals == NULL) {
-	ErrorF("Failed to allocate for minimal set of GLX visuals\n");
-	return;
-    }
-
-    visuals = pGlxScreen->pScreen->visuals;
-    for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) {
-	if (visuals[i].nplanes == 32)
-	    config = pickFBConfig(pGlxScreen, &minimal, &visuals[i]);
-	else {
-	    config = pickFBConfig(pGlxScreen, &best, &visuals[i]);
-	    if (config == NULL)
-		config = pickFBConfig(pGlxScreen, &good, &visuals[i]);
-        }
-	if (config == NULL)
-	    config = pGlxScreen->fbconfigs;
-	if (config == NULL)
+	/* Can't use the same FBconfig for multiple X visuals.  I think. */
+	if (config->visualID != 0)
 	    continue;
 
-	pGlxScreen->visuals[j] = config;
-	config->visualID = visuals[i].vid;
-	j++;
-    }
-
-    pGlxScreen->numVisuals = j;
-}
-
-static void
-addTypicalSet(__GLXscreen *pGlxScreen)
-{
-    addMinimalSet(pGlxScreen);
-}
-
-static void
-addFullSet(__GLXscreen *pGlxScreen)
-{
-    __GLXconfig *config;
-    VisualPtr visuals;
-    int i, depth;
-
-    pGlxScreen->visuals =
-	xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
-    if (pGlxScreen->visuals == NULL) {
-	ErrorF("Failed to allocate for full set of GLX visuals\n");
-	return;
-    }
-
-    config = pGlxScreen->fbconfigs;
-    depth = config->redBits + config->greenBits + config->blueBits;
-    visuals = AddScreenVisuals(pGlxScreen->pScreen, pGlxScreen->numFBConfigs, depth);
-    if (visuals == NULL) {
-	xfree(pGlxScreen->visuals);
-	return;
-    }
-
-    pGlxScreen->numVisuals = pGlxScreen->numFBConfigs;
-    for (i = 0, config = pGlxScreen->fbconfigs; config; config = config->next, i++) {
-	pGlxScreen->visuals[i] = config;
-	initGlxVisual(&visuals[i], config);
+	if (config->doubleBufferMode > 0)
+	    score += 8;
+	if (config->depthBits > 0)
+	    score += 4;
+	if (config->stencilBits > 0)
+	    score += 2;
+	if (config->alphaBits > 0)
+	    score++;
+
+	if (score > best_score) {
+	    best = config;
+	    best_score = score;
+	}
     }
-}
 
-static int glxVisualConfig = GLX_ALL_VISUALS;
-
-void GlxSetVisualConfig(int config)
-{
-    glxVisualConfig = config;
+    return best;
 }
 
 void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
 {
     __GLXconfig *m;
+    __GLXconfig *config;
     int i;
 
     pGlxScreen->pScreen       = pScreen;
@@ -517,32 +406,66 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
     pGlxScreen->CloseScreen = pScreen->CloseScreen;
     pScreen->CloseScreen = glxCloseScreen;
 
-    filterOutNativeConfigs(pGlxScreen);
-
     i = 0;
     for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
 	m->fbconfigID = FakeClientID(0);
-	m->visualID = findVisualForConfig(pScreen, m);
+	m->visualID = 0;
 	i++;
     }
     pGlxScreen->numFBConfigs = i;
 
-    /* Select a subset of fbconfigs that we send to the client when it
-     * asks for the glx visuals.  All the fbconfigs here have a valid
-     * value for visual ID and each visual ID is only present once.
-     * This runs before composite adds its extra visual so we have to
-     * remember the number of visuals here.*/
-
-    switch (glxVisualConfig) {
-    case GLX_MINIMAL_VISUALS:
-	addMinimalSet(pGlxScreen);
-	break;
-    case GLX_TYPICAL_VISUALS:
-	addTypicalSet(pGlxScreen);
-	break;
-    case GLX_ALL_VISUALS:
-	addFullSet(pGlxScreen);
-	break;
+    pGlxScreen->visuals =
+	xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
+
+    /* First, try to choose featureful FBconfigs for the existing X visuals.
+     * Note that if multiple X visuals end up with the same FBconfig being
+     * chosen, the later X visuals don't get GLX visuals (because we want to
+     * prioritize the root visual being GLX).
+     */
+    for (i = 0; i < pScreen->numVisuals; i++) {
+	VisualPtr visual = &pScreen->visuals[i];
+
+	config = pickFBConfig(pGlxScreen, visual);
+	if (config) {
+	    pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
+	    config->visualID = visual->vid;
+	}
+    }
+
+    /* Then, add new visuals corresponding to all FBconfigs that didn't have
+     * an existing, appropriate visual.
+     */
+    for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
+	int depth;
+
+	VisualPtr visual;
+
+	if (config->visualID != 0)
+	    continue;
+
+	/* Only count RGB bits and not alpha, as we're not trying to create
+	 * visuals for compositing (that's what the 32-bit composite visual
+	 * set up above is for.
+	 */
+	depth = config->redBits + config->greenBits + config->blueBits;
+
+	/* Make sure that our FBconfig's depth can actually be displayed
+	 * (corresponds to an existing visual).
+	 */
+	for (i = 0; i < pScreen->numVisuals; i++) {
+	    if (depth == pScreen->visuals[i].nplanes)
+		break;
+	}
+	if (i == pScreen->numVisuals)
+	    continue;
+
+	/* Create a new X visual for our FBconfig. */
+	visual = AddScreenVisuals(pScreen, 1, depth);
+	if (visual == NULL)
+	    continue;
+
+	pGlxScreen->visuals[pGlxScreen->numVisuals++] = config;
+	initGlxVisual(visual, config);
     }
 
     dixSetPrivate(&pScreen->devPrivates, glxScreenPrivateKey, pGlxScreen);
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 1d20929..a5ca0a2 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -135,8 +135,6 @@ enum {
     GLX_ALL_VISUALS
 };
 
-void GlxSetVisualConfig(int config);
-
 void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
 				   void (*leave)(GLboolean));
 void __glXenterServer(GLboolean rendering);
diff --git a/hw/xfree86/dixmods/glxmodule.c b/hw/xfree86/dixmods/glxmodule.c
index f6fda4b..62a047e 100644
--- a/hw/xfree86/dixmods/glxmodule.c
+++ b/hw/xfree86/dixmods/glxmodule.c
@@ -101,21 +101,6 @@ glxSetup(pointer module, pointer opts, int *errmaj, int *errmin)
 	GlxPushProvider(provider);
     }
 
-    switch (xf86Info.glxVisuals) {
-    case XF86_GlxVisualsMinimal:
-	GlxSetVisualConfig(GLX_MINIMAL_VISUALS);
-	xf86Msg(xf86Info.aiglxFrom, "Exporting only minimal set of GLX visuals\n");
-	break;
-    case XF86_GlxVisualsTypical:
-	GlxSetVisualConfig(GLX_TYPICAL_VISUALS);
-	xf86Msg(xf86Info.aiglxFrom, "Exporting typical set of GLX visuals\n");
-	break;
-    case XF86_GlxVisualsAll:
-	GlxSetVisualConfig(GLX_ALL_VISUALS);
-	xf86Msg(xf86Info.aiglxFrom, "Exporting all GLX visuals\n");
-	break;
-    }
-
     LoadExtension(&GLXExt, FALSE);
 
     return module;
commit 8b967b24690cb072fc37c463eceb2b886cef80c4
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Feb 2 10:13:46 2009 -0800

    glx: Don't match fbconfigs to visuals with mismatched channel masks.
    
    This fixes at least one known bug, where the depth 32 visual would end up
    with a depth 24 fbconfig attached, angering compiz.
    (cherry picked from commit 5100d829a4d71ce4a9fbc2b81694a1fb90066ccf)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 0c76cfd..33a8d58 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -394,14 +394,20 @@ typedef struct {
 } FBConfigTemplateRec, *FBConfigTemplatePtr;
 
 static __GLXconfig *
-pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
+pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template,
+	     VisualPtr visual)
 {
     __GLXconfig *config;
 
     for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
+	if (config->redMask != visual->redMask ||
+	    config->greenMask != visual->greenMask ||
+	    config->blueMask != visual->blueMask ||
+	    config->rgbBits != visual->nplanes)
+	    continue;
 	if (config->visualRating != GLX_NONE)
 	    continue;
-	if (glxConvertToXVisualType(config->visualType) != class)
+	if (glxConvertToXVisualType(config->visualType) != visual->class)
 	    continue;
 	if ((config->doubleBufferMode > 0) != template->doubleBuffer)
 	    continue;
@@ -436,11 +442,11 @@ addMinimalSet(__GLXscreen *pGlxScreen)
     visuals = pGlxScreen->pScreen->visuals;
     for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) {
 	if (visuals[i].nplanes == 32)
-	    config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class);
+	    config = pickFBConfig(pGlxScreen, &minimal, &visuals[i]);
 	else {
-	    config = pickFBConfig(pGlxScreen, &best, visuals[i].class);
+	    config = pickFBConfig(pGlxScreen, &best, &visuals[i]);
 	    if (config == NULL)
-		config = pickFBConfig(pGlxScreen, &good, visuals[i].class);
+		config = pickFBConfig(pGlxScreen, &good, &visuals[i]);
         }
 	if (config == NULL)
 	    config = pGlxScreen->fbconfigs;
commit 7fdaca64463951ab9199dc12910379c90dba3fac
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Feb 17 18:57:13 2009 -0800

    mi: force the paired kbd device before CopyKeyClass. (#19574)
    
    Some multi-media keyboards send the key events for multimedia keys through
    the device file used by the mouse. Sending a key event through the VCP
    however will fail. The VCP doesn't have a key class so the server crashes or
    (with an appropriate fix) the event is simply swallowed.
    
    Thus, for key events if the master does not have a key class, get the device
    paired with the master (i.e. the VCK) before processing the event any
    further.
    
    X.Org Bug 19574 <http://bugs.freedesktop.org/show_bug.cgi?id=19574>
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/mieq.c b/mi/mieq.c
index 226caa6..213ad5b 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -451,7 +451,11 @@ mieqProcessInputEvents(void)
                    is transferred. */
                 if (event->u.u.type == DeviceKeyPress ||
                     event->u.u.type == DeviceKeyRelease)
+                {
+                    if (!master->key)
+                        master = GetPairedDevice(master);
 		    CopyKeyClass(dev, master);
+                }
 
                 CopyGetMasterEvent(master, dev, event, masterEvents, nevents);
             }
commit a9dd41de7eecc1dcede4ccc8d5cf25f10343bb1a
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Feb 2 10:20:13 2009 +1000

    mi: don't call UpdateSpriteForScreen if we have Xinerama enabled. #18668
    
    In Xinerama all windows hang off the first root window. Crossing the screens
    must not reset the spriteTrace, otherwise picking fails and events are sent to
    the root window.
    
    X.Org Bug 18668 <http://bugs.freedesktop.org/show_bug.cgi?id=18668>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 9fe9b6e4ef669b192ee349e3290db5d2aeea273c)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/mipointer.c b/mi/mipointer.c
index 8c8af6e..e37316e 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -332,7 +332,14 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
 	pPointer->pScreen = pScreen;
     }
 
-    if (changedScreen)
+    /* Don't call USFS if we use Xinerama, otherwise the root window is
+     * updated to the second screen, and we never receive any events.
+     * (FDO bug #18668) */
+    if (changedScreen
+#ifdef PANORAMIX
+            && noPanoramiXExtension
+#endif
+       )
         UpdateSpriteForScreen (pDev, pScreen) ;
 }
 
commit 536748aa88f82e4157b86ed1a02b798b1510bdb8
Merge: 8c6ddbf... be21199...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Feb 17 18:52:04 2009 -0800

    Merge branch 'panning-for-server-1.6' into server-1.6-branch

commit 8c6ddbf754ff6c2eb99105f93aaa30749dced619
Author: Paulo Cesar Pereira de Andrade <pcpa at mandriva.com.br>
Date:   Sun Nov 30 02:59:34 2008 -0200

    Correct static symbol XkmReadTOC and first pass on compile warning fixes.
    
      The warnings corrected were only the ones that should correct
    real problems. The most common one is 64 bit integers as
    "printf %l" arguments.
      Note that there is a patch related to this at:
    http://bugs.freedesktop.org/show_bug.cgi?id=18204
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 16b11cd03d8c5def07f0e598f237f71a37883a46)

diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 3236b5a..b94d500 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -1005,7 +1005,7 @@ needCheck(resPtr pRes, unsigned long type, int entityIndex, xf86State state)
     if (pRes->entityIndex > -1)
 	r_loc = xf86Entities[pRes->entityIndex]->busType;
 
-    if ((type & ResAccMask == ResShared) &&
+    if ((type & ResAccMask) == ResShared &&
 	(pRes->res_type & ResAccMask) == ResShared)
 	return FALSE;
 
@@ -1038,7 +1038,7 @@ checkConflict(resRange *rgp, resPtr pRes, int entityIndex,
 	case ResBlock:
 	    if (rgp->rEnd < rgp->rBegin) {
 		xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
-			rgp->rEnd,rgp->rBegin);
+			(long)rgp->rEnd, (long)rgp->rBegin);
 		return 0;
 	    }
 	    if ((ret = checkConflictBlock(rgp, pRes))) {
@@ -1051,7 +1051,7 @@ checkConflict(resRange *rgp, resPtr pRes, int entityIndex,
 	    if ((rgp->rBase & rgp->rMask) != rgp->rBase) {
 		xf86Msg(X_ERROR,"sparse io range (base: 0x%lx  mask: 0x%lx)"
 			"doesn't satisfy (base & mask = mask)\n",
-			rgp->rBase, rgp->rMask);
+			(long)rgp->rBase, (long)rgp->rMask);
 		return 0;
 	    }
 	    if ((ret = checkConflictSparse(rgp, pRes))) {
@@ -1107,7 +1107,7 @@ xf86AddResToList(resPtr rlist, resRange *range, int entityIndex)
     case ResBlock:
 	if (range->rEnd < range->rBegin) {
 		xf86Msg(X_ERROR,"end of block range 0x%lx < begin 0x%lx\n",
-			range->rEnd,range->rBegin);
+			(long)range->rEnd, (long)range->rBegin);
 		return rlist;
 	}
 	break;
@@ -1115,7 +1115,7 @@ xf86AddResToList(resPtr rlist, resRange *range, int entityIndex)
 	if ((range->rBase & range->rMask) != range->rBase) {
 	    xf86Msg(X_ERROR,"sparse io range (base: 0x%lx  mask: 0x%lx)"
 		    "doesn't satisfy (base & mask = mask)\n",
-		    range->rBase, range->rMask);
+		    (long)range->rBase, (long)range->rMask);
 	    return rlist;
 	}
 	break;
@@ -1190,14 +1190,17 @@ xf86PrintResList(int verb, resPtr list)
 				   "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx (0x%lx)",
 				   i, list->entityIndex,
 				   (list->res_type & ResDomain) >> 24,
-				   list->block_begin, list->block_end,
-				   list->block_end - list->block_begin + 1);
+				   (long)list->block_begin,
+				   (long)list->block_end,
+				   (long)(list->block_end -
+					  list->block_begin + 1));
 		    break;
 		case ResSparse:
 		    xf86ErrorFVerb(verb, "\t[%d] %d\t%ld\t0x%08lx - 0x%08lx ",
 				   i, list->entityIndex,
 				   (list->res_type & ResDomain) >> 24,
-				   list->sparse_base,list->sparse_mask);
+				   (long)list->sparse_base,
+				   (long)list->sparse_mask);
 		    break;
 		default:
 		    list = list->next;
@@ -1856,7 +1859,8 @@ xf86PostProbe(void)
 		resp = resp->next;
 		resp_x->next = tmp;
 		} else {
-		    xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",val);
+		    xf86MsgVerb(X_INFO, 3, "Found conflict at: 0x%lx\n",
+				(long)val);
  		    resp->res_type &= ~ResEstimated;
 		    tmp = xf86Entities[i]->resources;
 		    xf86Entities[i]->resources = resp;
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index b6ec4ad..467a0c3 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -441,7 +441,7 @@ xf86PciProbe(void)
 		    memdone = TRUE;
 		} else
 		    xf86ErrorF(", ");
-		xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size);
+		xf86ErrorF("0x%08lx/%ld", (long)r->base_addr, (long)r->size);
 	    }
 	}
 
@@ -454,12 +454,12 @@ xf86PciProbe(void)
 		    iodone = TRUE;
 		} else
 		    xf86ErrorF(", ");
-		xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size);
+		xf86ErrorF("0x%08lx/%ld", (long)r->base_addr, (long)r->size);
 	    }
 	}
 
 	if ( info->rom_size ) {
-	    xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld", info->rom_size);
+	    xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld", (long)info->rom_size);
 	}
 
 	xf86ErrorF("\n");
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index 06f42f8..8274bbb 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -252,7 +252,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
 	for (cs = V_BIOS;  cs < SYS_BIOS;  cs += V_BIOS_SIZE)
 	    if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE)
 		xf86DrvMsg(screen, X_WARNING,
-			   "Unable to retrieve all of segment 0x%06lX.\n", cs);
+			   "Unable to retrieve all of segment 0x%06lX.\n",
+			   (long)cs);
 #ifdef DEBUG
 	ErrorF("done\n");
 #endif
diff --git a/include/xkbfile.h b/include/xkbfile.h
index 0a6cb18..948d6ca 100644
--- a/include/xkbfile.h
+++ b/include/xkbfile.h
@@ -402,35 +402,6 @@ extern unsigned	XkmReadFile(
     XkbDescPtr	        * /* result */
 );
 
-#ifdef _XKMFORMAT_H_
-
-extern Bool	XkmReadTOC(
-    FILE *              /* file */,
-    xkmFileInfo *       /* file_info */,
-    int                 /* max_toc */,
-    xkmSectionInfo *    /* toc */
-);
-
-extern xkmSectionInfo *XkmFindTOCEntry(
-    xkmFileInfo *       /* finfo */,
-    xkmSectionInfo *    /* toc */,
-    unsigned            /* type */
-);
-
-extern Bool	XkmReadFileSection(
-    FILE *              /* file */,
-    xkmSectionInfo *    /* toc */,
-    XkbDescPtr       /* result */,
-    unsigned *          /* loaded_rtrn */
-);
-
-extern char *	XkmReadFileSectionName(
-    FILE *		/* file */,
-    xkmSectionInfo *	/* toc */
-);
-
-#endif /* _XKMFORMAT_H  */
-
 _XFUNCPROTOEND
 
 #endif /* _XKBFILE_H_ */
commit 0c9db0ea10d9fd2a311bca47bba3c60e74ec6eec
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Jan 9 14:32:14 2009 +1000

    xfree86: always force RAW mode under linux.
    
    The previous check for AEI on left us with the possibility that AEI is forced
    off in the config, but devices are added through evdev nonetheless. A keyboard
    added this way can CTRL+C the server. Even when we use kbd, we can set the
    mode to RAW, so it's safer alround to to so.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit b33905234025f005819c7e2acd653a3a0ecfeb82)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 6ee8ed6..7f40857 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -250,6 +250,8 @@ xf86OpenConsole(void)
 
         if (!ShareVTs)
         {
+            struct termios nTty;
+
 #if defined(DO_OS_FONTRESTORE)
 	    lnx_savefont();
 #endif
@@ -282,37 +284,27 @@ xf86OpenConsole(void)
 	        FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
 		           strerror(errno));
 
-	    /* Set the keyboard to RAW mode. If we're using the keyboard
-	     * driver, the driver does it for us. If we have AEI on, then
-	     * we're expecting the devices to be added (i.e. evdev) and we
-	     * have to set it manually.
-	     */
-	    if (xf86Info.allowEmptyInput)
-	    {
-		struct termios nTty;
-
-		tcgetattr(xf86Info.consoleFd, &tty_attr);
-		ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
-
-		if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0)
-		    FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
-			    strerror(errno));
-
-		nTty = tty_attr;
-		nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
-		nTty.c_oflag = 0;
-		nTty.c_cflag = CREAD | CS8;
-		nTty.c_lflag = 0;
-		nTty.c_cc[VTIME]=0;
-		nTty.c_cc[VMIN]=1;
-		cfsetispeed(&nTty, 9600);
-		cfsetospeed(&nTty, 9600);
-		tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
-
-		/* need to keep the buffer clean, else the kernel gets angry */
-		console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
-							drain_console, NULL);
-	    }
+            tcgetattr(xf86Info.consoleFd, &tty_attr);
+            ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
+
+            if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0)
+                FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+                        strerror(errno));
+
+            nTty = tty_attr;
+            nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+            nTty.c_oflag = 0;
+            nTty.c_cflag = CREAD | CS8;
+            nTty.c_lflag = 0;
+            nTty.c_cc[VTIME]=0;
+            nTty.c_cc[VMIN]=1;
+            cfsetispeed(&nTty, 9600);
+            cfsetospeed(&nTty, 9600);
+            tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
+
+            /* need to keep the buffer clean, else the kernel gets angry */
+            console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
+                    drain_console, NULL);
 
 	    /* we really should have a InitOSInputDevices() function instead
 	     * of Init?$#*&Device(). So I just place it here */
@@ -376,10 +368,8 @@ xf86CloseConsole()
 	xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
 		strerror(errno));
 
-    if (xf86Info.allowEmptyInput) {
-	ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
-	tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
-    }
+    ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
+    tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
 
     if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) 
 	xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
commit 3284b03dca180ba2312904b1e20fe83df56f5f3c
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Thu Feb 12 18:34:22 2009 -0800

    Check for and report errors writing xorg.conf.new from Xorg -configure
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
    (cherry picked from commit ac470dfb4fadaa0b28b6f8b57f4f13a20842b897)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 8700496..77326b6 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -758,7 +758,11 @@ DoConfigure(void)
     snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new",
 	     home, addslash);
 
-    xf86writeConfigFile(filename, xf86config);
+    if (xf86writeConfigFile(filename, xf86config) == 0) {
+	xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
+		filename, strerror(errno));
+	goto bail;
+    }
 
     xf86DoConfigurePass1 = FALSE;
     /* Try to get DDC information filled in */
@@ -854,7 +858,11 @@ DoConfigure(void)
 		(glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
     }
 
-    xf86writeConfigFile(filename, xf86config);
+    if (xf86writeConfigFile(filename, xf86config) == 0) {
+	xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
+		filename, strerror(errno));
+	goto bail;
+    }
 
     ErrorF("\n");
 
commit caf503aef15865a969b881355d5e663490a6e194
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Thu Feb 12 18:23:59 2009 -0800

    Correct error message if specified config file is not found
    
    By making the "Unable to open config file" header a warning, it was
    not appearing with the filename when a config file was specified and
    not found.   Now we make it an error message again, but only issue
    the error if a filename was specified - if none was specified, then
    we don't even issue a warning, just the "Using autoconfig" info message.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
    (cherry picked from commit bd713794ceaa1b2890522554562103c0a2d50f04)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 6c6fac3..6db925c 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2525,10 +2525,9 @@ xf86HandleConfigFile(Bool autoconfig)
 	    xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename);
 	    xf86ConfigFile = xnfstrdup(filename);
 	} else {
-	    xf86Msg(X_WARNING, "Unable to locate/open config file");
 	    if (xf86ConfigFile)
-		xf86ErrorFVerb(0, ": \"%s\"", xf86ConfigFile);
-	    xf86ErrorFVerb(0, "\n");
+		xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n",
+			xf86ConfigFile);
 	    return CONFIG_NOFILE;
 	}
     }
commit 791c6ecceec94369f6035b8845a2cb293d194eef
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Feb 3 20:18:37 2009 -0800

    Handle the combination of panning and crtc transforms
    
    This patch gets the shadow scanout buffer repainted on panning area changes.
    It does not, however, track the mouse correctly.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 7968823cbc02615e1080c0d3f34dcebe14ea1771)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index b972974..7c9e443 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -293,33 +293,14 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
     } else
 	crtc->transformPresent = FALSE;
 
-    /* Shift offsets that move us out of virtual size */
-    if (x + mode->HDisplay > xf86_config->maxWidth ||
-	y + mode->VDisplay > xf86_config->maxHeight)
-    {
-	if (x + mode->HDisplay > xf86_config->maxWidth)
-	    crtc->x = xf86_config->maxWidth - mode->HDisplay;
-	if (y + mode->VDisplay > xf86_config->maxHeight)
-	    crtc->y = xf86_config->maxHeight - mode->VDisplay;
-	if (crtc->x < 0 || crtc->y < 0)
-	{
-	    xf86DrvMsg (scrn->scrnIndex, X_ERROR,
-			"Mode %dx%d does not fit virtual size %dx%d - "
-			"internal error\n", mode->HDisplay, mode->VDisplay,
-			xf86_config->maxWidth, xf86_config->maxHeight);
-	    goto done;
-	}
-	xf86DrvMsg (scrn->scrnIndex, X_ERROR,
-		    "Mode %dx%d+%d+%d does not fit virtual size %dx%d - "
-		    "offset updated to +%d+%d\n",
-		    mode->HDisplay, mode->VDisplay, x, y,
-		    xf86_config->maxWidth, xf86_config->maxHeight,
-		    crtc->x, crtc->y);
-    }
-
     if (crtc->funcs->set_origin &&
 	memcmp (mode, &saved_mode, sizeof(saved_mode)) == 0 &&
-	saved_rotation == rotation) {
+	saved_rotation == rotation &&
+	saved_transform_present == crtc->transformPresent &&
+	(!crtc->transformPresent || RRTransformEqual(&saved_transform, &crtc->transform)))
+    {
+	if (!xf86CrtcRotate (crtc))
+		goto done;
 	crtc->funcs->set_origin (crtc, crtc->x, crtc->y);
 	ret = TRUE;
 	goto done;
@@ -421,8 +402,11 @@ xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y)
 {
     crtc->x = x;
     crtc->y = y;
-    if (crtc->funcs->set_origin)
+    if (crtc->funcs->set_origin) {
+	if (!xf86CrtcRotate (crtc))
+	    return;
 	crtc->funcs->set_origin (crtc, x, y);
+    }
     else
 	xf86CrtcSetMode (crtc, &crtc->mode, crtc->rotation, x, y);
 }
commit 099d74a12752808dd1972c28bdb228fc447d3774
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Feb 3 20:15:41 2009 -0800

    Damage re-used shadow scanout buffer using new transforms.
    
    When the shadow scanout buffer can be re-used, the underlying framebuffer
    area must be damaged so that the scanout will be repainted. This patch
    delays the addition of that damaged area until after the transform in the
    crtc has been updated, otherwise the old transform would have been used and
    the wrong area repainted.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 763df9eec79a867978efc5138d8635a46c1a0d17)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index f9f43c9..66d97a9 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -406,6 +406,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
     int			new_width = 0;
     int			new_height = 0;
     RRTransformPtr	transform = NULL;
+    Bool		damage = FALSE;
 
     if (crtc->transformPresent)
 	transform = &crtc->transform;
@@ -466,7 +467,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
 	else
 	{
 	    /* mark shadowed area as damaged so it will be repainted */
-	    xf86CrtcDamageShadow (crtc);
+	    damage = TRUE;
 	}
 
 	if (!xf86_config->rotation_damage)
@@ -540,6 +541,9 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
     crtc->bounds.y2 = crtc->mode.VDisplay;
     pixman_f_transform_bounds (&f_crtc_to_fb, &crtc->bounds);
 
+    if (damage)
+        xf86CrtcDamageShadow (crtc);
+
     /* All done */
     return TRUE;
 }
commit 4992c31e6c09a9140d4482d762b5dfff0a4efedb
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Feb 3 20:12:42 2009 -0800

    Handle matrix computation overflow in RRTransformCompute
    
    If the computation of the composite fixed-point transform for RandR
    overflows at any point, take the resulting floating point transform and
    scale that back to fit in a fixed point matrix. This ensures that a matrix
    will always be available, although perhaps at reduced precision. Someday we
    should add floating point matrices to Render.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 62fc98cb88e4e8b636f343453fc1168a87c58972)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index a901df4..49be2e0 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -120,6 +120,22 @@ RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
 
 #define F(x)	IntToxFixed(x)
 
+static void
+RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
+{
+    double max = 0, v, scale;
+    int i, j;
+
+    for (j = 0; j < 3; j++)
+	for (i = 0; i < 3; i++)
+	    if ((v = abs (f_transform->m[j][i])) > max)
+		max = v;
+    scale = limit / max;
+    for (j = 0; j < 3; j++)
+	for (i = 0; i < 3; i++)
+	    f_transform->m[j][i] *= scale;
+}
+
 /*
  * Compute the complete transformation matrix including
  * client-specified transform, rotation/reflection values and the crtc 
@@ -141,6 +157,7 @@ RRTransformCompute (int			    x,
 {
     PictTransform	    t_transform, inverse;
     struct pixman_f_transform tf_transform, tf_inverse;
+    Bool		    overflow = FALSE;
 
     if (!transform) transform = &t_transform;
     if (!f_transform) f_transform = &tf_transform;
@@ -234,7 +251,8 @@ RRTransformCompute (int			    x,
 #ifdef RANDR_12_INTERFACE
     if (rr_transform)
     {
-        pixman_transform_multiply (transform, transform, &rr_transform->transform);
+        if (!pixman_transform_multiply (transform, transform, &rr_transform->transform))
+	    overflow = TRUE;
 	pixman_f_transform_multiply (f_transform, f_transform, &rr_transform->f_transform);
 	pixman_f_transform_multiply (f_inverse, &rr_transform->f_inverse, f_inverse);
     }
@@ -242,19 +260,26 @@ RRTransformCompute (int			    x,
     /*
      * Compute the class of the resulting transform
      */
-    if (pixman_transform_is_identity (transform))
+    if (!overflow && pixman_transform_is_identity (transform))
     {
 	pixman_transform_init_translate (transform, F ( x), F ( y));
 
-	pixman_f_transform_init_translate (f_transform, F( x), F( y));
-	pixman_f_transform_init_translate (f_inverse,   F(-x), F(-y));
+	pixman_f_transform_init_translate (f_transform,  x,  y);
+	pixman_f_transform_init_translate (f_inverse,   -x, -y);
 	return FALSE;
     }
     else
     {
-	pixman_transform_translate (&inverse, transform, x, y);
-	pixman_f_transform_translate (f_inverse, f_transform, x, y);
+	pixman_f_transform_translate (f_transform, f_inverse, x, y);
+	if (!pixman_transform_translate (transform, &inverse, F(x), F(y)))
+	    overflow = TRUE;
+	if (overflow)
+	{
+	    struct pixman_f_transform f_scaled;
+	    f_scaled = *f_transform;
+	    RRTransformRescale(&f_scaled, 16384.0);
+	    pixman_transform_from_pixman_f_transform(transform, &f_scaled);
+	}
 	return TRUE;
     }
 }
-
commit 660c2a7d4c6cb52fd0992e9d2008a24805dc8c02
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Thu Feb 12 18:27:48 2009 -0800

    Query the DDX in ProcRRGetScreenInfo.
    
    This is the RandR 1.1 version of GetScreenResources and needs to re-query the
    DDX to see if the mode pool changed.
    
    Fixes Launchpad bug #325115.
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index da633b2..36ef86e 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -615,7 +615,7 @@ ProcRRGetScreenInfo (ClientPtr client)
     rep.pad = 0;
     
     if (pScrPriv)
-	if (!RRGetInfo (pScreen, FALSE))
+	if (!RRGetInfo (pScreen, TRUE))
 	    return BadAlloc;
 
     output = RRFirstOutput (pScreen);
commit 34724f45512e311377b972da480d35304fd687cc
Author: Paulo Cesar Pereira de Andrade <pcpa at mandriva.com.br>
Date:   Fri Jan 30 03:56:39 2009 -0200

    Work around inclusion of <X11/extensions/panoramiXext.h>
    
      The X Server build only needs the macros PANORAMIX_MAJOR_VERSION
    and PANORAMIX_MINOR_VERSION from that header.
      Addition of extra prototypes to <X11/extensions/panoramiXext.h>
    caused a X Server build failure.

diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h
index 89c7547..700c5a4 100644
--- a/Xext/panoramiX.h
+++ b/Xext/panoramiX.h
@@ -40,7 +40,10 @@ Equipment Corporation.
 #ifndef _PANORAMIX_H_
 #define _PANORAMIX_H_
 
+#define _PANORAMIX_SERVER
 #include <X11/extensions/panoramiXext.h>
+#undef _PANORAMIX_SERVER
+
 #include "gcstruct.h"
 
 
commit 1f729b42d567ae9533ac0e467afc9fbc83390776
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Jan 30 21:12:17 2009 -0800

    Version to 1.5.99.902

diff --git a/configure.ac b/configure.ac
index da5f488..61b8b12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,11 +26,13 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.5.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.5.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE
 
+RELEASE_DATE="2009-1-30"
+
 dnl this gets generated by autoheader, and thus contains all the defines.  we
 dnl don't ever actually use it, internally.
 AC_CONFIG_HEADERS(include/do-not-use-config.h)
@@ -417,7 +419,6 @@ VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}"
 
 VENDOR_NAME="The X.Org Foundation"
 VENDOR_NAME_SHORT="X.Org"
-RELEASE_DATE="(unreleased)"
 VENDOR_WEB="http://wiki.x.org"
 
 m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
commit 56f6fb8c8652c85e522e42557f8969987069076b
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jan 30 19:06:17 2009 -0800

    randr: Avoid re-querying the configuration on everything but GetScreenResources.
    
    The new path should only re-query on the other requests when we haven't
    gathered the information from the DDX yet (such as with a non-RandR 1.2 DDX).
    
    Bug #19037.
    (cherry picked from commit 317f2b4a9fe4b606975711bc332166a82db5087d)

diff --git a/randr/randrstr.h b/randr/randrstr.h
index b5cebdc..9c9b7c0 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -468,7 +468,7 @@ RRTellChanged (ScreenPtr pScreen);
  * Poll the driver for changed information
  */
 Bool
-RRGetInfo (ScreenPtr pScreen);
+RRGetInfo (ScreenPtr pScreen, Bool force_query);
 
 Bool RRInit (void);
 
diff --git a/randr/rrinfo.c b/randr/rrinfo.c
index 38314de..12b9a4a 100644
--- a/randr/rrinfo.c
+++ b/randr/rrinfo.c
@@ -178,12 +178,20 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
  * Poll the driver for changed information
  */
 Bool
-RRGetInfo (ScreenPtr pScreen)
+RRGetInfo (ScreenPtr pScreen, Bool force_query)
 {
     rrScrPriv (pScreen);
     Rotation	    rotations;
     int		    i;
 
+    /* Return immediately if we don't need to re-query and we already have the
+     * information.
+     */
+    if (!force_query) {
+	if (pScrPriv->numCrtcs != 0 || pScrPriv->numOutputs != 0)
+	    return TRUE;
+    }
+
     for (i = 0; i < pScrPriv->numOutputs; i++)
 	pScrPriv->outputs[i]->changed = FALSE;
     for (i = 0; i < pScrPriv->numCrtcs; i++)
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 95662c9..da633b2 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -224,7 +224,7 @@ ProcRRGetScreenSizeRange (ClientPtr client)
     
     if (pScrPriv) 
     {
-	if (!RRGetInfo (pScreen))
+	if (!RRGetInfo (pScreen, FALSE))
 	    return BadAlloc;
 	rep.minWidth  = pScrPriv->minWidth;
 	rep.minHeight = pScrPriv->minHeight;
@@ -340,7 +340,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
     rep.pad = 0;
     
     if (query && pScrPriv)
-	if (!RRGetInfo (pScreen))
+	if (!RRGetInfo (pScreen, query))
 	    return BadAlloc;
 
     if (!pScrPriv)
@@ -615,7 +615,7 @@ ProcRRGetScreenInfo (ClientPtr client)
     rep.pad = 0;
     
     if (pScrPriv)
-	if (!RRGetInfo (pScreen))
+	if (!RRGetInfo (pScreen, FALSE))
 	    return BadAlloc;
 
     output = RRFirstOutput (pScreen);
@@ -796,7 +796,7 @@ ProcRRSetScreenConfig (ClientPtr client)
 	rep.status = RRSetConfigFailed;
 	goto sendReply;
     }
-    if (!RRGetInfo (pScreen))
+    if (!RRGetInfo (pScreen, FALSE))
 	return BadAlloc;
     
     output = RRFirstOutput (pScreen);
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index 7f9a798..36135c6 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -307,12 +307,8 @@ ProcRRXineramaQueryScreens(ClientPtr client)
     REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
 
     if (RRXineramaScreenActive (pScreen))
-    {
-	rrScrPriv(pScreen);
-	if (pScrPriv->numCrtcs == 0 || pScrPriv->numOutputs == 0)
-	    RRGetInfo (pScreen);
-    }
-    
+	RRGetInfo (pScreen, FALSE);
+
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
     rep.number = RRXineramaScreenCount (pScreen);
commit 6d928aa227b12832dd358619722a5f4dc71b5d19
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Jan 30 20:17:10 2009 -0800

    RandR crtcs not fetched correctly when primary output is set.
    
    Primary outputs may not have a CRTC.
    Loops fetching CRTCs respecting primary output were broken.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 4de5705545792d77c9990bbec3e263a517757a2a)

diff --git a/randr/randr.c b/randr/randr.c
index 2e482f0..6fe9b56 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -438,7 +438,7 @@ RRFirstOutput (ScreenPtr pScreen)
     RROutputPtr		    output;
     int	i, j;
     
-    if (pScrPriv->primaryOutput)
+    if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
 	return pScrPriv->primaryOutput;
 
     for (i = 0; i < pScrPriv->numCrtcs; i++)
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 9b1024e..95662c9 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -324,7 +324,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
     rrScrPrivPtr		pScrPriv;
     CARD8			*extra;
     unsigned long		extraLen;
-    int				i, n, rc, has_primary;
+    int				i, n, rc, has_primary = 0;
     RRCrtc			*crtcs;
     RROutput			*outputs;
     xRRModeInfo			*modeinfos;
@@ -402,19 +402,22 @@ rrGetScreenResources(ClientPtr client, Bool query)
 	modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
 	names = (CARD8 *) (modeinfos + num_modes);
 
-	has_primary = (pScrPriv->primaryOutput != NULL);
-	if (pScrPriv->primaryOutput)
+	if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
 	{
-	    crtcs[0] = pScrPriv->primaryOutput->id;
+	    has_primary = 1;
+	    crtcs[0] = pScrPriv->primaryOutput->crtc->id;
 	    if (client->swapped)
 		swapl (&crtcs[0], n);
 	}
 	
 	for (i = 0; i < pScrPriv->numCrtcs; i++)
 	{
-	    if (pScrPriv->primaryOutput &&
+	    if (has_primary &&
 		pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
+	    {
+		has_primary = 0;
 		continue;
+	    }
 	    crtcs[i + has_primary] = pScrPriv->crtcs[i]->id;
 	    if (client->swapped)
 		swapl (&crtcs[i + has_primary], n);
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index 5af6fb0..7f9a798 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -328,16 +328,21 @@ ProcRRXineramaQueryScreens(ClientPtr client)
     if(rep.number) {
 	rrScrPriv(pScreen);
 	int i;
-	int has_primary = (pScrPriv->primaryOutput != NULL);
+	int has_primary = 0;
 
-	if (has_primary) {
+	if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) {
+	    has_primary = 1;
 	    RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc);
 	}
 
 	for(i = 0; i < pScrPriv->numCrtcs; i++) {
-	    RRCrtcPtr	crtc = pScrPriv->crtcs[i];
-	    if (!has_primary || (crtc != pScrPriv->primaryOutput->crtc))
-		RRXineramaWriteCrtc(client, crtc);
+	    if (has_primary &&
+		pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
+	    {
+		has_primary = 0;
+		continue;
+	    }
+	    RRXineramaWriteCrtc(client, pScrPriv->crtcs[i]);
 	}
     }
 
commit 759ed0679a030f502b74a6ff44c15d1c97d9a937
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Jan 30 19:14:36 2009 -0800

    RandR SetOutputPrimary should work with or without a crtc connected
    
    The test was inverted from the protocol spec, and besides, the test is bogus
    anyways.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit c1f2be1f3fd0c80cb4c85b98140b98aa9311242b)

diff --git a/randr/rroutput.c b/randr/rroutput.c
index 82c2530..939c14d 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -588,11 +588,6 @@ ProcRRSetOutputPrimary(ClientPtr client)
 	    return RRErrorBase + BadRROutput;
 	}
 
-	if (output->crtc) {
-	    client->errorValue = stuff->output;
-	    return BadMatch;
-	}
-
 	if (output->pScreen != pWin->drawable.pScreen) {
 	    client->errorValue = stuff->window;
 	    return BadMatch;
commit be21199f550d9a19c10df16ed23c6f9ed94e55da
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Dec 11 18:48:02 2008 +0100

    randr: Fix initial panning border copy
    
    Thanks to Julien Cristau for finding this.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 7ed8266..e1697a2 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1345,7 +1345,10 @@ xf86InitialPanning (ScrnInfoPtr scrn)
 			&track_width, &track_height, &track_left, &track_top,
 			&brdr[0], &brdr[1], &brdr[2], &brdr[3])) {
 	case 12:
-	    memcpy (output->initialBorder, brdr, 4*sizeof(INT16));
+	    output->initialBorder[0] = brdr[0];
+	    output->initialBorder[1] = brdr[1];
+	    output->initialBorder[2] = brdr[2];
+	    output->initialBorder[3] = brdr[3];
 	    /* fall through */
 	case 8:
 	    output->initialTrackingArea.x1 = track_left;
commit 19a978359d7358501cccb79965b78a3f8ec18743
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Dec 11 17:51:20 2008 +0100

    randr: Oops, miscalculated panning rectangle's coordinates

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 99f7d1e..b504b0c 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1098,12 +1098,12 @@ ProcRRSetPanning (ClientPtr client)
 
     total.x1    = stuff->left;
     total.y1    = stuff->top;
-    total.x2    = stuff->width - total.x1;
-    total.y2    = stuff->height - total.y1;
+    total.x2    = total.x1 + stuff->width;
+    total.y2    = total.y1 + stuff->height;
     tracking.x1 = stuff->track_left;
     tracking.y1 = stuff->track_top;
-    tracking.x2 = stuff->track_width - tracking.x1;
-    tracking.y2 = stuff->track_height - tracking.y1;
+    tracking.x2 = tracking.x1 + stuff->track_width;
+    tracking.y2 = tracking.y1 + stuff->track_height;
     border[0]   = stuff->border_left;
     border[1]   = stuff->border_top;
     border[2]   = stuff->border_right;
commit ab56607a0855e88de2ad2d7eb43e1d806db0c47b
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Dec 11 16:48:40 2008 +0100

    randr: Update initial screen size if panning information is present

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 362229c..08799c2 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -561,10 +561,16 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
 	int	    crtc_width = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
 	int	    crtc_height = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
 	
-	if (crtc->enabled && crtc_width > width)
-	    width = crtc_width;
-	if (crtc->enabled && crtc_height > height)
-	    height = crtc_height;
+	if (crtc->enabled) {
+	    if (crtc_width > width)
+		width = crtc_width;
+	    if (crtc_height > height)
+		height = crtc_height;
+	    if (crtc->panningTotalArea.x2 > width)
+		width = crtc->panningTotalArea.x2;
+	    if (crtc->panningTotalArea.y2 > height)
+		height = crtc->panningTotalArea.y2;
+	}
     }
     
     if (width && height)
@@ -615,6 +621,13 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "Setting screen physical size to %d x %d\n",
 		   mmWidth, mmHeight);
+	/*
+	 * This is the initial setting of the screen size.
+	 * We have to pre-set it here, otherwise panning would be adapted
+	 * to the new screen size.
+	 */
+	pScreen->width  = width;
+	pScreen->height = height;
 	xf86RandR12ScreenSetSize (pScreen,
 				  width,
 				  height,
commit 657d963a663a189d3c8068a39528b2d73af5fe70
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Dec 11 16:48:11 2008 +0100

    randr: Fix error message for bad panning config

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index ef3723e..7ed8266 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1362,7 +1362,7 @@ xf86InitialPanning (ScrnInfoPtr scrn)
 	    output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
 	    break;
 	default:
-	    xf86DrvMsg (output->scrn->scrnIndex, X_ERROR,
+	    xf86DrvMsg (scrn->scrnIndex, X_ERROR,
 			"Broken panning specification '%s' for output %s in config file\n",
 			panning, output->name);
 	}
commit 44b89dc0a5aa23df69539754fb76c67c310530db
Author: Matthias Hopf <mhopf at suse.de>
Date:   Thu Dec 11 14:56:51 2008 +0100

    randr: Add monitor option "Panning" for initial panning configuration

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 9717620..ef3723e 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -453,6 +453,7 @@ typedef enum {
     OPTION_MAX_CLOCK,
     OPTION_IGNORE,
     OPTION_ROTATE,
+    OPTION_PANNING,
 } OutputOpts;
 
 static OptionInfoRec xf86OutputOptions[] = {
@@ -468,6 +469,7 @@ static OptionInfoRec xf86OutputOptions[] = {
     {OPTION_MAX_CLOCK,	    "MaxClock",		OPTV_FREQ,    {0}, FALSE },
     {OPTION_IGNORE,	    "Ignore",		OPTV_BOOLEAN, {0}, FALSE },
     {OPTION_ROTATE,	    "Rotate",		OPTV_STRING,  {0}, FALSE },
+    {OPTION_PANNING,	    "Panning",		OPTV_STRING,  {0}, FALSE },
     {-1,		    NULL,		OPTV_NONE,    {0}, FALSE },
 };
 
@@ -1317,6 +1319,56 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
     return TRUE;
 }
 
+static void
+xf86InitialPanning (ScrnInfoPtr scrn)
+{
+    xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn);
+    int			o;
+    
+    for (o = 0; o < config->num_output; o++)
+    {
+	xf86OutputPtr	output = config->output[o];
+	char	       *panning = xf86GetOptValString (output->options, OPTION_PANNING);
+	int		width, height, left, top;
+	int		track_width, track_height, track_left, track_top;
+	int		brdr[4];
+
+	memset (&output->initialTotalArea,    0, sizeof(BoxRec));
+	memset (&output->initialTrackingArea, 0, sizeof(BoxRec));
+	memset (output->initialBorder,        0, 4*sizeof(INT16));
+
+	if (! panning)
+	    continue;
+
+	switch (sscanf (panning, "%dx%d+%d+%d/%dx%d+%d+%d/%d/%d/%d/%d",
+			&width, &height, &left, &top,
+			&track_width, &track_height, &track_left, &track_top,
+			&brdr[0], &brdr[1], &brdr[2], &brdr[3])) {
+	case 12:
+	    memcpy (output->initialBorder, brdr, 4*sizeof(INT16));
+	    /* fall through */
+	case 8:
+	    output->initialTrackingArea.x1 = track_left;
+	    output->initialTrackingArea.y1 = track_top;
+	    output->initialTrackingArea.x2 = track_left + track_width;
+	    output->initialTrackingArea.y2 = track_top  + track_height;
+	    /* fall through */
+	case 4:
+	    output->initialTotalArea.x1 = left;
+	    output->initialTotalArea.y1 = top;
+	    /* fall through */
+	case 2:
+	    output->initialTotalArea.x2 = output->initialTotalArea.x1 + width;
+	    output->initialTotalArea.y2 = output->initialTotalArea.y1 + height;
+	    break;
+	default:
+	    xf86DrvMsg (output->scrn->scrnIndex, X_ERROR,
+			"Broken panning specification '%s' for output %s in config file\n",
+			panning, output->name);
+	}
+    }
+}
+
 /*
  * XXX walk the monitor mode list and prune out duplicates that
  * are inserted by xf86DDCMonitorSet. In an ideal world, that
@@ -2243,6 +2295,11 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
 	xfree (modes);
 	return FALSE;
     }
+
+    /*
+     * Set initial panning of each output
+     */
+    xf86InitialPanning (scrn);
 	
     /*
      * Assign CRTCs to fit output configuration
@@ -2286,6 +2343,9 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
 	    crtc->enabled = TRUE;
 	    crtc->x = output->initial_x;
 	    crtc->y = output->initial_y;
+	    memcpy (&crtc->panningTotalArea,    &output->initialTotalArea,    sizeof(BoxRec));
+	    memcpy (&crtc->panningTrackingArea, &output->initialTrackingArea, sizeof(BoxRec));
+	    memcpy (crtc->panningBorder,        output->initialBorder,        4*sizeof(INT16));
 	    output->crtc = crtc;
 	} else {
 	    output->crtc = NULL;
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 5e47e6f..bc36b31 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -466,7 +466,7 @@ typedef struct _xf86OutputFuncs {
 } xf86OutputFuncsRec, *xf86OutputFuncsPtr;
 
 
-#define XF86_OUTPUT_VERSION 1
+#define XF86_OUTPUT_VERSION 2
 
 struct _xf86Output {
     /**
@@ -574,6 +574,10 @@ struct _xf86Output {
 #else
     void		*randr_output;
 #endif
+    /** Desired initial panning */
+    BoxRec          initialTotalArea;
+    BoxRec          initialTrackingArea;
+    INT16           initialBorder[4];
 };
 
 typedef struct _xf86CrtcConfigFuncs {


More information about the xorg-commit mailing list