[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'upstream-experimental'



 Xext/sync.c                 |    2 
 configure.ac                |   37 ++++++++--------
 exa/Makefile.am             |    4 -
 glx/glxdri2.c               |    4 +
 hw/kdrive/ephyr/ephyr.c     |    9 +++-
 hw/kdrive/ephyr/hostx.c     |    4 -
 hw/kdrive/src/kdrive.c      |    3 -
 hw/kdrive/src/kdrive.h      |    1 
 hw/kdrive/src/kinput.c      |   10 ++--
 hw/xfree86/Makefile.am      |   11 ----
 hw/xfree86/modes/xf86Crtc.c |    3 +
 hw/xnest/GCOps.c            |    1 
 include/input.h             |   12 ++---
 mi/mieq.c                   |    2 
 miext/sync/Makefile.am      |    3 -
 miext/sync/misync.h         |    2 
 miext/sync/misyncfd.c       |   99 ++++++++++++++++++++++++++++++++++++++++++++
 miext/sync/misyncfd.h       |   45 ++++++++++++++++++++
 miext/sync/misyncshm.c      |   21 ++++++---
 miext/sync/misyncshm.h      |    2 
 present/present.c           |   52 +++++++++++++++++++----
 present/present_event.c     |    2 
 present/present_fake.c      |    2 
 present/present_fence.c     |   29 ++++++++++++
 present/present_priv.h      |   17 ++++++-
 present/present_screen.c    |    2 
 test/Makefile.am            |    4 -
 27 files changed, 304 insertions(+), 79 deletions(-)

New commits:
commit 80481267662c8687e73081237913fa561e7a6561
Author: Keith Packard <keithp@keithp.com>
Date:   Sat Nov 23 22:22:37 2013 -0800

    Bump release to 1.14.99.903 (1.15 RC3)
    
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/configure.ac b/configure.ac
index 2f4edee..6c4a609 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,9 +26,9 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.14.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2013-11-14"
-RELEASE_NAME="English Breakfast"
+AC_INIT([xorg-server], 1.14.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2013-11-23"
+RELEASE_NAME="Apple Pie"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AC_USE_SYSTEM_EXTENSIONS

commit f1604002a32b7f098c2a16b4a8649c694af570c8
Author: Keith Packard <keithp@keithp.com>
Date:   Mon Nov 18 22:36:17 2013 -0800

    miext: Ensure xshmfence is only called when driver supports it
    
    This provides a place for drivers to insert their own FD-based
    SyncFence implementations, and prevents applications from using DRI3
    SyncFence creation functions unless the driver has some support for
    them.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Tested-by: Fredrik Höglund <fredrik@kde.org>

diff --git a/miext/sync/Makefile.am b/miext/sync/Makefile.am
index ac13c52..34961d5 100644
--- a/miext/sync/Makefile.am
+++ b/miext/sync/Makefile.am
@@ -5,7 +5,7 @@ AM_CFLAGS = $(DIX_CFLAGS)
 AM_CPPFLAGS = 
 
 if XORG
-sdk_HEADERS = misync.h misyncstr.h misyncshm.h
+sdk_HEADERS = misync.h misyncstr.h misyncshm.h misyncfd.h
 endif
 
 XSHMFENCE_SRCS = misyncshm.c
@@ -13,6 +13,7 @@ XSHMFENCE_SRCS = misyncshm.c
 libsync_la_SOURCES =	\
 	misync.c	\
 	misync.h	\
+	misyncfd.c	\
 	misyncstr.h
 
 if XSHMFENCE
diff --git a/miext/sync/misync.h b/miext/sync/misync.h
index f63ec2b..dc78c5f 100644
--- a/miext/sync/misync.h
+++ b/miext/sync/misync.h
@@ -42,8 +42,8 @@ typedef struct _syncScreenFuncs {
     SyncScreenDestroyFenceFunc DestroyFence;
 } SyncScreenFuncsRec, *SyncScreenFuncsPtr;
 
-extern _X_EXPORT void
 
+extern _X_EXPORT void
 miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence * pFence,
                         Bool initially_triggered);
 extern _X_EXPORT void
diff --git a/miext/sync/misyncfd.c b/miext/sync/misyncfd.c
new file mode 100644
index 0000000..93ff85f
--- /dev/null
+++ b/miext/sync/misyncfd.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright © 2013 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "scrnintstr.h"
+#include "misync.h"
+#include "misyncstr.h"
+#include "misyncfd.h"
+#include "pixmapstr.h"
+
+static DevPrivateKeyRec syncFdScreenPrivateKey;
+
+typedef struct _SyncFdScreenPrivate {
+    SyncFdScreenFuncsRec        funcs;
+} SyncFdScreenPrivateRec, *SyncFdScreenPrivatePtr;
+
+static inline SyncFdScreenPrivatePtr sync_fd_screen_priv(ScreenPtr pScreen)
+{
+    if (!dixPrivateKeyRegistered(&syncFdScreenPrivateKey))
+        return NULL;
+    return dixLookupPrivate(&pScreen->devPrivates, &syncFdScreenPrivateKey);
+}
+
+int
+miSyncInitFenceFromFD(DrawablePtr pDraw, SyncFence *pFence, int fd, BOOL initially_triggered)
+
+{
+    SyncFdScreenPrivatePtr      priv = sync_fd_screen_priv(pDraw->pScreen);
+
+    if (!priv)
+        return BadMatch;
+
+    return (*priv->funcs.CreateFenceFromFd)(pDraw->pScreen, pFence, fd, initially_triggered);
+}
+
+int
+miSyncFDFromFence(DrawablePtr pDraw, SyncFence *pFence)
+{
+    SyncFdScreenPrivatePtr      priv = sync_fd_screen_priv(pDraw->pScreen);
+
+    if (!priv)
+        return -1;
+
+    return (*priv->funcs.GetFenceFd)(pDraw->pScreen, pFence);
+}
+
+_X_EXPORT Bool miSyncFdScreenInit(ScreenPtr pScreen,
+                                  const SyncFdScreenFuncsRec *funcs)
+{
+    SyncFdScreenPrivatePtr     priv;
+
+    /* Check to see if we've already been initialized */
+    if (sync_fd_screen_priv(pScreen) != NULL)
+        return FALSE;
+
+    if (!miSyncSetup(pScreen))
+        return FALSE;
+    
+    if (!dixPrivateKeyRegistered(&syncFdScreenPrivateKey)) {
+        if (!dixRegisterPrivateKey(&syncFdScreenPrivateKey, PRIVATE_SCREEN, 0))
+            return FALSE;
+    }
+
+    priv = calloc(1, sizeof (SyncFdScreenPrivateRec));
+    if (!priv)
+        return FALSE;
+
+    /* Will require version checks when there are multiple versions
+     * of the funcs structure
+     */
+
+    priv->funcs = *funcs;
+
+    dixSetPrivate(&pScreen->devPrivates, &syncFdScreenPrivateKey, priv);
+    
+    return TRUE;
+}
diff --git a/miext/sync/misyncfd.h b/miext/sync/misyncfd.h
new file mode 100644
index 0000000..c1d05f9
--- /dev/null
+++ b/miext/sync/misyncfd.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2013 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _MISYNCFD_H_
+#define _MISYNCFD_H_
+
+typedef int (*SyncScreenCreateFenceFromFdFunc) (ScreenPtr screen,
+                                                SyncFence *fence,
+                                                int fd,
+                                                Bool initially_triggered);
+
+typedef int (*SyncScreenGetFenceFdFunc) (ScreenPtr screen,
+                                      SyncFence *fence);
+
+#define SYNC_FD_SCREEN_FUNCS_VERSION    1
+
+typedef struct _syncFdScreenFuncs {
+    int                                 version;
+    SyncScreenCreateFenceFromFdFunc     CreateFenceFromFd;
+    SyncScreenGetFenceFdFunc            GetFenceFd;
+} SyncFdScreenFuncsRec, *SyncFdScreenFuncsPtr;
+
+extern _X_EXPORT Bool miSyncFdScreenInit(ScreenPtr pScreen,
+                                         const SyncFdScreenFuncsRec *funcs);
+
+#endif /* _MISYNCFD_H_ */
diff --git a/miext/sync/misyncshm.c b/miext/sync/misyncshm.c
index ddd15ae..3f9350a 100644
--- a/miext/sync/misyncshm.c
+++ b/miext/sync/misyncshm.c
@@ -28,6 +28,7 @@
 #include "misync.h"
 #include "misyncstr.h"
 #include "misyncshm.h"
+#include "misyncfd.h"
 #include "pixmapstr.h"
 #include <sys/mman.h>
 #include <unistd.h>
@@ -118,13 +119,12 @@ miSyncShmScreenDestroyFence(ScreenPtr pScreen, SyncFence * pFence)
     miSyncScreenDestroyFence(pScreen, pFence);
 }
 
-int
-miSyncInitFenceFromFD(DrawablePtr pDraw, SyncFence *pFence, int fd, BOOL initially_triggered)
-
+static int
+miSyncShmCreateFenceFromFd(ScreenPtr pScreen, SyncFence *pFence, int fd, Bool initially_triggered)
 {
     SyncShmFencePrivatePtr      pPriv = SYNC_FENCE_PRIV(pFence);
 
-    miSyncInitFence(pDraw->pScreen, pFence, initially_triggered);
+    miSyncInitFence(pScreen, pFence, initially_triggered);
 
     pPriv->fence = xshmfence_map_shm(fd);
     if (pPriv->fence) {
@@ -136,8 +136,8 @@ miSyncInitFenceFromFD(DrawablePtr pDraw, SyncFence *pFence, int fd, BOOL initial
     return BadValue;
 }
 
-int
-miSyncFDFromFence(DrawablePtr pDraw, SyncFence *pFence)
+static int
+miSyncShmGetFenceFd(ScreenPtr pScreen, SyncFence *pFence)
 {
     SyncShmFencePrivatePtr      pPriv = SYNC_FENCE_PRIV(pFence);
 
@@ -154,11 +154,17 @@ miSyncFDFromFence(DrawablePtr pDraw, SyncFence *pFence)
     return pPriv->fd;
 }
 
+static const SyncFdScreenFuncsRec miSyncShmScreenFuncs = {
+    .version = SYNC_FD_SCREEN_FUNCS_VERSION,
+    .CreateFenceFromFd = miSyncShmCreateFenceFromFd,
+    .GetFenceFd = miSyncShmGetFenceFd
+};
+
 _X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen)
 {
     SyncScreenFuncsPtr  funcs;
 
-    if (!miSyncSetup(pScreen))
+    if (!miSyncFdScreenInit(pScreen, &miSyncShmScreenFuncs))
         return FALSE;
 
     if (!dixPrivateKeyRegistered(&syncShmFencePrivateKey)) {
@@ -171,6 +177,7 @@ _X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen)
 
     funcs->CreateFence = miSyncShmScreenCreateFence;
     funcs->DestroyFence = miSyncShmScreenDestroyFence;
+
     return TRUE;
 }
 
diff --git a/miext/sync/misyncshm.h b/miext/sync/misyncshm.h
index 4edbb50..23c001a 100644
--- a/miext/sync/misyncshm.h
+++ b/miext/sync/misyncshm.h
@@ -21,7 +21,7 @@
  */
 
 #ifndef _MISYNCSHM_H_
-#define _MISYNCSYM_H_
+#define _MISYNCSHM_H_
 
 extern _X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen);
 

commit 037566c57caff93fd7717f385d4b532b81f19c77
Author: Keith Packard <keithp@keithp.com>
Date:   Mon Nov 18 22:33:27 2013 -0800

    Xext: Recover from miSyncInitFenceFromFD failure without crashing
    
    miSyncDestroyFence must not be called unless miSyncInitFence has been
    invoked, so if miSyncInitFenceFromFD fails, we must free the fence
    manually.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Tested-by: Fredrik Höglund <fredrik@kde.org>

diff --git a/Xext/sync.c b/Xext/sync.c
index dd18cde..2d58ea1 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -929,7 +929,7 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL
 
     status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered);
     if (status != Success) {
-        miSyncDestroyFence(pFence);
+        dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE);
         return status;
     }
 

commit e7000534a456fdf9cd4eaada3193846c8525f740
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Oct 5 08:47:03 2013 +0100

    glx/glxdri2: Unwrap EnterVT/LeaveVT upon CloseScreen
    
    In a similar spirit to
    
    commit d75e8146c414bfd512ba5dbd4a83acb334bbe19b
    Author: Keith Packard <keithp@keithp.com>
    Date:   Mon Jul 12 16:01:34 2010 -0700
    
        Unwrap/rewrap EnterVT/LeaveVT completely, Fixes 28998
    
    we need to unwrap our pScrn->EnterVT/LeaveVT hooks around server
    regeneration or else we cause an infinite recursion on the next VT
    switch afterwards.
    
    Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1235516
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 1d74c8f..fbbd1fd 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -371,6 +371,7 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
 {
     int i;
 
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(baseScreen->pScreen);
     __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
 
     (*screen->core->destroyScreen) (screen->driScreen);
@@ -385,6 +386,9 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
         free(screen->driConfigs);
     }
 
+    pScrn->EnterVT = screen->enterVT;
+    pScrn->LeaveVT = screen->leaveVT;
+
     free(screen);
 }
 

commit 6d5883bd7e5b765f8f0548501b825d9e56840799
Author: Keith Packard <keithp@keithp.com>
Date:   Sat Nov 23 16:19:46 2013 -0800

    xnest: Ignore GetImage() error in xnestGetImage() (v3)
    
    (I found an amended version of this patch and applied the difference
    here - keithp)
    
    v3: Don't call Xsync before restoring error handler as any errors
        generated by XGetImage() should be processed when this call
        returns as suggested by Jamey Sharp <jamey@minilop.net>
    
    Signed-off-by: Egbert Eich <eich@freedesktop.org>
    Reviewed-by: Jamey Sharp <jamey@minilop.net>

diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c
index 7b1956d..d00511d 100644
--- a/hw/xnest/GCOps.c
+++ b/hw/xnest/GCOps.c
@@ -115,7 +115,6 @@ xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
 
     ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable),
                        x, y, w, h, planeMask, format);
-    XSync(xnestDisplay, False);
     XSetErrorHandler(old_handler);
 
     if (ximage) {

commit 6403cbb143c67872ca9c58e3116ae7942def0ae1
Author: Keith Packard <keithp@keithp.com>
Date:   Tue Nov 19 22:13:54 2013 -0800

    present: When unflipping, copy to flip window rather than screen
    
    unflip happens after the clip lists have been updated, so instead of
    smashing the whole screen and drawing over other windows, just draw to
    the original flip window; it'll have the right clip list and so the
    copy will work just fine.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>

diff --git a/present/present.c b/present/present.c
index 16dc381..f9eef6b 100644
--- a/present/present.c
+++ b/present/present.c
@@ -321,8 +321,8 @@ present_unflip(ScreenPtr screen)
 
     /* Update the screen pixmap with the current flip pixmap contents
      */
-    if (screen_priv->flip_pixmap) {
-        present_copy_region(&screen->GetScreenPixmap(screen)->drawable,
+    if (screen_priv->flip_pixmap && screen_priv->flip_window) {
+        present_copy_region(&screen_priv->flip_window->drawable,
                             screen_priv->flip_pixmap,
                             NULL, 0, 0);
     }

commit 8bdd2ccc776ded3f527596b5009ef25129aa3287
Author: Keith Packard <keithp@keithp.com>
Date:   Mon Nov 11 18:03:42 2013 -0800

    present: Block for wait_fence in present_execute
    
    Pend presentation until wait_fence is also triggered by having the
    SyncFence trigger invoke present_execute once triggered.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>

diff --git a/present/present.c b/present/present.c
index 67d7f6e..16dc381 100644
--- a/present/present.c
+++ b/present/present.c
@@ -453,6 +453,26 @@ present_check_flip_window (WindowPtr window)
 }
 
 /*
+ * Called when the wait fence is triggered; just gets the current msc/ust and
+ * calls present_execute again. That will re-check the fence and pend the
+ * request again if it's still not actually ready
+ */
+static void
+present_wait_fence_triggered(void *param)
+{
+    present_vblank_ptr  vblank = param;
+    WindowPtr           window = vblank->window;
+    uint64_t            ust = 0, crtc_msc = 0;
+
+    if (window) {
+        present_window_priv_ptr     window_priv = present_get_window_priv(window, TRUE);
+        if (window_priv)
+            (void) present_get_ust_msc(window, window_priv->crtc, &ust, &crtc_msc);
+    }
+    present_execute(vblank, ust, crtc_msc);
+}
+
+/*
  * Once the required MSC has been reached, execute the pending request.
  *
  * For requests to actually present something, either blt contents to
@@ -469,7 +489,10 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
     present_screen_priv_ptr     screen_priv = present_screen_priv(window->drawable.pScreen);
 
     if (vblank->wait_fence) {
-        /* XXX check fence, queue if not ready */
+        if (!present_fence_check_triggered(vblank->wait_fence)) {
+            present_fence_set_callback(vblank->wait_fence, present_wait_fence_triggered, vblank);
+            return;
+        }
     }
 
     xorg_list_del(&vblank->event_queue);
@@ -654,6 +677,12 @@ present_pixmap(WindowPtr window,
             target_msc--;
     }
 
+    if (wait_fence) {
+        vblank->wait_fence = present_fence_create(wait_fence);
+        if (!vblank->wait_fence)
+            goto no_mem;
+    }
+
     if (idle_fence) {
         vblank->idle_fence = present_fence_create(idle_fence);
         if (!vblank->idle_fence)
@@ -764,6 +793,9 @@ present_vblank_destroy(present_vblank_ptr vblank)
     if (vblank->update)
         RegionDestroy(vblank->update);
 
+    if (vblank->wait_fence)
+        present_fence_destroy(vblank->wait_fence);
+
     if (vblank->idle_fence)
         present_fence_destroy(vblank->idle_fence);
 
diff --git a/present/present_event.c b/present/present_event.c
index a30bc82..a8f7176 100644
--- a/present/present_event.c
+++ b/present/present_event.c
@@ -26,8 +26,6 @@
 
 #include "present_priv.h"
 
-#include "present_priv.h"
-
 RESTYPE present_event_type;
 
 static int
diff --git a/present/present_fence.c b/present/present_fence.c
index db5efca..e09657d 100644
--- a/present/present_fence.c
+++ b/present/present_fence.c
@@ -37,6 +37,8 @@
 struct present_fence {
     SyncTrigger         trigger;
     SyncFence           *fence;
+    void                (*callback)(void *param);
+    void                *param;
 };
 
 /*
@@ -45,12 +47,18 @@ struct present_fence {
 static Bool
 present_fence_sync_check_trigger(SyncTrigger *trigger, XSyncValue oldval)
 {
-    return FALSE;
+    struct present_fence        *present_fence = container_of(trigger, struct present_fence, trigger);
+
+    return present_fence->callback != NULL;
 }
 
 static void
 present_fence_sync_trigger_fired(SyncTrigger *trigger)
 {
+    struct present_fence        *present_fence = container_of(trigger, struct present_fence, trigger);
+
+    if (present_fence->callback)
+        (*present_fence->callback)(present_fence->param);
 }
 
 static void
@@ -101,6 +109,25 @@ present_fence_set_triggered(struct present_fence *present_fence)
             (*present_fence->fence->funcs.SetTriggered) (present_fence->fence);
 }
 
+Bool
+present_fence_check_triggered(struct present_fence *present_fence)
+{
+    if (!present_fence)
+        return TRUE;
+    if (!present_fence->fence)
+        return TRUE;
+    return (*present_fence->fence->funcs.CheckTriggered)(present_fence->fence);
+}
+
+void
+present_fence_set_callback(struct present_fence *present_fence,
+                           void (*callback) (void *param),
+                           void *param)
+{
+    present_fence->callback = callback;
+    present_fence->param = param;
+}
+
 XID
 present_fence_id(struct present_fence *present_fence)
 {
diff --git a/present/present_priv.h b/present/present_priv.h
index 40c88dd..500c7c2 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -249,6 +249,14 @@ present_fence_destroy(struct present_fence *present_fence);
 void
 present_fence_set_triggered(struct present_fence *present_fence);
 
+Bool
+present_fence_check_triggered(struct present_fence *present_fence);
+
+void
+present_fence_set_callback(struct present_fence *present_fence,
+                           void (*callback)(void *param),
+                           void *param);
+
 XID
 present_fence_id(struct present_fence *present_fence);
 
@@ -271,6 +279,13 @@ void
 present_destroy_notifies(present_notify_ptr notifies, int num_notifies);
 
 /*
+ * present_redirect.c
+ */
+
+WindowPtr
+present_redirect(ClientPtr client, WindowPtr target);
+
+/*
  * present_request.c
  */
 int

commit e5a188cb919edee2e3a03054276bce0db02f7b62
Author: Keith Packard <keithp@keithp.com>
Date:   Sat Nov 9 12:36:47 2013 -0800

    present: Signal destroyed flip window with vblank->window == NULL
    
    This eliminates dereferencing freed window pointers when there is a
    flip for that window in progress. The flip will complete, and then
    immediately get undone (as we can't stop an in-progress flip).
    
    Remove the vblank->window_destroyed field as we can signal this with
    vblank->window == NULL instead.
    
    Change check to vblank->window == NULL in:
    
    	present_flip_notify
    
    Add check for vblank->window == NULL in:
    	present_vblank_notify
    	present_execute
    
    present_flip_notify was also using vblank->window->drawable.pScreen,
    so stop doing that and use vblank->screen instead.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>

diff --git a/present/present.c b/present/present.c
index bfafa92..67d7f6e 100644
--- a/present/present.c
+++ b/present/present.c
@@ -171,7 +171,8 @@ present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_
 {
     int         n;
 
-    present_send_complete_notify(vblank->window, kind, mode, vblank->serial, ust, crtc_msc - vblank->msc_offset);
+    if (vblank->window)
+        present_send_complete_notify(vblank->window, kind, mode, vblank->serial, ust, crtc_msc - vblank->msc_offset);
     for (n = 0; n < vblank->num_notifies; n++) {
         WindowPtr   window = vblank->notifies[n].window;
         CARD32      serial = vblank->notifies[n].serial;
@@ -336,8 +337,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc);
 static void
 present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
 {
-    WindowPtr                   window = vblank->window;
-    ScreenPtr                   screen = window->drawable.pScreen;
+    ScreenPtr                   screen = vblank->screen;
     present_screen_priv_ptr     screen_priv = present_screen_priv(screen);
 
     DebugPresent(("\tn %p %8lld: %08lx -> %08lx\n", vblank, vblank->target_msc,
@@ -363,8 +363,7 @@ present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
     if (vblank->abort_flip)
         present_unflip(screen);
 
-    if (!vblank->window_destroyed)
-        present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc);
+    present_vblank_notify(vblank, PresentCompleteKindPixmap, PresentCompleteModeFlip, ust, crtc_msc);
     present_vblank_destroy(vblank);
 }
 
@@ -474,7 +473,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
     }
 
     xorg_list_del(&vblank->event_queue);
-    if (vblank->pixmap) {
+    if (vblank->pixmap && vblank->window) {
 
         if (vblank->flip && screen_priv->flip_pending == NULL && !screen_priv->unflip_event_id) {
 
diff --git a/present/present_priv.h b/present/present_priv.h
index a92b62a..40c88dd 100644
--- a/present/present_priv.h
+++ b/present/present_priv.h
@@ -72,8 +72,6 @@ struct present_vblank {
     Bool                flip;
     Bool                sync_flip;
     Bool                abort_flip;
-
-    Bool                window_destroyed;
 };
 
 typedef struct present_screen_priv {
diff --git a/present/present_screen.c b/present/present_screen.c
index 50b2b2d..2702cd6 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -92,7 +92,7 @@ present_clear_window_flip(WindowPtr window)
 
     if (flip_pending && flip_pending->window == window) {
         assert (flip_pending->abort_flip);
-        flip_pending->window_destroyed = TRUE;
+        flip_pending->window = NULL;
     }
     if (screen_priv->flip_window == window)
         screen_priv->flip_window = NULL;

commit a5bcc4f7b9499caf8993f0a6ef96088553399ca3
Author: Keith Packard <keithp@keithp.com>
Date:   Sat Nov 9 12:33:02 2013 -0800

    present: Ignore event_id 0 from driver vblank notify
    
    We use event_id 0 to mean 'no such event'; if a driver sends us that
    event_id, make sure we don't accidentally match it.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>

diff --git a/present/present.c b/present/present.c
index 228d43a..bfafa92 100644
--- a/present/present.c
+++ b/present/present.c
@@ -374,6 +374,8 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
     present_vblank_ptr  vblank, tmp;
     int                 s;
 
+    if (!event_id)
+        return;
     DebugPresent(("\te %lld ust %lld msc %lld\n", event_id, ust, msc));
     xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
         if (vblank->event_id == event_id) {
@@ -398,6 +400,7 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
             DebugPresent(("\tun %lld\n", event_id));
             screen_priv->unflip_event_id = 0;
             present_flip_idle(screen);
+            return;
         }
     }
 }

commit 4f3c37a1f17ffcfbbff71d217e1caad3d0148c90
Author: Keith Packard <keithp@keithp.com>
Date:   Thu Nov 7 14:17:12 2013 -0800

    present: Round fake MSC computations intead of truncating
    
    If the timer fired too early, we'd sometimes mis-compute the MSC for
    fake vblanks. Rounding the computation to the nearest MSC fixes this nicely.
    
    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>

diff --git a/present/present_fake.c b/present/present_fake.c
index a677592..e550e98 100644
--- a/present/present_fake.c
+++ b/present/present_fake.c
@@ -42,7 +42,7 @@ present_fake_get_ust_msc(ScreenPtr screen, uint64_t *ust, uint64_t *msc)
     present_screen_priv_ptr screen_priv = present_screen_priv(screen);
 
     *ust = GetTimeInMicros();
-    *msc = *ust / screen_priv->fake_interval;
+    *msc = (*ust + screen_priv->fake_interval / 2) / screen_priv->fake_interval;
     return Success;
 }
 

commit da9997f89f14ab619f244d5b2e80a423b028c789
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Nov 19 08:07:09 2013 +1000

    configure: allow for --enable-libunwind and --disable-libunwind
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/configure.ac b/configure.ac
index 1e6f813..2f4edee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -305,13 +305,6 @@ AC_CHECK_HEADER([execinfo.h],[
     ])]
 )
 
-PKG_CHECK_MODULES(LIBUNWIND, libunwind, [HAVE_LIBUNWIND=yes], [HAVE_LIBUNWIND=no])
-if test "x$HAVE_LIBUNWIND" = xyes; then
-	AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
-fi
-AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = xyes])
-
-
 dnl ---------------------------------------------------------------------------
 dnl Bus options and CPU capabilities.  Replaces logic in
 dnl hw/xfree86/os-support/bus/Makefile.am, among others.
@@ -654,6 +647,7 @@ dnl kdrive options
 AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
 AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
 AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
+AC_ARG_ENABLE(libunwind,      AS_HELP_STRING([--enable-libunwind], [Use libunwind for backtracing (default: auto)]), [LIBUNWIND="$enableval"], [LIBUNWIND="auto"])
 
 
 dnl chown/chmod to be setuid root as part of build
@@ -1616,6 +1610,20 @@ AC_SUBST(SHA1_CFLAGS)
 PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
 PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
 
+PKG_CHECK_MODULES(LIBUNWIND, libunwind, [HAVE_LIBUNWIND=yes], [HAVE_LIBUNWIND=no])
+if test "x$LIBUNWIND" = "xauto"; then
+    LIBUNWIND="$HAVE_LIBUNWIND"
+fi
+
+if test "x$LIBUNWIND" = "xyes"; then
+    if test "x$HAVE_LIBUNWIND" != "xyes"; then
+        AC_MSG_ERROR([libunwind requested but not installed.])
+    fi
+    AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
+fi
+
+AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$LIBUNWIND" = xyes])
+
 # Autotools has some unfortunate issues with library handling.  In order to
 # get a server to rebuild when a dependency in the tree is changed, it must
 # be listed in SERVERNAME_DEPENDENCIES.  However, no system libraries may be

commit 0492deb8f8238b7782e5a706ec6219d88aa1091d
Author: Adam Jackson <ajax@redhat.com>
Date:   Tue Oct 29 12:09:27 2013 -0400

    mieq: Bump default queue size to 512
    
    Based on some bugzilla scraping I did around November 2012.  Of xserver
    bugs in Red Hat bugzilla with an EQ size message in the log, the
    distribution looked like:
    
    String                      | Matches
    -------------------------------------
    Increasing EQ size to 512   | 460
    Increasing EQ size to 1024  | 52
    Increasing EQ size to 2048  | 6
    Increasing EQ size to 4096  | 0
    
    Most of the "512" ones appear to be mostly harmless, some relatively
    expensive path in either rendering or resource destruction simply taking
    too long due to external pressures like paging or CPU contention.  So
    let's raise the initial queue size, both to reduce the number of
    spurious abrt reports and to drop fewer events in all but the most
    pathological cases.
    
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/mi/mieq.c b/mi/mieq.c
index d7d73de..4c07480 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -60,7 +60,7 @@ in this Software without prior written authorization from The Open Group.
 #endif
 
 /* Maximum size should be initial size multiplied by a power of 2 */
-#define QUEUE_INITIAL_SIZE                 256
+#define QUEUE_INITIAL_SIZE                 512
 #define QUEUE_RESERVED_SIZE                 64
 #define QUEUE_MAXIMUM_SIZE                4096
 #define QUEUE_DROP_BACKTRACE_FREQUENCY     100

commit d1440783a7367ff0d0c47d256bbca3b3cf8a5034
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Oct 29 12:09:26 2013 -0400

    xfree86: return NULL for compat output if no outputs.
    
    With outputless GPUs showing up we crash here if there are not outputs
    try and recover with a bit of grace.
    
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 2a02c85..a441fd1 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1863,6 +1863,9 @@ SetCompatOutput(xf86CrtcConfigPtr config)
     DisplayModePtr maxmode = NULL, testmode, mode;
     int o, compat = -1, count, mincount = 0;
 
+    if (config->num_output == 0)
+        return NULL;
+
     /* Look for one that's definitely connected */
     for (o = 0; o < config->num_output; o++) {
         test = config->output[o];

commit d7ee27e5e415778240919082c83a65226c6f17e6
Author: Dan Horák <dan@danny.cz>
Date:   Tue Oct 29 12:09:25 2013 -0400

    test: build the touch test only when building Xorg
    
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dan Horák <dan@danny.cz>
    Signed-off-by: Keith Packard <keithp@keithp.com>

diff --git a/test/Makefile.am b/test/Makefile.am
index e59c412..2852bb3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,11 +1,11 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
-noinst_PROGRAMS = list string touch
+noinst_PROGRAMS = list string
 if XORG
 # Tests that require at least some DDX functions in order to fully link
 # For now, requires xf86 ddx, could be adjusted to use another
 SUBDIRS += xi2
-noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest os signal-logging
+noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest os signal-logging touch
 endif
 check_LTLIBRARIES = libxservertest.la
 

commit 8ff7e32c3ef7b0c13c4ab9664f651e9782d35a85
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Nov 13 17:14:11 2013 +1000

    include: export key_is_down and friends
    
    VNC needs key_is_down to check if a key is processed as down before it
    simulates various key releases. Make it available, because I seriously can't
    be bothered thinking about how to rewrite VNC to not need that.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Acked-by: Keith Packard <keithp@keithp.com>

diff --git a/include/input.h b/include/input.h
index 350daba..2d5e531 100644
--- a/include/input.h
+++ b/include/input.h
@@ -244,12 +244,12 @@ typedef struct _InputAttributes {
 #define KEY_POSTED 2
 #define BUTTON_POSTED 2
 
-extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
-extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
-extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
-extern void set_button_down(DeviceIntPtr pDev, int button, int type);
-extern void set_button_up(DeviceIntPtr pDev, int button, int type);
-extern int button_is_down(DeviceIntPtr pDev, int button, int type);
+extern _X_EXPORT void set_key_down(DeviceIntPtr pDev, int key_code, int type);


Reply to: