[PATCH xserver 7/9] Add XDamageSubtractAndTrigger operation
James Jones
jajones at nvidia.com
Tue Sep 21 16:32:17 PDT 2010
XDamageSubtractAndTrigger behaves exactly like
XDamageSubtract except it receives an optional
fence sync object. If the value of this object
is not None, it is triggered by X once all the
rendering associated with the damage regions
being subtracted has completed.
Signed-off-by: James Jones <jajones at nvidia.com>
Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
Reviewed-by: Robert Morell <rmorell at nvidia.com>
---
COPYING | 2 +-
Xext/sync.c | 27 +++++++-------
Xext/syncsrv.h | 68 ++++++++++------------------------
configure.ac | 21 ++++++-----
damageext/damageext.c | 64 +++++++++++++++++++++++++++------
include/protocol-versions.h | 2 +-
miext/Makefile.am | 4 +-
miext/X/Makefile.am | 14 +++++++
miext/X/misync.c | 44 ++++++++++++++++++++++
miext/X/misync.h | 36 ++++++++++++++++++
miext/X/misyncstr.h | 84 +++++++++++++++++++++++++++++++++++++++++++
11 files changed, 280 insertions(+), 86 deletions(-)
create mode 100644 miext/X/Makefile.am
create mode 100644 miext/X/misync.c
create mode 100644 miext/X/misync.h
create mode 100644 miext/X/misyncstr.h
diff --git a/COPYING b/COPYING
index 3fb06b8..3aad5fa 100644
--- a/COPYING
+++ b/COPYING
@@ -14,7 +14,7 @@ Copyright © 2006-2007 Intel Corporation
Copyright © 2006 Nokia Corporation
Copyright © 2006-2008 Peter Hutterer
Copyright © 2006 Adam Jackson
-Copyright © 2009 NVIDIA Corporation
+Copyright © 2009-2010 NVIDIA Corporation
Copyright © 1999 Keith Packard
Copyright © 2007-2009 Red Hat, Inc.
Copyright © 2005-2008 Daniel Stone
diff --git a/Xext/sync.c b/Xext/sync.c
index da1d407..644bdd7 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -1977,13 +1977,23 @@ FreeFence(void *obj, XID id)
return Success;
}
+int SyncVerifyFence(SyncFence **ppSyncFence, XID fid,
+ ClientPtr client, Mask mode)
+{
+ int rc = dixLookupResourceByType((pointer *)ppSyncFence, fid, RTFence,
+ client, mode);
+
+ if (rc != Success)
+ client->errorValue = fid;
+
+ return rc;
+}
+
static int
ProcSyncTriggerFence(ClientPtr client)
{
REQUEST(xSyncTriggerFenceReq);
SyncFence *pFence;
- SyncTriggerList *ptl, *pNext;
- CARD64 unused;
int rc;
REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
@@ -1993,17 +2003,7 @@ ProcSyncTriggerFence(ClientPtr client)
if (rc != Success)
return rc;
- pFence->triggered = TRUE;
-
- XSyncIntToValue(&unused, 0L);
-
- /* run through triggers to see if any fired */
- for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext)
- {
- pNext = ptl->next;
- if ((*ptl->pTrigger->CheckTrigger)(ptl->pTrigger, unused))
- (*ptl->pTrigger->TriggerFired)(ptl->pTrigger);
- }
+ miSyncTriggerFence(pFence);
return client->noClientException;
}
@@ -2590,7 +2590,6 @@ SyncResetProc(ExtensionEntry *extEntry)
RTCounter = 0;
}
-
/*
* ** Initialise the extension.
*/
diff --git a/Xext/syncsrv.h b/Xext/syncsrv.h
index 0fde6c6..14d6019 100644
--- a/Xext/syncsrv.h
+++ b/Xext/syncsrv.h
@@ -51,31 +51,8 @@ PERFORMANCE OF THIS SOFTWARE.
#ifndef _SYNCSRV_H_
#define _SYNCSRV_H_
-#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
-
-/* Sync object types */
-#define SYNC_COUNTER 0
-#define SYNC_FENCE 1
-
-typedef struct _SyncObject {
- ClientPtr client; /* Owning client. 0 for system counters */
- XID id; /* resource ID */
- struct _SyncTriggerList *pTriglist; /* list of triggers */
- unsigned char type; /* SYNC_* */
- Bool beingDestroyed; /* in process of going away */
-} SyncObject;
-
-typedef struct _SyncCounter {
- SyncObject sync; /* Common sync object data */
- CARD64 value; /* counter value */
- struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
-} SyncCounter;
-
-typedef struct _SyncFence {
- SyncObject sync; /* Common sync object data */
- ScreenPtr pScreen; /* Screen of this fence object */
- Bool triggered; /* fence state */
-} SyncFence;
+#include "misync.h"
+#include "misyncstr.h"
/*
* The System Counter interface
@@ -107,29 +84,6 @@ typedef struct _SysCounterInfo {
-typedef struct _SyncTrigger {
- SyncObject *pSync;
- CARD64 wait_value; /* wait value */
- unsigned int value_type; /* Absolute or Relative */
- unsigned int test_type; /* transition or Comparision type */
- CARD64 test_value; /* trigger event threshold value */
- Bool (*CheckTrigger)(
- struct _SyncTrigger * /*pTrigger*/,
- CARD64 /*newval*/
- );
- void (*TriggerFired)(
- struct _SyncTrigger * /*pTrigger*/
- );
- void (*CounterDestroyed)(
- struct _SyncTrigger * /*pTrigger*/
- );
-} SyncTrigger;
-
-typedef struct _SyncTriggerList {
- SyncTrigger *pTrigger;
- struct _SyncTriggerList *next;
-} SyncTriggerList;
-
typedef struct _SyncAlarmClientList {
ClientPtr client;
XID delete_id;
@@ -185,6 +139,24 @@ extern void SyncChangeCounter(
extern void SyncDestroySystemCounter(
pointer pCounter
);
+
+extern int SyncVerifyFence(SyncFence **ppFence, XID fid,
+ ClientPtr client, Mask mode);
+
+#define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \
+ do { \
+ int rc; \
+ rc = SyncVerifyFence(&(pFence), (fid), (client), (mode)); \
+ if (Success != rc) return rc; \
+ } while (0)
+
+#define VERIFY_SYNC_FENCE_OR_NONE(pFence, fid, client, mode) \
+ do { \
+ pFence = 0; \
+ if (None != fid) \
+ VERIFY_SYNC_FENCE((pFence), (fid), (client), (mode)); \
+ } while (0)
+
extern void InitServertime(void);
extern void SyncExtensionInit(void);
diff --git a/configure.ac b/configure.ac
index 95f7a76..2aa75ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1355,6 +1355,8 @@ FB_LIB='$(top_builddir)/fb/libfb.la'
FB_INC='-I$(top_srcdir)/fb'
MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
+MIEXT_X_INC='-I$(top_srcdir)/miext/X'
+MIEXT_X_LIB='$(top_builddir)/miext/X/libXext.la'
CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
# SHA1 hashing
@@ -1494,7 +1496,7 @@ AC_EGREP_CPP([I_AM_SVR4],[
AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
-XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
+XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_X_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
dnl ---------------------------------------------------------------------------
dnl DDX section.
@@ -1507,7 +1509,7 @@ AC_MSG_RESULT([$XVFB])
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
if test "x$XVFB" = xyes; then
- XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
+ XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_X_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
AC_SUBST([XVFB_LIBS])
AC_SUBST([XVFB_SYS_LIBS])
@@ -1528,7 +1530,7 @@ if test "x$XNEST" = xyes; then
if test "x$have_xnest" = xno; then
AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
fi
- XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $MAIN_LIB $OS_LIB"
+ XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_X_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $MAIN_LIB $OS_LIB"
XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
AC_SUBST([XNEST_LIBS])
AC_SUBST([XNEST_SYS_LIBS])
@@ -1556,7 +1558,7 @@ if test "x$XORG" = xyes; then
XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
- XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB"
+ XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_X_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB"
dnl ==================================================================
dnl symbol visibility
@@ -1891,7 +1893,7 @@ if test "x$XWIN" = xyes; then
XWIN_SYS_LIBS=-lwinsock2
;;
esac
- XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $RANDR_LIB $RENDER_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
+ XWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $RANDR_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $MIEXT_X_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $OS_LIB"
XWIN_SYS_LIBS="$XWIN_SYS_LIBS $XWINMODULES_LIBS"
AC_SUBST(XWIN_LIBS)
AC_SUBST(XWIN_SERVER_NAME)
@@ -1921,7 +1923,7 @@ if test "x$XQUARTZ" = xyes; then
AC_DEFINE(XQUARTZ,1,[Have Quartz])
AC_DEFINE(ROOTLESS,1,[Build Rootless code])
- DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $MAIN_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB"
+ DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $MAIN_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_X_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB"
AC_SUBST([DARWIN_LIBS])
AC_CHECK_LIB([Xplugin],[xp_init],[:])
@@ -1982,7 +1984,7 @@ if test "x$DMX" = xyes; then
fi
DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
XDMX_CFLAGS="$DMXMODULES_CFLAGS"
- XDMX_LIBS="$FB_LIB $MI_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $XEXT_LIB $MAIN_LIB $DIX_LIB $OS_LIB $FIXES_LIB"
+ XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_X_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $MAIN_LIB $DIX_LIB $OS_LIB $FIXES_LIB"
XDMX_SYS_LIBS="$DMXMODULES_LIBS"
AC_SUBST([XDMX_CFLAGS])
AC_SUBST([XDMX_LIBS])
@@ -2084,13 +2086,13 @@ if test "$KDRIVE" = yes; then
# damage shadow extension glx (NOTYET) fb mi
KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src'
- KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
+ KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_X_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC"
KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
- KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
+ KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $MIEXT_X_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
case $host_os in
*linux*)
@@ -2190,6 +2192,7 @@ record/Makefile
config/Makefile
mi/Makefile
miext/Makefile
+miext/X/Makefile
miext/damage/Makefile
miext/shadow/Makefile
miext/cw/Makefile
diff --git a/damageext/damageext.c b/damageext/damageext.c
index b4bb478..794afcb 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -25,6 +25,8 @@
#endif
#include "damageextint.h"
+#include "syncsrv.h"
+#include "misync.h"
#include "protocol-versions.h"
static unsigned char DamageReqCode;
@@ -242,18 +244,11 @@ ProcDamageDestroy (ClientPtr client)
}
static int
-ProcDamageSubtract (ClientPtr client)
+DamageSubtractCommon (ClientPtr client,
+ DamageExtPtr pDamageExt,
+ RegionPtr pRepair,
+ RegionPtr pParts)
{
- REQUEST(xDamageSubtractReq);
- DamageExtPtr pDamageExt;
- RegionPtr pRepair;
- RegionPtr pParts;
-
- REQUEST_SIZE_MATCH(xDamageSubtractReq);
- VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
- VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
- VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
-
if (pDamageExt->level != DamageReportRawRegion)
{
DamagePtr pDamage = pDamageExt->pDamage;
@@ -275,6 +270,50 @@ ProcDamageSubtract (ClientPtr client)
}
static int
+ProcDamageSubtract (ClientPtr client)
+{
+ REQUEST(xDamageSubtractReq);
+ DamageExtPtr pDamageExt;
+ RegionPtr pRepair;
+ RegionPtr pParts;
+
+ REQUEST_SIZE_MATCH(xDamageSubtractReq);
+ VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
+ VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
+ VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
+
+ return DamageSubtractCommon (client, pDamageExt, pRepair, pParts);
+}
+
+static int
+ProcDamageSubtractAndTrigger (ClientPtr client)
+{
+ REQUEST(xDamageSubtractAndTriggerReq);
+ DamageExtPtr pDamageExt;
+ RegionPtr pRepair;
+ RegionPtr pParts;
+ SyncFence* pFence;
+
+ REQUEST_SIZE_MATCH(xDamageSubtractAndTriggerReq);
+ VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess);
+ VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
+ VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
+ VERIFY_SYNC_FENCE_OR_NONE(pFence, stuff->finishedFence, client,
+ DixWriteAccess);
+
+ if (pFence && pFence->pScreen != pDamageExt->pDrawable->pScreen) {
+ client->errorValue = stuff->finishedFence;
+ return BadMatch;
+ }
+
+ if (pFence) {
+ miSyncTriggerFence(pFence);
+ }
+
+ return DamageSubtractCommon (client, pDamageExt, pRepair, pParts);
+}
+
+static int
ProcDamageAdd (ClientPtr client)
{
REQUEST(xDamageAddReq);
@@ -303,6 +342,7 @@ ProcDamageAdd (ClientPtr client)
static const int version_requests[] = {
X_DamageQueryVersion, /* before client sends QueryVersion */
X_DamageAdd, /* Version 1 */
+ X_DamageSubtractAndTrigger, /* Version 2 */
};
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
@@ -315,6 +355,8 @@ static int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
ProcDamageSubtract,
/*************** Version 1.1 ****************/
ProcDamageAdd,
+/*************** Version 1.2 ****************/
+ ProcDamageSubtractAndTrigger,
};
diff --git a/include/protocol-versions.h b/include/protocol-versions.h
index c674465..0f61226 100644
--- a/include/protocol-versions.h
+++ b/include/protocol-versions.h
@@ -44,7 +44,7 @@
/* Damage */
#define SERVER_DAMAGE_MAJOR_VERSION 1
-#define SERVER_DAMAGE_MINOR_VERSION 1
+#define SERVER_DAMAGE_MINOR_VERSION 2
/* DMX */
#define SERVER_DMX_MAJOR_VERSION 2
diff --git a/miext/Makefile.am b/miext/Makefile.am
index 84ab708..0635964 100644
--- a/miext/Makefile.am
+++ b/miext/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = damage shadow
+SUBDIRS = X damage shadow
if COMPOSITE
SUBDIRS += cw
endif
@@ -8,4 +8,4 @@ endif
if XWIN_MULTIWINDOWEXTWM
SUBDIRS += rootless
endif
-DIST_SUBDIRS = damage shadow cw rootless
+DIST_SUBDIRS = X damage shadow cw rootless
diff --git a/miext/X/Makefile.am b/miext/X/Makefile.am
new file mode 100644
index 0000000..8849958
--- /dev/null
+++ b/miext/X/Makefile.am
@@ -0,0 +1,14 @@
+noinst_LTLIBRARIES = libXext.la
+
+AM_CFLAGS = $(DIX_CFLAGS)
+
+INCLUDES =
+
+if XORG
+sdk_HEADERS = misync.h misyncstr.h
+endif
+
+libXext_la_SOURCES = \
+ misync.c \
+ misync.h \
+ misyncstr.h
diff --git a/miext/X/misync.c b/miext/X/misync.c
new file mode 100644
index 0000000..c0ee13d
--- /dev/null
+++ b/miext/X/misync.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright © 2010 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "misync.h"
+#include "misyncstr.h"
+
+void
+miSyncTriggerFence(SyncFence* pFence)
+{
+ SyncTriggerList *ptl, *pNext;
+ CARD64 unused;
+
+ pFence->triggered = TRUE;
+
+ XSyncIntToValue(&unused, 0L);
+
+ /* run through triggers to see if any fired */
+ for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext)
+ {
+ pNext = ptl->next;
+ if ((*ptl->pTrigger->CheckTrigger)(ptl->pTrigger, unused))
+ (*ptl->pTrigger->TriggerFired)(ptl->pTrigger);
+ }
+}
diff --git a/miext/X/misync.h b/miext/X/misync.h
new file mode 100644
index 0000000..d3e52f5
--- /dev/null
+++ b/miext/X/misync.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2010 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _MISYNC_H_
+#define _MISYNC_H_
+
+typedef struct _SyncFence SyncFence;
+
+extern void
+miSyncTriggerFence(SyncFence* pFence);
+
+#endif /* _MISYNC_H_ */
diff --git a/miext/X/misyncstr.h b/miext/X/misyncstr.h
new file mode 100644
index 0000000..90a17ac
--- /dev/null
+++ b/miext/X/misyncstr.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright © 2010 NVIDIA Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _MISYNCSTR_H_
+#define _MISYNCSTR_H_
+
+#include "dix.h"
+#include <X11/extensions/syncconst.h>
+
+#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
+
+/* Sync object types */
+#define SYNC_COUNTER 0
+#define SYNC_FENCE 1
+
+typedef struct _SyncObject {
+ ClientPtr client; /* Owning client. 0 for system counters */
+ XID id; /* resource ID */
+ struct _SyncTriggerList *pTriglist; /* list of triggers */
+ unsigned char type; /* SYNC_* */
+ Bool beingDestroyed; /* in process of going away */
+} SyncObject;
+
+typedef struct _SyncCounter {
+ SyncObject sync; /* Common sync object data */
+ CARD64 value; /* counter value */
+ struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
+} SyncCounter;
+
+struct _SyncFence {
+ SyncObject sync; /* Common sync object data */
+ ScreenPtr pScreen; /* Screen of this fence object */
+ Bool triggered; /* fence state */
+};
+
+typedef struct _SyncTrigger {
+ SyncObject *pSync;
+ CARD64 wait_value; /* wait value */
+ unsigned int value_type; /* Absolute or Relative */
+ unsigned int test_type; /* transition or Comparision type */
+ CARD64 test_value; /* trigger event threshold value */
+ Bool (*CheckTrigger)(
+ struct _SyncTrigger * /*pTrigger*/,
+ CARD64 /*newval*/
+ );
+ void (*TriggerFired)(
+ struct _SyncTrigger * /*pTrigger*/
+ );
+ void (*CounterDestroyed)(
+ struct _SyncTrigger * /*pTrigger*/
+ );
+} SyncTrigger;
+
+typedef struct _SyncTriggerList {
+ SyncTrigger *pTrigger;
+ struct _SyncTriggerList *next;
+} SyncTriggerList;
+
+#endif /* _MISYNCSTR_H_ */
+
--
1.7.1
More information about the xorg-devel
mailing list