xserver: Branch 'server-1.10-branch' - 6 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Sun Mar 27 22:42:28 PDT 2011


 Xi/xipassivegrab.c             |    4 ++--
 Xi/xiproperty.c                |    4 ++--
 configure.ac                   |    5 ++++-
 glx/glapi.c                    |    4 ++--
 glx/glapi.h                    |    2 +-
 glx/glthread.h                 |    2 +-
 hw/xfree86/common/xf86Xinput.c |    2 ++
 include/dix-config.h.in        |    3 +++
 include/xkbsrv.h               |    5 +++++
 xkb/XKBAlloc.c                 |   19 +++++++++++++++++++
 xkb/ddxLoad.c                  |   22 +++++++++++-----------
 xkb/xkb.c                      |   23 ++++++++++-------------
 12 files changed, 62 insertions(+), 33 deletions(-)

New commits:
commit a07c07dc6c921ffb9a729f5224c9de8ff237bf54
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Mar 18 11:06:57 2011 +1000

    xfree86: print out which driver is about to be used.
    
    Makes reading the log file a lot easier for those that don't magically
    recognise the log spew by the individual drivers.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    (cherry picked from commit fad10cb38ef2433c82f8a43d3b7d64e323728060)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index e3264e6..2bac33a 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -775,6 +775,8 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
         goto unwind;
     }
 
+    xf86Msg(X_INFO, "Using input driver '%s' for '%s'\n", drv->driverName, pInfo->name);
+
     if (!drv->PreInit) {
         xf86Msg(X_ERROR,
                 "Input driver `%s' has no PreInit function (ignoring)\n",
commit 4edf97ad4f99a78d2131bef54a8692c3a35b1c97
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Mar 22 19:01:48 2011 -0700

    GLX: Support TLS with better portability
    
    AX_TLS detects when toolchains support __thread or __declspec(thread),
    but existing code assumed __thread.
    
    This also adds a check to configure.ac to error out if TLS is requested
    but unsupported.
    
    Found-by: Tinderbox
    http://tinderbox.x.org/builds/2011-03-22-0007
    
    Regression-from: 82b1eaa6cad20f39dbf15573bdb3d62acbcd91f9
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Tom Fogal <tfogal at alumni.unh.edu>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    (cherry picked from commit c55baebf4ebf1887262cc16899eb297b9f284f6e)

diff --git a/configure.ac b/configure.ac
index 0a06391..61224b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -599,7 +599,10 @@ AC_ARG_ENABLE(aiglx,          AS_HELP_STRING([--enable-aiglx], [Build accelerate
                                 [AIGLX=yes])
 AX_TLS
 AC_ARG_ENABLE(glx-tls,        AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: auto)]),
-                                [GLX_USE_TLS=$enableval],
+                                [GLX_USE_TLS=$enableval
+                                 if test "x$GLX_USE_TLS" = "xyes" && test "${ac_cv_tls}" = "none" ; then
+                                   AC_MSG_ERROR([GLX with TLS support requested, but the compiler does not support it.])
+                                 fi],
                                 [GLX_USE_TLS=no
                                  if test "${ac_cv_tls}" != "none" ; then
                                    GLX_USE_TLS=yes
diff --git a/glx/glapi.c b/glx/glapi.c
index d6a568e..d9bd04d 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -190,11 +190,11 @@ static GLint NoOpUnused(void)
 /*@{*/
 #if defined(GLX_USE_TLS)
 
-PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch
+PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch
     __attribute__((tls_model("initial-exec")))
     = (struct _glapi_table *) __glapi_noop_table;
 
-PUBLIC __thread void * _glapi_tls_Context
+PUBLIC TLS void * _glapi_tls_Context
     __attribute__((tls_model("initial-exec")));
 
 PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL;
diff --git a/glx/glapi.h b/glx/glapi.h
index 8f2cf66..ab80f7e 100644
--- a/glx/glapi.h
+++ b/glx/glapi.h
@@ -83,7 +83,7 @@ typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
 const extern void *_glapi_Context;
 const extern struct _glapi_table *_glapi_Dispatch;
 
-extern __thread void * _glapi_tls_Context
+extern TLS void * _glapi_tls_Context
     __attribute__((tls_model("initial-exec")));
 
 # define GET_CURRENT_CONTEXT(C)  GLcontext *C = (GLcontext *) _glapi_tls_Context
diff --git a/glx/glthread.h b/glx/glthread.h
index e2765ce..78f149f 100644
--- a/glx/glthread.h
+++ b/glx/glthread.h
@@ -300,7 +300,7 @@ _glthread_SetTSD(_glthread_TSD *, void *);
 
 #if defined(GLX_USE_TLS)
 
-extern __thread struct _glapi_table * _glapi_tls_Dispatch
+extern TLS struct _glapi_table * _glapi_tls_Dispatch
     __attribute__((tls_model("initial-exec")));
 
 #define GET_DISPATCH() _glapi_tls_Dispatch
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 5622766..d81264d 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -441,6 +441,9 @@
 /* Define to 1 if you have the `ffs' function. */
 #undef HAVE_FFS
 
+/* If the compiler supports a TLS storage class define it to that here */
+#undef TLS
+
 /* Correctly set _XSERVER64 for OSX fat binaries */
 #ifdef __APPLE__
 #include "dix-config-apple-verbatim.h"
commit b8e8579df592c050dfab2dc45f5004b67dbb965e
Author: Rami Ylimäki <rami.ylimaki at vincit.fi>
Date:   Wed Mar 9 15:45:40 2011 +0200

    xkb: Initialize pad bytes sent in replies of geometry requests.
    
    Valgrind complains about uninitialized data being written to clients.
    
    Reviewed-by: Erkki Seppälä <erkki.seppala at vincit.fi>
    Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit dc9ce695a69ca0787f58f8d160212a7a41acb703)

diff --git a/xkb/xkb.c b/xkb/xkb.c
index 63eb46a..a8d0e80 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -4310,7 +4310,7 @@ ProcXkbSetNames(ClientPtr client)
 static char *
 XkbWriteCountedString(char *wire,char *str,Bool swap)
 {
-    CARD16 len,*pLen;
+    CARD16 len,*pLen, paddedLen;
 
     if (!str)
         return wire;
@@ -4322,8 +4322,9 @@ XkbWriteCountedString(char *wire,char *str,Bool swap)
 	register int n;
 	swaps(pLen,n);
     }
-    memcpy(&wire[2],str,len);
-    wire+= ((2+len+3)/4)*4;
+    paddedLen= pad_to_int32(sizeof(len)+len)-sizeof(len);
+    strncpy(&wire[sizeof(len)],str,paddedLen);
+    wire+= sizeof(len)+paddedLen;
     return wire;
 }
 
@@ -4434,6 +4435,7 @@ xkbShapeWireDesc *	shapeWire;
 	if (shape->approx!=NULL)
 	     shapeWire->approxNdx= XkbOutlineIndex(shape,shape->approx);
 	else shapeWire->approxNdx= XkbNoShape;
+	shapeWire->pad= 0;
 	if (swap) {
 	    register int n;
 	    swapl(&shapeWire->name,n);
@@ -4446,6 +4448,7 @@ xkbShapeWireDesc *	shapeWire;
 	    olWire= (xkbOutlineWireDesc *)wire;
 	    olWire->nPoints= ol->num_points;
 	    olWire->cornerRadius= ol->corner_radius;
+	    olWire->pad= 0;
 	    wire= (char *)&olWire[1];
 	    ptWire= (xkbPointWireDesc *)wire;
 	    for (p=0,pt=ol->points;p<ol->num_points;p++,pt++) {
@@ -4559,6 +4562,8 @@ xkbOverlayWireDesc *	olWire;
    olWire= (xkbOverlayWireDesc *)wire;
    olWire->name= ol->name;
    olWire->nRows= ol->num_rows;
+   olWire->pad1= 0;
+   olWire->pad2= 0;
    if (swap) {
 	register int n;
 	swapl(&olWire->name,n);
@@ -4571,6 +4576,7 @@ xkbOverlayWireDesc *	olWire;
 	rowWire= (xkbOverlayRowWireDesc *)wire;
 	rowWire->rowUnder= row->row_under;
 	rowWire->nKeys= row->num_keys;
+	rowWire->pad1= 0;
 	wire= (char *)&rowWire[1];
 	for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
 	    xkbOverlayKeyWireDesc *	keyWire;
commit e22497eddc54967e892fbe99f2c4239b4504daf6
Author: Rami Ylimäki <rami.ylimaki at vincit.fi>
Date:   Fri Mar 11 14:30:49 2011 +0200

    xkb: Release XKB component names when compiling keymap.
    
    Reviewed-by: Erkki Seppälä <erkki.seppala at vincit.fi>
    Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 5c47f8beac7f87680c6f7331483b9cf94a1dbc86)

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 9f1507e..34ef574 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -447,6 +447,11 @@ extern _X_EXPORT void	XkbFreeKeyboard(
 	Bool			/* freeDesc */
 );
 
+extern _X_EXPORT void	XkbFreeComponentNames(
+	XkbComponentNamesPtr	/* names */,
+	Bool			/* freeNames */
+);
+
 extern _X_EXPORT  void XkbSetActionKeyMods(
 	XkbDescPtr		/* xkb */,
 	XkbAction *		/* act */,
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index bffd60f..b70ac17 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -333,3 +333,22 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
 	free(xkb);
     return;
 }
+
+
+/***====================================================================***/
+
+void
+XkbFreeComponentNames(XkbComponentNamesPtr names, Bool freeNames)
+{
+    if (names)
+    {
+        free(names->keycodes);
+        free(names->types);
+        free(names->compat);
+        free(names->symbols);
+        free(names->geometry);
+        memset(names, 0, sizeof(XkbComponentNamesRec));
+    }
+    if (freeNames)
+        free(names);
+}
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index ac587fc..a935698 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -446,23 +446,23 @@ XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbComponentNamesPtr kccg
 static XkbDescPtr
 XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, int need)
 {
-    XkbDescPtr xkb;
+    XkbDescPtr xkb = NULL;
     unsigned int provided;
-    XkbComponentNamesRec kccgst;
+    XkbComponentNamesRec kccgst = {0};
     char name[PATH_MAX];
 
-    if (!XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst))
-        return NULL;
-
-    provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
-                                       &xkb, name, PATH_MAX);
-    if ((need & provided) != need) {
-        if (xkb) {
-            XkbFreeKeyboard(xkb, 0, TRUE);
-            xkb = NULL;
+    if (XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst)) {
+        provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
+                                           &xkb, name, PATH_MAX);
+        if ((need & provided) != need) {
+            if (xkb) {
+                XkbFreeKeyboard(xkb, 0, TRUE);
+                xkb = NULL;
+            }
         }
     }
 
+    XkbFreeComponentNames(&kccgst, FALSE);
     return xkb;
 }
 
diff --git a/xkb/xkb.c b/xkb/xkb.c
index a57139f..63eb46a 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -5897,16 +5897,7 @@ ProcXkbGetKbdByName(ClientPtr client)
 	XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
 	new= NULL;
     }
-    free(names.keycodes);
-    names.keycodes = NULL;
-    free(names.types);
-    names.types = NULL;
-    free(names.compat);
-    names.compat = NULL;
-    free(names.symbols);
-    names.symbols = NULL;
-    free(names.geometry);
-    names.geometry = NULL;
+    XkbFreeComponentNames(&names, FALSE);
     return Success;
 }
 
commit a96fd08b406b9955ff0d5c02f4a50f4fb2acf40e
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Mar 8 14:41:21 2011 +1000

    Xi: fix XI2 passive grab reply length calculation
    
    If modifiers failed, the reply length was 4 bytes too short.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 33fee13361e745e1db29e250b08622c83046d488)

diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index e99b6e5..4b71c68 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -194,7 +194,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
             info->status = status;
             info->modifiers = *modifiers;
             rep.num_modifiers++;
-            rep.length++;
+            rep.length += bytes_to_int32(sizeof(xXIGrabModifierInfo));
         }
     }
 
@@ -202,7 +202,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
     if (rep.num_modifiers)
     {
 	client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
-        WriteSwappedDataToClient(client, rep.num_modifiers * 4, (char*)modifiers_failed);
+        WriteSwappedDataToClient(client, rep.length * 4, (char*)modifiers_failed);
     }
     free(modifiers_failed);
     return ret;
commit 09f6d85b5bb49406f015ec667bb6efb3e710ced2
Author: Julien Cristau <jcristau at debian.org>
Date:   Mon Mar 7 18:55:19 2011 +0100

    Xi: fix length checks for swapped clients
    
    ChangeDeviceProperty and XIChangeProperty are followed by some data, so
    use REQUEST_AT_LEAST_SIZE instead of REQUEST_SIZE_MATCH.
    
    X.Org bug#35082 <https://bugs.freedesktop.org/show_bug.cgi?id=35082>
    
    Reported-by: Markus Fleschutz <markus.fleschutz at x-software.com>
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit eb8141b6edd8b477c0ba796be71e985c35520a9b)

diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 17835e2..83ce930 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -1051,11 +1051,11 @@ SProcXChangeDeviceProperty (ClientPtr client)
     char n;
     REQUEST(xChangeDevicePropertyReq);
 
+    REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
     swaps(&stuff->length, n);
     swapl(&stuff->property, n);
     swapl(&stuff->type, n);
     swapl(&stuff->nUnits, n);
-    REQUEST_SIZE_MATCH(xChangeDevicePropertyReq);
     return (ProcXChangeDeviceProperty(client));
 }
 
@@ -1295,12 +1295,12 @@ SProcXIChangeProperty(ClientPtr client)
     char n;
     REQUEST(xXIChangePropertyReq);
 
+    REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
     swaps(&stuff->length, n);
     swaps(&stuff->deviceid, n);
     swapl(&stuff->property, n);
     swapl(&stuff->type, n);
     swapl(&stuff->num_items, n);
-    REQUEST_SIZE_MATCH(xXIChangePropertyReq);
     return (ProcXIChangeProperty(client));
 }
 


More information about the xorg-commit mailing list