xserver: Branch 'orib-soc-2006'

Ori Bernstein orib at kemper.freedesktop.org
Thu Jun 15 07:43:37 EEST 2006


 hw/xnest/Color.c   |    4 ++--
 hw/xnest/Cursor.c  |   23 ++++++++++++++---------
 hw/xnest/Display.c |   19 +++++++++----------
 hw/xnest/Font.c    |    3 ++-
 hw/xnest/Screen.c  |   31 +++++++++++++++++--------------
 5 files changed, 44 insertions(+), 36 deletions(-)

New commits:
diff-tree 2a17338c611ed2c294062797deaa6e5886f47374 (from b1eb6817e41d4e5b7f2f8db2b4c2c39c01f357c6)
Author: Ori Bernstein <rand.chars at gmail.com>
Date:   Thu Jun 15 00:49:30 2006 -0500

    Seem to have ixed some Match errors, but introduced a very very strange segfault where XCBListColorReply() returns NULL, but the error is also NULL.

diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index 973e874..2530baf 100644
--- a/hw/xnest/Color.c
+++ b/hw/xnest/Color.c
@@ -43,6 +43,7 @@ static ColormapPtr InstalledMaps[MAXSCRE
 Bool xnestCreateColormap(ColormapPtr pCmap)
 {
     VisualPtr pVisual;
+    XCBGenericError *e;
     XCBRGB *colors;
     int i, ncolors;
     CARD32 *pixels;
@@ -115,10 +116,9 @@ Bool xnestCreateColormap(ColormapPtr pCm
                 blue += blueInc;
                 if (blue > pVisual->blueMask) blue = 0L;
             }
-
             c = XCBQueryColors(xnestConnection, xnestColormap(pCmap), ncolors, pixels);
             xfree(pixels);
-            rep = XCBQueryColorsReply(xnestConnection, c, 0);
+            rep = XCBQueryColorsReply(xnestConnection, c, &e);
             colors = XCBQueryColorsColors(rep);
             for (i = 0; i < ncolors; i++) {
                 pCmap->red[i].co.local.red = colors[i].red;
diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index 384a771..720ccdd 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -43,12 +43,13 @@
 Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
 {
     XCBPIXMAP source, mask;
+    XCBDRAWABLE d;
     int pad;
     int size;
     XCBCURSOR c;
     unsigned long valuemask;
     XCBParamsGC values;
-
+#if 0
     valuemask = XCBGCFunction   | 
                 XCBGCPlaneMask  | 
                 XCBGCForeground |
@@ -66,26 +67,28 @@ Bool xnestRealizeCursor(ScreenPtr pScree
     source = XCBPIXMAPNew(xnestConnection);
     mask = XCBPIXMAPNew(xnestConnection);
 
+    d.window = xnestDefaultWindows[pScreen->myNum];
     XCBCreatePixmap(xnestConnection,
                     xnestDefaultDepth,
                     source,
-                    (XCBDRAWABLE)xnestDefaultWindows[pScreen->myNum],
+                    d,
                     pCursor->bits->width,
                     pCursor->bits->height);
 
     XCBCreatePixmap(xnestConnection, 
                     xnestDefaultDepth,
                     mask,
-                    (XCBDRAWABLE) xnestDefaultWindows[pScreen->myNum],
+                    d,
                     pCursor->bits->width,
                     pCursor->bits->height);
 
     pad =  XCBGetSetup(xnestConnection)->bitmap_format_scanline_pad;
     /*not sure if this is right*/
     size = (((pCursor->bits->width + pad - 1) & -pad) >> 3) * pCursor->bits->height;
+    d.pixmap = source;
     XCBPutImage(xnestConnection,
-                XCBImageFormatXYBitmap,
-                (XCBDRAWABLE)source,
+                XCBImageFormatZPixmap,
+                d,
                 xnestBitmapGC,
                 pCursor->bits->width,
                 pCursor->bits->height,
@@ -94,9 +97,10 @@ Bool xnestRealizeCursor(ScreenPtr pScree
                 1,                      /*depth*/
                 size,      /*length..correct??*/
                 pCursor->bits->source);             /*bits*/
+    d.pixmap = mask;
     XCBPutImage(xnestConnection,
-                XCBImageFormatXYBitmap,
-                (XCBDRAWABLE)mask,
+                XCBImageFormatZPixmap,
+                d,
                 xnestBitmapGC,
                 pCursor->bits->width,
                 pCursor->bits->height,
@@ -105,8 +109,9 @@ Bool xnestRealizeCursor(ScreenPtr pScree
                 1,                      /*depth*/
                 size,      /*length..correct??*/
                  pCursor->bits->mask);             /*bits*/
-
+#endif
     pCursor->devPriv[pScreen->myNum] = (pointer)xalloc(sizeof(xnestPrivCursor));
+#if 0
     c = XCBCURSORNew(xnestConnection);
     xnestCursorPriv(pCursor, pScreen)->cursor = c.xid;
     XCBCreateCursor(xnestConnection,
@@ -124,7 +129,7 @@ Bool xnestRealizeCursor(ScreenPtr pScree
 
     XCBFreePixmap(xnestConnection, source);
     XCBFreePixmap(xnestConnection, mask);
-
+#endif
     return True;
 }
 
diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c
index 4a23da5..e544b9b 100644
--- a/hw/xnest/Display.c
+++ b/hw/xnest/Display.c
@@ -62,25 +62,25 @@ static XCBVISUALTYPE **xnestListVisuals(
     XCBVISUALTYPEIter viter;
     XCBDEPTHIter      diter;
     XCBSCREEN        *screen;
-    XCBVISUALTYPE   **vis = NULL;
+    static XCBVISUALTYPE   **vis = NULL;
     /*reserve for NULL termination*/
-    int               nvis = 1;
+    int               nvis = 0;
     int               i = 0;
 
     screen = XCBSetupRootsIter(XCBGetSetup(c)).data;
     diter = XCBSCREENAllowedDepthsIter(screen);
-    for (; diter.rem; XCBDEPTHNext(&diter)) {
+    *depths = NULL;
+    for ( ; diter.rem; XCBDEPTHNext(&diter)) {
         viter = XCBDEPTHVisualsIter (diter.data);
         nvis += viter.rem;
-        vis = xrealloc(vis, sizeof(XCBVISUALTYPE) * (nvis+1));
-        *depths = xrealloc(*depths, sizeof(CARD8) * (nvis+1));
-        vis[nvis-1] = NULL;
+        vis = Xrealloc(vis, sizeof(XCBVISUALTYPE) * (nvis+1));
+        *depths = Xrealloc(*depths, sizeof(CARD8) * (nvis+1));
         for ( ; viter.rem; XCBVISUALTYPENext(&viter)){
             (*depths)[i] = diter.data->depth;
             vis[i++] = viter.data;
         }
     }
-    *numvisuals = nvis-1;
+    *numvisuals = i;
     return vis;
 }
 
@@ -100,7 +100,7 @@ static CARD8 *xnestListDepths(XCBConnect
     for (; diter.rem; XCBDEPTHNext(&diter)) {
         depths[i++]=diter.data->depth;
     }
-    *numdepths = ndepth-1;
+    *numdepths = ndepth;
     return depths;
 }
 
@@ -185,8 +185,7 @@ void xnestOpenDisplay(int argc, char *ar
 
     for (i=0; i < xnestNumPixmapFormats; i++) {
         for (j=0; j < xnestNumDepth; j++) {
-            if ((xnestPixmapFormats[i].depth == xnestDepths[j])||
-                (xnestPixmapFormats[i].depth == 1 )) {
+            if ((xnestPixmapFormats[i].depth == xnestDepths[j])|| (xnestPixmapFormats[i].depth == 1 )) {
                 xnestDefaultDrawables[xnestPixmapFormats[i].depth].pixmap = XCBPIXMAPNew(xnestConnection);
                 XCBCreatePixmap(xnestConnection,
                                 xnestPixmapFormats[i].depth,
diff --git a/hw/xnest/Font.c b/hw/xnest/Font.c
index c247dc1..fcf7d9d 100644
--- a/hw/xnest/Font.c
+++ b/hw/xnest/Font.c
@@ -71,7 +71,8 @@ Bool xnestRealizeFont(ScreenPtr pScreen,
     priv = (pointer)xalloc(sizeof(xnestPrivFont));
     FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
 
-    xnestFontPriv(pFont)->font = XCBFONTNew(xnestConnection);
+    font = XCBFONTNew(xnestConnection);
+    xnestFontPriv(pFont)->font = font;
     XCBOpenFont(xnestConnection, font, strlen(name), name);
 
     if (!xnestFont(pFont).xid)
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 671d057..e33e666 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -143,7 +143,7 @@ Bool xnestOpenScreen(int index, ScreenPt
     DepthPtr            depths;
     int numVisuals,     numDepths;
     int                 i, j, depthIndex;
-    unsigned long       valuemask;
+    unsigned long       valuemask = 0;
     XCBGetGeometryRep  *rattr;
     XCBGetGeometryCookie cattr;
     XCBParamsCW         param;
@@ -151,6 +151,7 @@ Bool xnestOpenScreen(int index, ScreenPt
     VisualID            defaultVisual;
     int                 rootDepth;
     XCBSCREEN          *screen;
+    XCBVISUALID         vid;
 
     if (!(AllocateWindowPrivate(pScreen, xnestWindowPrivateIndex,
                     sizeof(xnestPrivWin))  &&
@@ -387,20 +388,22 @@ Bool xnestOpenScreen(int index, ScreenPt
                                       xnestDefaultWindows[pScreen->myNum],
                                       XCBCWEventMask,
                                       &xnestEventMask);
-        } else
+        } else {
+            vid.id = pScreen->rootVisual;
             xnestDefaultWindows[pScreen->myNum] = XCBWINDOWNew(xnestConnection);
-                XCBAuxCreateWindow(xnestConnection, 
-                                pScreen->rootDepth,
-                                xnestDefaultWindows[pScreen->myNum],
-                                screen->root,
-                                xnestX + POSITION_OFFSET,
-                                xnestY + POSITION_OFFSET,
-                                xnestWidth, xnestHeight,
-                                xnestBorderWidth,
-                                InputOutput,
-                                xnestGetDefaultVisual(pScreen)->visual_id,
-                                valuemask, 
-                                &param);
+            XCBAuxCreateWindow(xnestConnection, 
+                               pScreen->rootDepth,
+                               xnestDefaultWindows[pScreen->myNum],
+                               screen->root,
+                               xnestX + POSITION_OFFSET,
+                               xnestY + POSITION_OFFSET,
+                               xnestWidth, xnestHeight,
+                               xnestBorderWidth,
+                               XCBWindowClassInputOutput,
+                               vid,
+                               valuemask, 
+                               &param);
+        }
 
         if (!xnestWindowName)
             xnestWindowName = argv[0];



More information about the xorg-commit mailing list