xserver: Branch 'transform-proposal' - 25 commits

Keith Packard keithp at kemper.freedesktop.org
Thu Mar 27 11:48:24 PDT 2008


 GL/glx/glxcmds.c                        |    6 +
 configure.ac                            |    7 +
 hw/kdrive/ephyr/Makefile.am             |    1 
 hw/kdrive/ephyr/XF86dri.c               |   37 ++++++--
 hw/kdrive/ephyr/ephyr.c                 |   34 ++++++-
 hw/kdrive/ephyr/hostx.c                 |    3 
 hw/kdrive/ephyr/hostx.h                 |    1 
 hw/xfree86/ddc/Makefile.am              |    4 
 hw/xfree86/ddc/decode_edid.c            |   80 +++++++++++++++++
 hw/xfree86/dri2/dri2.c                  |   11 ++
 hw/xfree86/dri2/dri2.h                  |    2 
 hw/xfree86/int10/helper_exec.c          |   57 ++++++++++--
 hw/xfree86/modes/xf86Crtc.c             |  147 ++++++++++++++++++++++----------
 hw/xfree86/modes/xf86Crtc.h             |   11 ++
 hw/xfree86/modes/xf86RandR12.c          |   24 +----
 hw/xfree86/os-support/bsd/i386_video.c  |    5 +
 hw/xfree86/os-support/bus/Makefile.am   |   12 --
 hw/xfree86/os-support/bus/Pci.h         |    3 
 hw/xfree86/os-support/bus/bsd_pci.c     |    2 
 hw/xfree86/os-support/linux/Makefile.am |    2 
 hw/xfree86/os-support/shared/ia64Pci.c  |   55 -----------
 hw/xfree86/utils/ioport/Makefile.am     |    2 
 hw/xfree86/xf4bpp/ppcSpMcro.h           |    6 -
 include/os.h                            |    4 
 include/regionstr.h                     |    2 
 include/xorg-config.h.in                |    3 
 mi/miregion.c                           |   11 +-
 os/io.c                                 |   10 +-
 os/osdep.h                              |    2 
 randr/Makefile.am                       |    2 
 randr/randrstr.h                        |    3 
 randr/rrcrtc.c                          |    9 +
 xkb/xkbUtils.c                          |    8 -
 33 files changed, 391 insertions(+), 175 deletions(-)

New commits:
commit e6f10f62f7dd98ab814ad4d222739a4821c3f17d
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Mar 27 11:46:39 2008 -0700

    Update RandR global transform when driver notifies of transform change.
    
    Need to compute and save the global transform when the driver changes it.

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 14654ff..f702a36 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -233,6 +233,15 @@ RRCrtcNotify (RRCrtcPtr	    crtc,
 	RRTransformCopy (&crtc->client_current_transform, transform);
 	RRCrtcChanged (crtc, TRUE);
     }
+    if (crtc->changed)
+    {
+	RRTransformCompute (x, y,
+			    mode->mode.width, mode->mode.height,
+			    rotation,
+			    &crtc->client_current_transform,
+			    &crtc->transform, &crtc->f_transform,
+			    &crtc->f_inverse);
+    }
     return TRUE;
 }
 
commit 127068ac7b23333e50d868167bb9fb5def7ad6e0
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Mar 27 11:45:53 2008 -0700

    Export rrtransform.h as needed by randrstr.h
    
    When the transform management was moved from randrstr.h, the associated
    header file became necessary to build drivers. Include it as a part of the
    sdk headers.

diff --git a/randr/Makefile.am b/randr/Makefile.am
index 3d16ede..1f1bea0 100644
--- a/randr/Makefile.am
+++ b/randr/Makefile.am
@@ -5,7 +5,7 @@ AM_CFLAGS = $(DIX_CFLAGS)
 XINERAMA_SRCS = rrxinerama.c
 
 if XORG
-sdk_HEADERS = randrstr.h
+sdk_HEADERS = randrstr.h rrtransform.h
 endif
 
 librandr_la_SOURCES =	\
commit 5ab0acfc5108faf7eb4735f915d86c03a5c4f3df
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Mar 27 11:44:37 2008 -0700

    Write a framework to decode edid data in an external program.
    
    This isn't complete, but demonstrates how one would write an external EDID
    parser that can work from binary data as dumped by the X server.

diff --git a/hw/xfree86/ddc/Makefile.am b/hw/xfree86/ddc/Makefile.am
index cd146c5..69afc72 100644
--- a/hw/xfree86/ddc/Makefile.am
+++ b/hw/xfree86/ddc/Makefile.am
@@ -10,3 +10,7 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
 EXTRA_DIST = ddcPriv.h DDC.HOWTO
+
+bin_PROGRAMS = decode_edid
+
+decode_edid_SOURCES = decode_edid.c interpret_edid.c print_edid.c
diff --git a/hw/xfree86/ddc/decode_edid.c b/hw/xfree86/ddc/decode_edid.c
new file mode 100644
index 0000000..9859ae7
--- /dev/null
+++ b/hw/xfree86/ddc/decode_edid.c
@@ -0,0 +1,80 @@
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#define _PARSE_EDID_
+#include "xf86DDC.h"
+#include <string.h>
+
+Uchar	edid[] = {
+    0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
+    0x52, 0x62, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x11, 0x01, 0x03, 0x80, 0x69, 0x3b, 0x78,
+    0x0a, 0x0d, 0xc9, 0xa0, 0x57, 0x47, 0x98, 0x27, 
+    0x12, 0x48, 0x4c, 0x20, 0x00, 0x00, 0x01, 0x01,
+    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a,
+    0x80, 0xd0, 0x72, 0x38, 0x2d, 0x40, 0x10, 0x2c, 
+    0x45, 0x80, 0xc4, 0x8e, 0x21, 0x00, 0x00, 0x1e,
+    0x8c, 0x0a, 0xd0, 0x90, 0x20, 0x40, 0x31, 0x20, 
+    0x0c, 0x40, 0x55, 0x00, 0xc4, 0x8e, 0x21, 0x00,
+    0x00, 0x18, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x54, 
+    0x4f, 0x53, 0x48, 0x49, 0x42, 0x41, 0x2d, 0x54,
+    0x56, 0x0a, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 
+    0x00, 0x17, 0x3d, 0x0f, 0x44, 0x0f, 0x00, 0x0a,
+    0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x3b, 
+};
+
+int
+main (int argc, char **argv)
+{
+    xf86MonPtr	m;
+    
+    m = xf86InterpretEDID (0, edid);
+    (void) xf86PrintEDID (m);
+    return 0;
+}
+
+pointer
+XNFcalloc (unsigned long amount)
+{
+    return calloc (amount, 1);
+}
+
+#include <stdarg.h>
+
+void
+xf86DrvMsg (int srcn, MessageType type, const char *fmt, ...)
+{
+    va_list args;
+    va_start (args, fmt);
+
+    vprintf (fmt, args);
+}
+
+void
+xf86Msg (MessageType type, const char *fmt, ...)
+{
+    va_list args;
+    va_start (args, fmt);
+
+    vprintf (fmt, args);
+}
+
+void
+xf86ErrorF (const char *fmt, ...)
+{
+    va_list args;
+    va_start (args, fmt);
+
+    vprintf (fmt, args);
+}
+
+void
+Xfree (pointer x)
+{
+    free (x);
+}
commit 501bdedc117ecfb285dcc50c55a20a00ca437b55
Merge: 16ff219... edad0a9...
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Mar 27 11:43:29 2008 -0700

    Merge commit 'origin/master' into transform-proposal

commit edad0a9dfebcce5c54b2f9c32bd9d45549e20c51
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Tue Mar 18 17:51:21 2008 -0400

    Apply __glXDisp_GetVisualConfigs message patch
    From http://bugs.freedesktop.org/show_bug.cgi?id=13863
    
    Problem was that the glxcmds.c __glXDisp_GetVisualConfigs
    function left garbage in the tail end of the message used for extensions.

diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index 32d1bc8..3b79cca 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -944,6 +944,12 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
 	buf[p++] = modes->transparentAlpha;
 	buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
 	buf[p++] = modes->transparentIndex;
+	buf[p++] = 0;
+	buf[p++] = 0;
+	buf[p++] = 0;
+	buf[p++] = 0;
+	buf[p++] = 0;
+	buf[p++] = 0;
 
 	if (client->swapped) {
 	    __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
commit cdadd2ff9bade318caac5c1d9bcdc8a001347da9
Author: Dodji Seketeli <dodji at seketeli.org>
Date:   Tue Mar 18 14:00:15 2008 +0100

    [Xephyr/DRI] correctly route motion events targeted at GL drawable

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index e95001d..b02f990 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -891,9 +891,12 @@ ephyrPoll(void)
               continue;
           }
           {
-            if (ephyrCurScreen != ev.data.mouse_motion.screen)
+            if (ev.data.mouse_motion.screen >=0
+                && (ephyrCurScreen != ev.data.mouse_motion.screen))
               {
-                  EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
+                  EPHYR_LOG ("warping mouse cursor. "
+                             "cur_screen%d, motion_screen:%d\n",
+                             ephyrCurScreen, ev.data.mouse_motion.screen) ;
                   if (ev.data.mouse_motion.screen >= 0)
                     {
                       ephyrWarpCursor
@@ -904,11 +907,30 @@ ephyrPoll(void)
               }
             else
               {
+                  int x=0, y=0;
+#ifdef XEPHYR_DRI
+                  EphyrWindowPair *pair = NULL;
+#endif
                   EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
-                  KdEnqueuePointerEvent(ephyrMouse, mouseState,
-                                        ev.data.mouse_motion.x,
-                                        ev.data.mouse_motion.y,
-                                        0);
+                  x = ev.data.mouse_motion.x;
+                  y = ev.data.mouse_motion.y;
+                  EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ;
+#ifdef XEPHYR_DRI
+                  EPHYR_LOG ("is this window peered by a gl drawable ?\n") ;
+                  if (findWindowPairFromRemote (ev.data.mouse_motion.window,
+                                                &pair))
+                    {
+                        EPHYR_LOG ("yes, it is peered\n") ;
+                        x += pair->local->drawable.x;
+                        y += pair->local->drawable.y;
+                    }
+                  else
+                    {
+                        EPHYR_LOG ("no, it is not peered\n") ;
+                    }
+                  EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ;
+#endif
+                  KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
               }
           }
           break;
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index ae1bb4b..fd84ec0 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -914,8 +914,9 @@ hostx_get_event(EphyrHostXEvent *ev)
                 host_screen_from_window (xev.xmotion.window);
 
 	    ev->type = EPHYR_EV_MOUSE_MOTION;
-	    ev->data.mouse_motion.x = xev.xmotion.x; 
+	    ev->data.mouse_motion.x = xev.xmotion.x;
 	    ev->data.mouse_motion.y = xev.xmotion.y;
+	    ev->data.mouse_motion.window = xev.xmotion.window;
 	    ev->data.mouse_motion.screen = (host_screen ? host_screen->mynum : -1);
 	  }
 	  return 1;
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index f72cfe7..48d3147 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -70,6 +70,7 @@ struct EphyrHostXEvent
       int x;
       int y;
       int screen;
+      int window;
     } mouse_motion;
 
     struct mouse_down { 	
commit afd7428690d87097117ab20335658f6d59d60103
Author: Jesse Barnes <jbarnes at jbarnes-t61.(none)>
Date:   Mon Mar 17 14:55:44 2008 -0700

    Cleanup logic in xf86PrepareOutputs
    
    Should have done this in the first place.  Since we're checking for the absence
    of the get_crtc callback in the first place, we'll short circuit the later call
    and disable the output, so the ugly "continue" block is unnecesary.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 536b530..8c2b247 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2047,13 +2047,9 @@ xf86PrepareOutputs (ScrnInfoPtr scrn)
     for (o = 0; o < config->num_output; o++) {
 	xf86OutputPtr output = config->output[o];
 #if RANDR_GET_CRTC_INTERFACE
-	/* If we can't get the current CRTC, play it safe */
-	if (!output->funcs->get_crtc) {
-	    (*output->funcs->dpms)(output, DPMSModeOff);
-	    continue;
-	}
 	/* Disable outputs that are unused or will be re-routed */
-	if (output->crtc != (*output->funcs->get_crtc)(output) ||
+	if (!output->funcs->get_crtc ||
+	    output->crtc != (*output->funcs->get_crtc)(output) ||
 	    output->crtc == NULL)
 #endif
 	    (*output->funcs->dpms)(output, DPMSModeOff);
commit ba85caacb565b9aa0aeace52a362350304b0566d
Author: Jesse Barnes <jbarnes at jbarnes-t61.(none)>
Date:   Mon Mar 17 14:13:09 2008 -0700

    Make xf86SetDesiredModes aware of current output configuration
    
    By adding a new output callback, ->get_crtc, xf86SetDesiredModes is able to
    avoid turning off outputs & CRTCs if the current output<->CRTC mappings are the
    same as the desired configuration.  This helps avoid flickering displays at
    startup time, which speeds things up a little and looks better.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 6b845b7..536b530 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2034,6 +2034,72 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
 }
 
 /*
+ * Check the CRTC we're going to map each output to vs. it's current
+ * CRTC.  If they don't match, we have to disable the output and the CRTC
+ * since the driver will have to re-route things.
+ */
+static void
+xf86PrepareOutputs (ScrnInfoPtr scrn)
+{
+    xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(scrn);
+    int			o;
+
+    for (o = 0; o < config->num_output; o++) {
+	xf86OutputPtr output = config->output[o];
+#if RANDR_GET_CRTC_INTERFACE
+	/* If we can't get the current CRTC, play it safe */
+	if (!output->funcs->get_crtc) {
+	    (*output->funcs->dpms)(output, DPMSModeOff);
+	    continue;
+	}
+	/* Disable outputs that are unused or will be re-routed */
+	if (output->crtc != (*output->funcs->get_crtc)(output) ||
+	    output->crtc == NULL)
+#endif
+	    (*output->funcs->dpms)(output, DPMSModeOff);
+    }
+}
+
+static void
+xf86PrepareCrtcs (ScrnInfoPtr scrn)
+{
+    xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(scrn);
+    int			c;
+
+    for (c = 0; c < config->num_crtc; c++) {
+#if RANDR_GET_CRTC_INTERFACE
+	xf86CrtcPtr	crtc = config->crtc[c];
+	xf86OutputPtr	output = NULL;
+	uint32_t	desired_outputs = 0, current_outputs = 0;
+	int		o;
+
+	for (o = 0; o < config->num_output; o++) {
+	    output = config->output[o];
+	    if (output->crtc == crtc)
+		desired_outputs |= (1<<o);
+	    /* If we can't tell where it's mapped, force it off */
+	    if (!output->funcs->get_crtc) {
+		desired_outputs = 0;
+		break;
+	    }
+	    if ((*output->funcs->get_crtc)(output) == crtc)
+		current_outputs |= (1<<o);
+	}
+
+	/*
+	 * If mappings are different or the CRTC is unused,
+	 * we need to disable it
+	 */
+	if (desired_outputs != current_outputs ||
+	    !desired_outputs)
+	    (*crtc->funcs->dpms)(crtc, DPMSModeOff);
+#else
+	(*crtc->funcs->dpms)(crtc, DPMSModeOff);
+#endif
+    }
+}
+
+/*
  * Using the desired mode information in each crtc, set
  * modes (used in EnterVT functions, or at server startup)
  */
@@ -2042,26 +2108,11 @@ _X_EXPORT Bool
 xf86SetDesiredModes (ScrnInfoPtr scrn)
 {
     xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(scrn);
-    int			c, o;
-
-    /*
-     * Turn off everything so mode setting is done
-     * with hardware in a consistent state
-     */
-    for (o = 0; o < config->num_output; o++) 
-    {
-	xf86OutputPtr  output = config->output[o];
-	(*output->funcs->dpms)(output, DPMSModeOff);
-    }
+    int			c;
 
-    for (c = 0; c < config->num_crtc; c++) 
-    {
-	xf86CrtcPtr crtc = config->crtc[c];
+    xf86PrepareOutputs(scrn);
+    xf86PrepareCrtcs(scrn);
 
-	crtc->funcs->dpms(crtc, DPMSModeOff);
-	memset(&crtc->mode, 0, sizeof(crtc->mode));
-    }
-    
     for (c = 0; c < config->num_crtc; c++)
     {
 	xf86CrtcPtr	crtc = config->crtc[c];
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index a542e7f..2d723a5 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -425,6 +425,13 @@ typedef struct _xf86OutputFuncs {
     (*get_property)(xf86OutputPtr output,
 		    Atom property);
 #endif
+#ifdef RANDR_GET_CRTC_INTERFACE
+    /**
+     * Callback to get current CRTC for a given output
+     */
+    xf86CrtcPtr
+    (*get_crtc)(xf86OutputPtr output);
+#endif
     /**
      * Clean up driver-specific bits of the output
      */
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 4d7c9cc..62d4bbf 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -55,6 +55,7 @@
 #define RANDR_10_INTERFACE 1
 #define RANDR_12_INTERFACE 1
 #define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */
+#define RANDR_GET_CRTC_INTERFACE 1
 
 #define RANDR_INTERFACE_VERSION 0x0103
 
commit bee2ddf35f75086cee951142098637f2c756b96b
Author: Jesse Barnes <jbarnes at jbarnes-t61.(none)>
Date:   Mon Mar 17 08:33:01 2008 -0700

    Fail CRTC configuration if !vtSema
    
    Unless we check for vtSema before calling into the CRTC and output callbacks,
    we may end up trying to access video memory that no longer exists, leading to a
    crash.  So if we don't have vtSema, return FALSE to the caller, indicating that
    we didn't do anything.
    
    Fixes #14444.

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 1dca223..4767f26 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -743,6 +743,9 @@ xf86RandR12CrtcSet (ScreenPtr	pScreen,
     xf86CrtcPtr		*save_crtcs;
     Bool		save_enabled = crtc->enabled;
 
+    if (!crtc->scrn->vtSema)
+	return FALSE;
+
     save_crtcs = xalloc(config->num_output * sizeof (xf86CrtcPtr));
     if ((randr_mode != NULL) != crtc->enabled)
 	changed = TRUE;
commit db248ffb840a0c113b6eb508a0fa1e74e752474d
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Sun Mar 16 18:46:11 2008 +0100

    test for the presence of pci_system_init_dev_mem() before calling it.
    
    This avoids creating a dependency on -current libpciaccess for
    BSD systems other than OpenBSD (which don't otherwise need it).

diff --git a/configure.ac b/configure.ac
index 5417bbb..49f2395 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1308,6 +1308,13 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
 	XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $SELINUX_LIB"
 
 	PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
+	SAVE_LIBS=$LIBS
+	SAVE_CFLAGS=$CFLAGS
+	CFLAGS=$PCIACCESS_CFLAGS
+	LIBS=$PCIACCESS_LIBS
+	AC_CHECK_FUNCS([pci_system_init_dev_mem])
+	LIBS=$SAVE_LIBS
+	CFLAGS=$SAVE_CFLAGS
 	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS"
 	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
 
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 7e4a4d2..1ebac67 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -212,8 +212,10 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
 	pVidMem->mapMem = mapVidMem;
 	pVidMem->unmapMem = unmapVidMem;
 
+#if HAVE_PCI_SYSTEM_INIT_DEV_MEM
 	if (useDevMem)
 		pci_system_init_dev_mem(devMemFd);
+#endif
 
 #ifdef HAS_MTRR_SUPPORT
 	if (useDevMem) {
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 0603eab..5587c0a 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -115,6 +115,9 @@
 /* Have execinfo.h */
 #undef HAVE_EXECINFO_H
 
+/* Have pci_system_init_dev_mem() */
+#undef HAVE_PCI_SYSTEM_INIT_DEV_MEM
+
 /* Path to text files containing PCI IDs */
 #undef PCI_TXT_IDS_PATH
 
commit aa231f28d56402d7daea6cbd3002fbf760f79497
Author: Donnie Berkholz <dberkholz at gentoo.org>
Date:   Fri Mar 14 18:41:25 2008 -0700

    Xephyr: Build fix: Port across XF86dri.c changes from Mesa.

diff --git a/hw/kdrive/ephyr/XF86dri.c b/hw/kdrive/ephyr/XF86dri.c
index 506d7be..e656ff5 100644
--- a/hw/kdrive/ephyr/XF86dri.c
+++ b/hw/kdrive/ephyr/XF86dri.c
@@ -385,9 +385,8 @@ Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
 					   context, hHWContext );
 }
 
-GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context)
+GLboolean XF86DRIDestroyContext( Display *dpy, int screen, XID context)
 {
-    Display * const dpy = (Display *) ndpy;
     XExtDisplayInfo *info = find_display (dpy);
     xXF86DRIDestroyContextReq *req;
 
@@ -407,10 +406,9 @@ GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid
 }
 
 GLboolean
-XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
-                       __DRIid drawable, drm_drawable_t * hHWDrawable)
+XF86DRICreateDrawable (Display *dpy, int screen,
+                       XID drawable, drm_drawable_t * hHWDrawable)
 {
-    Display * const dpy = (Display *) ndpy;
     XExtDisplayInfo *info = find_display (dpy);
     xXF86DRICreateDrawableReply rep;
     xXF86DRICreateDrawableReq *req;
@@ -437,16 +435,36 @@ XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
     return True;
 }
 
-GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
-    __DRIid drawable )
+static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
+{
+    return 0;
+}
+
+GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
+    XID drawable )
 {
-    Display * const dpy = (Display *) ndpy;
     XExtDisplayInfo *info = find_display (dpy);
     xXF86DRIDestroyDrawableReq *req;
+    int (*oldXErrorHandler)(Display *, XErrorEvent *);
 
     TRACE("DestroyDrawable...");
     XF86DRICheckExtension (dpy, info, False);
 
+    /* This is called from the DRI driver, which used call it like this
+     *
+     *   if (windowExists(drawable))
+     *     destroyDrawable(drawable);
+     *
+     * which is a textbook race condition - the window may disappear
+     * from the server between checking for its existance and
+     * destroying it.  Instead we change the semantics of
+     * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
+     * the windows is gone, by wrapping the destroy call in an error
+     * handler. */
+
+    XSync(dpy, GL_FALSE);
+    oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
+
     LockDisplay(dpy);
     GetReq(XF86DRIDestroyDrawable, req);
     req->reqType = info->codes->major_opcode;
@@ -455,6 +473,9 @@ GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
     req->drawable = drawable;
     UnlockDisplay(dpy);
     SyncHandle();
+
+    XSetErrorHandler(oldXErrorHandler);
+
     TRACE("DestroyDrawable... return True");
     return True;
 }
commit a955c3b587b22b8bf20cb6bedbbec4ad5fcb32ac
Author: Donnie Berkholz <dberkholz at gentoo.org>
Date:   Fri Mar 14 18:41:07 2008 -0700

    Xephyr: Distribute ephyrdriext.h in tarballs.

diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index d025c20..81d3d69 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -35,6 +35,7 @@ if XEPHYR_HAS_DRI
 
 libxephyr_hostdri_a_SOURCES= \
 ephyrdriext.c	\
+ephyrdriext.h	\
 ephyrdri.c	\
 ephyrdri.h	\
 XF86dri.c	\
commit 090b26db767d296e7a3452da83b136d1caa0ed01
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Mar 14 21:58:27 2008 +0200

    XkbCopyKeymap: Fix broken indentation
    
    An astute observer will note that the entirety of XkbCopyKeymap is indented
    with spaces, and no tabs whatsoever, and not commit changes which break the
    otherwise consistent indentation.
    A non-astute observer will note the breakage when the commit mail comes
    through with clearly broken indentation.
    A polite, non-astute, observer will then fix it.
    
    C'est la vie.

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index a3ae655..8339cef 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1796,7 +1796,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
                   dsection = dst->geom->sections;
                  i < src->geom->num_sections;
                  i++, ssection++, dsection++) {
-		*dsection = *ssection;
+                *dsection = *ssection;
                 if (ssection->num_rows) {
                     tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec));
                     if (!tmp)
@@ -1852,9 +1852,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
                     }
                     ddoodad->any.type = sdoodad->any.type;
                 }
-		dsection->overlays = NULL;
-		dsection->sz_overlays = 0;
-		dsection->num_overlays = 0;
+                dsection->overlays = NULL;
+                dsection->sz_overlays = 0;
+                dsection->num_overlays = 0;
             }
         }
         else {
commit 88bec0915e3867f8dbf859a3dfbb771d0d07092d
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Mar 14 21:54:13 2008 +0200

    mi: More meaningful assert crashes
    
    When we fail an assert in miregion.c (which happens every now and then,
    though I haven't yet checked up why), at least generate a segfault, so
    we'll get a backtrace.

diff --git a/mi/miregion.c b/mi/miregion.c
index 45768a3..69ecdc2 100644
--- a/mi/miregion.c
+++ b/mi/miregion.c
@@ -89,9 +89,14 @@ Equipment Corporation.
 
 #undef assert
 #ifdef DEBUG
-#define assert(expr) {if (!(expr)) \
-		FatalError("Assertion failed file %s, line %d: expr\n", \
-			__FILE__, __LINE__); }
+#define assert(expr) { \
+            CARD32 *foo = NULL; \
+            if (!(expr)) { \
+                ErrorF("Assertion failed file %s, line %d: %s\n", \
+                       __FILE__, __LINE__, #expr); \
+                *foo = 0xdeadbeef; /* to get a backtrace */ \
+            } \
+        }
 #else
 #define assert(expr)
 #endif
commit 57d48d94b8947c571925e6fd4c9bf041fbd1b2ac
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Mar 14 14:37:42 2008 -0400

    Fix a stray use of ALLOCATE_LOCAL.

diff --git a/hw/xfree86/xf4bpp/ppcSpMcro.h b/hw/xfree86/xf4bpp/ppcSpMcro.h
index 2b7f951..655a883 100644
--- a/hw/xfree86/xf4bpp/ppcSpMcro.h
+++ b/hw/xfree86/xf4bpp/ppcSpMcro.h
@@ -28,11 +28,11 @@
 #define SETSPANPTRS(IN,N,IPW,PW,IPPT,PPT,FPW,FPPT,FSORT)		\
 	{								\
 	N = IN * miFindMaxBand(pGC->pCompositeClip);			\
-	if(!(PW = (int *)ALLOCATE_LOCAL(N * sizeof(int))))		\
+	if(!(PW = (int *)xalloc(N * sizeof(int))))		\
 		return;							\
-	if(!(PPT = (DDXPointRec *)ALLOCATE_LOCAL(N * sizeof(DDXPointRec)))) \
+	if(!(PPT = (DDXPointRec *)xalloc(N * sizeof(DDXPointRec)))) \
 		{							\
-		DEALLOCATE_LOCAL(PW);					\
+		free(PW);					\
 		return;							\
     		}							\
 	FPW = PW;							\
commit 824853772241acf64bc37ac8b85254194741ae13
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Mar 14 14:24:21 2008 -0400

    RANDR 1.2: Fix initial mode aspect ratio match in a corner case.
    
    Actually more like in the mainline case, where the ideal mode happens to
    be the very first aspect match on the first monitor.  But let's not
    split hairs.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 39e84e6..6b845b7 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1683,14 +1683,19 @@ aspectMatch(float a, float b)
 }
 
 static DisplayModePtr
-nextAspectMode(DisplayModePtr start, float aspect)
+nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect)
 {
-    DisplayModePtr m = start;
+    DisplayModePtr m = NULL;
 
-    if (!m)
+    if (!o)
 	return NULL;
 
-    for (m = m->next; m; m = m->next)
+    if (!last)
+	m = o->probed_modes;
+    else
+	m = last->next;
+
+    for (; m; m = m->next)
 	if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay))
 	    return m;
 
@@ -1700,31 +1705,29 @@ nextAspectMode(DisplayModePtr start, float aspect)
 static DisplayModePtr
 bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
 {
-    int o, p;
-    DisplayModePtr mode, test = NULL, match = NULL;
+    int o = -1, p;
+    DisplayModePtr mode = NULL, test = NULL, match = NULL;
 
-    for (o = -1; nextEnabledOutput(config, enabled, &o); ) {
-	mode = config->output[o]->probed_modes;
-	while ((mode = nextAspectMode(mode, aspect))) {
-	    for (p = o; nextEnabledOutput(config, enabled, &p); ) {
-		test = xf86OutputFindClosestMode(config->output[p], mode);
-		if (!test)
-		    break;
-		if (test->HDisplay != mode->HDisplay ||
+    nextEnabledOutput(config, enabled, &o);
+    while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
+	for (p = o; nextEnabledOutput(config, enabled, &p); ) {
+	    test = xf86OutputFindClosestMode(config->output[p], mode);
+	    if (!test)
+		break;
+	    if (test->HDisplay != mode->HDisplay ||
 		    test->VDisplay != mode->VDisplay) {
-		    test = NULL;
-		    break;
-		}
+		test = NULL;
+		break;
 	    }
+	}
 
-	    /* if we didn't match it on all outputs, try the next one */
-	    if (!test)
-		continue;
+	/* if we didn't match it on all outputs, try the next one */
+	if (!test)
+	    continue;
 
-	    /* if it's bigger than the last one, save it */
-	    if (!match || (test->HDisplay > match->HDisplay))
-		match = test;
-	}
+	/* if it's bigger than the last one, save it */
+	if (!match || (test->HDisplay > match->HDisplay))
+	    match = test;
     }
 
     /* return the biggest one found */
commit 1b9878ffcfc0c0dbc4a6e674827fe508ba77db4b
Author: Bart Trojanowski <bart at jukie.net>
Date:   Thu Mar 13 17:42:16 2008 -0400

    Bug #14332: Fix PCI access cycles from x86emu.
    
    The address written to 0xcf8 contains the PCI slot address to send the
    config cycle to.  However, we would ignore that and always send the
    cycle to the device whose BIOS we were running.  This breaks some
    integrated graphics platforms that have explicit knowledge about the
    system's host bridge, for example.

diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index de6fde5..9daff22 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -33,6 +33,7 @@
 #ifdef _X86EMU
 #include "x86emu/x86emui.h"
 #endif
+#include <pciaccess.h>
 
 static int pciCfg1in(CARD16 addr, CARD32 *val);
 static int pciCfg1out(CARD16 addr, CARD32 val);
@@ -459,7 +460,43 @@ Mem_wl(CARD32 addr, CARD32 val)
 
 static CARD32 PciCfg1Addr = 0;
 
-#define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff)
+#define PCI_OFFSET(x) ((x) & 0x000000ff)
+#define PCI_TAG(x)    ((x) & 0xffffff00)
+
+static struct pci_device*
+pci_device_for_cfg_address (CARD32 addr)
+{
+	struct pci_device *dev = NULL;
+	PCITAG tag = PCI_TAG(addr);
+	struct pci_slot_match slot_match = {
+		.domain = PCI_DOM_FROM_TAG(tag),
+		.bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)),
+		.dev = PCI_DEV_FROM_TAG(tag),
+		.func = PCI_FUNC_FROM_TAG(tag),
+		.match_data = 0
+	};
+
+	struct pci_device_iterator *iter =
+	    pci_slot_match_iterator_create (&slot_match);
+	if (iter)
+		dev = pci_device_next(iter);
+	if (!dev) {
+		char buf[128]; /* enough to store "%u@%u" */
+		xf86FormatPciBusNumber(tag >> 16, buf);
+		ErrorF("Failed to find device matching %s:%u:%u\n",
+				buf, slot_match.dev, slot_match.func);
+		return NULL;
+	}
+
+	if (pci_device_next(iter)) {
+		char buf[128]; /* enough to store "%u@%u" */
+		xf86FormatPciBusNumber(tag >> 16, buf);
+		ErrorF("Multiple devices matching %s:%u:%u\n",
+				buf, slot_match.dev, slot_match.func);
+	}
+
+	return dev;
+}
 
 static int
 pciCfg1in(CARD16 addr, CARD32 *val)
@@ -469,7 +506,8 @@ pciCfg1in(CARD16 addr, CARD32 *val)
 	return 1;
     }
     if (addr == 0xCFC) {
-	pci_device_cfg_read_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr));
+	pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
+			val, PCI_OFFSET(PciCfg1Addr));
 	if (PRINT_PORT && DEBUG_IO_TRACE())
 	    ErrorF(" cfg_inl(%#x) = %8.8x\n", PciCfg1Addr, *val);
 	return 1;
@@ -487,7 +525,8 @@ pciCfg1out(CARD16 addr, CARD32 val)
     if (addr == 0xCFC) {
 	if (PRINT_PORT && DEBUG_IO_TRACE())
 	    ErrorF(" cfg_outl(%#x, %8.8x)\n", PciCfg1Addr, val);
-	pci_device_cfg_write_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr));
+	pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr),
+			val, PCI_OFFSET(PciCfg1Addr));
 	return 1;
     }
     return 0;
@@ -506,7 +545,8 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
     if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
 	const unsigned offset = addr - 0xCFC;
 
-	pci_device_cfg_read_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
+	pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
+			val, PCI_OFFSET(PciCfg1Addr) + offset);
 	if (PRINT_PORT && DEBUG_IO_TRACE())
 	    ErrorF(" cfg_inw(%#x) = %4.4x\n", PciCfg1Addr + offset, *val);
 	return 1;
@@ -530,7 +570,8 @@ pciCfg1outw(CARD16 addr, CARD16 val)
 
 	if (PRINT_PORT && DEBUG_IO_TRACE())
 	    ErrorF(" cfg_outw(%#x, %4.4x)\n", PciCfg1Addr + offset, val);
-	pci_device_cfg_write_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
+	pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr),
+			val, PCI_OFFSET(PciCfg1Addr) + offset);
 	return 1;
     }
     return 0;
@@ -549,7 +590,8 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
     if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
 	const unsigned offset = addr - 0xCFC;
 
-	pci_device_cfg_read_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
+	pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
+			val, PCI_OFFSET(PciCfg1Addr) + offset);
 	if (PRINT_PORT && DEBUG_IO_TRACE())
 	    ErrorF(" cfg_inb(%#x) = %2.2x\n", PciCfg1Addr + offset, *val);
 	return 1;
@@ -573,7 +615,8 @@ pciCfg1outb(CARD16 addr, CARD8 val)
 
 	if (PRINT_PORT && DEBUG_IO_TRACE())
 	    ErrorF(" cfg_outb(%#x, %2.2x)\n", PciCfg1Addr + offset, val);
-	pci_device_cfg_write_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
+	pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr),
+			val, PCI_OFFSET(PciCfg1Addr) + offset);
 	return 1;
     }
     return 0;
commit f7abe05b3306ed9a6f2cf5e3e45ed524d725d029
Author: Doug Chapman <doug.chapman at hp.com>
Date:   Thu Mar 13 17:40:34 2008 -0400

    Bug #14091: Fix build (and runtime) on ia64.

diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am
index 381b992..5a15430 100644
--- a/hw/xfree86/os-support/bus/Makefile.am
+++ b/hw/xfree86/os-support/bus/Makefile.am
@@ -27,18 +27,6 @@ if LINUX_ALPHA
 PCI_SOURCES += axpPci.c
 endif
 
-if LINUX_IA64
-PLATFORM_PCI_SOURCES = \
-	460gxPCI.c \
-	460gxPCI.h \
-	altixPCI.c \
-	altixPCI.h \
-	e8870PCI.c \
-	e8870PCI.h \
-	zx1PCI.c \
-	zx1PCI.h
-endif
-
 if XORG_BUS_SPARC
 PLATFORM_SOURCES = Sbus.c
 sdk_HEADERS += xf86Sbus.h
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 0abb34f..ebac090 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -207,9 +207,8 @@
 # endif
 #elif defined(__ia64__)
 # if defined(linux)
-#  define ARCH_PCI_INIT ia64linuxPciInit
+#  define ARCH_PCI_INIT linuxPciInit
 # endif
-# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
 #elif defined(__i386__) || defined(__i386)
 # if defined(linux)
 #  define ARCH_PCI_INIT linuxPciInit
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 5a52ffd..beaae3d 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -1,7 +1,7 @@
 noinst_LTLIBRARIES = liblinux.la
 
 if LINUX_IA64
-PLATFORM_PCI_SUPPORT = $(srcdir)/lnx_ia64.c $(srcdir)/../shared/ia64Pci.c
+PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c
 PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset
 PLATFORM_INCLUDES = -I$(srcdir)/../shared
 endif
diff --git a/hw/xfree86/os-support/shared/ia64Pci.c b/hw/xfree86/os-support/shared/ia64Pci.c
index 45522e9..6f6924b 100644
--- a/hw/xfree86/os-support/shared/ia64Pci.c
+++ b/hw/xfree86/os-support/shared/ia64Pci.c
@@ -42,12 +42,7 @@
 #include <linux/pci.h>
 
 #include "compiler.h"
-#include "460gxPCI.h"
-#include "e8870PCI.h"
-#include "zx1PCI.h"
-#include "altixPCI.h"
 #include "Pci.h"
-#include "ia64Pci.h"
 
 /*
  * We use special in/out routines here since Altix platforms require the
@@ -191,53 +186,3 @@ _X_EXPORT unsigned int inl(unsigned long port)
     return val;
 }
 
-void
-ia64ScanPCIWrapper(scanpciWrapperOpt flags)
-{
-    static IA64Chipset chipset = NONE_CHIPSET;
-    
-    if (flags == SCANPCI_INIT) {
-
-	/* PCI configuration space probes should be done first */
-	if (xorgProbe460GX(flags)) {
-	    chipset = I460GX_CHIPSET;
-	    xf86PreScan460GX();	
-	    return;
-	} else if (xorgProbeE8870(flags)) {
-	    chipset = E8870_CHIPSET;
-	    xf86PreScanE8870();
-	    return;
-	}
-#ifdef OS_PROBE_PCI_CHIPSET
-	chipset = OS_PROBE_PCI_CHIPSET(flags);
-	switch (chipset) {
-	    case ZX1_CHIPSET:
-		xf86PreScanZX1();
-		return;
-	    case ALTIX_CHIPSET:
-		xf86PreScanAltix();
-		return;
-	    default:
-		return;
-	}
-#endif
-    } else /* if (flags == SCANPCI_TERM) */ {
-
-	switch (chipset) {
-	    case I460GX_CHIPSET:
-		xf86PostScan460GX();
-		return;
-	    case E8870_CHIPSET:
-		xf86PostScanE8870();
-		return;
-	    case ZX1_CHIPSET:
-		xf86PostScanZX1();
-		return;
-	    case ALTIX_CHIPSET:
-		xf86PostScanAltix();
-		return;
-	    default:
-		return;
-	}
-    }
-}
commit 5d7437c29e686a081b20823450d78c4c2f4e0aec
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Mar 13 17:37:12 2008 -0400

    RANDR 1.2: Fix the RANDR 1.1 screen size estimation to approach reality.
    
    While the ScreenRec's notion of size in millimeters would get updates,
    the RANDR 1.1 notion wouldn't, so your screen would appear to be square
    and probably at some ludicrous DPI.

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index af950e6..1dca223 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -355,8 +355,8 @@ xf86RandR12ScreenSetSize (ScreenPtr	pScreen,
 
     pScreen->width = pScrnPix->drawable.width = width;
     pScreen->height = pScrnPix->drawable.height = height;
-    pScreen->mmWidth = mmWidth;
-    pScreen->mmHeight = mmHeight;
+    randrp->mmWidth = pScreen->mmWidth = mmWidth;
+    randrp->mmHeight = pScreen->mmHeight = mmHeight;
 
     xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
     xf86SetViewport (pScreen, 0, 0);
commit 61c3f63a75d8b0cc47ffed4a0e30147fab2ae8f4
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Mar 13 17:34:54 2008 -0400

    RANDR 1.2: Don't report a square resolution to RANDR 1.1 clients.
    
    It can't possibly do anything useful, and older versions of Gnome (and
    proably others) get very confused by it.  So do the drivers, for that
    matter.

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 816175c..af950e6 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -145,23 +145,6 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
 	randrp->maxY = maxY;
     }
 
-    if (scrp->currentMode->HDisplay != randrp->virtualX ||
-	scrp->currentMode->VDisplay != randrp->virtualY)
-    {
-	pSize = RRRegisterSize (pScreen,
-				randrp->virtualX, randrp->virtualY,
-				randrp->mmWidth,
-				randrp->mmHeight);
-	if (!pSize)
-	    return FALSE;
-	RRRegisterRate (pScreen, pSize, refresh0);
-	if (scrp->virtualX == randrp->virtualX &&
-	    scrp->virtualY == randrp->virtualY)
-	{
-	    RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize);
-	}
-    }
-
     return TRUE;
 }
 
commit 06c0372c3a1b45005eb6d50406f77f4e93f1de1e
Author: Mark Kettenis <mark.kettenis at xs4all.nl>
Date:   Wed Mar 12 21:45:37 2008 +0100

    OpenBSD support for libpciaccess.
    
    xserver and libpciaccess both need to open /dev/xf86, which can only
    be opened once.  I implemented pci_system_init_dev_mem() like Ian
    suggested.  This requires some minor changes to the BSD-specific
    os-support code.  Since pci_system_init_dev_mem() is a no-op on
    FreeBSD this should be no problem.

diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 0dcff66..7e4a4d2 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -212,6 +212,9 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
 	pVidMem->mapMem = mapVidMem;
 	pVidMem->unmapMem = unmapVidMem;
 
+	if (useDevMem)
+		pci_system_init_dev_mem(devMemFd);
+
 #ifdef HAS_MTRR_SUPPORT
 	if (useDevMem) {
 		if (cleanMTRR()) {
diff --git a/hw/xfree86/os-support/bus/bsd_pci.c b/hw/xfree86/os-support/bus/bsd_pci.c
index bceb108..57ad09b 100644
--- a/hw/xfree86/os-support/bus/bsd_pci.c
+++ b/hw/xfree86/os-support/bus/bsd_pci.c
@@ -81,4 +81,6 @@ bsdPciInit(void)
 {
     pciNumBuses = 1;
     pciBusInfo[0] = &bsd_pci;
+
+    xf86InitVidMem();
 }
diff --git a/hw/xfree86/utils/ioport/Makefile.am b/hw/xfree86/utils/ioport/Makefile.am
index c1f9453..12f8613 100644
--- a/hw/xfree86/utils/ioport/Makefile.am
+++ b/hw/xfree86/utils/ioport/Makefile.am
@@ -37,7 +37,7 @@ ioport_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 ioport_LDADD = \
 	../../os-support/libxorgos.la \
 	../../dummylib/libdummy-nonserver.a \
-	${UTILS_SYS_LIBS}
+	${UTILS_SYS_LIBS} ${PCIACCESS_LIBS}
 
 
 ioport_SOURCES =	\
commit 2036851125226065891f13583ade3ce559e7bd37
Author: Matthias Hopf <mhopf at suse.de>
Date:   Mon Mar 10 19:29:07 2008 +0100

    Return randr interface version in xf86CrtcScreenInit()
    
    Necessary to allow drivers to be run-time backwards compatible when using the
    modes/ functions w/o providing their own copy.

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 0bef5b4..39e84e6 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -694,7 +694,12 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen)
 /*
  * Called at ScreenInit time to set up
  */
-_X_EXPORT Bool
+_X_EXPORT
+#ifdef RANDR_13_INTERFACE
+int
+#else
+Bool
+#endif
 xf86CrtcScreenInit (ScreenPtr screen)
 {
     ScrnInfoPtr		scrn = xf86Screens[screen->myNum];
@@ -727,7 +732,11 @@ xf86CrtcScreenInit (ScreenPtr screen)
     config->CloseScreen = screen->CloseScreen;
     screen->CloseScreen = xf86CrtcCloseScreen;
     
+#ifdef RANDR_13_INTERFACE
+    return RANDR_INTERFACE_VERSION;
+#else
     return TRUE;
+#endif
 }
 
 static DisplayModePtr
@@ -2228,7 +2237,7 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
 	}
     }
     xf86DisableUnusedFunctions(pScrn);
-#if RANDR_12_INTERFACE
+#ifdef RANDR_12_INTERFACE
     xf86RandR12TellChanged (pScrn->pScreen);
 #endif
     return ok;
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index b87a325..a542e7f 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -692,7 +692,11 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
 void
 xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
 
+#ifdef RANDR_13_INTERFACE
+int
+#else
 Bool
+#endif
 xf86CrtcScreenInit (ScreenPtr pScreen);
 
 Bool
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 3b48f5c..4d7c9cc 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -56,6 +56,8 @@
 #define RANDR_12_INTERFACE 1
 #define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */
 
+#define RANDR_INTERFACE_VERSION 0x0103
+
 typedef XID	RRMode;
 typedef XID	RROutput;
 typedef XID	RRCrtc;
commit c7536f4b87e089a7e7c43026b189922fec70c565
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Tue Mar 11 13:11:04 2008 -0400

    Silence REGION_INIT() warning.
    
    Evaluating the address of a BoxRec as a boolean gives this warning:
    
      i830_driver.c:2317: warning: the address of 'ScreenBox' will always
      evaluate as 'true'
    
    which is pretty annoying.  This patch compares the address to NULL to
    avoid the pointer->bool conversion and gets rid of the warning.  Seems
    like a lame hack, but the warning is worse.

diff --git a/include/regionstr.h b/include/regionstr.h
index f44cab7..5a79b12 100644
--- a/include/regionstr.h
+++ b/include/regionstr.h
@@ -158,7 +158,7 @@ extern RegDataRec miBrokenData;
 
 #define REGION_INIT(_pScreen, _pReg, _rect, _size) \
 { \
-    if (_rect) \
+    if ((_rect) != NULL)				\
     { \
         (_pReg)->extents = *(_rect); \
         (_pReg)->data = (RegDataPtr)NULL; \
commit cc05255191413b3f376edbc600122ff085f45f7b
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Tue Mar 11 00:51:43 2008 -0400

    Make WriteToClient take a const void * like any decent IO write function.
    
    Enough with the casting.  Doesn't break API or even ABI, but does make
    a lot of silly casts superfluos.

diff --git a/include/os.h b/include/os.h
index 4be6b80..c0f04c6 100644
--- a/include/os.h
+++ b/include/os.h
@@ -115,7 +115,7 @@ extern void FlushIfCriticalOutputPending(void);
 
 extern void SetCriticalOutputPending(void);
 
-extern int WriteToClient(ClientPtr /*who*/, int /*count*/, char* /*buf*/);
+extern int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*buf*/);
 
 extern void ResetOsBuffers(void);
 
@@ -448,7 +448,7 @@ typedef struct {
 extern CallbackListPtr ReplyCallback;
 typedef struct {
     ClientPtr client;
-    pointer replyData;
+    const void *replyData;
     unsigned long dataLenBytes;
     unsigned long bytesRemaining;
     Bool startOfReply;
diff --git a/os/io.c b/os/io.c
index e7ec609..4f4a109 100644
--- a/os/io.c
+++ b/os/io.c
@@ -730,11 +730,12 @@ SetCriticalOutputPending(void)
  *****************/
 
 _X_EXPORT int
-WriteToClient (ClientPtr who, int count, char *buf)
+WriteToClient (ClientPtr who, int count, const void *__buf)
 {
     OsCommPtr oc = (OsCommPtr)who->osPrivate;
     ConnectionOutputPtr oco = oc->output;
     int padBytes;
+    const char *buf = __buf;
 #ifdef DEBUG_COMMUNICATION
     Bool multicount = FALSE;
 #endif
@@ -871,13 +872,14 @@ WriteToClient (ClientPtr who, int count, char *buf)
  **********************/
 
 int
-FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
+FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
 {
     ConnectionOutputPtr oco = oc->output;
     int connection = oc->fd;
     XtransConnInfo trans_conn = oc->trans_conn;
     struct iovec iov[3];
     static char padBuffer[3];
+    const char *extraBuf = __extraBuf;
     long written;
     long padsize;
     long notWritten;
@@ -916,14 +918,14 @@ FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
 	    before = (-len); \
 	} else { \
 	    iov[i].iov_len = len; \
-	    iov[i].iov_base = (pointer) + before; \
+	    iov[i].iov_base = (pointer) + before;	\
 	    i++; \
 	    remain -= len; \
 	    before = 0; \
 	}
 
 	InsertIOV ((char *)oco->buf, oco->count)
-	InsertIOV (extraBuf, extraCount)
+	InsertIOV ((char *)extraBuf, extraCount)
 	InsertIOV (padBuffer, padsize)
 
 	errno = 0;
diff --git a/os/osdep.h b/os/osdep.h
index b6894c1..84f7177 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -184,7 +184,7 @@ typedef struct _osComm {
 extern int FlushClient(
     ClientPtr /*who*/,
     OsCommPtr /*oc*/,
-    char* /*extraBuf*/,
+    const void * /*extraBuf*/,
     int /*extraCount*/
 );
 
commit bc504ffbba3dec2e3467bab8ba1ac25db6dd317e
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Tue Mar 11 00:35:31 2008 -0400

    DRI2: Add DRI2AuthConnection().
    
    DRI2 uses the same authentication scheme as XF86DRI, so implement this
    entry point so DRI2 protocol code can access it.

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index d2664b1..d527387 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -342,6 +342,17 @@ DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
     return TRUE;
 }
 
+Bool
+DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic)
+{
+    DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+    if (ds == NULL || drmAuthMagic(ds->fd, magic))
+	return FALSE;
+
+    return TRUE;
+}
+
 unsigned int
 DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags)
 {
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index a319085..126087a 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -58,6 +58,8 @@ Bool DRI2Connect(ScreenPtr pScreen,
 		 const char **driverName,
 		 unsigned int *sareaHandle);
 
+Bool DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic);
+
 unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap,
 				 unsigned int *flags);
 


More information about the xorg-commit mailing list