Merge remote branch 'jajones/for-keith'
This commit is contained in:
commit
f5b8bd620f
2
COPYING
2
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
|
||||
|
|
|
@ -15,7 +15,7 @@ INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
|
|||
AM_CFLAGS = $(DIX_CFLAGS)
|
||||
|
||||
if XORG
|
||||
sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h
|
||||
sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h syncsdk.h
|
||||
endif
|
||||
|
||||
# Sources always included in libXextbuiltin.la & libXext.la
|
||||
|
@ -26,6 +26,7 @@ BUILTIN_SRCS = \
|
|||
sleepuntil.c \
|
||||
sleepuntil.h \
|
||||
sync.c \
|
||||
syncsdk.h \
|
||||
syncsrv.h \
|
||||
xcmisc.c \
|
||||
xtest.c
|
||||
|
|
905
Xext/sync.c
905
Xext/sync.c
File diff suppressed because it is too large
Load Diff
47
Xext/syncsdk.h
Normal file
47
Xext/syncsdk.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _SYNCSDK_H_
|
||||
#define _SYNCSDK_H_
|
||||
|
||||
#include "misync.h"
|
||||
|
||||
extern _X_EXPORT 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)
|
||||
|
||||
#endif /* _SYNCSDK_H_ */
|
||||
|
|
@ -51,16 +51,8 @@ PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef _SYNCSRV_H_
|
||||
#define _SYNCSRV_H_
|
||||
|
||||
#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
|
||||
|
||||
typedef struct _SyncCounter {
|
||||
ClientPtr client; /* Owning client. 0 for system counters */
|
||||
XSyncCounter id; /* resource ID */
|
||||
CARD64 value; /* counter value */
|
||||
struct _SyncTriggerList *pTriglist; /* list of triggers */
|
||||
Bool beingDestroyed; /* in process of going away */
|
||||
struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
|
||||
} SyncCounter;
|
||||
#include "misync.h"
|
||||
#include "misyncstr.h"
|
||||
|
||||
/*
|
||||
* The System Counter interface
|
||||
|
@ -92,29 +84,6 @@ typedef struct _SysCounterInfo {
|
|||
|
||||
|
||||
|
||||
typedef struct _SyncTrigger {
|
||||
SyncCounter *pCounter;
|
||||
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;
|
||||
|
@ -148,7 +117,6 @@ typedef union {
|
|||
SyncAwait await;
|
||||
} SyncAwaitUnion;
|
||||
|
||||
|
||||
extern pointer SyncCreateSystemCounter(
|
||||
char * /* name */,
|
||||
CARD64 /* inital_value */,
|
||||
|
@ -171,6 +139,7 @@ extern void SyncChangeCounter(
|
|||
extern void SyncDestroySystemCounter(
|
||||
pointer pCounter
|
||||
);
|
||||
|
||||
extern void InitServertime(void);
|
||||
|
||||
extern void SyncExtensionInit(void);
|
||||
|
|
23
configure.ac
23
configure.ac
|
@ -788,7 +788,7 @@ WINDOWSWMPROTO="windowswmproto"
|
|||
APPLEWMPROTO="applewmproto >= 1.4"
|
||||
|
||||
dnl Core modules for most extensions, et al.
|
||||
SDK_REQUIRED_MODULES="[xproto >= 7.0.17] [randrproto >= 1.2.99.3] [renderproto >= 0.11] [xextproto >= 7.0.99.3] [inputproto >= 1.9.99.902] [kbproto >= 1.0.3] fontsproto"
|
||||
SDK_REQUIRED_MODULES="[xproto >= 7.0.17] [randrproto >= 1.2.99.3] [renderproto >= 0.11] [xextproto >= 7.1.99] [inputproto >= 1.9.99.902] [kbproto >= 1.0.3] fontsproto"
|
||||
# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
|
||||
AC_SUBST(SDK_REQUIRED_MODULES)
|
||||
|
||||
|
@ -1350,6 +1350,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_SYNC_INC='-I$(top_srcdir)/miext/sync'
|
||||
MIEXT_SYNC_LIB='$(top_builddir)/miext/sync/libsync.la'
|
||||
CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
|
||||
|
||||
# SHA1 hashing
|
||||
|
@ -1489,7 +1491,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_SYNC_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl DDX section.
|
||||
|
@ -1502,7 +1504,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_SYNC_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])
|
||||
|
@ -1523,7 +1525,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_SYNC_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])
|
||||
|
@ -1551,7 +1553,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_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB"
|
||||
|
||||
dnl ==================================================================
|
||||
dnl symbol visibility
|
||||
|
@ -1886,7 +1888,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_SYNC_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)
|
||||
|
@ -1916,7 +1918,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_SYNC_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],[:])
|
||||
|
@ -1977,7 +1979,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 $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_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_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB"
|
||||
XDMX_SYS_LIBS="$DMXMODULES_LIBS"
|
||||
AC_SUBST([XDMX_CFLAGS])
|
||||
AC_SUBST([XDMX_LIBS])
|
||||
|
@ -2082,13 +2084,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_SYNC_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_SYNC_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*)
|
||||
|
@ -2189,6 +2191,7 @@ record/Makefile
|
|||
config/Makefile
|
||||
mi/Makefile
|
||||
miext/Makefile
|
||||
miext/sync/Makefile
|
||||
miext/damage/Makefile
|
||||
miext/shadow/Makefile
|
||||
miext/cw/Makefile
|
||||
|
|
|
@ -447,6 +447,7 @@ static const char *key_names[PRIVATE_LAST] = {
|
|||
[PRIVATE_GLYPH] = "GLYPH",
|
||||
[PRIVATE_GLYPHSET] = "GLYPHSET",
|
||||
[PRIVATE_PICTURE] = "PICTURE",
|
||||
[PRIVATE_SYNC_FENCE] = "SYNC_FENCE",
|
||||
};
|
||||
|
||||
void
|
||||
|
|
|
@ -41,6 +41,9 @@ cat > sdksyms.c << EOF
|
|||
#include "damage.h"
|
||||
#include "damagestr.h"
|
||||
|
||||
/* miext/sync/Makefile.am */
|
||||
#include "misync.h"
|
||||
#include "misyncstr.h"
|
||||
|
||||
/* Xext/Makefile.am -- half is module, half is builtin */
|
||||
/*
|
||||
|
@ -50,6 +53,7 @@ cat > sdksyms.c << EOF
|
|||
#include "geext.h"
|
||||
#include "geint.h"
|
||||
#include "shmint.h"
|
||||
#include "syncsdk.h"
|
||||
#if XINERAMA
|
||||
# include "panoramiXsrv.h"
|
||||
# include "panoramiX.h"
|
||||
|
|
|
@ -51,6 +51,7 @@ typedef enum {
|
|||
PRIVATE_GLYPH,
|
||||
PRIVATE_GLYPHSET,
|
||||
PRIVATE_PICTURE,
|
||||
PRIVATE_SYNC_FENCE,
|
||||
|
||||
/* last private type */
|
||||
PRIVATE_LAST,
|
||||
|
|
|
@ -95,6 +95,10 @@
|
|||
#define SERVER_SHM_MAJOR_VERSION 1
|
||||
#define SERVER_SHM_MINOR_VERSION 1
|
||||
|
||||
/* Sync */
|
||||
#define SERVER_SYNC_MAJOR_VERSION 3
|
||||
#define SERVER_SYNC_MINOR_VERSION 1
|
||||
|
||||
/* Windows WM */
|
||||
#define SERVER_WINDOWSWM_MAJOR_VERSION 1
|
||||
#define SERVER_WINDOWSWM_MINOR_VERSION 0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS = damage shadow
|
||||
SUBDIRS = sync 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 = sync damage shadow cw rootless
|
||||
|
|
14
miext/sync/Makefile.am
Normal file
14
miext/sync/Makefile.am
Normal file
|
@ -0,0 +1,14 @@
|
|||
noinst_LTLIBRARIES = libsync.la
|
||||
|
||||
AM_CFLAGS = $(DIX_CFLAGS)
|
||||
|
||||
INCLUDES =
|
||||
|
||||
if XORG
|
||||
sdk_HEADERS = misync.h misyncstr.h
|
||||
endif
|
||||
|
||||
libsync_la_SOURCES = \
|
||||
misync.c \
|
||||
misync.h \
|
||||
misyncstr.h
|
201
miext/sync/misync.c
Normal file
201
miext/sync/misync.c
Normal file
|
@ -0,0 +1,201 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
#include "scrnintstr.h"
|
||||
#include "misync.h"
|
||||
#include "misyncstr.h"
|
||||
|
||||
static DevPrivateKeyRec syncScreenPrivateKeyRec;
|
||||
static DevPrivateKey syncScreenPrivateKey = &syncScreenPrivateKeyRec;
|
||||
|
||||
#define SYNC_SCREEN_PRIV(pScreen) \
|
||||
(SyncScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, \
|
||||
syncScreenPrivateKey)
|
||||
|
||||
typedef struct _syncScreenPriv {
|
||||
/* Wrappable sync-specific screen functions */
|
||||
SyncScreenFuncsRec funcs;
|
||||
|
||||
/* Wrapped screen functions */
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
} SyncScreenPrivRec, *SyncScreenPrivPtr;
|
||||
|
||||
/* Default implementations of the sync screen functions */
|
||||
void
|
||||
miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence* pFence,
|
||||
Bool initially_triggered)
|
||||
{
|
||||
(void)pScreen;
|
||||
|
||||
pFence->triggered = initially_triggered;
|
||||
}
|
||||
|
||||
void miSyncScreenDestroyFence(ScreenPtr pScreen, SyncFence* pFence)
|
||||
{
|
||||
(void)pScreen;
|
||||
(void)pFence;
|
||||
}
|
||||
|
||||
/* Default implementations of the per-object functions */
|
||||
static void
|
||||
miSyncFenceSetTriggered(SyncFence* pFence)
|
||||
{
|
||||
pFence->triggered = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
miSyncFenceReset(SyncFence* pFence)
|
||||
{
|
||||
pFence->triggered = FALSE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
miSyncFenceCheckTriggered(SyncFence* pFence)
|
||||
{
|
||||
return pFence->triggered;
|
||||
}
|
||||
|
||||
static void
|
||||
miSyncFenceAddTrigger(SyncTrigger* pTrigger)
|
||||
{
|
||||
(void)pTrigger;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
miSyncFenceDeleteTrigger(SyncTrigger* pTrigger)
|
||||
{
|
||||
(void)pTrigger;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Machine independent portion of the fence sync object implementation */
|
||||
void
|
||||
miSyncInitFence(ScreenPtr pScreen, SyncFence* pFence, Bool initially_triggered)
|
||||
{
|
||||
SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
|
||||
static const SyncFenceFuncsRec miSyncFenceFuncs = {
|
||||
&miSyncFenceSetTriggered,
|
||||
&miSyncFenceReset,
|
||||
&miSyncFenceCheckTriggered,
|
||||
&miSyncFenceAddTrigger,
|
||||
&miSyncFenceDeleteTrigger
|
||||
};
|
||||
|
||||
pFence->pScreen = pScreen;
|
||||
pFence->funcs = miSyncFenceFuncs;
|
||||
|
||||
pScreenPriv->funcs.CreateFence(pScreen, pFence, initially_triggered);
|
||||
}
|
||||
|
||||
void
|
||||
miSyncDestroyFence(SyncFence* pFence)
|
||||
{
|
||||
ScreenPtr pScreen = pFence->pScreen;
|
||||
SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
|
||||
SyncTriggerList *ptl, *pNext;
|
||||
|
||||
pFence->sync.beingDestroyed = TRUE;
|
||||
/* tell all the fence's triggers that the counter has been destroyed */
|
||||
for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext)
|
||||
{
|
||||
(*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger);
|
||||
pNext = ptl->next;
|
||||
free(ptl); /* destroy the trigger list as we go */
|
||||
}
|
||||
|
||||
pScreenPriv->funcs.DestroyFence(pScreen, pFence);
|
||||
|
||||
dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE);
|
||||
}
|
||||
|
||||
void
|
||||
miSyncTriggerFence(SyncFence* pFence)
|
||||
{
|
||||
SyncTriggerList *ptl, *pNext;
|
||||
CARD64 unused;
|
||||
|
||||
pFence->funcs.SetTriggered(pFence);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
SyncScreenFuncsPtr miSyncGetScreenFuncs(ScreenPtr pScreen)
|
||||
{
|
||||
SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
|
||||
|
||||
return &pScreenPriv->funcs;
|
||||
}
|
||||
|
||||
static Bool
|
||||
SyncCloseScreen (int i, ScreenPtr pScreen)
|
||||
{
|
||||
SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
|
||||
|
||||
pScreen->CloseScreen = pScreenPriv->CloseScreen;
|
||||
free(pScreenPriv);
|
||||
|
||||
return (*pScreen->CloseScreen) (i, pScreen);
|
||||
}
|
||||
|
||||
Bool
|
||||
miSyncSetup(ScreenPtr pScreen)
|
||||
{
|
||||
SyncScreenPrivPtr pScreenPriv;
|
||||
|
||||
static const SyncScreenFuncsRec miSyncScreenFuncs = {
|
||||
&miSyncScreenCreateFence,
|
||||
&miSyncScreenDestroyFence
|
||||
};
|
||||
|
||||
if (dixPrivateKeyRegistered(syncScreenPrivateKey))
|
||||
return TRUE;
|
||||
|
||||
if (!dixRegisterPrivateKey(syncScreenPrivateKey, PRIVATE_SCREEN,
|
||||
sizeof(SyncScreenPrivRec)))
|
||||
return FALSE;
|
||||
|
||||
pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
|
||||
|
||||
pScreenPriv->funcs = miSyncScreenFuncs;
|
||||
|
||||
/* Wrap CloseScreen to clean up */
|
||||
pScreenPriv->CloseScreen = pScreen->CloseScreen;
|
||||
pScreen->CloseScreen = SyncCloseScreen;
|
||||
|
||||
return TRUE;
|
||||
}
|
77
miext/sync/misync.h
Normal file
77
miext/sync/misync.h
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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;
|
||||
typedef struct _SyncTrigger SyncTrigger;
|
||||
|
||||
typedef void (*SyncScreenCreateFenceFunc) (ScreenPtr pScreen,
|
||||
SyncFence* pFence,
|
||||
Bool initially_triggered);
|
||||
typedef void (*SyncScreenDestroyFenceFunc) (ScreenPtr pScreen,
|
||||
SyncFence* pFence);
|
||||
|
||||
typedef struct _syncScreenFuncs {
|
||||
SyncScreenCreateFenceFunc CreateFence;
|
||||
SyncScreenDestroyFenceFunc DestroyFence;
|
||||
} SyncScreenFuncsRec, *SyncScreenFuncsPtr;
|
||||
|
||||
extern _X_EXPORT void
|
||||
miSyncScreenCreateFence(ScreenPtr pScreen, SyncFence* pFence,
|
||||
Bool initially_triggered);
|
||||
extern _X_EXPORT void
|
||||
miSyncScreenDestroyFence(ScreenPtr pScreen, SyncFence* pFence);
|
||||
|
||||
typedef void (*SyncFenceSetTriggeredFunc) (SyncFence* pFence);
|
||||
typedef void (*SyncFenceResetFunc) (SyncFence* pFence);
|
||||
typedef Bool (*SyncFenceCheckTriggeredFunc) (SyncFence* pFence);
|
||||
typedef void (*SyncFenceAddTriggerFunc) (SyncTrigger* pTrigger);
|
||||
typedef void (*SyncFenceDeleteTriggerFunc) (SyncTrigger* pTrigger);
|
||||
|
||||
typedef struct _syncFenceFuncs {
|
||||
SyncFenceSetTriggeredFunc SetTriggered;
|
||||
SyncFenceResetFunc Reset;
|
||||
SyncFenceCheckTriggeredFunc CheckTriggered;
|
||||
SyncFenceAddTriggerFunc AddTrigger;
|
||||
SyncFenceDeleteTriggerFunc DeleteTrigger;
|
||||
} SyncFenceFuncsRec, *SyncFenceFuncsPtr;
|
||||
|
||||
extern _X_EXPORT void
|
||||
miSyncInitFence(ScreenPtr pScreen, SyncFence* pFence, Bool initially_triggered);
|
||||
extern _X_EXPORT void
|
||||
miSyncDestroyFence(SyncFence* pFence);
|
||||
extern _X_EXPORT void
|
||||
miSyncTriggerFence(SyncFence* pFence);
|
||||
|
||||
extern _X_EXPORT SyncScreenFuncsPtr
|
||||
miSyncGetScreenFuncs(ScreenPtr pScreen);
|
||||
extern _X_EXPORT Bool
|
||||
miSyncSetup(ScreenPtr pScreen);
|
||||
|
||||
#endif /* _MISYNC_H_ */
|
86
miext/sync/misyncstr.h
Normal file
86
miext/sync/misyncstr.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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 */
|
||||
struct _SyncTriggerList *pTriglist; /* list of triggers */
|
||||
XID id; /* resource ID */
|
||||
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 */
|
||||
SyncFenceFuncsRec funcs; /* Funcs for performing ops on fence */
|
||||
Bool triggered; /* fence state */
|
||||
PrivateRec *devPrivates; /* driver-specific per-fence data */
|
||||
};
|
||||
|
||||
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*/
|
||||
);
|
||||
};
|
||||
|
||||
typedef struct _SyncTriggerList {
|
||||
SyncTrigger *pTrigger;
|
||||
struct _SyncTriggerList *next;
|
||||
} SyncTriggerList;
|
||||
|
||||
#endif /* _MISYNCSTR_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user