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

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Thu Jan 3 13:29:19 PST 2008


 config/dbus-core.c         |    5 +-
 config/hal.c               |   11 ++++
 dix/devices.c              |    3 -
 hw/kdrive/ephyr/ephyr.c    |    1 
 hw/xquartz/darwin.c        |  108 ++++++++++++++++++---------------------------
 hw/xquartz/darwin.h        |   10 ++--
 hw/xquartz/xpr/xprScreen.c |   81 ++++++++++++++++++++++-----------
 include/xkbsrv.h           |    3 -
 os/connection.c            |    3 -
 9 files changed, 126 insertions(+), 99 deletions(-)

New commits:
commit c9dff90ce869131e2d4e020c2f80674ec9ef2ccb
Merge: 8e4c28e... 60144ac...
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Thu Jan 3 13:26:22 2008 -0800

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

commit 8e4c28ec2a72619bd47af4286b9bbf0c019dc6da
Author: Jeremy Huddleston <jeremy at yuffie.local>
Date:   Sat Dec 22 15:09:12 2007 -0800

    XQuartz: Cleaned up color map configuration.
    8 bit color still doesn't work, but the -depth command line argument now works properly.
    (cherry picked from commit 6765949c27c053d22882f54337cfd09203aa5383)

diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 5353893..08013a2 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -78,7 +78,7 @@
 #include "darwinEvents.h"
 #include "darwinKeyboard.h"
 #include "quartz.h"
-#include "darwinClut8.h"
+//#include "darwinClut8.h"
 
 #ifdef ENABLE_DEBUG_LOG
 FILE *debug_log_fp = NULL;
@@ -176,17 +176,10 @@ static Bool DarwinSaveScreen(ScreenPtr pScreen, int on)
  *  This is a callback from dix during AddScreen() from InitOutput().
  *  Initialize the screen and communicate information about it back to dix.
  */
-static Bool DarwinAddScreen(
-    int         index,
-    ScreenPtr   pScreen,
-    int         argc,
-    char        **argv )
-{
-    int         bitsPerRGB, i, dpi;
+static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv) {
+    int         dpi;
     static int  foundIndex = 0;
     Bool        ret;
-    VisualPtr   visual;
-    ColormapPtr pmap;
     DarwinFramebufferPtr dfb;
 
     // reset index of found screens for each server generation
@@ -204,28 +197,13 @@ static Bool DarwinAddScreen(
     if (! ret)
         return FALSE;
 
-    bitsPerRGB = dfb->bitsPerComponent;
-
     // reset the visual list
     miClearVisualTypes();
 
     // setup a single visual appropriate for our pixel type
-    if (dfb->colorType == TrueColor) {
-        if (!miSetVisualTypes( dfb->colorBitsPerPixel, TrueColorMask,
-                               bitsPerRGB, TrueColor )) {
-            return FALSE;
-        }
-    } else if (dfb->colorType == PseudoColor) {
-        if (!miSetVisualTypes( dfb->colorBitsPerPixel, PseudoColorMask,
-                               bitsPerRGB, PseudoColor )) {
-            return FALSE;
-        }
-    } else if (dfb->colorType == StaticColor) {
-        if (!miSetVisualTypes( dfb->colorBitsPerPixel, StaticColorMask,
-                               bitsPerRGB, StaticColor )) {
-            return FALSE;
-        }
-    } else {
+    if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB,
+                                 dfb->preferredCVC, dfb->redMask,
+                                 dfb->greenMask, dfb->blueMask)) {
         return FALSE;
     }
 
@@ -249,20 +227,28 @@ static Bool DarwinAddScreen(
         return FALSE;
     }
 
+//    ErrorF("Screen type: %d, %d=%d, %d=%d, %d=%d, %x=%x=%x, %x=%x=%x, %x=%x=%x\n", pScreen->visuals->class,
+//           pScreen->visuals->offsetRed, dfb->bitsPerRGB * 2,
+//           pScreen->visuals->offsetGreen, dfb->bitsPerRGB,
+//           pScreen->visuals->offsetBlue, 0,
+//           pScreen->visuals->redMask, dfb->redMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetRed,
+//           pScreen->visuals->greenMask, dfb->greenMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetGreen,
+//           pScreen->visuals->blueMask, dfb->blueMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetBlue);
+
     // set the RGB order correctly for TrueColor
-    if (dfb->bitsPerPixel > 8) {
-        for (i = 0, visual = pScreen->visuals;  // someday we may have more than 1
-            i < pScreen->numVisuals; i++, visual++) {
-            if (visual->class == TrueColor) {
-                visual->offsetRed = bitsPerRGB * 2;
-                visual->offsetGreen = bitsPerRGB;
-                visual->offsetBlue = 0;
-                visual->redMask = ((1<<bitsPerRGB)-1) << visual->offsetRed;
-                visual->greenMask = ((1<<bitsPerRGB)-1) << visual->offsetGreen;
-                visual->blueMask = ((1<<bitsPerRGB)-1) << visual->offsetBlue;
-            }
-        }
-    }
+//    if (dfb->bitsPerPixel > 8) {
+//        for (i = 0, visual = pScreen->visuals;  // someday we may have more than 1
+//            i < pScreen->numVisuals; i++, visual++) {
+//            if (visual->class == TrueColor) {
+//                visual->offsetRed = bitsPerRGB * 2;
+//                visual->offsetGreen = bitsPerRGB;
+//                visual->offsetBlue = 0;
+//                visual->redMask = ((1<<bitsPerRGB)-1) << visual->offsetRed;
+//                visual->greenMask = ((1<<bitsPerRGB)-1) << visual->offsetGreen;
+//                visual->blueMask = ((1<<bitsPerRGB)-1) << visual->offsetBlue;
+//            }
+//        }
+//    }
 
 #ifdef RENDER
     if (! fbPictureInit(pScreen, 0, 0)) {
@@ -292,17 +278,16 @@ static Bool DarwinAddScreen(
      * mode and we're using a fixed color map.  Essentially this translates
      * to Darwin/x86 in 8-bit mode.
      */
-    if( (dfb->colorBitsPerPixel == 8) &&
-                (dfb->colorType == StaticColor) )
-    {
-        pmap = miInstalledMaps[pScreen->myNum];
-        visual = pmap->pVisual;
-        for( i = 0; i < visual->ColormapEntries; i++ ) {
-            pmap->red[i].co.local.red   = darwinClut8[i].red;
-            pmap->red[i].co.local.green = darwinClut8[i].green;
-            pmap->red[i].co.local.blue  = darwinClut8[i].blue;
-        }
-    }
+//    if(dfb->depth == 8) {
+//        ColormapPtr map = RootlessGetColormap (pScreen);
+//        for( i = 0; i < map->pVisual->ColormapEntries; i++ ) {
+//            Entry *ent = map->red + i;
+//            ErrorF("Setting lo %d -> r: %04x g: %04x b: %04x\n", i, darwinClut8[i].red, darwinClut8[i].green, darwinClut8[i].blue);
+//            ent->co.local.red   = darwinClut8[i].red;
+//            ent->co.local.green = darwinClut8[i].green;
+//            ent->co.local.blue  = darwinClut8[i].blue;
+//        }
+//    }
 
     dixScreenOrigins[index].x = dfb->x;
     dixScreenOrigins[index].y = dfb->y;
@@ -800,24 +785,21 @@ int ddxProcessArgument( int argc, char *argv[], int i )
     }
 
     if ( !strcmp( argv[i], "-depth" ) ) {
-        int     bitDepth;
-
         if ( i == argc-1 ) {
             FatalError( "-depth must be followed by a number\n" );
         }
 #ifdef OLD_POWERBOOK_G3
         ErrorF( "Ignoring unsupported -depth option on old PowerBook G3\n");
 #else
-        bitDepth = atoi( argv[i+1] );
-        if (bitDepth == 8)
-            darwinDesiredDepth = 0;
-        else if (bitDepth == 15)
-            darwinDesiredDepth = 1;
-        else if (bitDepth == 24)
-            darwinDesiredDepth = 2;
-        else
+        darwinDesiredDepth = atoi( argv[i+1] );
+        if(darwinDesiredDepth != -1 &&
+           darwinDesiredDepth != 8 &&
+           darwinDesiredDepth != 15 &&
+           darwinDesiredDepth != 24) {
             FatalError( "Unsupported pixel depth. Use 8, 15, or 24 bits\n" );
-        ErrorF( "Attempting to use pixel depth of %i\n", bitDepth );
+        }
+
+        ErrorF( "Attempting to use pixel depth of %i\n", darwinDesiredDepth );
 #endif
         return 2;
     }
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index f835ae0..365f5b7 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -40,10 +40,14 @@ typedef struct {
     int                 width;
     int                 height;
     int                 pitch;
-    int                 colorType;
+    int                 depth;
+    int                 visuals;
+    int                 bitsPerRGB;
     int                 bitsPerPixel;
-    int                 colorBitsPerPixel;
-    int                 bitsPerComponent;
+    int                 preferredCVC;
+    Pixel               redMask;
+    Pixel               greenMask;
+    Pixel               blueMask;
 } DarwinFramebufferRec, *DarwinFramebufferPtr;
 
 // From darwin.c
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 068b7b1..29179e5 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -42,6 +42,7 @@
 #include "globals.h"
 #include "Xplugin.h"
 #include "applewmExt.h"
+#include "micmap.h"
 
 // From xprFrame.c
 WindowPtr xprGetXWindow(xp_window_id wid);
@@ -249,35 +250,59 @@ static Bool
 xprAddScreen(int index, ScreenPtr pScreen)
 {
     DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen);
-
-    /* If no specific depth chosen, look for the depth of the main display.
-       Else if 16bpp specified, use that. Else use 32bpp. */
-
-    dfb->colorType = TrueColor;
-    dfb->bitsPerComponent = 8;
-    dfb->bitsPerPixel = 32;
-    dfb->colorBitsPerPixel = 24;
-
-    if (darwinDesiredDepth == -1)
-    {
-        dfb->bitsPerComponent = CGDisplayBitsPerSample(kCGDirectMainDisplay);
-        dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
-        dfb->colorBitsPerPixel =
-                CGDisplaySamplesPerPixel(kCGDirectMainDisplay) *
-                dfb->bitsPerComponent;
+    int depth = darwinDesiredDepth;
+    
+    if(depth == -1) {
+        depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
+        //dfb->depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
+        //dfb->bitsPerRGB = CGDisplayBitsPerSample(kCGDirectMainDisplay);
+        //dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
     }
-    else if (darwinDesiredDepth == 15)
-    {
-        dfb->bitsPerComponent = 5;
-        dfb->bitsPerPixel = 16;
-        dfb->colorBitsPerPixel = 15;
-    }
-    else if (darwinDesiredDepth == 8)
-    {
-        dfb->colorType = PseudoColor;
-        dfb->bitsPerComponent = 8;
-        dfb->bitsPerPixel = 8;
-        dfb->colorBitsPerPixel = 8;
+    
+    switch(depth) {
+        case -8: // broken
+            FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
+            dfb->visuals = (1 << StaticGray) | (1 << GrayScale);
+            dfb->preferredCVC = GrayScale;
+            dfb->depth = 8;
+            dfb->bitsPerRGB = 8;
+            dfb->bitsPerPixel = 8;
+            dfb->redMask = 0;
+            dfb->greenMask = 0;
+            dfb->blueMask = 0;
+            break;
+        case 8: // broken
+            dfb->visuals = PseudoColorMask;
+            dfb->preferredCVC = PseudoColor;
+            dfb->depth = 8;
+            dfb->bitsPerRGB = 8;
+            dfb->bitsPerPixel = 8;
+            dfb->redMask = 0;
+            dfb->greenMask = 0;
+            dfb->blueMask = 0;
+            break;
+        case 15:
+            dfb->visuals = LARGE_VISUALS;
+            dfb->preferredCVC = TrueColor;
+            dfb->depth = 15;
+            dfb->bitsPerRGB = 5;
+            dfb->bitsPerPixel = 16;
+            dfb->redMask   = 0x7c00;
+            dfb->greenMask = 0x03e0;
+            dfb->blueMask  = 0x001f;
+            break;
+        case 24:
+            dfb->visuals = LARGE_VISUALS;
+            dfb->preferredCVC = TrueColor;
+            dfb->depth = 24;
+            dfb->bitsPerRGB = 8;
+            dfb->bitsPerPixel = 32;
+            dfb->redMask   = 0x00ff0000;
+            dfb->greenMask = 0x0000ff00;
+            dfb->blueMask  = 0x000000ff;
+            break;
+        default:
+            FatalError("Unsupported color depth %d\n", darwinDesiredDepth);
     }
 
     if (noPseudoramiXExtension)
commit 60144ac814ee26e151186f7c93cb1a273468d497
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Dec 19 16:20:36 2007 +1030

    include: never overwrite realInputProc with enqueueInputProc. Bug #13511
    
    In some cases (triggered by a key repeat during a sync grab) XKB unwrapping
    can overwrite the device's realInputProc with the enqueueInputProc. When the
    grab is released and the events are replayed, we end up in an infinite loop.
    Each event is replayed and in replaying pushed to the end of the queue again.
    
    This fix is a hack only. It ensures that the realInputProc is never
    overwritten with the enqueueInputProc.
    
    This fixes Bug #13511 (https://bugs.freedesktop.org/show_bug.cgi?id=13511)
    (cherry picked from commit eace88989c3b65d5c20e9f37ea9b23c7c8e19335)
    (cherry picked from commit 50e80c39870adfdc84fdbc00dddf1362117ad443)

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 167dbec..9174eb6 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -258,7 +258,8 @@ typedef struct
 	    device->public.processInputProc = proc; \
 	oldprocs->processInputProc = \
 	oldprocs->realInputProc = device->public.realInputProc; \
-	device->public.realInputProc = proc; \
+	if (proc != device->public.enqueueInputProc) \
+		device->public.realInputProc = proc; \
 	oldprocs->unwrapProc = device->unwrapProc; \
 	device->unwrapProc = unwrapproc;
 
commit 102c012c206cbb3bbf0fa5b0c8f0ce2ce9bba72a
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:49:50 2007 +0200

    Input: Don't reinit devices
    
    If a device is already initialised (i.e. the virtual core devices) during
    IASD, don't init them again.  This fixes a leak.
    (cherry picked from commit 1f6015c8fe62c28cfaa82cc855b5b9c28fd34607)

diff --git a/dix/devices.c b/dix/devices.c
index 287d730..f6f3c8e 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -473,7 +473,8 @@ InitAndStartDevices(void)
 
     for (dev = inputInfo.off_devices; dev; dev = dev->next) {
         DebugF("(dix) initialising device %d\n", dev->id);
-	ActivateDevice(dev);
+        if (!dev->inited)
+            ActivateDevice(dev);
     }
     for (dev = inputInfo.off_devices; dev; dev = next)
     {
commit a304fc1d4a7062f65161ef8748fd358639ec73de
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:48:57 2007 +0200

    KDrive: Xephyr: Don't leak screen damage structure
    (cherry picked from commit 0b03d97a244540824c922c300adbc3d3ae4855d5)

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index e8001df..27165a5 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -394,6 +394,7 @@ ephyrUnsetInternalDamage (ScreenPtr pScreen)
   
   pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
   DamageUnregister (&pPixmap->drawable, scrpriv->pDamage);
+  DamageDestroy (scrpriv->pDamage);
   
   RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler,
 				ephyrInternalDamageWakeupHandler,
commit 38d8cfaaff0ae6273d9e921aae08b2706355f0d2
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:48:25 2007 +0200

    OS: Don't leak connection translation table on regeneration
    (cherry picked from commit e868e0bc0d2318e62707d3ae68532b0029959154)

diff --git a/os/connection.c b/os/connection.c
index b944593..d1ba845 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -353,7 +353,8 @@ InitConnectionLimits(void)
 #endif
 
 #if !defined(WIN32)
-    ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1));
+    if (!ConnectionTranslation)
+        ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1));
 #else
     InitConnectionTranslation();
 #endif
commit 30fc8053a5e734c3b70156bdae94fd7d5d7865a5
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:47:57 2007 +0200

    Config: HAL: Don't leak options on failure to add device
    
    This showed up in Xephyr in particular, which denies new device requests.
    (cherry picked from commit 2bb199056edf6c63cf978d1a8ad49a57ce1938f3)

diff --git a/config/hal.c b/config/hal.c
index 4427deb..16f16ec 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -92,6 +92,8 @@ add_option(InputOption **options, const char *key, const char *value)
     for (; *options; options = &(*options)->next)
         ;
     *options = xcalloc(sizeof(**options), 1);
+    if (!*options) /* Yeesh. */
+        return;
     (*options)->key = xstrdup(key);
     (*options)->value = xstrdup(value);
     (*options)->next = NULL;
@@ -156,7 +158,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
     char *path = NULL, *driver = NULL, *name = NULL, *xkb_rules = NULL;
     char *xkb_model = NULL, *xkb_layout = NULL, *xkb_variant = NULL;
     char *xkb_options = NULL, *config_info = NULL;
-    InputOption *options = NULL;
+    InputOption *options = NULL, *tmpo = NULL;
     DeviceIntPtr dev;
     DBusError error;
     int type = TYPE_NONE;
@@ -232,6 +234,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
 
     if (NewInputDeviceRequest(options, &dev) != Success) {
         DebugF("[config/hal] NewInputDeviceRequest failed\n");
+        dev = NULL;
         goto unwind;
     }
 
@@ -255,6 +258,12 @@ unwind:
         xfree(xkb_options);
     if (config_info)
         xfree(config_info);
+    while (!dev && (tmpo = options)) {
+        options = tmpo->next;
+        xfree(tmpo->key);
+        xfree(tmpo->value);
+        xfree(tmpo);
+    }
 
 out_error:
     dbus_error_free(&error);
commit 81c5950d0af8d5859f850b98c98a532784e9a757
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Dec 28 15:47:21 2007 +0200

    Config: D-Bus: Don't leak timers
    
    TimerCancel doesn't free the timer: you need TimerFree for that.
    (cherry picked from commit 25deaa7e6b29b3913b35efa39b9c8b25de5e6d95)

diff --git a/config/dbus-core.c b/config/dbus-core.c
index eab72a5..9cf1530 100644
--- a/config/dbus-core.c
+++ b/config/dbus-core.c
@@ -76,7 +76,7 @@ teardown(void)
     struct config_dbus_core_hook *hook;
 
     if (bus_info.timer) {
-        TimerCancel(bus_info.timer);
+        TimerFree(bus_info.timer);
         bus_info.timer = NULL;
     }
 
@@ -116,6 +116,8 @@ message_filter(DBusConnection *connection, DBusMessage *message, void *data)
         bus_info.connection = NULL;
         teardown();
 
+        if (bus_info.timer)
+            TimerFree(bus_info.timer);
         bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);
 
         return DBUS_HANDLER_RESULT_HANDLED;
@@ -186,6 +188,7 @@ static CARD32
 reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg)
 {
     if (connect_to_bus()) {
+        TimerFree(bus_info.timer);
         bus_info.timer = NULL;
         return 0;
     }


More information about the xorg-commit mailing list