xserver: Branch 'xgl-0-0-1'

David Reveman davidr at kemper.freedesktop.org
Mon Sep 25 23:12:57 EEST 2006


 hw/xgl/glx/xglx.c |  182 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 181 insertions(+), 1 deletion(-)

New commits:
diff-tree 1978343ef4094919643d4e0a3d910dac01805ecb (from 526238a26d05fc04093a3604e68bb86e06381ab3)
Author: David Reveman <davidr at novell.com>
Date:   Mon Sep 25 16:10:43 2006 -0400

    Traditional xinerama extension support. Based on patch by Jurg Billeter.

diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c
index 0e00d3d..7f65658 100644
--- a/hw/xgl/glx/xglx.c
+++ b/hw/xgl/glx/xglx.c
@@ -44,6 +44,11 @@
 #include "randrstr.h"
 #endif
 
+#ifdef PANORAMIX
+#include <X11/extensions/panoramiXproto.h>
+#include "extnsionst.h"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -507,6 +512,170 @@ xglxEnqueueEvents (void)
     }
 }
 
+#ifdef PANORAMIX
+
+static int xglxXineramaGeneration = -1;
+
+static void
+xglxXineramaResetProc (ExtensionEntry *extEntry)
+{
+}
+
+static int
+xglxProcXineramaQueryVersion (ClientPtr client)
+{
+    xPanoramiXQueryVersionReply	rep;
+    register int		n;
+    int				majorVersion, minorVersion;
+
+    REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+
+    XineramaQueryVersion (xdisplay, &majorVersion, &minorVersion);
+
+    rep.type	       = X_Reply;
+    rep.length	       = 0;
+    rep.sequenceNumber = client->sequence;
+    rep.majorVersion   = majorVersion;
+    rep.minorVersion   = minorVersion;
+
+    if (client->swapped)
+    {
+	swaps (&rep.sequenceNumber, n);
+	swapl (&rep.length, n);
+	swaps (&rep.majorVersion, n);
+	swaps (&rep.minorVersion, n);
+    }
+
+    WriteToClient (client, sizeof (xPanoramiXQueryVersionReply), (char *) &rep);
+
+    return client->noClientException;
+}
+
+static int
+xglxProcXineramaIsActive (ClientPtr client)
+{
+    xXineramaIsActiveReply rep;
+
+    REQUEST_SIZE_MATCH (xXineramaIsActiveReq);
+
+    rep.type	       = X_Reply;
+    rep.length	       = 0;
+    rep.sequenceNumber = client->sequence;
+    rep.state	       = XineramaIsActive (xdisplay);
+
+    if (client->swapped)
+    {
+	register int n;
+
+	swaps (&rep.sequenceNumber, n);
+	swapl (&rep.length, n);
+	swapl (&rep.state, n);
+    }
+
+    WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep);
+
+    return client->noClientException;
+}
+
+static int
+xglxProcXineramaQueryScreens (ClientPtr client)
+{
+    xXineramaQueryScreensReply rep;
+    xXineramaScreenInfo	       scratch;
+    XineramaScreenInfo	       *info;
+    int			       n;
+
+    REQUEST_SIZE_MATCH (xXineramaQueryScreensReq);
+
+    info = XineramaQueryScreens (xdisplay, &n);
+
+    rep.type	       = X_Reply;
+    rep.sequenceNumber = client->sequence;
+    rep.number	       = n;
+    rep.length	       = n * sz_XineramaScreenInfo >> 2;
+
+    if (client->swapped)
+    {
+	register int n;
+
+	swaps (&rep.sequenceNumber, n);
+	swapl (&rep.length, n);
+	swapl (&rep.number, n);
+    }
+
+    WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep);
+
+    if (info)
+    {
+	xXineramaScreenInfo scratch;
+	int		    i;
+
+	for (i = 0; i < rep.number; i++)
+	{
+	    scratch.x_org  = info[i].x_org;
+	    scratch.y_org  = info[i].y_org;
+	    scratch.width  = info[i].width;
+	    scratch.height = info[i].height;
+
+	    if (client->swapped)
+	    {
+		register int n;
+
+		swaps (&scratch.x_org, n);
+		swaps (&scratch.y_org, n);
+		swaps (&scratch.width, n);
+		swaps (&scratch.height, n);
+	    }
+
+	    WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch);
+	}
+
+	XFree (info);
+    }
+
+    return client->noClientException;
+}
+
+static int
+xglxProcXineramaDispatch (ClientPtr client)
+{
+    REQUEST (xReq);
+
+    switch (stuff->data) {
+    case X_PanoramiXQueryVersion:
+	return xglxProcXineramaQueryVersion (client);
+    case X_XineramaIsActive:
+	return xglxProcXineramaIsActive (client);
+    case X_XineramaQueryScreens:
+	return xglxProcXineramaQueryScreens (client);
+    }
+
+    return BadRequest;
+}
+
+static Bool
+xglxXineramaInit (void)
+{
+    ExtensionEntry *extEntry;
+
+    if (xglxXineramaGeneration != serverGeneration)
+    {
+	extEntry = AddExtension (PANORAMIX_PROTOCOL_NAME, 0,0,
+				 xglxProcXineramaDispatch,
+				 xglxProcXineramaDispatch,
+				 xglxXineramaResetProc,
+				 StandardMinorOpcode);
+	if (!extEntry)
+	    return FALSE;
+
+	xglxXineramaGeneration = serverGeneration;
+    }
+
+    return TRUE;
+}
+
+#endif
+
 static void
 xglxConstrainCursor (ScreenPtr pScreen,
 		     BoxPtr    pBox)
@@ -1061,6 +1230,11 @@ xglxInitOutput (ScreenInfo *pScreenInfo,
 
     xglxScreenFormat = format;
 
+#ifdef PANORAMIX
+    if (!noPanoramiXExtension)
+	xglxXineramaInit ();
+#endif
+
     for (i = 0; i < numScreen; i++)
 	AddScreen (xglxScreenInit, argc, argv);
 }
@@ -1618,7 +1792,13 @@ xglxOsVendorInit (void)
 			     preferBlanking, allowExposures);
 	    XResetScreenSaver (xdisplay);
 
-	    if (XineramaIsActive (xdisplay))
+	    if (XineramaIsActive (xdisplay)
+
+#ifdef PANORAMIX
+		&& noPanoramiXExtension
+#endif
+
+		)
 	    {
 		XineramaScreenInfo *info;
 		int		   nInfo = 0;



More information about the xorg-commit mailing list