1 /*************************************************************************/ /*!
3 @Title Synchronisation checkpoint interface header
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Defines the client side interface for synchronisation
6 @License Dual MIT/GPLv2
8 The contents of this file are subject to the MIT license as set out below.
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
32 This License is also included in this distribution in the file called
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
44 #ifndef _SYNC_CHECKPOINT_
45 #define _SYNC_CHECKPOINT_
47 #include "img_types.h"
48 #include "pvrsrv_error.h"
49 #include "pvrsrv_sync_km.h"
50 #include "pdumpdefs.h"
52 #include "pvr_debug.h"
54 #include "device_connection.h"
56 typedef struct _PVRSRV_DEVICE_NODE_ PVRSRV_DEVICE_NODE;
58 typedef struct _SYNC_CHECKPOINT_CONTEXT *PSYNC_CHECKPOINT_CONTEXT;
60 typedef struct _SYNC_CHECKPOINT *PSYNC_CHECKPOINT;
63 /*************************************************************************/ /*!
64 @Function SyncCheckpointContextCreate
66 @Description Create a new synchronisation checkpoint context
68 @Input psDevNode Device node
70 @Output ppsSyncCheckpointContext Handle to the created synchronisation
73 @Return PVRSRV_OK if the synchronisation checkpoint context was
76 /*****************************************************************************/
78 SyncCheckpointContextCreate(PVRSRV_DEVICE_NODE *psDevNode,
79 PSYNC_CHECKPOINT_CONTEXT *ppsSyncCheckpointContext);
81 /*************************************************************************/ /*!
82 @Function SyncCheckpointContextDestroy
84 @Description Destroy a synchronisation checkpoint context
86 @Input psSyncCheckpointContext Handle to the synchronisation
87 checkpoint context to destroy
89 @Return PVRSRV_OK if the synchronisation checkpoint context was
90 successfully destroyed.
91 PVRSRV_ERROR_UNABLE_TO_DESTROY_CONTEXT if the context still
92 has sync checkpoints defined
94 /*****************************************************************************/
96 SyncCheckpointContextDestroy(PSYNC_CHECKPOINT_CONTEXT psSyncCheckpointContext);
98 /*************************************************************************/ /*!
99 @Function SyncCheckpointAlloc
101 @Description Allocate a new synchronisation checkpoint on the specified
102 synchronisation checkpoint context
104 @Input hSyncCheckpointContext Handle to the synchronisation
107 @Input pszClassName Sync checkpoint source annotation
108 (will be truncated to at most
109 SYNC_CHECKPOINT_NAME_SIZE chars)
111 @Output ppsSyncCheckpoint Created synchronisation checkpoint
113 @Return PVRSRV_OK if the synchronisation checkpoint was
116 /*****************************************************************************/
118 SyncCheckpointAlloc(PSYNC_CHECKPOINT_CONTEXT psSyncContext,
119 const IMG_CHAR *pszCheckpointName,
120 PSYNC_CHECKPOINT *ppsSyncCheckpoint);
122 /*************************************************************************/ /*!
123 @Function SyncCheckpointFree
125 @Description Free a synchronization checkpoint
126 The reference count held for the synchronization checkpoint
127 is decremented - if it has becomes zero, it is also freed.
129 @Input psSyncCheckpoint The synchronisation checkpoint to free
133 /*****************************************************************************/
135 SyncCheckpointFree(PSYNC_CHECKPOINT psSyncCheckpoint);
137 /*************************************************************************/ /*!
138 @Function SyncCheckpointSignal
140 @Description Signal the synchronisation checkpoint
142 @Input psSyncCheckpoint The synchronisation checkpoint to signal
146 /*****************************************************************************/
148 SyncCheckpointSignal(PSYNC_CHECKPOINT psSyncCheckpoint);
150 /*************************************************************************/ /*!
151 @Function SyncCheckpointError
153 @Description Error the synchronisation checkpoint
155 @Input psSyncCheckpoint The synchronisation checkpoint to error
159 /*****************************************************************************/
161 SyncCheckpointError(PSYNC_CHECKPOINT psSyncCheckpoint);
163 /*************************************************************************/ /*!
164 @Function SyncCheckpointErrorFromUFO
166 @Description Error the synchronisation checkpoint which has the
167 given UFO firmware address
169 @Input hSyncCheckpointContext Handle to the synchronisation checkpoint
170 context to which the checkpoint belongs
172 @Input ui32FwAddr The firmware address of the sync
173 checkpoint to be errored
177 /*****************************************************************************/
179 SyncCheckpointErrorFromUFO(PSYNC_CHECKPOINT_CONTEXT psSyncCheckpointContext,
180 IMG_UINT32 ui32FwAddr);
182 /*************************************************************************/ /*!
183 @Function SyncCheckpointIsSignalled
185 @Description Returns IMG_TRUE if the synchronisation checkpoint is
188 @Input psSyncCheckpoint The synchronisation checkpoint to test
192 /*****************************************************************************/
194 SyncCheckpointIsSignalled(PSYNC_CHECKPOINT psSyncCheckpoint);
196 /*************************************************************************/ /*!
197 @Function SyncCheckpointIsErrored
199 @Description Returns IMG_TRUE if the synchronisation checkpoint is
202 @Input psSyncCheckpoint The synchronisation checkpoint to test
206 /*****************************************************************************/
208 SyncCheckpointIsErrored(PSYNC_CHECKPOINT psSyncCheckpoint);
210 /*************************************************************************/ /*!
211 @Function SyncCheckpointTakeRef
213 @Description Take a reference on a synchronisation checkpoint
215 @Input psSyncCheckpoint Synchronisation checkpoint to take a
218 @Return PVRSRV_OK if a reference was taken on the synchronisation
221 /*****************************************************************************/
223 SyncCheckpointTakeRef(PSYNC_CHECKPOINT psSyncCheckpoint);
225 /*************************************************************************/ /*!
226 @Function SyncCheckpointDropRef
228 @Description Drop a reference on a synchronisation checkpoint
230 @Input psSyncCheckpoint Synchronisation checkpoint to drop a
233 @Return PVRSRV_OK if a reference was dropped on the synchronisation
236 /*****************************************************************************/
238 SyncCheckpointDropRef(PSYNC_CHECKPOINT psSyncCheckpoint);
240 /*************************************************************************/ /*!
241 @Function SyncCheckpointResolveFence
243 @Description Resolve a fence, returning a list of the sync checkpoints
245 This function in turn calls a function provided by the
246 OS native sync implementation.
248 @Input hFence The fence to be resolved
250 @Output pui32NumSyncCheckpoints The number of sync checkpoints the
251 fence contains. Can return 0 if
252 passed a null (-1) fence.
254 @Output psSyncCheckpoints List of sync checkpoints the fence
257 @Return PVRSRV_OK if a valid fence was provided.
258 PVRSRV_ERROR_SYNC_NATIVESYNC_NOT_REGISTERED if the OS native
259 sync has not registered a callback function.
261 /*****************************************************************************/
263 SyncCheckpointResolveFence(PVRSRV_FENCE_KM hFence, IMG_UINT32 *pui32NumSyncCheckpoints, PSYNC_CHECKPOINT *psSyncCheckpoints);
265 /*************************************************************************/ /*!
266 @Function SyncCheckpointCreateFence
268 @Description Create a fence containing a single sync checkpoint.
269 Return the fence and a ptr to sync checkpoint it contains.
270 This function in turn calls a function provided by the
271 OS native sync implementation.
273 @Input pszFenceName String to assign to the new fence
274 (for debugging purposes)
276 @Input hTimeline Timeline on which the new fence is
279 @Output phNewFence The newly created fence
281 @Output psNewSyncCheckpoint The sync checkpoint contained in
284 @Return PVRSRV_OK if a valid fence was provided.
285 PVRSRV_ERROR_SYNC_NATIVESYNC_NOT_REGISTERED if the OS native
286 sync has not registered a callback function.
288 /*****************************************************************************/
290 SyncCheckpointCreateFence(const IMG_CHAR *pszFenceName, PVRSRV_TIMELINE_KM hTimeline, PVRSRV_FENCE_KM *phNewFence, PSYNC_CHECKPOINT *psNewSyncCheckpoint);
292 #endif /* _SYNC_CHECKPOINT_ */