2 * Copyright © 2010 NVIDIA Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 #ifdef HAVE_DIX_CONFIG_H
25 #include <dix-config.h>
32 #include "scrnintstr.h"
33 #include <X11/extensions/syncconst.h>
35 #define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
37 /* Sync object types */
38 #define SYNC_COUNTER 0
41 typedef struct _SyncObject
{
42 ClientPtr client
; /* Owning client. 0 for system counters */
43 struct _SyncTriggerList
*pTriglist
; /* list of triggers */
44 XID id
; /* resource ID */
45 unsigned char type
; /* SYNC_* */
46 Bool beingDestroyed
; /* in process of going away */
49 typedef struct _SyncCounter
{
50 SyncObject sync
; /* Common sync object data */
51 CARD64 value
; /* counter value */
52 struct _SysCounterInfo
*pSysCounterInfo
; /* NULL if not a system counter */
56 SyncObject sync
; /* Common sync object data */
57 ScreenPtr pScreen
; /* Screen of this fence object */
58 SyncFenceFuncsRec funcs
; /* Funcs for performing ops on fence */
59 Bool triggered
; /* fence state */
60 PrivateRec
*devPrivates
; /* driver-specific per-fence data */
65 CARD64 wait_value
; /* wait value */
66 unsigned int value_type
; /* Absolute or Relative */
67 unsigned int test_type
; /* transition or Comparision type */
68 CARD64 test_value
; /* trigger event threshold value */
69 Bool (*CheckTrigger
) (struct _SyncTrigger
* /*pTrigger */ ,
72 void (*TriggerFired
) (struct _SyncTrigger
* /*pTrigger */
74 void (*CounterDestroyed
) (struct _SyncTrigger
* /*pTrigger */
78 typedef struct _SyncTriggerList
{
79 SyncTrigger
*pTrigger
;
80 struct _SyncTriggerList
*next
;
83 extern DevPrivateKeyRec miSyncScreenPrivateKey
;
85 #define SYNC_SCREEN_PRIV(pScreen) \
86 (SyncScreenPrivPtr) dixLookupPrivate(&pScreen->devPrivates, \
87 &miSyncScreenPrivateKey)
89 typedef struct _syncScreenPriv
{
90 /* Wrappable sync-specific screen functions */
91 SyncScreenFuncsRec funcs
;
93 /* Wrapped screen functions */
94 CloseScreenProcPtr CloseScreen
;
95 } SyncScreenPrivRec
, *SyncScreenPrivPtr
;
97 #endif /* _MISYNCSTR_H_ */