xserver: Branch 'xorg-server-1.6-apple' - 2 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Sun Jan 11 01:53:55 PST 2009


 hw/xquartz/darwin.c                 |   11 +++++++
 hw/xquartz/darwinEvents.c           |    3 +-
 hw/xquartz/mach-startup/Makefile.am |    1 
 hw/xquartz/quartzKeyboard.c         |    2 -
 hw/xquartz/xpr/xprCursor.c          |   27 +++---------------
 hw/xquartz/xpr/xprScreen.c          |    4 ++
 mi/mieq.c                           |   54 ++++++++++++++++++++++++++++++++++++
 mi/mipointer.c                      |   12 ++++++++
 8 files changed, 87 insertions(+), 27 deletions(-)

New commits:
commit 7a8d2266861e74176b5310b83652a9c10a170494
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Jan 11 01:52:42 2009 -0800

    XQuartz: Add locking to make mieq thread safe on OSX

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 37f0bfb..1863eff 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -116,7 +116,8 @@ void darwinEvents_lock(void) {
     }
 }
 
-static inline void darwinEvents_unlock(void) {
+void darwinEvents_unlock(void);
+void darwinEvents_unlock(void) {
     int err;
     if((err = pthread_mutex_unlock(&mieq_lock))) {
         ErrorF("%s:%s:%d: Failed to unlock mieq_lock: %d\n",
diff --git a/mi/mieq.c b/mi/mieq.c
index db48f55..2905c77 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -36,6 +36,11 @@ in this Software without prior written authorization from The Open Group.
 #include <dix-config.h>
 #endif
 
+#ifdef XQUARTZ
+#include  <pthread.h>
+static pthread_mutex_t miEventQueueMutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
 # define NEED_EVENTS
 # include   <X11/X.h>
 # include   <X11/Xmd.h>
@@ -139,6 +144,9 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
     int                    isMotion = 0;
     int                    evlen;
 
+#ifdef XQUARTZ
+    pthread_mutex_lock(&miEventQueueMutex);
+#endif
 
     /* avoid merging events from different devices */
     if (e->u.u.type == MotionNotify)
@@ -157,6 +165,10 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
         lastkbp = (deviceKeyButtonPointer *) laste->events->event;
 
         if (laste->nevents > 6) {
+#ifdef XQUARTZ
+            pthread_mutex_unlock(&miEventQueueMutex);
+#endif
+            
             ErrorF("[mi] mieqEnqueue: more than six valuator events; dropping.\n");
             return;
         }
@@ -168,11 +180,17 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
               lastkbp->type == ProximityOut) ||
             ((lastkbp->deviceid & DEVICE_BITS) !=
              (v->deviceid & DEVICE_BITS))) {
+#ifdef XQUARTZ
+            pthread_mutex_unlock(&miEventQueueMutex);
+#endif
             ErrorF("[mi] mieqEnequeue: out-of-order valuator event; dropping.\n");
             return;
         }
 
         memcpy((laste->events[laste->nevents++].event), e, sizeof(xEvent));
+#ifdef XQUARTZ
+        pthread_mutex_unlock(&miEventQueueMutex);
+#endif
         return;
     }
 
@@ -192,6 +210,9 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
 		xorg_backtrace();
 		stuck = 1;
 	    }
+#ifdef XQUARTZ
+	    pthread_mutex_unlock(&miEventQueueMutex);
+#endif
 	    return;
         }
 	stuck = 0;
@@ -209,6 +230,9 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
         if (!evt->event)
         {
             ErrorF("[mi] Running out of memory. Tossing event.\n");
+#ifdef XQUARTZ
+            pthread_mutex_unlock(&miEventQueueMutex);
+#endif
             return;
         }
     }
@@ -229,24 +253,39 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
 
     miEventQueue.lastMotion = isMotion;
     miEventQueue.tail = (oldtail + 1) % QUEUE_SIZE;
+#ifdef XQUARTZ
+    pthread_mutex_unlock(&miEventQueueMutex);
+#endif
 }
 
 void
 mieqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX)
 {
+#ifdef XQUARTZ
+    pthread_mutex_lock(&miEventQueueMutex);
+#endif
     EnqueueScreen(pDev) = pScreen;
     if (fromDIX)
 	DequeueScreen(pDev) = pScreen;
+#ifdef XQUARTZ
+    pthread_mutex_unlock(&miEventQueueMutex);
+#endif
 }
 
 void
 mieqSetHandler(int event, mieqHandler handler)
 {
+#ifdef XQUARTZ
+    pthread_mutex_lock(&miEventQueueMutex);
+#endif
     if (handler && miEventQueue.handlers[event])
         ErrorF("[mi] mieq: warning: overriding existing handler %p with %p for "
                "event %d\n", miEventQueue.handlers[event], handler, event);
 
     miEventQueue.handlers[event] = handler;
+#ifdef XQUARTZ
+    pthread_mutex_unlock(&miEventQueueMutex);
+#endif
 }
 
 /**
@@ -313,6 +352,10 @@ mieqProcessInputEvents(void)
     DeviceIntPtr dev = NULL,
                  master = NULL;
 
+#ifdef XQUARTZ
+    pthread_mutex_lock(&miEventQueueMutex);
+#endif
+    
     while (miEventQueue.head != miEventQueue.tail) {
         e = &miEventQueue.events[miEventQueue.head];
 
@@ -336,6 +379,10 @@ mieqProcessInputEvents(void)
 
         miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE;
 
+#ifdef XQUARTZ
+        pthread_mutex_unlock(&miEventQueueMutex);
+#endif
+        
         type    = event->u.u.type;
         master  = (!dev->isMaster && dev->u.master) ? dev->u.master : NULL;
 
@@ -385,6 +432,13 @@ mieqProcessInputEvents(void)
         /* Update the sprite now. Next event may be from different device. */
         if (type == DeviceMotionNotify && dev->coreEvents)
             miPointerUpdateSprite(dev);
+
+#ifdef XQUARTZ
+        pthread_mutex_lock(&miEventQueueMutex);
+#endif
     }
+#ifdef XQUARTZ
+    pthread_mutex_unlock(&miEventQueueMutex);
+#endif
 }
 
diff --git a/mi/mipointer.c b/mi/mipointer.c
index b998cd4..9b2a1b2 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -547,6 +547,12 @@ miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
     *y = MIPOINTER(pDev)->y;
 }
 
+#ifdef XQUARTZ
+#include <pthread.h>
+void darwinEvents_lock(void);
+void darwinEvents_unlock(void);
+#endif
+
 void
 miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
 {
@@ -573,7 +579,13 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
     nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_ABSOLUTE, 0, 2, valuators);
 
     OsBlockSignals();
+#ifdef XQUARTZ
+    darwinEvents_lock();
+#endif
     for (i = 0; i < nevents; i++)
         mieqEnqueue(pDev, events[i].event);
+#ifdef XQUARTZ
+    darwinEvents_unlock();
+#endif
     OsReleaseSignals();
 }
commit c137f681680e1d04b1513a8be68aeda4d1c56fd5
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Jan 11 01:42:24 2009 -0800

    XQuartz: misc 1.6 updates (still --disable-glx)
      rlAccel is not longer compatable, and it's not worth fixing
      Don't override DeviceCursorInitialize with a noop
      Don't do a SwitchCoreKeyboard (which wasn't even needed in the first place)

diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 07b243b..c104589 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -510,6 +510,17 @@ void InitInput( int argc, char **argv )
     darwinTabletEraser->name = strdup("eraser");
 
     darwinTabletCurrent = darwinTabletStylus;
+
+    ActivateDevice(darwinKeyboard);
+    ActivateDevice(darwinPointer);
+    ActivateDevice(darwinTabletStylus);
+    ActivateDevice(darwinTabletCursor);
+    ActivateDevice(darwinTabletEraser);
+    EnableDevice(darwinKeyboard);
+    EnableDevice(darwinPointer);
+    EnableDevice(darwinTabletStylus);
+    EnableDevice(darwinTabletCursor);
+    EnableDevice(darwinTabletEraser);
     
     DarwinEQInit();
 
diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am
index bbad10a..40060d0 100644
--- a/hw/xquartz/mach-startup/Makefile.am
+++ b/hw/xquartz/mach-startup/Makefile.am
@@ -18,7 +18,6 @@ X11_bin_LDADD = \
 	$(top_builddir)/hw/xquartz/xpr/libXquartzXpr.la \
 	$(top_builddir)/dix/dixfonts.lo \
 	$(top_builddir)/miext/rootless/librootless.la \
-	$(top_builddir)/miext/rootless/accel/librlAccel.la \
 	$(top_builddir)/hw/xquartz/pbproxy/libxpbproxy.la \
 	$(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin
 
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 945f01e..72f94b4 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -362,8 +362,6 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
 
         XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOn);
     }
-	// TODO: What do we do now in 1.6?
-    SwitchCoreKeyboard(pDev);   
 
     DarwinKeyboardSetDeviceKeyMap(&keySyms);
 }
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index bf1a6e8..4345bee 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -239,7 +239,6 @@ QuartzSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
     }
 }
 
-
 /*
  * QuartzMoveCursor
  *  Move the cursor. This is a noop for us.
@@ -249,25 +248,6 @@ QuartzMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
 {
 }
 
-/* TODO: New for 1.6 ... probably noop */
-static Bool QuartzDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) {
-    return TRUE;
-}
-
-/* TODO: New for 1.6 ... probably noop */
-static void QuartzDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) {
-}
-
-static miPointerSpriteFuncRec quartzSpriteFuncsRec = {
-    QuartzRealizeCursor,
-    QuartzUnrealizeCursor,
-    QuartzSetCursor,
-    QuartzMoveCursor,
-    QuartzDeviceCursorInitialize,
-    QuartzDeviceCursorCleanup
-};
-
-
 /*
 ===========================================================================
 
@@ -387,13 +367,16 @@ QuartzInitCursor(ScreenPtr pScreen)
     PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
 
     ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
-    PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
 
+    PointPriv->spriteFuncs->RealizeCursor = QuartzRealizeCursor;
+    PointPriv->spriteFuncs->UnrealizeCursor = QuartzUnrealizeCursor;
+    PointPriv->spriteFuncs->SetCursor = QuartzSetCursor;
+    PointPriv->spriteFuncs->MoveCursor = QuartzMoveCursor;
+    
     ScreenPriv->cursorVisible = TRUE;
     return TRUE;
 }
 
-
 /*
  * QuartzSuspendXCursor
  *  X server is hiding. Restore the Aqua cursor.
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 52fb9c9..da262f6 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -364,7 +364,9 @@ xprSetupScreen(int index, ScreenPtr pScreen)
 {
     // Initialize accelerated rootless drawing
     // Note that this must be done before DamageSetup().
-    RootlessAccelInit(pScreen);
+
+    // These are crashing ugly... better to be stable and not crash for now.
+    //RootlessAccelInit(pScreen);
 
 #ifdef DAMAGE
     // The Damage extension needs to wrap underneath the


More information about the xorg-commit mailing list