xserver: Branch 'xorg-server-1.5-apple' - 8 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Fri Aug 29 20:52:46 PDT 2008


 Xext/shm.c                            |   94 +++++++++-------------------------
 Xext/shmint.h                         |    3 -
 Xext/xselinux.c                       |   21 +++----
 dix/events.c                          |   14 +++++
 exa/exa.c                             |    7 --
 exa/exa_accel.c                       |   92 ---------------------------------
 exa/exa_priv.h                        |    9 ---
 glx/glxdriswrast.c                    |    2 
 glx/glxext.c                          |   37 ++++++++-----
 hw/xfree86/ddc/print_edid.c           |    3 -
 hw/xquartz/X11Application.m           |    8 +-
 hw/xquartz/darwin.c                   |    2 
 hw/xquartz/mach-startup/bundle-main.c |   19 ++++++
 mi/miexpose.c                         |    4 -
 miext/rootless/rootlessWindow.c       |   33 +++++++++++
 15 files changed, 131 insertions(+), 217 deletions(-)

New commits:
commit 24aef18e97dabb7d9f7d6d557821a0f0942e0c5a
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Aug 29 20:45:48 2008 -0700

    XQuartz: Added debugging output to the crash log to help track down two crashes, since people don't often report their system.log spew.
    (cherry picked from commit aaf0f71db197526b6b866cc1b39fbdfe051879ef)

diff --git a/dix/events.c b/dix/events.c
index aef333e..2667fef 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2441,11 +2441,25 @@ WindowHasNewCursor(WindowPtr pWin)
     PostNewCursor();
 }
 
+#ifdef XQUARTZ
+#include <string.h>
+extern char *__crashreporter_info__;
+extern const char *__crashreporter_info__base;
+extern int __crashreporter_info__len;
+#endif
+
 _X_EXPORT void
 NewCurrentScreen(ScreenPtr newScreen, int x, int y)
 {
     sprite.hotPhys.x = x;
     sprite.hotPhys.y = y;
+#ifdef XQUARTZ
+    /* We're seeing a crash here, but I'm not sure what's causing it... so putting in some debugging */
+    snprintf(__crashreporter_info__, __crashreporter_info__len, "%s\n\nNewCurrentScreen debug data\nnoPanoramiXExtension=%d\nnewScreen=%p\nnewScreen->myNum=%d\n",
+             __crashreporter_info__base, noPanoramiXExtension, newScreen,newScreen->myNum);
+    ErrorF("NewCurrentScreen debug data\nnoPanoramiXExtension=%d\nnewScreen=%p\nnewScreen->myNum=%d\n",
+           noPanoramiXExtension, newScreen, newScreen->myNum);
+#endif
 #ifdef PANORAMIX
     if(!noPanoramiXExtension) {
 	sprite.hotPhys.x += panoramiXdataPtr[newScreen->myNum].x - 
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 86f273c..3b5e31f 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -153,8 +153,6 @@ const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
 #define XORG_RELEASE "?"
 #endif
 
-const char *__crashreporter_info__ = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
-
 void DDXRingBell(int volume, int pitch, int duration) {
   // FIXME -- make some noise, yo
 }
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 0eb45d1..6f1704e 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -59,6 +59,18 @@ extern int noPanoramiXExtension;
 #define DEFAULT_STARTX "/usr/X11/bin/startx"
 #define DEFAULT_SHELL  "/bin/sh"
 
+#ifndef BUILD_DATE
+#define BUILD_DATE ""
+#endif
+#ifndef XSERVER_VERSION
+#define XSERVER_VERSION "?"
+#endif
+
+const int __crashreporter_info__len = 4096;
+const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Build Date: " BUILD_DATE;
+char __crashreporter_info__buf[4096];
+char *__crashreporter_info__ = __crashreporter_info__buf;
+
 #define DEBUG 1
 
 static int execute(const char *command);
@@ -389,7 +401,10 @@ int main(int argc, char **argv, char **envp) {
 
     // The server must not run the PanoramiX operations.
     noPanoramiXExtension = TRUE;
-    
+
+    /* Setup the initial crasherporter info */
+    strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len);
+
     fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
     for(i=0; i < argc; i++) {
         fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]);
@@ -397,7 +412,7 @@ int main(int argc, char **argv, char **envp) {
             listenOnly = TRUE;
         }
     }
-    
+
     mp = checkin_or_register(SERVER_BOOTSTRAP_NAME);
     if(mp == MACH_PORT_NULL) {
         fprintf(stderr, "NULL mach service: %s", SERVER_BOOTSTRAP_NAME);
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 0edafe7..2268299 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -131,16 +131,45 @@ RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state)
   pWin->rootlessUnhittable = winRec->is_offscreen;
 }
 
+#ifdef XQUARTZ
+#include <string.h>
+extern char *__crashreporter_info__;
+extern const char *__crashreporter_info__base;
+extern int __crashreporter_info__len;
+#endif
+
 void RootlessNativeWindowMoved (WindowPtr pWin) {
     xp_box bounds;
     int sx, sy, err;
     XID vlist[2];
     Mask mask;
     ClientPtr client, pClient;
-    RootlessWindowRec *winRec = WINREC(pWin);
+    RootlessWindowRec *winRec;
+
+#ifdef XQUARTZ
+    /* We're seeing a crash here, but I'm not sure what's causing it... so putting in some debugging */
+    snprintf(__crashreporter_info__, __crashreporter_info__len,
+             "%s\n\RootlessNativeWindowMoved debug data\npWin=%p\n",
+             __crashreporter_info__base, pWin);
+    ErrorF("RootlessNativeWindowMoved debug data\npWin=%p\n", pWin);
+#endif
+    
+    winRec = WINREC(pWin);
+
+#ifdef XQUARTZ
+    /* We're seeing a crash here, but I'm not sure what's causing it... so putting in some debugging */
+    snprintf(__crashreporter_info__, __crashreporter_info__len, "%swinRec=%p\nwinRec->wid=%d\n", __crashreporter_info__, winRec, winRec ? (int)winRec->wid : 0);
+    ErrorF("winRec=%p\nwinRec->wid=%d\n", winRec, winRec ? (int)winRec->wid : 0);
+#endif
     
     if (xp_get_window_bounds ((xp_window_id)winRec->wid, &bounds) != Success) return;
     
+#ifdef XQUARTZ
+    /* We're seeing a crash here, but I'm not sure what's causing it... so putting in some debugging */
+    snprintf(__crashreporter_info__, __crashreporter_info__len, "%spWin->drawable.pScreen=%p\npWin->drawable.pScreen->myNum=%d\n", __crashreporter_info__, pWin->drawable.pScreen, pWin->drawable.pScreen ? pWin->drawable.pScreen->myNum : 0);
+    ErrorF("pWin->drawable.pScreen=%p\npWin->drawable.pScreen->myNum=%d\n", pWin->drawable.pScreen, pWin->drawable.pScreen ? pWin->drawable.pScreen->myNum : 0);
+#endif
+    
     sx = dixScreenOrigins[pWin->drawable.pScreen->myNum].x + darwinMainScreenX;
     sy = dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY;
     
@@ -153,7 +182,7 @@ void RootlessNativeWindowMoved (WindowPtr pWin) {
     /* pretend we're the owner of the window! */
     err = dixLookupClient(&pClient, pWin->drawable.id, NullClient, DixUnknownAccess);
     if(err != Success) {
-        ErrorF("RootlessNativeWindowMoved(): Failed to lookup window: 0x%x\n", pWin->drawable.id);
+        ErrorF("RootlessNativeWindowMoved(): Failed to lookup window: 0x%x\n", (unsigned int)pWin->drawable.id);
         return;
     }
     
commit 1ecfc492bc033c1ab4a978a5d3fa134470d8f3f7
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Aug 29 03:54:55 2008 -0700

    XQuartz: xp_is_symbolic_hotkey_event catches the input menu, but not our mainMenu, so we still need to do that the old way.
    (cherry picked from commit 25eccf12c89d73b8bce2c9be14841efb230acedc)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 5b1d171..a1c09ef 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -244,13 +244,15 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                         for_x = NO;
                         DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
 #endif
-                    } else if(X11EnableKeyEquivalents &&
 #if XPLUGIN_VERSION >= 1
+                    } else if(X11EnableKeyEquivalents &&
                               xp_is_symbolic_hotkey_event([e eventRef])) {
-#else
+                        swallow_up = [e keyCode];
+                        for_x = NO;
+#endif
+                    } else if(X11EnableKeyEquivalents &&
                               [[self mainMenu] performKeyEquivalent:e]) {
                         for_appkit = NO;
-#endif
                         swallow_up = [e keyCode];
                         for_x = NO;
                     } else {
commit c48b4ddeffedda949f4aed7731b1190403380d6b
Merge: 41f99b1... 580e96d...
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Aug 29 20:44:55 2008 -0700

    Merge branch 'server-1.5-branch' into xorg-server-1.5-apple

commit 580e96d6d4355acae6314105a3a8e4c7a4d6e3ea
Author: Xavier Bestel <xavier.bestel at free.fr>
Date:   Tue Jul 29 13:06:10 2008 -0400

    Cosmetic fix to EDID decoding.
    (cherry picked from commit bb2cacd33eb85f39b9e7fa554545611957df677d)

diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c
index f5442ad..df11bfb 100644
--- a/hw/xfree86/ddc/print_edid.c
+++ b/hw/xfree86/ddc/print_edid.c
@@ -148,7 +148,8 @@ print_dpms_features(int scrnIndex, struct disp_features *c,
 	}
     } else {
 	int enc = c->display_type;
-	xf86DrvMsg(scrnIndex, X_INFO, "\nSupported color encodings: "
+	xf86ErrorF("\n");
+	xf86DrvMsg(scrnIndex, X_INFO, "Supported color encodings: "
 		   "RGB 4:4:4 %s%s\n",
 		   enc & DISP_YCRCB444 ? "YCrCb 4:4:4 " : "",
 		   enc & DISP_YCRCB422 ? "YCrCb 4:2:2" : "");
commit d0ef93430505d110e0d3c0552dad3361db33b369
Author: Fredrik Höglund <fredrik at kde.org>
Date:   Mon Aug 18 19:27:34 2008 +0200

    Fix the tile offset in miPaintWindow for ParentRelative windows.
    (cherry picked from commit 244a635fcdc9e0a7212d51b26d74f49d8e1b071f)

diff --git a/mi/miexpose.c b/mi/miexpose.c
index 5c2bd03..2fba6a2 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -564,8 +564,8 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 	draw_x_off = drawable->x;
 	draw_y_off = drawable->y;
 
-	tile_x_off = 0;
-	tile_y_off = 0;
+	tile_x_off = pWin->drawable.x - draw_x_off;
+	tile_y_off = pWin->drawable.y - draw_y_off;
 	fill = pWin->background;
 	switch (pWin->backgroundState) {
 	case None:
commit 05472534cfefe6057b908cc7d698967eecb5dde4
Author: Daniel Drake <dsd at laptop.org>
Date:   Thu Jul 24 21:06:34 2008 -0500

    Don't abort if swrast library is not present
    
    GLX is enabled by default, but the current swrast behaviour causes X
    to abort with fatal error if the swrast dri library dlopen fails.
    
    Handle the case where the swrast library is not present, and do not
    register the GLX extension unless at least one screen has a usable
    GL provider.
    (cherry picked from commit eff25430b4a391409e39337962ff7697165d23c7)

diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 9d987c2..f36dae7 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -532,7 +532,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     xfree(screen);
 
-    FatalError("GLX: could not load software renderer\n");
+    LogMessage(X_ERROR, "GLX: could not load software renderer\n");
 
     return NULL;
 }
diff --git a/glx/glxext.c b/glx/glxext.c
index 13c65da..6ba404f 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -279,6 +279,7 @@ void GlxExtensionInit(void)
     ScreenPtr pScreen;
     int i;
     __GLXprovider *p;
+    Bool glx_provided = False;
 
     __glXContextRes = CreateNewResourceType((DeleteType)ContextGone);
     __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone);
@@ -289,6 +290,29 @@ void GlxExtensionInit(void)
     if (!AddCallback (&ClientStateCallback, glxClientCallback, 0))
 	return;
 
+    for (i = 0; i < screenInfo.numScreens; i++) {
+	pScreen = screenInfo.screens[i];
+
+	for (p = __glXProviderStack; p != NULL; p = p->next) {
+	    if (p->screenProbe(pScreen) != NULL) {
+		LogMessage(X_INFO,
+			   "GLX: Initialized %s GL provider for screen %d\n",
+			   p->name, i);
+		break;
+	    }
+	}
+
+	if (!p)
+	    LogMessage(X_INFO,
+		       "GLX: no usable GL providers found for screen %d\n", i);
+	else
+	    glx_provided = True;
+    }
+
+    /* don't register extension if GL is not provided on any screen */
+    if (!glx_provided)
+	return;
+
     /*
     ** Add extension to server extensions.
     */
@@ -306,19 +330,6 @@ void GlxExtensionInit(void)
     }
 
     __glXErrorBase = extEntry->errorBase;
-
-    for (i = 0; i < screenInfo.numScreens; i++) {
-	pScreen = screenInfo.screens[i];
-
-	for (p = __glXProviderStack; p != NULL; p = p->next) {
-	    if (p->screenProbe(pScreen) != NULL) {
-		LogMessage(X_INFO,
-			   "GLX: Initialized %s GL provider for screen %d\n",
-			   p->name, i);
-	    	break;
-	    }
-	}
-    }
 }
 
 /************************************************************************/
commit 4652c51e92ab21df020f83be3dc1ca1c897f6cf9
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Aug 27 16:05:47 2008 -0400

    Reimplement ShmPutImage.
    
    There's no reason to not just dispatch this straight into the GC.  As a
    bonus, if you do so, damage wraps correctly, and thus swcursor works.
    The side effect is it's no longer possible to override ShmPutImage with
    ShmRegisterFuncs().
    
    Also remove the (broken) damage tracking for same from EXA, since it didn't
    work right, and is now superfluous.
    
    (cherry picked from commit ee7c684f21d220d5e046bab31ae617a7d64d60f6)

diff --git a/Xext/shm.c b/Xext/shm.c
index 8cf5944..34c8752 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -106,7 +106,6 @@ typedef struct _ShmDesc {
     unsigned long size;
 } ShmDescRec, *ShmDescPtr;
 
-static void miShmPutImage(XSHM_PUT_IMAGE_ARGS);
 static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
 static int ShmDetachSegment(
     pointer		/* value */,
@@ -148,8 +147,8 @@ static int shmPixFormat[MAXSCREENS];
 static ShmFuncsPtr shmFuncs[MAXSCREENS];
 static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS];
 static DevPrivateKey shmPixmapPrivate = &shmPixmapPrivate;
-static ShmFuncs miFuncs = {NULL, miShmPutImage};
-static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
+static ShmFuncs miFuncs = {NULL, NULL};
+static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL};
 
 #define VERIFY_SHMSEG(shmseg,shmdesc,client) \
 { \
@@ -522,70 +521,28 @@ ProcShmDetach(client)
     return(client->noClientException);
 }
 
+/*
+ * If the given request doesn't exactly match PutImage's constraints,
+ * wrap the image in a scratch pixmap header and let CopyArea sort it out.
+ */
 static void
-miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
-    DrawablePtr dst;
-    GCPtr	pGC;
-    int		depth, w, h, sx, sy, sw, sh, dx, dy;
-    unsigned int format;
-    char 	*data;
+doShmPutImage(DrawablePtr dst, GCPtr pGC,
+	      int depth, unsigned int format,
+	      int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
+	      char *data)
 {
-    PixmapPtr pmap;
-    GCPtr putGC;
-
-    putGC = GetScratchGC(depth, dst->pScreen);
-    if (!putGC)
-	return;
-    pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth,
-					 CREATE_PIXMAP_USAGE_SCRATCH);
-    if (!pmap)
-    {
-	FreeScratchGC(putGC);
+    PixmapPtr pPixmap;
+  
+    pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
+				     BitsPerPixel(depth),
+				     PixmapBytePad(w, depth),
+				     data);
+    if (!pPixmap)
 	return;
-    }
-    ValidateGC((DrawablePtr)pmap, putGC);
-    (*putGC->ops->PutImage)((DrawablePtr)pmap, putGC, depth, -sx, -sy, w, h, 0,
-			    (format == XYPixmap) ? XYPixmap : ZPixmap, data);
-    FreeScratchGC(putGC);
-    if (format == XYBitmap)
-	(void)(*pGC->ops->CopyPlane)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh,
-				     dx, dy, 1L);
-    else
-	(void)(*pGC->ops->CopyArea)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh,
-				    dx, dy);
-    (*pmap->drawable.pScreen->DestroyPixmap)(pmap);
+    pGC->ops->CopyArea((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy);
+    FreeScratchPixmapHeader(pPixmap);
 }
 
-_X_EXPORT void
-fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
-    DrawablePtr dst;
-    GCPtr	pGC;
-    int		depth, w, h, sx, sy, sw, sh, dx, dy;
-    unsigned int format;
-    char 	*data;
-{
-    if ((format == ZPixmap) || (depth == 1))
-    {
-	PixmapPtr pPixmap;
-
-	pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
-		BitsPerPixel(depth), PixmapBytePad(w, depth), (pointer)data);
-	if (!pPixmap)
-	    return;
-	if (format == XYBitmap)
-	    (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC,
-					 sx, sy, sw, sh, dx, dy, 1L);
-	else
-	    (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC,
-					sx, sy, sw, sh, dx, dy);
-	FreeScratchPixmapHeader(pPixmap);
-    }
-    else
-	miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
-		      data);
-}
-
-
 #ifdef PANORAMIX
 static int 
 ProcPanoramiXShmPutImage(register ClientPtr client)
@@ -940,13 +897,12 @@ ProcShmPutImage(client)
 			       shmdesc->addr + stuff->offset +
 			       (stuff->srcY * length));
     else
-	(*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
-			       pDraw, pGC, stuff->depth, stuff->format,
-			       stuff->totalWidth, stuff->totalHeight,
-			       stuff->srcX, stuff->srcY,
-			       stuff->srcWidth, stuff->srcHeight,
-			       stuff->dstX, stuff->dstY,
-                               shmdesc->addr + stuff->offset);
+	doShmPutImage(pDraw, pGC, stuff->depth, stuff->format,
+		      stuff->totalWidth, stuff->totalHeight,
+		      stuff->srcX, stuff->srcY,
+		      stuff->srcWidth, stuff->srcHeight,
+		      stuff->dstX, stuff->dstY,
+                      shmdesc->addr + stuff->offset);
 
     if (stuff->sendEvent)
     {
diff --git a/Xext/shmint.h b/Xext/shmint.h
index 33ab6a4..fc056bc 100644
--- a/Xext/shmint.h
+++ b/Xext/shmint.h
@@ -37,9 +37,6 @@ void
 ShmSetPixmapFormat(ScreenPtr pScreen, int format);
 
 void
-fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
-
-void
 ShmRegisterFbFuncs(ScreenPtr pScreen);
 
 #endif /* _SHMINT_H_ */
diff --git a/exa/exa.c b/exa/exa.c
index 100a1ec..ccf148a 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -924,13 +924,6 @@ exaDriverInit (ScreenPtr		pScreen,
     }
 #endif
 
-#ifdef MITSHM
-    /* Re-register with the MI funcs, which don't allow shared pixmaps.
-     * Shared pixmaps are almost always a performance loss for us, but this
-     * still allows for SHM PutImage.
-     */
-    ShmRegisterFuncs(pScreen, &exaShmFuncs);
-#endif
     /*
      * Hookup offscreen pixmaps
      */
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index d66dd47..3ec9625 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -245,104 +245,12 @@ exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
     return TRUE;
 }
 
-#ifdef MITSHM
-
-static Bool
-exaDoShmPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
-		 unsigned int format, int w, int h, int sx, int sy, int sw,
-		 int sh, int dx, int dy, char *data)
-{
-    int src_stride = PixmapBytePad(w, depth);
-
-    if (exaDoPutImage(pDrawable, pGC, depth, dx, dy, sw, sh, format, data +
-		      sy * src_stride + sx * BitsPerPixel(depth) / 8,
-		      src_stride))
-	return TRUE;
-
-    if (format == ZPixmap)
-    {
-	PixmapPtr pPixmap;
-
-	pPixmap = GetScratchPixmapHeader(pDrawable->pScreen, w, h, depth,
-		BitsPerPixel(depth), PixmapBytePad(w, depth), (pointer)data);
-	if (!pPixmap)
-	    return FALSE;
-
-	if (exaGCReadsDestination(pDrawable, pGC->planemask, pGC->fillStyle,
-				  pGC->alu))
-	    exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
-	else
-	    ExaDoPrepareAccess (pDrawable, EXA_PREPARE_DEST);
-	fbCopyArea((DrawablePtr)pPixmap, pDrawable, pGC, sx, sy, sw, sh, dx, dy);
-	exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
-
-	FreeScratchPixmapHeader(pPixmap);
-
-	return TRUE;
-    }
-
-    return FALSE;
-}
-
-/* The actual ShmPutImage isn't wrapped by the damage layer, so we need to
- * inform any interested parties of the damage incurred to the drawable.
- *
- * We also need to set the pending damage to ensure correct migration in all
- * cases.
- */
-void
-exaShmPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int format,
-	       int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
-	       char *data)
-{
-    PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
-    ExaPixmapPriv(pPixmap);
-    BoxRec box = { .x1 = pDrawable->x + dx, .y1 = pDrawable->y + dy,
-		   .x2 = pDrawable->x + dx + sw, .y2 = pDrawable->y + dy + sh };
-    RegionRec region;
-    int xoff, yoff;
-    RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
-
-    REGION_INIT(pScreen, &region, &box, 1);
-
-    exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
-
-    REGION_TRANSLATE(pScreen, &region, xoff, yoff);
-    REGION_UNION(pScreen, pending_damage, pending_damage, &region);
-
-    if (!exaDoShmPutImage(pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh,
-			  dx, dy, data)) {
-	if (exaGCReadsDestination(pDrawable, pGC->planemask, pGC->fillStyle,
-				  pGC->alu))
-	    exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
-	else
-	    ExaDoPrepareAccess (pDrawable, EXA_PREPARE_DEST);
-	fbShmPutImage(pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
-		      data);
-	exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
-    }
-
-    REGION_TRANSLATE(pScreen, &region, -xoff, -yoff);
-    DamageDamageRegion(pDrawable, &region);
-
-    REGION_UNINIT(pScreen, &region);
-}
-
-ShmFuncs exaShmFuncs = { NULL, exaShmPutImage };
-
-#endif
-
 static void
 exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
 	     int w, int h, int leftPad, int format, char *bits)
 {
-#ifdef MITSHM
-    if (!exaDoShmPutImage(pDrawable, pGC, depth, format, w, h, 0, 0, w, h, x, y,
-			  bits))
-#else
     if (!exaDoPutImage(pDrawable, pGC, depth, x, y, w, h, format, bits,
 		       PixmapBytePad(w, pDrawable->depth)))
-#endif
 	ExaCheckPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
 			 bits);
 }
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 21e6f0b..e4b6b54 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -320,20 +320,11 @@ exaFillRegionTiled (DrawablePtr	pDrawable, RegionPtr pRegion, PixmapPtr pTile,
 		    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu);
 
 void
-exaShmPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int format,
-	       int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
-	       char *data);
-
-void
 exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
 	     unsigned int format, unsigned long planeMask, char *d);
 
 extern const GCOps exaOps;
 
-#ifdef MITSHM
-extern ShmFuncs exaShmFuncs;
-#endif
-
 #ifdef RENDER
 void
 ExaCheckComposite (CARD8      op,
commit ef0780b7384b1d8257698b07091dd5214d64c4c1
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Aug 28 23:45:17 2008 -0400

    Attempt getpeercon() on remote sockets as well as local ones.
    (cherry picked from commit 60ad8d5d05485339e89d7f1f9f1ded75de7c7ea1)

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index a47df03..1d3449b 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -458,6 +458,7 @@ static void
 SELinuxLabelClient(ClientPtr client)
 {
     XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn;
+    int fd = _XSERVTransGetConnectionNumber(ci);
     SELinuxSubjectRec *subj;
     SELinuxObjectRec *obj;
     security_context_t ctx;
@@ -467,19 +468,20 @@ SELinuxLabelClient(ClientPtr client)
     obj = dixLookupPrivate(&client->devPrivates, objectKey);
     sidput(obj->sid);
 
+    /* Try to get a context from the socket */
+    if (fd < 0 || getpeercon(fd, &ctx) < 0) {
+	/* Otherwise, fall back to a default context */
+	if (selabel_lookup(label_hnd, &ctx, NULL, SELABEL_X_CLIENT) < 0)
+	    FatalError("SELinux: failed to look up remote-client context\n");
+    }
+
+    /* For local clients, try and determine the executable name */
     if (_XSERVTransIsLocal(ci)) {
-	int fd = _XSERVTransGetConnectionNumber(ci);
 	struct ucred creds;
 	socklen_t len = sizeof(creds);
 	char path[PATH_MAX + 1];
 	size_t bytes;
 
-	/* For local clients, can get context from the socket */
-	if (getpeercon(fd, &ctx) < 0)
-	    FatalError("SELinux: client %d: couldn't get context from socket\n",
-		       client->index);
-
-	/* Try and determine the client's executable name */
 	memset(&creds, 0, sizeof(creds));
 	if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &creds, &len) < 0)
 	    goto finish;
@@ -500,10 +502,7 @@ SELinuxLabelClient(ClientPtr client)
 
 	memcpy(subj->command, path, bytes);
 	subj->command[bytes - 1] = 0;
-    } else
-	/* For remote clients, need to use a default context */
-	if (selabel_lookup(label_hnd, &ctx, NULL, SELABEL_X_CLIENT) < 0)
-	    FatalError("SELinux: failed to look up remote-client context\n");
+    }
 
 finish:
     /* Get a SID from the context */


More information about the xorg-commit mailing list