xserver: Branch 'master' - 4 commits

Keith Packard keithp at kemper.freedesktop.org
Sun Jan 4 17:03:09 PST 2015


 glx/glxcmds.c |   71 +++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 41 insertions(+), 30 deletions(-)

New commits:
commit 1c01633877caa4239f901f02fbe113926318d030
Merge: 3573855 e774663
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Jan 4 17:02:25 2015 -0800

    Merge remote-tracking branch 'ajax/xserver-next'

commit e774663fa5209ff469d920821934bb1f5964a72f
Author: Michele Baldessari <michele at redhat.com>
Date:   Wed Dec 3 11:30:29 2014 -0500

    ephyr: Implement per-screen colormaps
    
    Xephyr's pseudocolor emulation added in:
    
        commit 81a3b6fe27567b4f91033ece69996aa6bf8d01a3
        Author: Matthew Allum <breakfast at 10.am>
        Date:   Mon Nov 8 22:39:47 2004 +0000
    
            Add support to Xephyr for lower depths than hosts
    
    only tracks one global colormap for the whole (Xephyr) display.  Move
    this to per-screen state so each screen's colormap can be correct.
    
    [ajax: rebased to 1.17, cleaned up commit message]
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Michele Baldessari <michele at redhat.com>

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 93a48a9..907bbeb 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -1292,7 +1292,7 @@ ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
         if (p > max)
             max = p;
 
-        hostx_set_cmap_entry(p,
+        hostx_set_cmap_entry(pScreen, p,
                              pdefs->red >> 8,
                              pdefs->green >> 8, pdefs->blue >> 8);
         pdefs++;
diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index 2395a7f..18bfe11 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -83,6 +83,7 @@ typedef struct _ephyrScrPriv {
 
     KdScreenInfo *screen;
     int mynum;                  /* Screen number */
+    unsigned long cmap[256];
 
     /**
      * Per-screen Xlib-using state for glamor (private to
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 8d6d5e8..f64861b 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -82,8 +82,6 @@ struct EphyrHostXVars {
     KdScreenInfo **screens;
 
     long damage_debug_msec;
-
-    unsigned long cmap[256];
 };
 
 /* memset ( missing> ) instead of below  */
@@ -751,9 +749,12 @@ hostx_calculate_color_shift(unsigned long mask)
 }
 
 void
-hostx_set_cmap_entry(unsigned char idx,
+hostx_set_cmap_entry(ScreenPtr pScreen, unsigned char idx,
                      unsigned char r, unsigned char g, unsigned char b)
 {
+    KdScreenPriv(pScreen);
+    KdScreenInfo *screen = pScreenPriv->screen;
+    EphyrScrPriv *scrpriv = screen->driver;
 /* need to calculate the shifts for RGB because server could be BGR. */
 /* XXX Not sure if this is correct for 8 on 16, but this works for 8 on 24.*/
     static int rshift, bshift, gshift = 0;
@@ -765,7 +766,7 @@ hostx_set_cmap_entry(unsigned char idx,
         gshift = hostx_calculate_color_shift(HostX.visual->green_mask);
         bshift = hostx_calculate_color_shift(HostX.visual->blue_mask);
     }
-    HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) |
+    scrpriv->cmap[idx] = ((r << rshift) & HostX.visual->red_mask) |
         ((g << gshift) & HostX.visual->green_mask) |
         ((b << bshift) & HostX.visual->blue_mask);
 }
@@ -1017,7 +1018,7 @@ hostx_paint_rect(KdScreenInfo *screen,
                     unsigned char pixel =
                         *(unsigned char *) (scrpriv->fb_data + idx);
                     xcb_image_put_pixel(scrpriv->ximg, x, y,
-                                        HostX.cmap[pixel]);
+                                        scrpriv->cmap[pixel]);
                     break;
                 }
                 default:
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index 87acd5a..93aaa50 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -141,7 +141,7 @@ hostx_get_visual_masks(KdScreenInfo *screen,
                        CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
 void
 
-hostx_set_cmap_entry(unsigned char idx,
+hostx_set_cmap_entry(ScreenPtr pScreen, unsigned char idx,
                      unsigned char r, unsigned char g, unsigned char b);
 
 void *hostx_screen_init(KdScreenInfo *screen,
commit cadd70c809232c9a6601fb8baab665a7ab10045d
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Dec 2 14:52:35 2014 -0500

    glx: Add hack for GLX-1.2-style naked windows to GetDrawableAttributes
    
    Some people like to call this on bare Window XIDs and expect reasonable
    results.  I sure wish they wouldn't, but since they do, if we're given
    a window without any glx decoration just fill in as much as we can. This
    means you won't actually get an answer for GLX_FBCONFIG_ID and friends,
    but there's not much to be done about that, and it matches what NVIDIA's
    driver seems to do.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54080
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 4de8643..f5f2bab 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1916,38 +1916,48 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
 {
     ClientPtr client = cl->client;
     xGLXGetDrawableAttributesReply reply;
-    __GLXdrawable *pGlxDraw;
+    __GLXdrawable *pGlxDraw = NULL;
+    DrawablePtr pDraw;
     CARD32 attributes[14];
     int num = 0, error;
 
     if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
-                          DixGetAttrAccess, &pGlxDraw, &error))
-        return error;
+                          DixGetAttrAccess, &pGlxDraw, &error)) {
+        /* hack for GLX 1.2 naked windows */
+        int err = dixLookupWindow((WindowPtr *)&pDraw, drawId, client,
+                                  DixGetAttrAccess);
+        if (err != Success)
+            return error;
+    }
+    if (pGlxDraw)
+        pDraw = pGlxDraw->pDraw;
 
-    attributes[2*num] = GLX_TEXTURE_TARGET_EXT;
-    attributes[2*num+1] = pGlxDraw->target == GL_TEXTURE_2D ?
-        GLX_TEXTURE_2D_EXT :
-        GLX_TEXTURE_RECTANGLE_EXT;
-    num++;
     attributes[2*num] = GLX_Y_INVERTED_EXT;
     attributes[2*num+1] = GL_FALSE;
     num++;
-    attributes[2*num] = GLX_EVENT_MASK;
-    attributes[2*num+1] = pGlxDraw->eventMask;
-    num++;
     attributes[2*num] = GLX_WIDTH;
-    attributes[2*num+1] = pGlxDraw->pDraw->width;
+    attributes[2*num+1] = pDraw->width;
     num++;
     attributes[2*num] = GLX_HEIGHT;
-    attributes[2*num+1] = pGlxDraw->pDraw->height;
-    num++;
-    attributes[2*num] = GLX_FBCONFIG_ID;
-    attributes[2*num+1] = pGlxDraw->config->fbconfigID;
+    attributes[2*num+1] = pDraw->height;
     num++;
-    if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) {
-        attributes[2*num] = GLX_PRESERVED_CONTENTS;
-        attributes[2*num+1] = GL_TRUE;
+    if (pGlxDraw) {
+        attributes[2*num] = GLX_TEXTURE_TARGET_EXT;
+        attributes[2*num+1] = pGlxDraw->target == GL_TEXTURE_2D ?
+            GLX_TEXTURE_2D_EXT :
+            GLX_TEXTURE_RECTANGLE_EXT;
+        num++;
+        attributes[2*num] = GLX_EVENT_MASK;
+        attributes[2*num+1] = pGlxDraw->eventMask;
         num++;
+        attributes[2*num] = GLX_FBCONFIG_ID;
+        attributes[2*num+1] = pGlxDraw->config->fbconfigID;
+        num++;
+        if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) {
+            attributes[2*num] = GLX_PRESERVED_CONTENTS;
+            attributes[2*num+1] = GL_TRUE;
+            num++;
+        }
     }
 
     reply = (xGLXGetDrawableAttributesReply) {
commit f452b4a47b3bebf883e84df804e8d54830ccfe83
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Dec 2 14:47:45 2014 -0500

    glx: Dynamically compute attribute slot in GetDrawableAttributes
    
    No functional change.
    
    Reviewed-by: Eric Anholt <eric at anholt.net>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index e836af8..4de8643 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1918,42 +1918,43 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
     xGLXGetDrawableAttributesReply reply;
     __GLXdrawable *pGlxDraw;
     CARD32 attributes[14];
-    int numAttribs = 0, error;
+    int num = 0, error;
 
     if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
                           DixGetAttrAccess, &pGlxDraw, &error))
         return error;
 
-    attributes[0] = GLX_TEXTURE_TARGET_EXT;
-    attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT :
+    attributes[2*num] = GLX_TEXTURE_TARGET_EXT;
+    attributes[2*num+1] = pGlxDraw->target == GL_TEXTURE_2D ?
+        GLX_TEXTURE_2D_EXT :
         GLX_TEXTURE_RECTANGLE_EXT;
-    numAttribs++;
-    attributes[2] = GLX_Y_INVERTED_EXT;
-    attributes[3] = GL_FALSE;
-    numAttribs++;
-    attributes[4] = GLX_EVENT_MASK;
-    attributes[5] = pGlxDraw->eventMask;
-    numAttribs++;
-    attributes[6] = GLX_WIDTH;
-    attributes[7] = pGlxDraw->pDraw->width;
-    numAttribs++;
-    attributes[8] = GLX_HEIGHT;
-    attributes[9] = pGlxDraw->pDraw->height;
-    numAttribs++;
-    attributes[10] = GLX_FBCONFIG_ID;
-    attributes[11] = pGlxDraw->config->fbconfigID;
-    numAttribs++;
+    num++;
+    attributes[2*num] = GLX_Y_INVERTED_EXT;
+    attributes[2*num+1] = GL_FALSE;
+    num++;
+    attributes[2*num] = GLX_EVENT_MASK;
+    attributes[2*num+1] = pGlxDraw->eventMask;
+    num++;
+    attributes[2*num] = GLX_WIDTH;
+    attributes[2*num+1] = pGlxDraw->pDraw->width;
+    num++;
+    attributes[2*num] = GLX_HEIGHT;
+    attributes[2*num+1] = pGlxDraw->pDraw->height;
+    num++;
+    attributes[2*num] = GLX_FBCONFIG_ID;
+    attributes[2*num+1] = pGlxDraw->config->fbconfigID;
+    num++;
     if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) {
-        attributes[12] = GLX_PRESERVED_CONTENTS;
-        attributes[13] = GL_TRUE;
-        numAttribs++;
+        attributes[2*num] = GLX_PRESERVED_CONTENTS;
+        attributes[2*num+1] = GL_TRUE;
+        num++;
     }
 
     reply = (xGLXGetDrawableAttributesReply) {
         .type = X_Reply,
         .sequenceNumber = client->sequence,
-        .length = numAttribs << 1,
-        .numAttribs = numAttribs
+        .length = num << 1,
+        .numAttribs = num
     };
 
     if (client->swapped) {


More information about the xorg-commit mailing list