1 /*************************************************************************/ /*!
3 @Title Synchronisation 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 #include "img_types.h"
45 #include "pvrsrv_error.h"
46 #include "sync_external.h"
47 #include "pdumpdefs.h"
49 #include "pvr_debug.h"
54 #if defined(__KERNEL__) && defined(ANDROID) && !defined(__GENKSYMS__)
55 #define __pvrsrv_defined_struct_enum__
56 #include <services_kernel_client.h>
59 /*************************************************************************/ /*!
60 @Function SyncPrimContextCreate
62 @Description Create a new synchronisation context
64 @Input hBridge Bridge handle
66 @Input hDeviceNode Device node handle
68 @Output hSyncPrimContext Handle to the created synchronisation
71 @Return PVRSRV_OK if the synchronisation primitive context was
74 /*****************************************************************************/
76 SyncPrimContextCreate(SYNC_BRIDGE_HANDLE hBridge,
77 IMG_HANDLE hDeviceNode,
78 PSYNC_PRIM_CONTEXT *hSyncPrimContext);
80 /*************************************************************************/ /*!
81 @Function SyncPrimContextDestroy
83 @Description Destroy a synchronisation context
85 @Input hSyncPrimContext Handle to the synchronisation
86 primitive context to destroy
90 /*****************************************************************************/
92 SyncPrimContextDestroy(PSYNC_PRIM_CONTEXT hSyncPrimContext);
94 /*************************************************************************/ /*!
95 @Function SyncPrimAlloc
97 @Description Allocate a new synchronisation primitive on the specified
98 synchronisation context
100 @Input hSyncPrimContext Handle to the synchronisation
103 @Output ppsSync Created synchronisation primitive
105 @Input pszClassName Sync source annotation
107 @Return PVRSRV_OK if the synchronisation primitive was
110 /*****************************************************************************/
112 SyncPrimAlloc(PSYNC_PRIM_CONTEXT hSyncPrimContext,
113 PVRSRV_CLIENT_SYNC_PRIM **ppsSync,
114 const IMG_CHAR *pszClassName);
116 #if defined(__KERNEL__)
117 /*************************************************************************/ /*!
118 @Function SyncPrimAllocForServerSync
120 @Description Allocate a new synchronisation primitive on the specified
121 synchronisation context for a server sync
123 @Input hSyncPrimContext Handle to the synchronisation
126 @Output ppsSync Created synchronisation primitive
128 @Input pszClassName Sync source annotation
130 @Return PVRSRV_OK if the synchronisation primitive was
133 /*****************************************************************************/
135 SyncPrimAllocForServerSync(PSYNC_PRIM_CONTEXT hSyncPrimContext,
136 PVRSRV_CLIENT_SYNC_PRIM **ppsSync,
137 const IMG_CHAR *pszClassName);
140 /*************************************************************************/ /*!
141 @Function SyncPrimFree
143 @Description Free a synchronisation primitive
145 @Input psSync The synchronisation primitive to free
149 /*****************************************************************************/
151 SyncPrimFree(PVRSRV_CLIENT_SYNC_PRIM *psSync);
153 /*************************************************************************/ /*!
154 @Function SyncPrimSet
156 @Description Set the synchronisation primitive to a value
158 @Input psSync The synchronisation primitive to set
160 @Input ui32Value Value to set it to
164 /*****************************************************************************/
166 SyncPrimSet(PVRSRV_CLIENT_SYNC_PRIM *psSync, IMG_UINT32 ui32Value);
168 #if defined(NO_HARDWARE)
170 /*************************************************************************/ /*!
171 @Function SyncPrimNoHwUpdate
173 @Description Updates the synchronisation primitive value (in NoHardware drivers)
175 @Input psSync The synchronisation primitive to update
177 @Input ui32Value Value to update it to
181 /*****************************************************************************/
183 SyncPrimNoHwUpdate(PVRSRV_CLIENT_SYNC_PRIM *psSync, IMG_UINT32 ui32Value);
187 SyncPrimServerAlloc(SYNC_BRIDGE_HANDLE hBridge,
188 IMG_HANDLE hDeviceNode,
189 PVRSRV_CLIENT_SYNC_PRIM **ppsSync,
190 const IMG_CHAR *pszClassName
191 PVR_DBG_FILELINE_PARAM);
194 SyncPrimServerGetStatus(IMG_UINT32 ui32SyncCount,
195 PVRSRV_CLIENT_SYNC_PRIM **papsSync,
196 IMG_UINT32 *pui32UID,
197 IMG_UINT32 *pui32FWAddr,
198 IMG_UINT32 *pui32CurrentOp,
199 IMG_UINT32 *pui32NextOp);
202 SyncPrimServerQueueOp(PVRSRV_CLIENT_SYNC_PRIM_OP *psSyncOp);
205 SyncPrimIsServerSync(PVRSRV_CLIENT_SYNC_PRIM *psSync);
208 SyncPrimGetServerHandle(PVRSRV_CLIENT_SYNC_PRIM *psSync);
213 SyncPrimOpCreate(IMG_UINT32 ui32SyncCount,
214 PVRSRV_CLIENT_SYNC_PRIM **papsSyncPrim,
215 PSYNC_OP_COOKIE *ppsCookie);
218 SyncPrimOpTake(PSYNC_OP_COOKIE psCookie,
219 IMG_UINT32 ui32SyncCount,
220 PVRSRV_CLIENT_SYNC_PRIM_OP *pasSyncOp);
223 SyncPrimOpReady(PSYNC_OP_COOKIE psCookie,
227 SyncPrimOpComplete(PSYNC_OP_COOKIE psCookie);
230 SyncPrimOpDestroy(PSYNC_OP_COOKIE psCookie);
233 SyncPrimOpResolve(PSYNC_OP_COOKIE psCookie,
234 IMG_UINT32 *pui32SyncCount,
235 PVRSRV_CLIENT_SYNC_PRIM_OP **ppsSyncOp);
238 SyncPrimDumpSyncs(IMG_UINT32 ui32SyncCount, PVRSRV_CLIENT_SYNC_PRIM **papsSync, const IMG_CHAR *pcszExtraInfo);
241 /*************************************************************************/ /*!
242 @Function SyncPrimPDump
244 @Description PDump the current value of the synchronisation primitive
246 @Input psSync The synchronisation primitive to PDump
250 /*****************************************************************************/
252 SyncPrimPDump(PVRSRV_CLIENT_SYNC_PRIM *psSync);
254 /*************************************************************************/ /*!
255 @Function SyncPrimPDumpValue
257 @Description PDump the ui32Value as the value of the synchronisation
258 primitive (regardless of the current value).
260 @Input psSync The synchronisation primitive to PDump
261 @Input ui32Value Value to give to the sync prim on the pdump
265 /*****************************************************************************/
267 SyncPrimPDumpValue(PVRSRV_CLIENT_SYNC_PRIM *psSync, IMG_UINT32 ui32Value);
269 /*************************************************************************/ /*!
270 @Function SyncPrimPDumpPol
272 @Description Do a PDump poll of the synchronisation primitive
274 @Input psSync The synchronisation primitive to PDump
276 @Input ui32Value Value to poll for
278 @Input ui32Mask PDump mask operator
280 @Input ui32PDumpFlags PDump flags
284 /*****************************************************************************/
286 SyncPrimPDumpPol(PVRSRV_CLIENT_SYNC_PRIM *psSync,
287 IMG_UINT32 ui32Value,
289 PDUMP_POLL_OPERATOR eOperator,
290 IMG_UINT32 ui32PDumpFlags);
292 /*************************************************************************/ /*!
293 @Function SyncPrimOpPDumpPol
295 @Description Do a PDump poll all the synchronisation primitives on this
298 @Input psCookie Operation cookie
300 @Input ui32PDumpFlags PDump flags
304 /*****************************************************************************/
306 SyncPrimOpPDumpPol(PSYNC_OP_COOKIE psCookie,
307 PDUMP_POLL_OPERATOR eOperator,
308 IMG_UINT32 ui32PDumpFlags);
310 /*************************************************************************/ /*!
311 @Function SyncPrimPDumpCBP
313 @Description Do a PDump CB poll using the synchronisation primitive
315 @Input psSync The synchronisation primitive to PDump
317 @Input uiWriteOffset Current write offset of buffer
319 @Input uiPacketSize Size of the packet to write into CB
321 @Input uiBufferSize Size of the CB
325 /*****************************************************************************/
327 SyncPrimPDumpCBP(PVRSRV_CLIENT_SYNC_PRIM *psSync,
328 IMG_UINT64 uiWriteOffset,
329 IMG_UINT64 uiPacketSize,
330 IMG_UINT64 uiBufferSize);
334 #ifdef INLINE_IS_PRAGMA
335 #pragma inline(SyncPrimPDumpValue)
337 static INLINE IMG_VOID
338 SyncPrimPDumpValue(PVRSRV_CLIENT_SYNC_PRIM *psSync, IMG_UINT32 ui32Value)
340 PVR_UNREFERENCED_PARAMETER(psSync);
341 PVR_UNREFERENCED_PARAMETER(ui32Value);
344 #ifdef INLINE_IS_PRAGMA
345 #pragma inline(SyncPrimPDump)
347 static INLINE IMG_VOID
348 SyncPrimPDump(PVRSRV_CLIENT_SYNC_PRIM *psSync)
350 PVR_UNREFERENCED_PARAMETER(psSync);
353 #ifdef INLINE_IS_PRAGMA
354 #pragma inline(SyncPrimPDumpPol)
356 static INLINE IMG_VOID
357 SyncPrimPDumpPol(PVRSRV_CLIENT_SYNC_PRIM *psSync,
358 IMG_UINT32 ui32Value,
360 PDUMP_POLL_OPERATOR eOperator,
361 IMG_UINT32 ui32PDumpFlags)
363 PVR_UNREFERENCED_PARAMETER(psSync);
364 PVR_UNREFERENCED_PARAMETER(ui32Value);
365 PVR_UNREFERENCED_PARAMETER(ui32Mask);
366 PVR_UNREFERENCED_PARAMETER(eOperator);
367 PVR_UNREFERENCED_PARAMETER(ui32PDumpFlags);
370 #ifdef INLINE_IS_PRAGMA
371 #pragma inline(SyncPrimServerPDumpPol)
373 static INLINE IMG_VOID
374 SyncPrimServerPDumpPol(PVRSRV_CLIENT_SYNC_PRIM *psSync,
375 PDUMP_POLL_OPERATOR eOperator,
376 IMG_UINT32 ui32PDumpFlags)
378 PVR_UNREFERENCED_PARAMETER(psSync);
379 PVR_UNREFERENCED_PARAMETER(eOperator);
380 PVR_UNREFERENCED_PARAMETER(ui32PDumpFlags);
383 #ifdef INLINE_IS_PRAGMA
384 #pragma inline(SyncPrimPDumpCBP)
386 static INLINE IMG_VOID
387 SyncPrimPDumpCBP(PVRSRV_CLIENT_SYNC_PRIM *psSync,
388 IMG_UINT64 uiWriteOffset,
389 IMG_UINT64 uiPacketSize,
390 IMG_UINT64 uiBufferSize)
392 PVR_UNREFERENCED_PARAMETER(psSync);
393 PVR_UNREFERENCED_PARAMETER(uiWriteOffset);
394 PVR_UNREFERENCED_PARAMETER(uiPacketSize);
395 PVR_UNREFERENCED_PARAMETER(uiBufferSize);
398 #endif /* _PVRSRV_SYNC_ */