xserver: Branch 'server-1.17-branch' - 19 commits

Adam Jackson ajax at kemper.freedesktop.org
Fri Jul 31 11:47:53 PDT 2015


 Xext/xace.c                   |   15 +++++++++++++++
 Xext/xace.h                   |    3 +++
 Xi/exevents.c                 |   12 ++++++++++++
 dix/Xserver.d                 |    5 ++++-
 dix/dispatch.c                |    5 +----
 dix/events.c                  |    8 +-------
 dix/getevents.c               |    7 +------
 dix/resource.c                |    5 +----
 fb/fb.h                       |    5 -----
 glx/glxdriswrast.c            |   37 ++++++++++++++++++++++++++++++++++---
 hw/dmx/config/dmxparse.h      |    3 ++-
 hw/dmx/config/dmxprint.c      |   20 ++++----------------
 hw/dmx/dmx.c                  |    1 +
 hw/dmx/dmxcb.c                |    3 ---
 hw/dmx/dmxfont.h              |    2 --
 hw/dmx/dmxgc.c                |    4 ++--
 hw/dmx/dmxgc.h                |    4 ++--
 hw/dmx/dmxinit.c              |   42 +++++++++++++++++++++---------------------
 hw/dmx/dmxpict.c              |    1 -
 hw/dmx/dmxprop.c              |    6 +++---
 hw/dmx/dmxscrinit.c           |    1 -
 hw/dmx/dmxwindow.c            |    4 ----
 hw/dmx/glxProxy/compsize.h    |    7 +++++++
 hw/dmx/glxProxy/g_disptab.h   |   21 ++++++++++++++++++++-
 hw/dmx/glxProxy/glxcmds.c     |    7 +++----
 hw/dmx/glxProxy/glxcmds.h     |    6 ++++++
 hw/dmx/glxProxy/glxcmdsswap.c |    2 --
 hw/dmx/glxProxy/glxext.h      |    1 +
 hw/dmx/glxProxy/glxscreens.c  |    6 +++---
 hw/dmx/glxProxy/glxscreens.h  |    2 ++
 hw/dmx/glxProxy/glxserver.h   |    8 --------
 hw/dmx/glxProxy/glxsingle.c   |    6 ++----
 hw/dmx/glxProxy/glxsingle.h   |    4 ----
 hw/dmx/glxProxy/glxswap.c     |    4 +---
 hw/dmx/glxProxy/glxvendor.c   |    6 ++----
 hw/dmx/input/dmxinputinit.c   |   10 +++++-----
 include/Makefile.am           |    1 +
 include/probes.h              |   41 +++++++++++++++++++++++++++++++++++++++++
 mi/mieq.c                     |    2 +-
 mi/miexpose.c                 |   13 +++++++++----
 os/connection.c               |   12 +++---------
 41 files changed, 214 insertions(+), 138 deletions(-)

New commits:
commit 061ff2621ccc8560d15fb804eff68a3e15c1b5d1
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 15 11:27:31 2015 -0400

    glx/swrast: Do more GLX extension setup
    
    This gets you nice things like core contexts when using Xvfb.
    
    Also, no, MESA_copy_sub_buffer is not enabled automatically.
    
    Reviewed-by: James Jones <jajones at nvidia.com>
    Reviewed-by: Jon Turney <jon.turney at dronecode.org.uk>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 2d7194334a9f84e417ec90e220b2fe476f704612)

diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 5d9aa04..e25ca47 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -71,6 +71,8 @@ struct __GLXDRIscreen {
     const __DRIcopySubBufferExtension *copySubBuffer;
     const __DRItexBufferExtension *texBuffer;
     const __DRIconfig **driConfigs;
+
+    unsigned char glx_enable_bits[__GLX_EXT_BYTES];
 };
 
 struct __GLXDRIcontext {
@@ -394,21 +396,34 @@ initializeExtensions(__GLXDRIscreen * screen)
     const __DRIextension **extensions;
     int i;
 
+    if (screen->swrast->base.version >= 3) {
+        __glXEnableExtension(screen->glx_enable_bits,
+                             "GLX_ARB_create_context");
+        __glXEnableExtension(screen->glx_enable_bits,
+                             "GLX_ARB_create_context_profile");
+        __glXEnableExtension(screen->glx_enable_bits,
+                             "GLX_EXT_create_context_es2_profile");
+    }
+
+    /* these are harmless to enable unconditionally */
+    __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_framebuffer_sRGB");
+    __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_fbconfig_float");
+    __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_make_current_read");
+
     extensions = screen->core->getExtensions(screen->driScreen);
 
     for (i = 0; extensions[i]; i++) {
         if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
             screen->copySubBuffer =
                 (const __DRIcopySubBufferExtension *) extensions[i];
-            /* GLX_MESA_copy_sub_buffer is always enabled. */
+            __glXEnableExtension(screen->glx_enable_bits,
+                                 "GLX_MESA_copy_sub_buffer");
         }
 
         if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
             screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
             /* GLX_EXT_texture_from_pixmap is always enabled. */
         }
-
-        /* Ignore unknown extensions */
     }
 }
 
@@ -420,6 +435,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 {
     const char *driverName = "swrast";
     __GLXDRIscreen *screen;
+    size_t buffer_size;
 
     screen = calloc(1, sizeof *screen);
     if (screen == NULL)
@@ -431,6 +447,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     screen->base.swapInterval = NULL;
     screen->base.pScreen = pScreen;
 
+    __glXInitExtensionEnableBits(screen->glx_enable_bits);
+
     screen->driver = glxProbeDriver(driverName,
                                     (void **) &screen->core,
                                     __DRI_CORE, 1,
@@ -459,6 +477,19 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     __glXScreenInit(&screen->base, pScreen);
 
+    /* The first call simply determines the length of the extension string.
+     * This allows us to allocate some memory to hold the extension string,
+     * but it requires that we call __glXGetExtensionString a second time.
+     */
+    buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
+    if (buffer_size > 0) {
+        free(screen->base.GLXextensions);
+
+        screen->base.GLXextensions = xnfalloc(buffer_size);
+        (void) __glXGetExtensionString(screen->glx_enable_bits,
+                                       screen->base.GLXextensions);
+    }
+
     screen->base.GLXmajor = 1;
     screen->base.GLXminor = 4;
 
commit 9e744ac376396ef032f44fba69f7e34d78f04abc
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 2 13:58:30 2015 -0400

    fb: Make rootless-agnostic
    
    Reviewed-by: Jasper St. Pierre <jstpierre at mecheye.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 315661a425018a546f7bcc18ad3e5f4578473ca6)

diff --git a/fb/fb.h b/fb/fb.h
index ab110f3..c687aa7 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -472,13 +472,8 @@ typedef struct {
 #define fbGetWindowPixmap(pWin)	((PixmapPtr)\
 				 dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey(pWin)))
 
-#ifdef ROOTLESS
 #define __fbPixDrawableX(pPix)	((pPix)->drawable.x)
 #define __fbPixDrawableY(pPix)	((pPix)->drawable.y)
-#else
-#define __fbPixDrawableX(pPix)	0
-#define __fbPixDrawableY(pPix)	0
-#endif
 
 #ifdef COMPOSITE
 #define __fbPixOffXWin(pPix)	(__fbPixDrawableX(pPix) - (pPix)->screen_x)
commit b46ff18b247f75b33408fe34118b8a86a0f77e45
Author: Julien Cristau <jcristau at debian.org>
Date:   Thu Jul 2 20:16:21 2015 +0200

    mi: fix typo in warning about overflowing queue
    
    Debian bug#726041
    
    Reported-by: Vincent Hobeïka <vincent.hobeika at gmail.com>
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit ac94cdb9df94dd26688de6d3d9143ac48f7b3c7b)

diff --git a/mi/mieq.c b/mi/mieq.c
index 8907a6e..b7be193 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -599,7 +599,7 @@ mieqProcessInputEvents(void)
         ErrorF("[mi] EQ processing has resumed after %lu dropped events.\n",
                (unsigned long) miEventQueue.dropped);
         ErrorF
-            ("[mi] This may be caused my a misbehaving driver monopolizing the server's resources.\n");
+            ("[mi] This may be caused by a misbehaving driver monopolizing the server's resources.\n");
         miEventQueue.dropped = 0;
     }
 
commit df4f69d4624b60c9a463712a81cce4e48175e4ae
Author: Peter Harris <pharris at opentext.com>
Date:   Tue May 12 14:19:15 2015 -0400

    Fix border tile origin when background is ParentRelative
    
    According to
    http://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html#requests:CreateWindow
    "The border tile origin is always the same as the background tile
    origin."
    
    ChangeWindowAttributes goes to some effort to make sure it repaints
    the border tile whenever the background origin may have changed, but
    miPaintWindow was ignoring the background origin.
    
    Found by xts XChangeWindowAttributes-3
    
    Signed-off-by: Peter Harris <pharris at opentext.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit b4061cf5f76241157b2dc81dec053012075311c0)

diff --git a/mi/miexpose.c b/mi/miexpose.c
index fc4dbc0..3e49f15 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -478,14 +478,21 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     else {
         PixmapPtr pixmap;
 
-        tile_x_off = drawable->x;
-        tile_y_off = drawable->y;
+        fill = pWin->border;
+        solid = pWin->borderIsPixel;
 
         /* servers without pixmaps draw their own borders */
         if (!pScreen->GetWindowPixmap)
             return;
         pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
         drawable = &pixmap->drawable;
+
+        while (pWin->backgroundState == ParentRelative)
+            pWin = pWin->parent;
+
+        tile_x_off = pWin->drawable.x;
+        tile_y_off = pWin->drawable.y;
+
 #ifdef COMPOSITE
         draw_x_off = pixmap->screen_x;
         draw_y_off = pixmap->screen_y;
@@ -495,8 +502,6 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
         draw_x_off = 0;
         draw_y_off = 0;
 #endif
-        fill = pWin->border;
-        solid = pWin->borderIsPixel;
     }
 
     gcval[0].val = GXcopy;
commit d23171754a6c4f7361ac5aed64eaa29222b32df2
Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Thu Jun 4 13:24:53 2015 -0500

    dix: Send KeyPress and KeyRelease events to the XACE_KEY_AVAIL hook
    
    While it's documented in the XACE spec, the XACE_KEY_AVAIL hook is
    currently never actually invoked by the xserver.
    
    This hook was added in 13c6713c82 (25 Aug 2006), but as the keyboard
    processing was moved into XKB, the hook was forgotten and silently
    dropped. The code calling this hook was removed by 7af53799c (4 Jan
    2009), but it was probably already unused before that.
    
    This patch re-adds support for this hook. The "count" hook parameter is
    unused.
    
    Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
    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 990cf5b2828f73dc7a07f1e38f608af39acfd81d)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 0857bce..21fb696 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1730,6 +1730,18 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
         break;
     }
 
+    /* send KeyPress and KeyRelease events to XACE plugins */
+    if (XaceHookIsSet(XACE_KEY_AVAIL) &&
+            (event->type == ET_KeyPress || event->type == ET_KeyRelease)) {
+        xEvent *core;
+        int count;
+
+        if (EventToCore(ev, &core, &count) == Success && count > 0) {
+            XaceHook(XACE_KEY_AVAIL, core, device, 0);
+            free(core);
+        }
+    }
+
     if (DeviceEventCallback && !syncEvents.playingEvents) {
         DeviceEventInfoRec eventinfo;
         SpritePtr pSprite = device->spriteInfo->sprite;
commit 918032905433f64320dc4c222228c008bbd50cd2
Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Thu Jun 4 13:23:19 2015 -0500

    xace: Add XaceHookIsSet helper function
    
    Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
    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 5dc2a9aae46352f1f35d3ba122da04727789a15d)

diff --git a/Xext/xace.c b/Xext/xace.c
index d77b312..b3c67f6 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -213,6 +213,21 @@ XaceHook(int hook, ...)
     return prv ? *prv : Success;
 }
 
+/* XaceHookIsSet
+ *
+ * Utility function to determine whether there are any callbacks listening on a
+ * particular XACE hook.
+ *
+ * Returns non-zero if there is a callback, zero otherwise.
+ */
+int
+XaceHookIsSet(int hook)
+{
+    if (hook < 0 || hook >= XACE_NUM_HOOKS)
+        return 0;
+    return XaceHooks[hook] != NULL;
+}
+
 /* XaceCensorImage
  *
  * Called after pScreen->GetImage to prevent pieces or trusted windows from
diff --git a/Xext/xace.h b/Xext/xace.h
index 5e6cb04..3303f76 100644
--- a/Xext/xace.h
+++ b/Xext/xace.h
@@ -65,6 +65,9 @@ extern _X_EXPORT int XaceHook(int /*hook */ ,
                               ...       /*appropriate args for hook */
     );
 
+/* determine whether any callbacks are present for the XACE hook */
+extern _X_EXPORT int XaceHookIsSet(int hook);
+
 /* Special-cased hook functions
  */
 extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
commit 3f26c837262c4d15f18a6974ea15660f24ce94c1
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 22:38:26 2014 -0800

    dmx: include header for DMXExtensionInit() in dmx.c
    
    Gets rid of gcc 4.8 warning:
    
    dmx.c:1193:1: warning: no previous prototype for ‘DMXExtensionInit’ [-Wmissing-prototypes]
     DMXExtensionInit(void)
     ^
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 4a758f59a8a65c313244e06852745c8e180ff247)

diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index 99e970c..2988df3 100644
--- a/hw/dmx/dmx.c
+++ b/hw/dmx/dmx.c
@@ -55,6 +55,7 @@
 #include "extinit.h"
 #include "opaque.h"
 
+#include "dmx.h"
 #include "dmxextension.h"
 #include <X11/extensions/dmxproto.h>
 #include <X11/extensions/dmx.h>
commit cb7ee9808a18057f534d6b8025b950f5f7275749
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 22:33:54 2014 -0800

    dmx: constify GCOps & GCFuncs pointers
    
    Gets rid of 16 instances of gcc 4.8 warnings:
    
    In file included from dmxgc.c:41:0:
    dmx.h:327:23: warning: assignment discards ‘const’ qualifier from
     pointer target type [enabled by default]
         (_saved)->_entry  = (_actual)->_entry;    \
                           ^
    dmxgc.h:80:5: note: in expansion of macro ‘DMX_WRAP’
         DMX_WRAP(funcs, &dmxGCFuncs, _pGCPriv, (_pGC));   \
         ^
    dmxgc.c:192:5: note: in expansion of macro ‘DMX_GC_FUNC_EPILOGUE’
         DMX_GC_FUNC_EPILOGUE(pGC);
         ^
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit a0e44ddfb0c641e7896a55abf26621ae3d17e337)

diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index 2343167..ec15d27 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -49,7 +49,7 @@
 #include "pixmapstr.h"
 #include "migc.h"
 
-static GCFuncs dmxGCFuncs = {
+static const GCFuncs dmxGCFuncs = {
     dmxValidateGC,
     dmxChangeGC,
     dmxCopyGC,
@@ -59,7 +59,7 @@ static GCFuncs dmxGCFuncs = {
     dmxCopyClip,
 };
 
-static GCOps dmxGCOps = {
+static const GCOps dmxGCOps = {
     dmxFillSpans,
     dmxSetSpans,
     dmxPutImage,
diff --git a/hw/dmx/dmxgc.h b/hw/dmx/dmxgc.h
index c8ecb53..c5c6b77 100644
--- a/hw/dmx/dmxgc.h
+++ b/hw/dmx/dmxgc.h
@@ -41,8 +41,8 @@
 
 /** GC private area. */
 typedef struct _dmxGCPriv {
-    GCOps *ops;
-    GCFuncs *funcs;
+    const GCOps *ops;
+    const GCFuncs *funcs;
     XlibGC gc;
     Bool msc;
 } dmxGCPrivRec, *dmxGCPrivPtr;
commit 03dd982d2b28f5959d5dc31ec45bff3ee5a0c82c
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 22:20:24 2014 -0800

    dmx: Mark glxIsExtensionSupported as a const char *
    
    Gets rid of 9 instances of gcc 4.8 warning:
    
    glxcmds.c: In function ‘CreateContext’:
    glxcmds.c:378:13: warning: passing argument 1 of ‘glxIsExtensionSupported’
     discards ‘const’ qualifier from pointer target type [enabled by default]
                 else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
                 ^
    In file included from glxserver.h:49:0,
                     from glxcmds.c:41:
    glxscreens.h:53:12: note: expected ‘char *’ but argument is of type
     ‘const char *’
     extern int glxIsExtensionSupported(char *ext);
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 9682c47e228962e4008855c4da7467748742685e)

diff --git a/hw/dmx/glxProxy/glxscreens.c b/hw/dmx/glxProxy/glxscreens.c
index b62776c..15bb1e8 100644
--- a/hw/dmx/glxProxy/glxscreens.c
+++ b/hw/dmx/glxProxy/glxscreens.c
@@ -335,7 +335,7 @@ __glXGetServerString(unsigned int name)
 }
 
 int
-glxIsExtensionSupported(char *ext)
+glxIsExtensionSupported(const char *ext)
 {
     return (strstr(ExtensionsString, ext) != NULL);
 }
diff --git a/hw/dmx/glxProxy/glxscreens.h b/hw/dmx/glxProxy/glxscreens.h
index 9a538d1..bb7477b 100644
--- a/hw/dmx/glxProxy/glxscreens.h
+++ b/hw/dmx/glxProxy/glxscreens.h
@@ -50,6 +50,6 @@ extern void __glXScreenReset(void);
 
 extern char *__glXGetServerString(unsigned int name);
 
-extern int glxIsExtensionSupported(char *ext);
+extern int glxIsExtensionSupported(const char *ext);
 
 #endif                          /* !__GLX_screens_h__ */
commit 78df8521cfd8a279da15c7d267de5c9fe1108d4a
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 22:16:49 2014 -0800

    dmx: remove redundant redeclarations of variables from other headers
    
    Gets rid of these gcc 4.8 warnings:
    
    dmxcb.c:50:12: warning: redundant redeclaration of ‘PanoramiXPixWidth’
     [-Wredundant-decls]
     extern int PanoramiXPixWidth;
                ^
    In file included from dmxcb.c:49:0:
    ../../Xext/panoramiXsrv.h:12:22: note: previous declaration of
     ‘PanoramiXPixWidth’ was here
     extern _X_EXPORT int PanoramiXPixWidth;
                          ^
    dmxcb.c:51:12: warning: redundant redeclaration of ‘PanoramiXPixHeight’
     [-Wredundant-decls]
     extern int PanoramiXPixHeight;
                ^
    In file included from dmxcb.c:49:0:
    ../../Xext/panoramiXsrv.h:13:22: note: previous declaration of
     ‘PanoramiXPixHeight’ was here
     extern _X_EXPORT int PanoramiXPixHeight;
                          ^
    dmxcb.c:52:12: warning: redundant redeclaration of ‘PanoramiXNumScreens’
     [-Wredundant-decls]
     extern int PanoramiXNumScreens;
                ^
    In file included from dmxcb.c:49:0:
    ../../Xext/panoramiXsrv.h:11:22: note: previous declaration of
     ‘PanoramiXNumScreens’ was here
     extern _X_EXPORT int PanoramiXNumScreens;
                          ^
    
    dmxpict.c:60:12: warning: redundant redeclaration of ‘RenderErrBase’
     [-Wredundant-decls]
     extern int RenderErrBase;
                ^
    In file included from ../../render/glyphstr.h:29:0,
                     from ../../render/picturestr.h:28,
                     from dmx.h:65,
                     from dmxpict.c:42:
    ../../render/picture.h:176:22: note: previous declaration of ‘RenderErrBase’
     was here
     extern _X_EXPORT int RenderErrBase;
                          ^
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 45ec646d77086eeb5f94766b055a93b5c75bdef0)

diff --git a/hw/dmx/dmxcb.c b/hw/dmx/dmxcb.c
index 86015f3..cca5702 100644
--- a/hw/dmx/dmxcb.c
+++ b/hw/dmx/dmxcb.c
@@ -47,9 +47,6 @@ extern int connBlockScreenStart;
 
 #ifdef PANORAMIX
 #include "panoramiXsrv.h"
-extern int PanoramiXPixWidth;
-extern int PanoramiXPixHeight;
-extern int PanoramiXNumScreens;
 #endif
 
 int dmxGlobalWidth, dmxGlobalHeight;
diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 64d0ae1..aaca178 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -57,7 +57,6 @@
 #include "mipict.h"
 #include "fbpict.h"
 
-extern int RenderErrBase;
 extern int (*ProcRenderVector[RenderNumberRequests]) (ClientPtr);
 
 static int (*dmxSaveRenderVector[RenderNumberRequests]) (ClientPtr);
commit 3af41608228a796ff51698b9a6b6e74aa7cd67ba
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 22:13:28 2014 -0800

    dmx: remove redundant declaration of dmxFontPrivateIndex from dmxfont.h
    
    Gets rid of 8 instances of gcc 4.8 warning:
    
    In file included from glxcmds.c:38:0:
    ../../../hw/dmx/dmxfont.h:57:12: warning: redundant redeclaration of
     ‘dmxFontPrivateIndex’ [-Wredundant-decls]
     extern int dmxFontPrivateIndex;
                ^
    In file included from glxcmds.c:35:0:
    ../../../hw/dmx/dmx.h:388:12: note: previous declaration of
     ‘dmxFontPrivateIndex’ was here
     extern int dmxFontPrivateIndex;        /**< Private index for Fonts     */
                ^
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 1033b85196e0f25877b4b9081993aff16bf32138)

diff --git a/hw/dmx/dmxfont.h b/hw/dmx/dmxfont.h
index 8575ca9..66c6633 100644
--- a/hw/dmx/dmxfont.h
+++ b/hw/dmx/dmxfont.h
@@ -54,6 +54,4 @@ extern Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont);
 extern Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont);
 extern Bool dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont);
 
-extern int dmxFontPrivateIndex;
-
 #endif                          /* DMXFONT_H */
commit 649f37fa01f7a2d471858609d47f297cdb8615d0
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 22:09:14 2014 -0800

    dmx: glxproxy prototype cleanup
    
    Gets rid of 107 -Wmissing-prototypes & -Wredundant-decls warnings
    from gcc 4.8
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit ac64a653fb4935a799baca7545ba6ca401e20fa1)

diff --git a/hw/dmx/glxProxy/compsize.h b/hw/dmx/glxProxy/compsize.h
index 3609662..5e759b0 100644
--- a/hw/dmx/glxProxy/compsize.h
+++ b/hw/dmx/glxProxy/compsize.h
@@ -48,4 +48,11 @@ extern GLint __glTexGeniv_size(GLenum e);
 extern GLint __glTexParameterfv_size(GLenum e);
 extern GLint __glTexParameteriv_size(GLenum e);
 
+extern GLint __glCallLists_size(GLsizei n, GLenum type);
+extern GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h);
+extern GLint __glBitmap_size(GLsizei w, GLsizei h);
+extern GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w);
+extern GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h);
+extern GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d);
+
 #endif                          /* !__compsize_h__ */
diff --git a/hw/dmx/glxProxy/g_disptab.h b/hw/dmx/glxProxy/g_disptab.h
index 5303387..783f87a 100644
--- a/hw/dmx/glxProxy/g_disptab.h
+++ b/hw/dmx/glxProxy/g_disptab.h
@@ -655,7 +655,6 @@ extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *);
 extern void __glXDispSwap_SeparableFilter2D(GLbyte *);
 extern void __glXDispSwap_TexImage3D(GLbyte *);
 extern void __glXDispSwap_TexSubImage3D(GLbyte *);
-extern void __glXDispSwap_DrawArrays(GLbyte *);
 extern void __glXDispSwap_PrioritizeTextures(GLbyte *);
 extern void __glXDispSwap_CopyTexImage1D(GLbyte *);
 extern void __glXDispSwap_CopyTexImage2D(GLbyte *);
@@ -663,6 +662,26 @@ extern void __glXDispSwap_CopyTexSubImage1D(GLbyte *);
 extern void __glXDispSwap_CopyTexSubImage2D(GLbyte *);
 extern void __glXDispSwap_CopyTexSubImage3D(GLbyte *);
 
+extern void __glXDispSwap_BindTexture(GLbyte *);
+extern void __glXDispSwap_BlendColor(GLbyte *);
+extern void __glXDispSwap_BlendEquation(GLbyte *);
+extern void __glXDispSwap_ColorTable(GLbyte *);
+extern void __glXDispSwap_ColorTableParameterfv(GLbyte *);
+extern void __glXDispSwap_ColorTableParameteriv(GLbyte *);
+extern void __glXDispSwap_CopyColorTable(GLbyte *);
+extern void __glXDispSwap_ConvolutionParameterf(GLbyte *);
+extern void __glXDispSwap_ConvolutionParameteri(GLbyte *);
+extern void __glXDispSwap_Histogram(GLbyte *);
+extern void __glXDispSwap_Minmax(GLbyte *);
+extern void __glXDispSwap_ResetHistogram(GLbyte *);
+extern void __glXDispSwap_ResetMinmax(GLbyte *);
+
+extern int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *, GLbyte *);
+extern int __glXSwapBindSwapBarrierSGIX(__GLXclientState *, GLbyte *);
+extern int __glXSwapJoinSwapGroupSGIX(__GLXclientState *, GLbyte *);
+extern int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *, GLbyte *);
+extern int __glXSwapMakeCurrentReadSGI(__GLXclientState *, GLbyte *);
+
 #define __GLX_MIN_GLXCMD_OPCODE 1
 #define __GLX_MAX_GLXCMD_OPCODE 20
 #define __GLX_MIN_RENDER_OPCODE 1
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 88c2eb1..4c500c9 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -61,7 +61,6 @@
 extern __GLXFBConfig **__glXFBConfigs;
 extern int __glXNumFBConfigs;
 
-extern int glxIsExtensionSupported(char *ext);
 extern int __glXGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc);
 
 #define BE_TO_CLIENT_ERROR(x) \
diff --git a/hw/dmx/glxProxy/glxcmds.h b/hw/dmx/glxProxy/glxcmds.h
index b074592..689e334 100644
--- a/hw/dmx/glxProxy/glxcmds.h
+++ b/hw/dmx/glxProxy/glxcmds.h
@@ -33,5 +33,11 @@ extern int __glXCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc);
 extern int __glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc);
 extern int __glXMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc);
 extern int __glXQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDoSwapBuffers(__GLXclientState * cl, XID drawId,
+                              GLXContextTag tag);
+
+extern Display *GetBackEndDisplay(__GLXclientState * cl, int s);
+extern int GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag,
+                                int s);
 
 #endif                          /* !__GLX_cmds_h__ */
diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c
index ab3e7ed..600a6e1 100644
--- a/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/hw/dmx/glxProxy/glxcmdsswap.c
@@ -39,8 +39,6 @@
 #include "glxext.h"
 #include "glxvendor.h"
 
-extern int glxIsExtensionSupported(char *ext);
-
 int __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc);
 
 /************************************************************************/
diff --git a/hw/dmx/glxProxy/glxext.h b/hw/dmx/glxProxy/glxext.h
index 47cec15..b96ebc1 100644
--- a/hw/dmx/glxProxy/glxext.h
+++ b/hw/dmx/glxProxy/glxext.h
@@ -53,6 +53,7 @@ extern void __glXFlushContextCache(void);
 
 extern void __glXFreeGLXWindow(__glXWindow * pGlxWindow);
 extern void __glXFreeGLXPixmap(__GLXpixmap * pGlxPixmap);
+extern void __glXFreeGLXPbuffer(__glXPbuffer * pGlxPbuffer);
 
 extern void __glXNoSuchRenderOpcode(GLbyte *);
 extern int __glXNoSuchSingleOpcode(__GLXclientState *, GLbyte *);
diff --git a/hw/dmx/glxProxy/glxscreens.h b/hw/dmx/glxProxy/glxscreens.h
index a9fe2a9..9a538d1 100644
--- a/hw/dmx/glxProxy/glxscreens.h
+++ b/hw/dmx/glxProxy/glxscreens.h
@@ -50,4 +50,6 @@ extern void __glXScreenReset(void);
 
 extern char *__glXGetServerString(unsigned int name);
 
+extern int glxIsExtensionSupported(char *ext);
+
 #endif                          /* !__GLX_screens_h__ */
diff --git a/hw/dmx/glxProxy/glxserver.h b/hw/dmx/glxProxy/glxserver.h
index 754ad30..7aa5ad2 100644
--- a/hw/dmx/glxProxy/glxserver.h
+++ b/hw/dmx/glxProxy/glxserver.h
@@ -149,9 +149,7 @@ extern __GLXclientState *__glXClients[];
 typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *);
 typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
 typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
-extern __GLXdispatchSingleProcPtr __glXSingleTable[];
 extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[];
-extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[];
 extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[];
 extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[];
 
@@ -193,9 +191,6 @@ extern RESTYPE __glXPbufferRes;
 
 extern char *__glXcombine_strings(const char *, const char *);
 
-extern void __glXDisp_DrawArrays(GLbyte *);
-extern void __glXDispSwap_DrawArrays(GLbyte *);
-
 /*
 ** Routines for sending swapped replies.
 */
@@ -287,9 +282,6 @@ extern int __glXConvolutionParameterfvSize(GLenum pname);
 extern int __glXColorTableParameterfvSize(GLenum pname);
 extern int __glXColorTableParameterivSize(GLenum pname);
 
-extern void __glXFreeGLXWindow(__glXWindow * pGlxWindow);
-extern void __glXFreeGLXPbuffer(__glXPbuffer * pGlxPbuffer);
-
 extern int __glXVersionMajor;
 extern int __glXVersionMinor;
 
diff --git a/hw/dmx/glxProxy/glxsingle.c b/hw/dmx/glxProxy/glxsingle.c
index 0344973..79d426b 100644
--- a/hw/dmx/glxProxy/glxsingle.c
+++ b/hw/dmx/glxProxy/glxsingle.c
@@ -45,6 +45,8 @@
 /* #include "g_disptab_EXT.h" */
 #include "unpack.h"
 #include "glxutil.h"
+#include "glxcmds.h"
+#include "glxsingle.h"
 
 #include "GL/glxproto.h"
 
@@ -81,10 +83,6 @@
 
 #define X_GLXSingle 0           /* needed by GetReqExtra */
 
-extern Display *GetBackEndDisplay(__GLXclientState * cl, int s);
-extern int GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag,
-                                int s);
-
 static int swap_vec_element_size = 0;
 
 static void
diff --git a/hw/dmx/glxProxy/glxsingle.h b/hw/dmx/glxProxy/glxsingle.h
index 32a9d49..6126177 100644
--- a/hw/dmx/glxProxy/glxsingle.h
+++ b/hw/dmx/glxProxy/glxsingle.h
@@ -47,8 +47,4 @@ extern int __glXForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc);
 extern int __glXForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc);
 extern int __glXForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc);
 
-extern int __glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc);
-extern int __glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc);
-extern int __glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc);
-
 #endif
diff --git a/hw/dmx/glxProxy/glxswap.c b/hw/dmx/glxProxy/glxswap.c
index 5f56501..bc18e55 100644
--- a/hw/dmx/glxProxy/glxswap.c
+++ b/hw/dmx/glxProxy/glxswap.c
@@ -39,9 +39,7 @@
 #include "dmxwindow.h"
 #include "glxserver.h"
 #include "glxswap.h"
-
-extern int __glXDoSwapBuffers(__GLXclientState * cl, XID drawId,
-                              GLXContextTag tag);
+#include "glxcmds.h"
 
 typedef struct _SwapGroup *SwapGroupPtr;
 
diff --git a/hw/dmx/glxProxy/glxvendor.c b/hw/dmx/glxProxy/glxvendor.c
index fc8aff0..52d70eb 100644
--- a/hw/dmx/glxProxy/glxvendor.c
+++ b/hw/dmx/glxProxy/glxvendor.c
@@ -44,6 +44,8 @@
 /* #include "g_disptab_EXT.h" */
 #include "unpack.h"
 #include "glxutil.h"
+#include "glxcmds.h"
+#include "glxvendor.h"
 
 #include "GL/glxproto.h"
 
@@ -78,10 +80,6 @@
 	dpy->request++
 #endif
 
-extern Display *GetBackEndDisplay(__GLXclientState * cl, int s);
-extern int GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag,
-                                int s);
-
 static int swap_vec_element_size = 0;
 
 static void
commit 069180bd2a243a13328eeea61ec5f8df5622a5de
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 21:11:17 2014 -0800

    dmx: more unshadowing of variables
    
    Gets rid of gcc 4.8 warnings:
    
    dmxinputinit.c: In function ‘dmxInputScanForExtensions’:
    dmxinputinit.c:877:14: warning: declaration of ‘display’ shadows a global declaration [-Wshadow]
         Display *display;
                  ^
    In file included from ../../../include/windowstr.h:60:0,
                     from dmxinputinit.c:72:
    ../../../include/opaque.h:52:30: warning: shadowed declaration is here [-Wshadow]
     extern _X_EXPORT const char *display;
                                  ^
    
    glxcmds.c: In function ‘__glXCreatePbuffer’:
    glxcmds.c:3397:21: warning: declaration of ‘pc’ shadows a parameter [-Wshadow]
                 CARD32 *pc = (CARD32 *) (be_req + 1);
                         ^
    glxcmds.c:3314:52: warning: shadowed declaration is here [-Wshadow]
     __glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
                                                        ^
    
    glxscreens.c: In function ‘CalcServerVersionAndExtensions’:
    glxscreens.c:139:35: warning: declaration of ‘req’ shadows a previous local [-Wshadow]
             xGLXQueryServerStringReq *req;
                                       ^
    glxscreens.c:68:26: warning: shadowed declaration is here [-Wshadow]
         xGLXQueryVersionReq *req;
                              ^
    glxscreens.c:140:36: warning: declaration of ‘reply’ shadows a previous local [-Wshadow]
             xGLXQueryServerStringReply reply;
                                        ^
    glxscreens.c:69:27: warning: shadowed declaration is here [-Wshadow]
         xGLXQueryVersionReply reply;
                               ^
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit bd563fd48f909094d6660854e97811ad7e676ddf)

diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index fb4d5ac..88c2eb1 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -3394,11 +3394,11 @@ __glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
 
         /* Send attributes */
         if (attr != NULL) {
-            CARD32 *pc = (CARD32 *) (be_req + 1);
+            CARD32 *pca = (CARD32 *) (be_req + 1);
 
             while (numAttribs-- > 0) {
-                *pc++ = *attr++;        /* token */
-                *pc++ = *attr++;        /* value */
+                *pca++ = *attr++;        /* token */
+                *pca++ = *attr++;        /* value */
             }
         }
 
diff --git a/hw/dmx/glxProxy/glxscreens.c b/hw/dmx/glxProxy/glxscreens.c
index 138afed..b62776c 100644
--- a/hw/dmx/glxProxy/glxscreens.c
+++ b/hw/dmx/glxProxy/glxscreens.c
@@ -65,8 +65,6 @@ static void
 CalcServerVersionAndExtensions(void)
 {
     int s;
-    xGLXQueryVersionReq *req;
-    xGLXQueryVersionReply reply;
     char **be_extensions;
     char *ext;
     char *denied_extensions;
@@ -80,6 +78,8 @@ CalcServerVersionAndExtensions(void)
     for (s = 0; s < __glXNumActiveScreens; s++) {
         DMXScreenInfo *dmxScreen = &dmxScreens[s];
         Display *dpy = dmxScreen->beDisplay;
+        xGLXQueryVersionReq *req;
+        xGLXQueryVersionReply reply;
 
         /* Send the glXQueryVersion request */
         LockDisplay(dpy);
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index abb6a85..56a39df 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -874,17 +874,17 @@ dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI)
 {
     XExtensionVersion *ext;
     XDeviceInfo *devices;
-    Display *display;
+    Display *dsp;
     int num;
     int i, j;
     XextErrorHandler handler;
 
-    if (!(display = XOpenDisplay(dmxInput->name)))
+    if (!(dsp = XOpenDisplay(dmxInput->name)))
         return;
 
     /* Print out information about the XInput Extension. */
     handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
-    ext = XGetExtensionVersion(display, INAME);
+    ext = XGetExtensionVersion(dsp, INAME);
     XSetExtensionErrorHandler(handler);
 
     if (!ext || ext == (XExtensionVersion *) NoSuchExtension) {
@@ -894,7 +894,7 @@ dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI)
         dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n",
                     dmxInput->name, INAME,
                     ext->major_version, ext->minor_version);
-        devices = XListInputDevices(display, &num);
+        devices = XListInputDevices(dsp, &num);
 
         XFree(ext);
         ext = NULL;
@@ -956,7 +956,7 @@ dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI)
         }
         XFreeDeviceList(devices);
     }
-    XCloseDisplay(display);
+    XCloseDisplay(dsp);
 }
 
 /** Re-initialize all the devices described in \a dmxInput.  Called from
commit 00a962261af856081a7505a95cd871f4af047071
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 21:07:12 2014 -0800

    dmx: attempt to untangle nested loops using same index variable
    
    This doesn't just make gcc sad, it makes my brain sad.
    
    Change from:
        for (i = 0; i < dmxNumScreens; i++) {
            int i;
            for (i = 0; i < nconfigs; i++) {
                for (j = 0; j < dmxScreen->beNumVisuals; j++) {
    
    to the easier to follow:
        for (i = 0; i < dmxNumScreens; i++) {
            for (j = 0; j < nconfigs; j++) {
                for (k = 0; k < dmxScreen->beNumVisuals; k++) {
    
    Gets rid of gcc 4.8 warning:
    
    dmxinit.c: In function ‘InitOutput’:
    dmxinit.c:765:17: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
                 int i;
                     ^
    dmxinit.c:608:9: warning: shadowed declaration is here [-Wshadow]
         int i;
             ^
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 57e08fae82f733304200a473f55b86e689404c13)

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 37961b8..025dc86 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -762,7 +762,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
             dmxGlxVisualPrivate **configprivs = NULL;
             int nconfigs = 0;
             int (*oldErrorHandler) (Display *, XErrorEvent *);
-            int i;
 
             /* Catch errors if when using an older GLX w/o FBconfigs */
             oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
@@ -797,28 +796,29 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
             configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate *));
 
             if (configs != NULL && configprivs != NULL) {
+                int j;
 
                 /* Initialize our private info for each visual
                  * (currently only x_visual_depth and x_visual_class)
                  */
-                for (i = 0; i < nconfigs; i++) {
+                for (j = 0; j < nconfigs; j++) {
 
-                    configprivs[i] = (dmxGlxVisualPrivate *)
+                    configprivs[j] = (dmxGlxVisualPrivate *)
                         malloc(sizeof(dmxGlxVisualPrivate));
-                    configprivs[i]->x_visual_depth = 0;
-                    configprivs[i]->x_visual_class = 0;
+                    configprivs[j]->x_visual_depth = 0;
+                    configprivs[j]->x_visual_class = 0;
 
                     /* Find the visual depth */
-                    if (configs[i].vid > 0) {
-                        int j;
-
-                        for (j = 0; j < dmxScreen->beNumVisuals; j++) {
-                            if (dmxScreen->beVisuals[j].visualid ==
-                                configs[i].vid) {
-                                configprivs[i]->x_visual_depth =
-                                    dmxScreen->beVisuals[j].depth;
-                                configprivs[i]->x_visual_class =
-                                    dmxScreen->beVisuals[j].class;
+                    if (configs[j].vid > 0) {
+                        int k;
+
+                        for (k = 0; k < dmxScreen->beNumVisuals; k++) {
+                            if (dmxScreen->beVisuals[k].visualid ==
+                                configs[j].vid) {
+                                configprivs[j]->x_visual_depth =
+                                    dmxScreen->beVisuals[k].depth;
+                                configprivs[j]->x_visual_class =
+                                    dmxScreen->beVisuals[k].class;
                                 break;
                             }
                         }
commit 25292a3bc1032aab8586d7311159e88acca7b689
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 20:53:33 2014 -0800

    dmx: remove unused variables
    
    Gets rid of gcc 4.8 warnings:
    
    dmxscrinit.c: In function ‘dmxBEScreenInit’:
    dmxscrinit.c:83:15: warning: unused variable ‘gcvals’ [-Wunused-variable]
         XGCValues gcvals;
                   ^
    
    dmxwindow.c: In function ‘dmxResizeWindow’:
    dmxwindow.c:860:19: warning: variable ‘pSibPriv’ set but not used [-Wunused-but-set-variable]
         dmxWinPrivPtr pSibPriv;
                       ^
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 0fbebad72428abbc9fc3fa9f406f7a7e1b9d95b2)

diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index 963d3a9..097418d 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -80,7 +80,6 @@ dmxBEScreenInit(ScreenPtr pScreen)
 {
     DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
     XSetWindowAttributes attribs;
-    XGCValues gcvals;
     unsigned long mask;
     int i, j;
 
diff --git a/hw/dmx/dmxwindow.c b/hw/dmx/dmxwindow.c
index c753735..c157e10 100644
--- a/hw/dmx/dmxwindow.c
+++ b/hw/dmx/dmxwindow.c
@@ -857,13 +857,9 @@ dmxResizeWindow(WindowPtr pWindow, int x, int y,
     ScreenPtr pScreen = pWindow->drawable.pScreen;
     DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
     dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
-    dmxWinPrivPtr pSibPriv;
     unsigned int m;
     XWindowChanges c;
 
-    if (pSib)
-        pSibPriv = DMX_GET_WINDOW_PRIV(pSib);
-
     DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
 #if 1
     if (pScreen->ResizeWindow)
commit 43251c13d7cfaa5deb1146219e175b3fcd1cfffd
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 19:09:36 2014 -0800

    dmx: fix printf format argument warnings
    
    Gets rid of these gcc 4.8 warnings:
    
    dmxinit.c: In function ‘dmxErrorHandler’:
    dmxinit.c:167:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
     but argument 3 has type ‘XID64’ [-Wformat=]
                    ev->resourceid);
                    ^
    dmxinit.c:171:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
     but argument 3 has type ‘XID64’ [-Wformat=]
                    ev->resourceid);
                    ^
    dmxinit.c:175:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
     but argument 3 has type ‘XID64’ [-Wformat=]
                    ev->resourceid);
                    ^
    dmxinit.c:181:12: warning: format ‘%d’ expects argument of type ‘int’,
     but argument 3 has type ‘long unsigned int’ [-Wformat=]
                ev->serial);
                ^
    dmxinit.c:183:12: warning: format ‘%d’ expects argument of type ‘int’,
     but argument 3 has type ‘long unsigned int’ [-Wformat=]
                dpy->request);
                ^
    dmxinit.c: In function ‘InitOutput’:
    dmxinit.c:637:9: warning: format ‘%d’ expects argument of type ‘int’,
     but argument 3 has type ‘long unsigned int’ [-Wformat=]
             dmxLog(dmxInfo, "Generation:         %d\n", dmxGeneration);
             ^
    
    dmxprop.c: In function ‘dmxPropertyCheckOtherWindows’:
    dmxprop.c:223:24: warning: format ‘%lu’ expects argument of type ‘long
     unsigned int’, but argument 4 has type ‘Window’ [-Wformat=]
                            dmxScreen->name, win, tp.value);
                            ^
    dmxprop.c: In function ‘dmxPropertyWindow’:
    dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
     unsigned int’, but argument 5 has type ‘Window’ [-Wformat=]
                    other->index, other->name, other->scrnWin);
                    ^
    dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
     unsigned int’, but argument 8 has type ‘Window’ [-Wformat=]
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit f358f0d50cadaf10f7d97e21da00419a4a37c4e1)

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index fd2ade0..37961b8 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -164,23 +164,23 @@ dmxErrorHandler(Display * dpy, XErrorEvent * ev)
     switch (ev->error_code) {
     case BadValue:
         dmxLog(dmxWarning, "                 Value:        0x%x\n",
-               ev->resourceid);
+               (unsigned int) ev->resourceid);
         break;
     case BadAtom:
         dmxLog(dmxWarning, "                 AtomID:       0x%x\n",
-               ev->resourceid);
+               (unsigned int) ev->resourceid);
         break;
     default:
         dmxLog(dmxWarning, "                 ResourceID:   0x%x\n",
-               ev->resourceid);
+               (unsigned int) ev->resourceid);
         break;
     }
 
     /* Provide serial number information */
     dmxLog(dmxWarning, "                 Failed serial number:  %d\n",
-           ev->serial);
+           (unsigned int) ev->serial);
     dmxLog(dmxWarning, "                 Current serial number: %d\n",
-           dpy->request);
+           (unsigned int) dpy->request);
     return 0;
 }
 
@@ -634,7 +634,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
         if (major > 0 && minor > 0)
             year += 2000;
 
-        dmxLog(dmxInfo, "Generation:         %d\n", dmxGeneration);
+        dmxLog(dmxInfo, "Generation:         %lu\n", dmxGeneration);
         dmxLog(dmxInfo, "DMX version:        %d.%d.%02d%02d%02d (%s)\n",
                major, minor, year, month, day, VENDOR_STRING);
 
diff --git a/hw/dmx/dmxprop.c b/hw/dmx/dmxprop.c
index 4be2dbd..5e306d2 100644
--- a/hw/dmx/dmxprop.c
+++ b/hw/dmx/dmxprop.c
@@ -220,7 +220,7 @@ dmxPropertyCheckOtherWindows(DMXScreenInfo * dmxScreen, Atom atom)
 
             if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) {
                 dmxLog(dmxDebug, "On %s/%lu: %s\n",
-                       dmxScreen->name, win, tp.value);
+                       dmxScreen->name, (unsigned long) win, tp.value);
                 if (!strncmp((char *) tp.value, (char *) id,
                              strlen((char *) id))) {
                     int idx;
@@ -360,8 +360,8 @@ dmxPropertyWindow(DMXScreenInfo * dmxScreen)
         dmxScreen->next = (other->next ? other->next : other);
         other->next = (tmp ? tmp : dmxScreen);
         dmxLog(dmxDebug, "%d/%s/%lu and %d/%s/%lu are on the same backend\n",
-               dmxScreen->index, dmxScreen->name, dmxScreen->scrnWin,
-               other->index, other->name, other->scrnWin);
+               dmxScreen->index, dmxScreen->name, (unsigned long) dmxScreen->scrnWin,
+               other->index, other->name, (unsigned long) other->scrnWin);
     }
 
     snprintf(buf, sizeof(buf), ".%d,%lu", dmxScreen->index,
commit d4b0ab833253493f0ea98b6faca6c17ed55b1c22
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 18:58:01 2014 -0800

    dmx: move format strings inline so gcc can check
    
    Gets rid of gcc 4.8 warnings:
    
    dmxprint.c: In function ‘dmxConfigPrintPair’:
    dmxprint.c:284:25: warning: format not a string literal,
      argument types not checked [-Wformat-nonliteral]
                             p->ysign < 0 ? '-' : '+', p->y);
                             ^
    dmxprint.c:289:9: warning: format not a string literal,
      argument types not checked [-Wformat-nonliteral]
             dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y);
             ^
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 11af200b004b4810c9267e3e16449c3175c64d4a)

diff --git a/hw/dmx/config/dmxprint.c b/hw/dmx/config/dmxprint.c
index 536d92b..c80e830 100644
--- a/hw/dmx/config/dmxprint.c
+++ b/hw/dmx/config/dmxprint.c
@@ -261,32 +261,20 @@ dmxConfigPrintString(DMXConfigStringPtr p, int quote)
 static int
 dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace)
 {
-    const char *format = NULL;
-
     if (!p)
         return 0;
-    switch (p->token) {
-    case T_ORIGIN:
-        format = "@%dx%d";
-        break;
-    case T_DIMENSION:
-        format = "%dx%d";
-        break;
-    case T_OFFSET:
-        format = "%c%d%c%d";
-        break;
-    }
     if (p->token == T_OFFSET) {
         if (!p->comment && !p->x && !p->y && p->xsign >= 0 && p->ysign >= 0)
             return 0;
-        dmxConfigOutput(addSpace, 0, p->comment, format,
+        dmxConfigOutput(addSpace, 0, p->comment, "%c%d%c%d",
                         p->xsign < 0 ? '-' : '+', p->x,
                         p->ysign < 0 ? '-' : '+', p->y);
     }
     else {
         if (!p->comment && !p->x && !p->y)
             return 0;
-        dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y);
+        dmxConfigOutput(addSpace, 0, p->comment, "%s%dx%d",
+                        (p->token == T_ORIGIN) ? "@" : "", p->x, p->y);
     }
     return 1;
 }
commit 904105166450fbcc76cf18392beb4d6d3238bee0
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri Dec 12 18:52:05 2014 -0800

    dmx: Add _X_ATTRIBUTE_PRINTF to dmxConfigLog() & dmxConfigOutput()
    
    Gets rid of gcc 4.8 warnings:
    
    dmxparse.c: In function ‘dmxConfigLog’:
    dmxparse.c:61:5: warning: function might be possible candidate for
     ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
         vprintf(format, args);      /* RATS: All calls to dmxConfigLog from
         ^
    
    dmxprint.c: In function ‘dmxConfigOutput’:
    dmxprint.c:149:9: warning: function might be possible candidate for
     ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
             pos += vfprintf(str, format, args);     /* assumes no newlines! */
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Rémi Cardona <remi at gentoo.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 5e01eac10e915568324aff81b51d3af558757042)

diff --git a/hw/dmx/config/dmxparse.h b/hw/dmx/config/dmxparse.h
index 7d31b63..cc2f0eb 100644
--- a/hw/dmx/config/dmxparse.h
+++ b/hw/dmx/config/dmxparse.h
@@ -38,6 +38,7 @@
 #define _DMXPARSE_H_
 
 #include <stdio.h>              /* For FILE */
+#include <X11/Xfuncproto.h>     /* For _X_ATTRIBUTE_PRINTF */
 
 /** Stores tokens not stored in other structures (e.g., keywords and ;) */
 typedef struct _DMXConfigToken {
@@ -203,7 +204,7 @@ extern int yylex(void);
 extern int yydebug;
 extern void yyerror(const char *message);
 
-extern void dmxConfigLog(const char *format, ...);
+extern void dmxConfigLog(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,0);
 extern void *dmxConfigAlloc(unsigned long bytes);
 extern void *dmxConfigRealloc(void *orig,
                               unsigned long orig_bytes, unsigned long bytes);
diff --git a/hw/dmx/config/dmxprint.c b/hw/dmx/config/dmxprint.c
index 9dec52b..536d92b 100644
--- a/hw/dmx/config/dmxprint.c
+++ b/hw/dmx/config/dmxprint.c
@@ -130,7 +130,7 @@ dmxConfigPopState(void)
     dmxConfigNewline();
 }
 
-static void
+static void _X_ATTRIBUTE_PRINTF(4, 5)
 dmxConfigOutput(int addSpace, int doNewline, const char *comment,
                 const char *format, ...)
 {
commit 838952c97e0ecb334fe4e84a17373fffde053ebe
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Dec 9 18:27:11 2014 -0800

    Get rid of const warnings in XSERVER_INPUT_EVENT dtrace probe calls
    
    Use typedefs to work around dtrace dropping const qualifiers from probe
    arguments when generating Xserver-dtrace.h.   Add new probes.h header to
    avoid having to replicate these typedefs in every file with dtrace probes.
    
    Gets rid of these warnings from gcc 4.8:
     getevents.c:1096:9:
      warning: passing argument 6 of '__dtrace_Xserver___input__event' discards
      'const' qualifier from pointer target type [enabled by default]
     getevents.c:1096:9:
      warning: passing argument 7 of '__dtrace_Xserver___input__event' disards
      'const' qualifier from pointer target type [enabled by default]
     getevents.c:1651:9:
      warning: passing argument 6 of '__dtrace_Xserver___input__event' disards
      'const' qualifier from pointer target type [enabled by default]
     getevents.c:1651:9:
      warning: passing argument 7 of '__dtrace_Xserver___input__event' disards
      'const' qualifier from pointer target type [enabled by default]
     getevents.c:1791:9:
      warning: passing argument 6 of '__dtrace_Xserver___input__event' disards
      'const' qualifier from pointer target type [enabled by default]
     getevents.c:1791:9:
      warning: passing argument 7 of '__dtrace_Xserver___input__event' disards
      'const' qualifier from pointer target type [enabled by default]
     getevents.c:1921:9:
      warning: passing argument 6 of '__dtrace_Xserver___input__event' disards
      'const' qualifier from pointer target type [enabled by default]
     getevents.c:1921:9:
      warning: passing argument 7 of '__dtrace_Xserver___input__event' disards
      'const' qualifier from pointer target type [enabled by default]
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 9e002dfcd71439fd81563db1f70e8c1964d52fab)

diff --git a/dix/Xserver.d b/dix/Xserver.d
index 248d48e..f4f229d 100644
--- a/dix/Xserver.d
+++ b/dix/Xserver.d
@@ -31,6 +31,9 @@
 #include <sys/types.h>
 #endif
 
+typedef const uint8_t *const_uint8_p;
+typedef const double *const_double_p;
+
 provider Xserver {
 	/* reqType, data, length, client id, request buffer */
 	probe request__start(string, uint8_t, uint16_t, int, void *);
@@ -49,7 +52,7 @@ provider Xserver {
 	/* client id, event type, event* */
 	probe send__event(int, uint8_t, void *);
 	/* deviceid, type, button/keycode/touchid, flags, nvalues, mask, values */
-	probe input__event(int, int, uint32_t, uint32_t, int8_t, uint8_t*, double*);
+	probe input__event(int, int, uint32_t, uint32_t, int8_t, const_uint8_p, const_double_p);
 };
 
 #pragma D attributes Unstable/Unstable/Common provider Xserver provider
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 9044ac7..17fa75e 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -131,10 +131,7 @@ int ProcInitialConnection();
 
 #ifdef XSERVER_DTRACE
 #include "registry.h"
-#include <sys/types.h>
-typedef const char *string;
-
-#include "Xserver-dtrace.h"
+#include "probes.h"
 #endif
 
 #define mskcnt ((MAXCLIENTS + 31) / 32)
diff --git a/dix/events.c b/dix/events.c
index 2500615..150620f 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -125,13 +125,7 @@ Equipment Corporation.
 #include <X11/extensions/XKBproto.h>
 #include "xkbsrv.h"
 #include "xace.h"
-
-#ifdef XSERVER_DTRACE
-#include <sys/types.h>
-typedef const char *string;
-
-#include "Xserver-dtrace.h"
-#endif
+#include "probes.h"
 
 #include <X11/extensions/XIproto.h>
 #include <X11/extensions/XI2proto.h>
diff --git a/dix/getevents.c b/dix/getevents.c
index 6fb12c5..bc7ffa6 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -68,12 +68,7 @@
 #include "exevents.h"
 #include "extnsionst.h"
 #include "listdev.h"            /* for sizing up DeviceClassesChangedEvent */
-
-#if XSERVER_DTRACE
-#include <sys/types.h>
-typedef const char *string;
-#include <Xserver-dtrace.h>
-#endif
+#include "probes.h"
 
 /* Number of motion history events to store. */
 #define MOTION_HISTORY_SIZE 256
diff --git a/dix/resource.c b/dix/resource.c
index 26debdb..964f0b3 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -144,10 +144,7 @@ Equipment Corporation.
 #include "gcstruct.h"
 
 #ifdef XSERVER_DTRACE
-#include <sys/types.h>
-typedef const char *string;
-
-#include "Xserver-dtrace.h"
+#include "probes.h"
 
 #define TypeNameString(t) LookupResourceName(t)
 #endif
diff --git a/include/Makefile.am b/include/Makefile.am
index 6578038..168b00f 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -71,6 +71,7 @@ EXTRA_DIST = 	\
 	busfault.h dbus-core.h \
 	dix-config-apple-verbatim.h \
 	dixfontstubs.h eventconvert.h eventstr.h inpututils.h \
+	probes.h \
 	protocol-versions.h \
 	systemd-logind.h \
 	xsha1.h
diff --git a/include/probes.h b/include/probes.h
new file mode 100644
index 0000000..e9cdd3e
--- /dev/null
+++ b/include/probes.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * 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.
+ */
+
+#ifndef XORG_PROBES_H
+#define XORG_PROBES_H
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+/* definitions needed to include Dtrace probes in a source file */
+
+#if XSERVER_DTRACE
+#include <sys/types.h>
+typedef const char *string;
+typedef const uint8_t *const_uint8_p;
+typedef const double *const_double_p;
+#include "../dix/Xserver-dtrace.h"
+#endif
+
+#endif /* XORG_PROBES_H */
diff --git a/os/connection.c b/os/connection.c
index 64c83fc..7ff44e1 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -113,17 +113,11 @@ SOFTWARE.
 #ifdef HAVE_GETPEERUCRED
 #include <ucred.h>
 #include <zone.h>
-#endif
-
-#ifdef XSERVER_DTRACE
-#include <sys/types.h>
-typedef const char *string;
-
-#ifndef HAVE_GETPEERUCRED
+#else
 #define zoneid_t int
 #endif
-#include "../dix/Xserver-dtrace.h"
-#endif
+
+#include "probes.h"
 
 static int lastfdesc;           /* maximum file descriptor */
 


More information about the xorg-commit mailing list