xserver: Branch 'master' - 2 commits

Peter Hutterer whot at kemper.freedesktop.org
Mon Sep 21 05:04:40 PDT 2009


 Xext/geext.c                          |    9 --
 Xext/panoramiX.c                      |    4 
 Xext/saver.c                          |    5 -
 Xext/security.c                       |    5 -
 Xext/shape.c                          |    5 -
 Xext/shm.c                            |    5 -
 Xext/xcalibrate.c                     |    5 -
 Xext/xf86bigfont.c                    |    5 -
 Xext/xres.c                           |    5 -
 Xext/xvmc.c                           |    5 -
 Xi/extinit.c                          |   10 +-
 composite/compext.c                   |   10 --
 damageext/damageext.c                 |   18 +---
 glx/glxcmds.c                         |    5 -
 glx/glxserver.h                       |    4 
 hw/dmx/dmx.c                          |    7 -
 hw/kdrive/ephyr/ephyrdriext.c         |    8 -
 hw/xfree86/dixmods/extmod/xf86dga2.c  |    5 -
 hw/xfree86/dixmods/extmod/xf86vmode.c |    5 -
 hw/xfree86/dri/xf86dri.c              |    7 -
 hw/xfree86/dri2/dri2ext.c             |    5 -
 hw/xfree86/modes/xf86Crtc.c           |    7 +
 hw/xfree86/modes/xf86DiDGA.c          |  119 ++++-----------------------
 hw/xfree86/modes/xf86RandR12.c        |    8 -
 hw/xquartz/applewm.c                  |    7 -
 hw/xquartz/xpr/appledri.c             |    7 -
 hw/xwin/winwindowswm.c                |    7 -
 include/Makefile.am                   |    3 
 include/protocol-versions.h           |  148 ++++++++++++++++++++++++++++++++++
 randr/rrdispatch.c                    |   10 --
 randr/rrxinerama.c                    |    8 -
 record/record.c                       |    6 -
 render/render.c                       |    7 -
 xfixes/xfixes.c                       |   14 +--
 xkb/xkb.c                             |   11 +-
 35 files changed, 285 insertions(+), 214 deletions(-)

New commits:
commit 55747d256d759850141e4a9c4dec965616a31dc8
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Sep 18 16:27:54 2009 +1000

    input: define server-supported protocol versions in one single file.
    
    include/protocol-versions.h specifies each extension version as supported by
    the server and sent back on the wire to the client.
    
    This fixes up several issues with the server potentially reporting a higher
    version of the protocol if recompiled against a newer version of the
    protocol.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Acked-by: Rémi Cardona <remi at gentoo.org>
    Acked-by: Julien Cristau <jcristau at debian.org>

diff --git a/Xext/geext.c b/Xext/geext.c
index 1ddcbb1..6fad4ae 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -32,10 +32,7 @@
 
 #include "geint.h"
 #include "geext.h"
-
-/* Currently supported XGE version */
-#define SERVER_GE_MAJOR 1
-#define SERVER_GE_MINOR 0
+#include "protocol-versions.h"
 
 #define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
 
@@ -81,8 +78,8 @@ ProcGEQueryVersion(ClientPtr client)
     rep.sequenceNumber = client->sequence;
 
     /* return the supported version by the server */
-    rep.majorVersion = SERVER_GE_MAJOR;
-    rep.minorVersion = SERVER_GE_MINOR;
+    rep.majorVersion = SERVER_GE_MAJOR_VERSION;
+    rep.minorVersion = SERVER_GE_MINOR_VERSION;
 
     /* Remember version the client requested */
     pGEClient->major_version = stuff->majorVersion;
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index c5fb700..4b7b07e 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -56,9 +56,7 @@ Equipment Corporation.
 #include "picturestr.h"
 #endif
 #include "modinit.h"
-
-#define SERVER_PANORAMIX_MAJOR_VERSION	1
-#define SERVER_PANORAMIX_MINOR_VERSION	1
+#include "protocol-versions.h"
 
 #ifdef GLXPROXY
 extern VisualPtr glxMatchVisual(ScreenPtr pScreen,
diff --git a/Xext/saver.c b/Xext/saver.c
index 18de4b5..04e6497 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -54,6 +54,7 @@ in this Software without prior written authorization from the X Consortium.
 #ifdef DPMSExtension
 #include <X11/extensions/dpmsconst.h>
 #endif
+#include "protocol-versions.h"
 
 #include <stdio.h>
 
@@ -727,8 +728,8 @@ ProcScreenSaverQueryVersion (ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = ScreenSaverMajorVersion;
-    rep.minorVersion = ScreenSaverMinorVersion;
+    rep.majorVersion = SERVER_SAVER_MAJOR_VERSION;
+    rep.minorVersion = SERVER_SAVER_MINOR_VERSION;
     if (client->swapped) {
     	swaps(&rep.sequenceNumber, n);
     	swapl(&rep.length, n);
diff --git a/Xext/security.c b/Xext/security.c
index 42eb9f0..2cd0e17 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -39,6 +39,7 @@ in this Software without prior written authorization from The Open Group.
 #include "securitysrv.h"
 #include <X11/extensions/securproto.h>
 #include "modinit.h"
+#include "protocol-versions.h"
 
 /* Extension stuff */
 static int SecurityErrorBase;  /* first Security error number */
@@ -371,8 +372,8 @@ ProcSecurityQueryVersion(
     rep.type        	= X_Reply;
     rep.sequenceNumber 	= client->sequence;
     rep.length         	= 0;
-    rep.majorVersion  	= SECURITY_MAJOR_VERSION;
-    rep.minorVersion  	= SECURITY_MINOR_VERSION;
+    rep.majorVersion  	= SERVER_SECURITY_MAJOR_VERSION;
+    rep.minorVersion  	= SERVER_SECURITY_MINOR_VERSION;
     if(client->swapped)
     {
 	char n;
diff --git a/Xext/shape.c b/Xext/shape.c
index 53167d1..700fe76 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group.
 #include "regionstr.h"
 #include "gcstruct.h"
 #include "modinit.h"
+#include "protocol-versions.h"
 
 typedef	RegionPtr (*CreateDftPtr)(
 	WindowPtr /* pWin */
@@ -259,8 +260,8 @@ ProcShapeQueryVersion (ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = SHAPE_MAJOR_VERSION;
-    rep.minorVersion = SHAPE_MINOR_VERSION;
+    rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
+    rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
     if (client->swapped) {
     	swaps(&rep.sequenceNumber, n);
     	swapl(&rep.length, n);
diff --git a/Xext/shm.c b/Xext/shm.c
index dd097e6..e4f08e2 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -54,6 +54,7 @@ in this Software without prior written authorization from The Open Group.
 #include "xace.h"
 #include <X11/extensions/shmproto.h>
 #include <X11/Xfuncproto.h>
+#include "protocol-versions.h"
 
 /* Needed for Solaris cross-zone shared memory extension */
 #ifdef HAVE_SHMCTL64
@@ -313,8 +314,8 @@ ProcShmQueryVersion(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.sharedPixmaps = sharedPixmaps;
     rep.pixmapFormat = sharedPixmaps ? ZPixmap : 0;
-    rep.majorVersion = SHM_MAJOR_VERSION;
-    rep.minorVersion = SHM_MINOR_VERSION;
+    rep.majorVersion = SERVER_SHM_MAJOR_VERSION;
+    rep.minorVersion = SERVER_SHM_MINOR_VERSION;
     rep.uid = geteuid();
     rep.gid = getegid();
     if (client->swapped) {
diff --git a/Xext/xcalibrate.c b/Xext/xcalibrate.c
index f923c17..6e6461a 100644
--- a/Xext/xcalibrate.c
+++ b/Xext/xcalibrate.c
@@ -32,6 +32,7 @@
 #include "dixstruct.h"
 #include "extnsionst.h"
 #include "swaprep.h"
+#include "protocol-versions.h"
 
 #include <X11/extensions/xcalibrateproto.h>
 #include <X11/extensions/xcalibratewire.h>
@@ -79,8 +80,8 @@ ProcXCalibrateQueryVersion (ClientPtr client)
   rep.type = X_Reply;
   rep.length = 0;
   rep.sequenceNumber = client->sequence;
-  rep.majorVersion = XCALIBRATE_MAJOR_VERSION;
-  rep.minorVersion = XCALIBRATE_MINOR_VERSION;   
+  rep.majorVersion = SERVER_XCALIBRATE_MAJOR_VERSION;
+  rep.minorVersion = SERVER_XCALIBRATE_MINOR_VERSION;
   if (client->swapped) { 
     int n;
     swaps(&rep.sequenceNumber, n);
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index aeea233..ba8b603 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -71,6 +71,7 @@
 #include "gcstruct.h"
 #include "dixfontstr.h"
 #include "extnsionst.h"
+#include "protocol-versions.h"
 
 #include <X11/extensions/xf86bigfproto.h>
 
@@ -338,8 +339,8 @@ ProcXF86BigfontQueryVersion(
     reply.type = X_Reply;
     reply.length = 0;
     reply.sequenceNumber = client->sequence;
-    reply.majorVersion = XF86BIGFONT_MAJOR_VERSION;
-    reply.minorVersion = XF86BIGFONT_MINOR_VERSION;
+    reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
+    reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
     reply.uid = geteuid();
     reply.gid = getegid();
 #ifdef HAS_SHM
diff --git a/Xext/xres.c b/Xext/xres.c
index 9dd08b1..109aa63 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -21,6 +21,7 @@
 #include "windowstr.h"
 #include "gcstruct.h"
 #include "modinit.h"
+#include "protocol-versions.h"
 
 static int
 ProcXResQueryVersion (ClientPtr client)
@@ -39,8 +40,8 @@ ProcXResQueryVersion (ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.server_major = XRES_MAJOR_VERSION;
-    rep.server_minor = XRES_MINOR_VERSION;   
+    rep.server_major = SERVER_XRES_MAJOR_VERSION;
+    rep.server_minor = SERVER_XRES_MINOR_VERSION;
     if (client->swapped) { 
         int n;
         swaps(&rep.sequenceNumber, n);
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index b7bb0fc..c17a4b1 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -20,6 +20,7 @@
 #include <X11/extensions/Xvproto.h>
 #include <X11/extensions/XvMCproto.h>
 #include "xvmcext.h"
+#include "protocol-versions.h"
 
 #ifdef HAS_XVMCSHM
 #include <sys/ipc.h>
@@ -116,8 +117,8 @@ ProcXvMCQueryVersion(ClientPtr client)
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
     rep.length = 0;
-    rep.major = XvMCVersion;
-    rep.minor = XvMCRevision;
+    rep.major = SERVER_XVMC_MAJOR_VERSION;
+    rep.minor = SERVER_XVMC_MINOR_VERSION;
     WriteToClient(client, sizeof(xvmcQueryVersionReply), (char*)&rep);
     return Success;
 }
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 84b999c..0c12919 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -72,6 +72,7 @@ SOFTWARE.
 #include "swaprep.h"
 #include "registry.h"
 #include "privates.h"
+#include "protocol-versions.h"
 
 /* modules local to Xi */
 #include "allowev.h"
@@ -380,11 +381,6 @@ Mask PropagateMask[MAXDEVICES];
 static int XIClientPrivateKeyIndex;
 DevPrivateKey XIClientPrivateKey = &XIClientPrivateKeyIndex;
 
-static XExtensionVersion thisversion = { XI_Present,
-    XI_2_Major,
-    XI_2_Minor
-};
-
 
 /*****************************************************************
  *
@@ -1255,6 +1251,10 @@ void
 XInputExtensionInit(void)
 {
     ExtensionEntry *extEntry;
+    XExtensionVersion thisversion = { XI_Present,
+        SERVER_XI_MAJOR_VERSION,
+        SERVER_XI_MINOR_VERSION,
+    };
 
     if (!dixRequestPrivate(XIClientPrivateKey, sizeof(XIClientRec)))
         FatalError("Cannot request private for XI.\n");
diff --git a/composite/compext.c b/composite/compext.c
index 56b4f27..976d002 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -53,9 +53,7 @@
 
 #include "compint.h"
 #include "xace.h"
-
-#define SERVER_COMPOSITE_MAJOR	0
-#define SERVER_COMPOSITE_MINOR	4
+#include "protocol-versions.h"
 
 static CARD8	CompositeReqCode;
 static int CompositeClientPrivateKeyIndex;
@@ -124,12 +122,12 @@ ProcCompositeQueryVersion (ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR) {
+    if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
 	rep.majorVersion = stuff->majorVersion;
 	rep.minorVersion = stuff->minorVersion;
     } else {
-	rep.majorVersion = SERVER_COMPOSITE_MAJOR;
-        rep.minorVersion = SERVER_COMPOSITE_MINOR;
+	rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
+        rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION;
     }
     pCompositeClient->major_version = rep.majorVersion;
     pCompositeClient->minor_version = rep.minorVersion;
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 8fa1c53..449c2fd 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -25,6 +25,7 @@
 #endif
 
 #include "damageextint.h"
+#include "protocol-versions.h"
 
 static unsigned char	DamageReqCode;
 static int		DamageEventBase;
@@ -35,13 +36,6 @@ static RESTYPE		DamageExtWinType;
 static int DamageClientPrivateKeyIndex;
 static DevPrivateKey DamageClientPrivateKey = &DamageClientPrivateKeyIndex;
 
-/* Version of the damage extension supported by the server, as opposed to the
- * DAMAGE_* defines from damageproto for what version the proto header
- * supports.
- */
-#define SERVER_DAMAGE_MAJOR	1
-#define SERVER_DAMAGE_MINOR	1
-
 #define prScreen	screenInfo.screens[0]
 
 static void
@@ -148,16 +142,16 @@ ProcDamageQueryVersion(ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    if (stuff->majorVersion < SERVER_DAMAGE_MAJOR) {
+    if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) {
 	rep.majorVersion = stuff->majorVersion;
 	rep.minorVersion = stuff->minorVersion;
     } else {
-	rep.majorVersion = SERVER_DAMAGE_MAJOR;
-	if (stuff->majorVersion == SERVER_DAMAGE_MAJOR && 
-	    stuff->minorVersion < SERVER_DAMAGE_MINOR)
+	rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION;
+	if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION &&
+	    stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION)
 	    rep.minorVersion = stuff->minorVersion;
 	else
-	    rep.minorVersion = SERVER_DAMAGE_MINOR;
+	    rep.minorVersion = SERVER_DAMAGE_MINOR_VERSION;
     }
     pDamageClient->major_version = rep.majorVersion;
     pDamageClient->minor_version = rep.minorVersion;
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index f5632d1..b1061a8 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -50,6 +50,7 @@
 #include "indirect_dispatch.h"
 #include "indirect_table.h"
 #include "indirect_util.h"
+#include "protocol-versions.h"
 
 static int
 validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
@@ -738,8 +739,8 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc)
     ** client if it wants to work with older clients; however, in this
     ** implementation the server just returns its version number.
     */
-    reply.majorVersion = GLX_SERVER_MAJOR_VERSION;
-    reply.minorVersion = GLX_SERVER_MINOR_VERSION;
+    reply.majorVersion = SERVER_GLX_MAJOR_VERSION;
+    reply.minorVersion = SERVER_GLX_MINOR_VERSION;
     reply.length = 0;
     reply.type = X_Reply;
     reply.sequenceNumber = client->sequence;
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 46c9382..4aa8c2e 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -64,10 +64,6 @@ typedef struct __GLXcontext __GLXcontext;
 #include "glxdrawable.h"
 #include "glxcontext.h"
 
-
-#define GLX_SERVER_MAJOR_VERSION 1
-#define GLX_SERVER_MINOR_VERSION 2
-
 #ifndef True
 #define True 1
 #endif
diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index 82f95c9..1a0c3fe 100644
--- a/hw/dmx/dmx.c
+++ b/hw/dmx/dmx.c
@@ -57,6 +57,7 @@
 #include "dmxextension.h"
 #include <X11/extensions/dmxproto.h>
 #include <X11/extensions/dmx.h>
+#include "protocol-versions.h"
 
 #ifdef PANORAMIX
 #include "panoramiX.h"
@@ -223,9 +224,9 @@ static int ProcDMXQueryVersion(ClientPtr client)
     rep.type           = X_Reply;
     rep.sequenceNumber = client->sequence;
     rep.length         = 0;
-    rep.majorVersion   = DMX_EXTENSION_MAJOR;
-    rep.minorVersion   = DMX_EXTENSION_MINOR;
-    rep.patchVersion   = DMX_EXTENSION_PATCH;
+    rep.majorVersion   = SERVER_DMX_MAJOR_VERSION;
+    rep.minorVersion   = SERVER_DMX_MINOR_VERSION;
+    rep.patchVersion   = SERVER_DMX_PATCH_VERSION;
     if (client->swapped) {
     	swaps(&rep.sequenceNumber, n);
         swapl(&rep.length, n);
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 323ebef..231b098 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -54,7 +54,7 @@
 #include "hostx.h"
 #define _HAVE_XALLOC_DECLS
 #include "ephyrlog.h"
-
+#include "protocol-versions.h"
 
 typedef struct {
     int foo;
@@ -622,9 +622,9 @@ ProcXF86DRIQueryVersion (register ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = XF86DRI_MAJOR_VERSION;
-    rep.minorVersion = XF86DRI_MINOR_VERSION;
-    rep.patchVersion = XF86DRI_PATCH_VERSION;
+    rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
+    rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
+    rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
     if (client->swapped) {
     	swaps(&rep.sequenceNumber, n);
     	swapl(&rep.length, n);
diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 7579f7d..5367bcc 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -26,6 +26,7 @@
 #include "swaprep.h"
 #include "dgaproc.h"
 #include "xf86dgaext.h"
+#include "protocol-versions.h"
 
 #include <string.h>
 
@@ -122,8 +123,8 @@ ProcXDGAQueryVersion(ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = XDGA_MAJOR_VERSION;
-    rep.minorVersion = XDGA_MINOR_VERSION;
+    rep.majorVersion = SERVER_XDGA_MAJOR_VERSION;
+    rep.minorVersion = SERVER_XDGA_MINOR_VERSION;
 
     WriteToClient(client, sizeof(xXDGAQueryVersionReply), (char *)&rep);
     return (client->noClientException);
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 1cfb5cc..4920115 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -46,6 +46,7 @@ from Kaleb S. KEITHLEY
 #include "xf86.h"
 #include "vidmodeproc.h"
 #include "globals.h"
+#include "protocol-versions.h"
 
 #define DEFAULT_XF86VIDMODE_VERBOSITY	3
 
@@ -384,8 +385,8 @@ ProcXF86VidModeQueryVersion(ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = XF86VIDMODE_MAJOR_VERSION;
-    rep.minorVersion = XF86VIDMODE_MINOR_VERSION;
+    rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
+    rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
     if (client->swapped) {
     	swaps(&rep.sequenceNumber, n);
     	swapl(&rep.length, n);
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 75344b7..035057b 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -60,6 +60,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dristruct.h"
 #include "xf86.h"
 #include "xf86drm.h"
+#include "protocol-versions.h"
 
 static int DRIErrorBase;
 
@@ -134,9 +135,9 @@ ProcXF86DRIQueryVersion(
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = XF86DRI_MAJOR_VERSION;
-    rep.minorVersion = XF86DRI_MINOR_VERSION;
-    rep.patchVersion = XF86DRI_PATCH_VERSION;
+    rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
+    rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
+    rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
     if (client->swapped) {
     	swaps(&rep.sequenceNumber, n);
     	swapl(&rep.length, n);
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 72f9a44..6c14578 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -45,6 +45,7 @@
 #include "xf86drm.h"
 #include "xfixes.h"
 #include "dri2.h"
+#include "protocol-versions.h"
 
 /* The only xf86 include */
 #include "xf86Module.h"
@@ -79,8 +80,8 @@ ProcDRI2QueryVersion(ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = 1;
-    rep.minorVersion = 1;
+    rep.majorVersion = SERVER_DRI2_MAJOR_VERSION;
+    rep.minorVersion = SERVER_DRI2_MAJOR_VERSION;
 
     if (client->swapped) {
     	swaps(&rep.sequenceNumber, n);
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 330bac4..14be180 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -50,6 +50,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <X11/extensions/applewmproto.h>
 #include "applewmExt.h"
 #include "X11Application.h"
+#include "protocol-versions.h"
 
 #define DEFINE_ATOM_HELPER(func,atom_name)                      \
 static Atom func (void) {                                       \
@@ -183,9 +184,9 @@ ProcAppleWMQueryVersion(
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = APPLE_WM_MAJOR_VERSION;
-    rep.minorVersion = APPLE_WM_MINOR_VERSION;
-    rep.patchVersion = APPLE_WM_PATCH_VERSION;
+    rep.majorVersion = SERVER_APPLEWM_MAJOR_VERSION;
+    rep.minorVersion = SERVER_APPLEWM_MINOR_VERSION;
+    rep.patchVersion = SERVER_APPLEWM_PATCH_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber, n);
         swapl(&rep.length, n);
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index 4d1a82f..835ccab 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -55,6 +55,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dristruct.h"
 #include "xpr.h"
 #include "x-hash.h"
+#include "protocol-versions.h"
 
 static int DRIErrorBase = 0;
 
@@ -119,9 +120,9 @@ ProcAppleDRIQueryVersion(
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = APPLE_DRI_MAJOR_VERSION;
-    rep.minorVersion = APPLE_DRI_MINOR_VERSION;
-    rep.patchVersion = APPLE_DRI_PATCH_VERSION;
+    rep.majorVersion = SERVER_APPLEDRI_MAJOR_VERSION;
+    rep.minorVersion = SERVER_APPLEDRI_MINOR_VERSION;
+    rep.patchVersion = SERVER_APPLEDRI_PATCH_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber, n);
         swapl(&rep.length, n);
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 61972c9..5b164ea 100755
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -41,6 +41,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "swaprep.h"
 #define _WINDOWSWM_SERVER_
 #include <X11/extensions/windowswmstr.h>
+#include "protocol-versions.h"
 
 static int WMErrorBase;
 
@@ -114,9 +115,9 @@ ProcWindowsWMQueryVersion(register ClientPtr client)
   rep.type = X_Reply;
   rep.length = 0;
   rep.sequenceNumber = client->sequence;
-  rep.majorVersion = WINDOWS_WM_MAJOR_VERSION;
-  rep.minorVersion = WINDOWS_WM_MINOR_VERSION;
-  rep.patchVersion = WINDOWS_WM_PATCH_VERSION;
+  rep.majorVersion = SERVER_WINDOWSWM_MAJOR_VERSION;
+  rep.minorVersion = SERVER_WINDOWSWM_MINOR_VERSION;
+  rep.patchVersion = SERVER_WINDOWSWM_PATCH_VERSION;
   if (client->swapped)
     {
       swaps(&rep.sequenceNumber, n);
diff --git a/include/Makefile.am b/include/Makefile.am
index f8eef53..aa5db7d 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -65,4 +65,5 @@ AM_CFLAGS = $(DIX_CFLAGS)
 
 EXTRA_DIST = 	\
 	dix-config-apple-verbatim.h \
-	eventconvert.h eventstr.h
+	eventconvert.h eventstr.h \
+	protocol-versions.h
diff --git a/include/protocol-versions.h b/include/protocol-versions.h
new file mode 100644
index 0000000..da9770c
--- /dev/null
+++ b/include/protocol-versions.h
@@ -0,0 +1,148 @@
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/**
+ * This file specifies the server-supported protocol versions.
+ */
+#ifndef _PROTOCOL_VERSIONS_
+#define _PROTOCOL_VERSIONS_
+
+/* Apple DRI */
+#define SERVER_APPLEDRI_MAJOR_VERSION		1
+#define SERVER_APPLEDRI_MINOR_VERSION		0
+#define SERVER_APPLEDRI_PATCH_VERSION		0
+
+/* AppleWM */
+#define SERVER_APPLEWM_MAJOR_VERSION		1
+#define SERVER_APPLEWM_MINOR_VERSION		3
+#define SERVER_APPLEWM_PATCH_VERSION		0
+
+/* Composite */
+#define SERVER_COMPOSITE_MAJOR_VERSION		0
+#define SERVER_COMPOSITE_MINOR_VERSION		4
+
+/* Damage */
+#define SERVER_DAMAGE_MAJOR_VERSION		1
+#define SERVER_DAMAGE_MINOR_VERSION		1
+
+/* DMX */
+#define SERVER_DMX_MAJOR_VERSION		2
+#define SERVER_DMX_MINOR_VERSION		2
+#define SERVER_DMX_PATCH_VERSION		20040604
+
+/* DRI2 */
+#define SERVER_DRI2_MAJOR_VERSION		1
+#define SERVER_DRI2_MINOR_VERSION		1
+
+/* Generic event extension */
+#define SERVER_GE_MAJOR_VERSION                 1
+#define SERVER_GE_MINOR_VERSION                 0
+
+/* GLX */
+#define SERVER_GLX_MAJOR_VERSION		1
+#define SERVER_GLX_MINOR_VERSION		2
+
+/* Xinerama */
+#define SERVER_PANORAMIX_MAJOR_VERSION          1
+#define SERVER_PANORAMIX_MINOR_VERSION		1
+
+/* RandR */
+#define SERVER_RANDR_MAJOR_VERSION		1
+#define SERVER_RANDR_MINOR_VERSION		3
+
+/* Record */
+#define SERVER_RECORD_MAJOR_VERSION		1
+#define SERVER_RECORD_MINOR_VERSION		13
+
+/* Render */
+#define SERVER_RENDER_MAJOR_VERSION		0
+#define SERVER_RENDER_MINOR_VERSION		10
+
+/* RandR Xinerama */
+#define SERVER_RRXINERAMA_MAJOR_VERSION		1
+#define SERVER_RRXINERAMA_MINOR_VERSION		1
+
+/* Screensaver */
+#define SERVER_SAVER_MAJOR_VERSION		1
+#define SERVER_SAVER_MINOR_VERSION		1
+
+/* Security */
+#define SERVER_SECURITY_MAJOR_VERSION		1
+#define SERVER_SECURITY_MINOR_VERSION		0
+
+/* Shape */
+#define SERVER_SHAPE_MAJOR_VERSION		1
+#define SERVER_SHAPE_MINOR_VERSION		1
+
+/* SHM */
+#define SERVER_SHM_MAJOR_VERSION		1
+#define SERVER_SHM_MINOR_VERSION		1
+
+/* Windows WM */
+#define SERVER_WINDOWSWM_MAJOR_VERSION		1
+#define SERVER_WINDOWSWM_MINOR_VERSION		0
+#define SERVER_WINDOWSWM_PATCH_VERSION		0
+
+/* Xcalibrate */
+#define SERVER_XCALIBRATE_MAJOR_VERSION		0
+#define SERVER_XCALIBRATE_MINOR_VERSION		1
+
+/* DGA */
+#define SERVER_XDGA_MAJOR_VERSION		2
+#define SERVER_XDGA_MINOR_VERSION		0
+
+/* Big Font */
+#define SERVER_XF86BIGFONT_MAJOR_VERSION	1
+#define SERVER_XF86BIGFONT_MINOR_VERSION	1
+
+/* DRI */
+#define SERVER_XF86DRI_MAJOR_VERSION		4
+#define SERVER_XF86DRI_MINOR_VERSION		1
+#define SERVER_XF86DRI_PATCH_VERSION		20040604
+
+/* Vidmode */
+#define SERVER_XF86VIDMODE_MAJOR_VERSION	2
+#define SERVER_XF86VIDMODE_MINOR_VERSION	2
+
+/* Fixes */
+#define SERVER_XFIXES_MAJOR_VERSION		4
+#define SERVER_XFIXES_MINOR_VERSION		0
+
+/* X Input */
+#define SERVER_XI_MAJOR_VERSION			2
+#define SERVER_XI_MINOR_VERSION			0
+
+/* XKB */
+#define SERVER_XKB_MAJOR_VERSION		1
+#define SERVER_XKB_MINOR_VERSION		0
+
+/* Resource */
+#define SERVER_XRES_MAJOR_VERSION		1
+#define SERVER_XRES_MINOR_VERSION		0
+
+/* XvMC */
+#define SERVER_XVMC_MAJOR_VERSION		1
+#define SERVER_XVMC_MINOR_VERSION		1
+
+#endif
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index 591d779..ffb46a4 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -21,9 +21,7 @@
  */
 
 #include "randrstr.h"
-
-#define SERVER_RANDR_MAJOR	1
-#define SERVER_RANDR_MINOR	3
+#include "protocol-versions.h"
 
 Bool
 RRClientKnowsRates (ClientPtr	pClient)
@@ -50,14 +48,14 @@ ProcRRQueryVersion (ClientPtr client)
     rep.sequenceNumber = client->sequence;
 
     if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
-        (SERVER_RANDR_MAJOR * 1000 + SERVER_RANDR_MINOR))
+        (SERVER_RANDR_MAJOR_VERSION * 1000 + SERVER_RANDR_MINOR_VERSION))
     {
 	rep.majorVersion = stuff->majorVersion;
 	rep.minorVersion = stuff->minorVersion;
     } else
     {
-        rep.majorVersion = SERVER_RANDR_MAJOR;
-        rep.minorVersion = SERVER_RANDR_MINOR;
+        rep.majorVersion = SERVER_RANDR_MAJOR_VERSION;
+        rep.minorVersion = SERVER_RANDR_MINOR_VERSION;
     }
 
     if (client->swapped) {
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index 97be7c1..94c8e54 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -71,9 +71,7 @@
 #include "randrstr.h"
 #include "swaprep.h"
 #include <X11/extensions/panoramiXproto.h>
-
-#define RR_XINERAMA_MAJOR_VERSION   1
-#define RR_XINERAMA_MINOR_VERSION   1
+#include "protocol-versions.h"
 
 /* Xinerama is not multi-screen capable; just report about screen 0 */
 #define RR_XINERAMA_SCREEN  0
@@ -98,8 +96,8 @@ ProcRRXineramaQueryVersion(ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.majorVersion = RR_XINERAMA_MAJOR_VERSION;
-    rep.minorVersion = RR_XINERAMA_MINOR_VERSION;
+    rep.majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION;
+    rep.minorVersion = SERVER_RRXINERAMA_MINOR_VERSION;
     if(client->swapped) {
         swaps(&rep.sequenceNumber, n);
         swapl(&rep.length, n);
diff --git a/record/record.c b/record/record.c
index 84a9618..b94b4ae 100644
--- a/record/record.c
+++ b/record/record.c
@@ -53,6 +53,8 @@ and Jim Haggerty of Metheus.
 #include "cursor.h"
 #endif
 
+#include "protocol-versions.h"
+
 static RESTYPE RTContext;   /* internal resource type for Record contexts */
 static int RecordErrorBase; /* first Record error number */
 
@@ -1866,8 +1868,8 @@ ProcRecordQueryVersion(ClientPtr client)
     rep.type        	= X_Reply;
     rep.sequenceNumber 	= client->sequence;
     rep.length         	= 0;
-    rep.majorVersion  	= RECORD_MAJOR_VERSION;
-    rep.minorVersion  	= RECORD_MINOR_VERSION;
+    rep.majorVersion  	= SERVER_RECORD_MAJOR_VERSION;
+    rep.minorVersion  	= SERVER_RECORD_MINOR_VERSION;
     if(client->swapped)
     {
     	swaps(&rep.sequenceNumber, n);
diff --git a/render/render.c b/render/render.c
index aadecf2..a306766 100644
--- a/render/render.c
+++ b/render/render.c
@@ -45,6 +45,7 @@
 #include <X11/Xfuncproto.h>
 #include "cursorstr.h"
 #include "xace.h"
+#include "protocol-versions.h"
 
 #if HAVE_STDINT_H
 #include <stdint.h>
@@ -272,14 +273,14 @@ ProcRenderQueryVersion (ClientPtr client)
     rep.sequenceNumber = client->sequence;
 
     if ((stuff->majorVersion * 1000 + stuff->minorVersion) <
-        (RENDER_MAJOR * 1000 + RENDER_MINOR))
+        (SERVER_RENDER_MAJOR_VERSION * 1000 + SERVER_RENDER_MINOR_VERSION))
     {
 	rep.majorVersion = stuff->majorVersion;
 	rep.minorVersion = stuff->minorVersion;
     } else
     {
-	rep.majorVersion = RENDER_MAJOR;
-	rep.minorVersion = RENDER_MINOR;
+	rep.majorVersion = SERVER_RENDER_MAJOR_VERSION;
+	rep.minorVersion = SERVER_RENDER_MINOR_VERSION;
     }
 
     if (client->swapped) {
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index 25c92ea..fa360b8 100644
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -52,13 +52,11 @@
 #endif
 
 #include "xfixesint.h"
-
+#include "protocol-versions.h"
 /*
  * Must use these instead of the constants from xfixeswire.h.  They advertise
  * what we implement, not what the protocol headers define.
  */
-#define SERVER_XFIXES_MAJOR 4
-#define SERVER_XFIXES_MINOR 0
 
 static unsigned char	XFixesReqCode;
 int		XFixesEventBase;
@@ -80,16 +78,16 @@ ProcXFixesQueryVersion(ClientPtr client)
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    if (stuff->majorVersion < SERVER_XFIXES_MAJOR) {
+    if (stuff->majorVersion < SERVER_XFIXES_MAJOR_VERSION) {
 	rep.majorVersion = stuff->majorVersion;
 	rep.minorVersion = stuff->minorVersion;
     } else {
-	rep.majorVersion = SERVER_XFIXES_MAJOR;
-	if (stuff->majorVersion == SERVER_XFIXES_MAJOR && 
-	    stuff->minorVersion < SERVER_XFIXES_MINOR)
+	rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION;
+	if (stuff->majorVersion == SERVER_XFIXES_MAJOR_VERSION &&
+	    stuff->minorVersion < SERVER_XFIXES_MINOR_VERSION)
 	    rep.minorVersion = stuff->minorVersion;
 	else
-	    rep.minorVersion = SERVER_XFIXES_MINOR;
+	    rep.minorVersion = SERVER_XFIXES_MINOR_VERSION;
     }
     pXFixesClient->major_version = rep.majorVersion;
     pXFixesClient->minor_version = rep.minorVersion;
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 0b54a2e..7abbeaa 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -38,6 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "extnsionst.h"
 #include "xace.h"
 #include "xkb.h"
+#include "protocol-versions.h"
 
 #include <X11/extensions/XI.h>
 #include <X11/extensions/XKMformat.h>
@@ -161,9 +162,9 @@ ProcXkbUseExtension(ClientPtr client)
     int	supported;
 
     REQUEST_SIZE_MATCH(xkbUseExtensionReq);
-    if (stuff->wantedMajor != XkbMajorVersion) {
+    if (stuff->wantedMajor != SERVER_XKB_MAJOR_VERSION) {
 	/* pre-release version 0.65 is compatible with 1.00 */
-	supported= ((XkbMajorVersion==1)&&
+	supported= ((SERVER_XKB_MAJOR_VERSION==1)&&
 		    (stuff->wantedMajor==0)&&(stuff->wantedMinor==65));
     }
     else supported = 1;
@@ -178,15 +179,15 @@ ProcXkbUseExtension(ClientPtr client)
 					client->index,
 					(long)client->clientAsMask,
 					stuff->wantedMajor,stuff->wantedMinor,
-					XkbMajorVersion,XkbMinorVersion);
+					SERVER_XKB_MAJOR_VERSION,SERVER_XKB_MINOR_VERSION);
     }
     memset(&rep, 0, sizeof(xkbUseExtensionReply));
     rep.type = X_Reply;
     rep.supported = supported;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
-    rep.serverMajor = XkbMajorVersion;
-    rep.serverMinor = XkbMinorVersion;
+    rep.serverMajor = SERVER_XKB_MAJOR_VERSION;
+    rep.serverMinor = SERVER_XKB_MINOR_VERSION;
     if ( client->swapped ) {
 	swaps(&rep.sequenceNumber, n);
 	swaps(&rep.serverMajor, n);
commit 0b7c6c728c2e2d8433a188315cc591308a89cd85
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Sep 18 21:12:17 2009 -0700

    xfree86/modes: Remove all framebuffer support from DGA
    
    This removes all rendering and mapping code from xf86DiDGA, leaving
    just mode setting and raw input device access. The mapping code didn't
    have the offset within /dev/mem for the frame buffer and the pixmap
    support assumed that the framebuffer was never reallocated.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index c6dfd8c..c1e31e0 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -805,6 +805,9 @@ xf86CrtcScreenInit (ScreenPtr screen)
     config->CloseScreen = screen->CloseScreen;
     screen->CloseScreen = xf86CrtcCloseScreen;
     
+#ifdef XFreeXDGA
+    xf86DiDGAInit(screen, 0);
+#endif
 #ifdef RANDR_13_INTERFACE
     return RANDR_INTERFACE_VERSION;
 #else
@@ -1923,6 +1926,10 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
 	}
     }
     scrn->currentMode = scrn->modes;
+#ifdef XFreeXDGA
+    if (scrn->pScreen)
+	    xf86DiDGAReInit(scrn->pScreen);
+#endif
 }
 
 static void
diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c
index 0964cef..0f7b834 100644
--- a/hw/xfree86/modes/xf86DiDGA.c
+++ b/hw/xfree86/modes/xf86DiDGA.c
@@ -72,8 +72,7 @@ xf86_dga_get_modes (ScreenPtr pScreen)
 	mode = modes + num++;
 
 	mode->mode = display_mode;
-	mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
-        mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
+	mode->flags = DGA_CONCURRENT_ACCESS;
 	if (display_mode->Flags & V_DBLSCAN)
 	    mode->flags |= DGA_DOUBLESCAN;
 	if (display_mode->Flags & V_INTERLACE)
@@ -91,14 +90,14 @@ xf86_dga_get_modes (ScreenPtr pScreen)
 	mode->yViewportStep = 1;
 	mode->viewportFlags = DGA_FLIP_RETRACE;
 	mode->offset = 0;
-	mode->address = (unsigned char *) xf86_config->dga_address;
-	mode->bytesPerScanline = xf86_config->dga_stride;
-	mode->imageWidth = xf86_config->dga_width;
-	mode->imageHeight = xf86_config->dga_height;
+	mode->address = 0;
+	mode->imageWidth = mode->viewportWidth;
+	mode->imageHeight = mode->viewportHeight;
+	mode->bytesPerScanline = (mode->imageWidth * scrn->bitsPerPixel) >> 3;
 	mode->pixmapWidth = mode->imageWidth;
 	mode->pixmapHeight = mode->imageHeight;
-	mode->maxViewportX = mode->imageWidth -	mode->viewportWidth;
-	mode->maxViewportY = mode->imageHeight - mode->viewportHeight;
+	mode->maxViewportX = 0;
+	mode->maxViewportY = 0;
 
 	display_mode = display_mode->next;
 	if (display_mode == scrn->modes)
@@ -149,93 +148,11 @@ xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
 }
 
 static Bool
-xf86_dga_get_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr *ppDrawable, GCPtr *ppGC)
-{
-    ScreenPtr		pScreen = scrn->pScreen;
-    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-    PixmapPtr		pPixmap;
-    GCPtr		pGC;
-    
-    pPixmap = GetScratchPixmapHeader (pScreen, xf86_config->dga_width, xf86_config->dga_height,
-				      scrn->depth, scrn->bitsPerPixel, xf86_config->dga_stride, 
-				      (char *) scrn->memPhysBase + scrn->fbOffset);
-    if (!pPixmap)
-	return FALSE;
-    pGC  = GetScratchGC (scrn->depth, pScreen);
-    if (!pGC)
-    {
-	FreeScratchPixmapHeader (pPixmap);
-	return FALSE;
-    }
-    *ppDrawable = &pPixmap->drawable;
-    *ppGC = pGC;
-    return TRUE;
-}
-
-static void
-xf86_dga_release_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr pDrawable, GCPtr pGC)
-{
-    FreeScratchGC (pGC);
-    FreeScratchPixmapHeader ((PixmapPtr) pDrawable);
-}
-
-static void
-xf86_dga_fill_rect(ScrnInfoPtr scrn, int x, int y, int w, int h, unsigned long color)
-{
-    GCPtr		pGC;
-    DrawablePtr		pDrawable;
-    XID			vals[1];
-    xRectangle		r;
-
-    if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
-	return;
-    vals[0] = color;
-    ChangeGC (pGC, GCForeground, vals);
-    ValidateGC (pDrawable, pGC);
-    r.x = x;
-    r.y = y;
-    r.width = w;
-    r.height = h;
-    pGC->ops->PolyFillRect (pDrawable, pGC, 1, &r);
-    xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
-}
-
-static void
-xf86_dga_sync(ScrnInfoPtr scrn)
-{
-    ScreenPtr	pScreen = scrn->pScreen;
-    WindowPtr	pRoot = WindowTable [pScreen->myNum];
-    char	buffer[4];
-
-    pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer);
-}
-
-static void
-xf86_dga_blit_rect(ScrnInfoPtr scrn, int srcx, int srcy, int w, int h, int dstx, int dsty)
-{
-    DrawablePtr	pDrawable;
-    GCPtr	pGC;
-
-    if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
-	return;
-    ValidateGC (pDrawable, pGC);
-    pGC->ops->CopyArea (pDrawable, pDrawable, pGC, srcx, srcy, w, h, dstx, dsty);
-    xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
-}
-
-static Bool
 xf86_dga_open_framebuffer(ScrnInfoPtr scrn,
 			  char **name,
 			  unsigned char **mem, int *size, int *offset, int *flags)
 {
-    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
-    
-    *size = xf86_config->dga_stride * xf86_config->dga_height;
-    *mem = (unsigned char *) (xf86_config->dga_address);
-    *offset = 0;
-    *flags = DGA_NEED_ROOT;
-
-    return TRUE;
+    return FALSE;
 }
 
 static void
@@ -249,9 +166,9 @@ static DGAFunctionRec xf86_dga_funcs = {
    xf86_dga_set_mode,
    xf86_dga_set_viewport,
    xf86_dga_get_viewport,
-   xf86_dga_sync,
-   xf86_dga_fill_rect,
-   xf86_dga_blit_rect,
+   NULL,
+   NULL,
+   NULL,
    NULL
 };
 
@@ -261,6 +178,9 @@ xf86DiDGAReInit (ScreenPtr pScreen)
     ScrnInfoPtr		scrn = xf86Screens[pScreen->myNum];
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     
+    if (!DGAAvailable(pScreen->myNum))
+	return TRUE;
+
     if (!xf86_dga_get_modes (pScreen))
 	return FALSE;
     
@@ -273,11 +193,14 @@ xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address)
     ScrnInfoPtr		scrn = xf86Screens[pScreen->myNum];
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
 
+    if (DGAAvailable(pScreen->myNum))
+	return TRUE;
+
     xf86_config->dga_flags = 0;
-    xf86_config->dga_address = dga_address;
-    xf86_config->dga_width = scrn->virtualX;
-    xf86_config->dga_height = scrn->virtualY;
-    xf86_config->dga_stride = scrn->displayWidth * scrn->bitsPerPixel >> 3;
+    xf86_config->dga_address = 0;
+    xf86_config->dga_width = 0;
+    xf86_config->dga_height = 0;
+    xf86_config->dga_stride = 0;
     
     if (!xf86_dga_get_modes (pScreen))
 	return FALSE;
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index c2465bc..6ea9d26 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -467,9 +467,6 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
     {
 	xf86ProbeOutputModes (scrp, 0, 0);
 	xf86SetScrnInfoModes (scrp);
-#ifdef XFreeXDGA
-	xf86DiDGAReInit (pScreen);
-#endif
     }
 
     for (mode = scrp->modes; ; mode = mode->next)
@@ -1528,9 +1525,6 @@ xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations)
 	return TRUE;
     xf86ProbeOutputModes (pScrn, 0, 0);
     xf86SetScrnInfoModes (pScrn);
-#ifdef XFreeXDGA
-    xf86DiDGAReInit (pScreen);
-#endif
     return xf86RandR12SetInfo12 (pScreen);
 }
 


More information about the xorg-commit mailing list