1 /**************************************************************************/ /*!
3 @Title Server side synchronisation interface
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Describes the server side synchronisation functions
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"
46 #include "devicemem.h"
48 #include "pvrsrv_error.h"
49 #include "connection_server.h"
51 #ifndef _SYNC_SERVER_H_
52 #define _SYNC_SERVER_H_
54 typedef struct _SERVER_OP_COOKIE_ SERVER_OP_COOKIE;
55 typedef struct _SERVER_SYNC_PRIMITIVE_ SERVER_SYNC_PRIMITIVE;
56 typedef struct _SYNC_PRIMITIVE_BLOCK_ SYNC_PRIMITIVE_BLOCK;
57 typedef struct _SERVER_SYNC_EXPORT_ SERVER_SYNC_EXPORT;
58 typedef struct _SYNC_CONNECTION_DATA_ SYNC_CONNECTION_DATA;
59 typedef struct SYNC_RECORD* SYNC_RECORD_HANDLE;
62 PVRSRVAllocSyncPrimitiveBlockKM(CONNECTION_DATA *psConnection,
63 PVRSRV_DEVICE_NODE *psDevNode,
64 SYNC_PRIMITIVE_BLOCK **ppsSyncBlk,
65 IMG_UINT32 *puiSyncPrimVAddr,
66 IMG_UINT32 *puiSyncPrimBlockSize,
67 DEVMEM_EXPORTCOOKIE **psExportCookie);
70 PVRSRVExportSyncPrimitiveBlockKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk,
71 DEVMEM_EXPORTCOOKIE **psExportCookie);
74 PVRSRVUnexportSyncPrimitiveBlockKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk);
77 PVRSRVFreeSyncPrimitiveBlockKM(SYNC_PRIMITIVE_BLOCK *ppsSyncBlk);
80 PVRSRVSyncPrimSetKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk, IMG_UINT32 ui32Index,
81 IMG_UINT32 ui32Value);
84 PVRSRVServerSyncPrimSetKM(SERVER_SYNC_PRIMITIVE *psServerSync, IMG_UINT32 ui32Value);
86 #if defined(SUPPORT_INSECURE_EXPORT)
88 PVRSRVSyncPrimServerExportKM(SERVER_SYNC_PRIMITIVE *psSync,
89 SERVER_SYNC_EXPORT **ppsExport);
92 PVRSRVSyncPrimServerUnexportKM(SERVER_SYNC_EXPORT *psExport);
95 PVRSRVSyncPrimServerImportKM(SERVER_SYNC_EXPORT *psExport,
96 SERVER_SYNC_PRIMITIVE **ppsSync,
97 IMG_UINT32 *pui32SyncPrimVAddr);
100 #if defined(SUPPORT_SECURE_EXPORT)
102 PVRSRVSyncPrimServerSecureExportKM(CONNECTION_DATA *psConnection,
103 SERVER_SYNC_PRIMITIVE *psSync,
104 IMG_SECURE_TYPE *phSecure,
105 SERVER_SYNC_EXPORT **ppsExport,
106 CONNECTION_DATA **ppsSecureConnection);
109 PVRSRVSyncPrimServerSecureUnexportKM(SERVER_SYNC_EXPORT *psExport);
112 PVRSRVSyncPrimServerSecureImportKM(IMG_SECURE_TYPE hSecure,
113 SERVER_SYNC_PRIMITIVE **ppsSync,
114 IMG_UINT32 *pui32SyncPrimVAddr);
117 IMG_UINT32 PVRSRVServerSyncRequesterRegisterKM(IMG_UINT32 *pui32SyncRequesterID);
118 IMG_VOID PVRSRVServerSyncRequesterUnregisterKM(IMG_UINT32 ui32SyncRequesterID);
121 PVRSRVSyncRecordAddKM(
122 SYNC_RECORD_HANDLE * phRecord,
123 SYNC_PRIMITIVE_BLOCK * hServerSyncPrimBlock,
124 IMG_UINT32 ui32FwBlockAddr,
125 IMG_UINT32 ui32SyncOffset,
126 IMG_BOOL bServerSync,
127 IMG_UINT32 ui32ClassNameSize,
128 const IMG_CHAR *pszClassName);
130 PVRSRVSyncRecordRemoveByHandleKM(
131 SYNC_RECORD_HANDLE hRecord);
134 PVRSRVServerSyncAllocKM(PVRSRV_DEVICE_NODE *psDevNode,
135 SERVER_SYNC_PRIMITIVE **ppsSync,
136 IMG_UINT32 *pui32SyncPrimVAddr,
137 IMG_UINT32 ui32ClassNameSize,
138 const IMG_CHAR *szClassName);
140 PVRSRVServerSyncFreeKM(SERVER_SYNC_PRIMITIVE *psSync);
143 PVRSRVServerSyncGetStatusKM(IMG_UINT32 ui32SyncCount,
144 SERVER_SYNC_PRIMITIVE **papsSyncs,
145 IMG_UINT32 *pui32UID,
146 IMG_UINT32 *pui32FWAddr,
147 IMG_UINT32 *pui32CurrentOp,
148 IMG_UINT32 *pui32NextOp);
151 PVRSRVServerSyncQueueSWOpKM(SERVER_SYNC_PRIMITIVE *psSync,
152 IMG_UINT32 *pui32FenceValue,
153 IMG_UINT32 *pui32UpdateValue,
154 IMG_UINT32 ui32SyncRequesterID,
156 IMG_BOOL *pbFenceRequired);
159 PVRSRVServerSyncQueueHWOpKM(SERVER_SYNC_PRIMITIVE *psSync,
161 IMG_UINT32 *pui32FenceValue,
162 IMG_UINT32 *pui32UpdateValue);
165 ServerSyncFenceIsMet(SERVER_SYNC_PRIMITIVE *psSync,
166 IMG_UINT32 ui32FenceValue);
169 ServerSyncCompleteOp(SERVER_SYNC_PRIMITIVE *psSync,
171 IMG_UINT32 ui32UpdateValue);
175 PVRSRVSyncPrimOpCreateKM(IMG_UINT32 ui32SyncBlockCount,
176 SYNC_PRIMITIVE_BLOCK **papsSyncPrimBlock,
177 IMG_UINT32 ui32ClientSyncCount,
178 IMG_UINT32 *paui32SyncBlockIndex,
179 IMG_UINT32 *paui32Index,
180 IMG_UINT32 ui32ServerSyncCount,
181 SERVER_SYNC_PRIMITIVE **papsServerSync,
182 SERVER_OP_COOKIE **ppsServerCookie);
185 PVRSRVSyncPrimOpTakeKM(SERVER_OP_COOKIE *psServerCookie,
186 IMG_UINT32 ui32ClientSyncCount,
187 IMG_UINT32 *paui32Flags,
188 IMG_UINT32 *paui32FenceValue,
189 IMG_UINT32 *paui32UpdateValue,
190 IMG_UINT32 ui32ServerSyncCount,
191 IMG_UINT32 *paui32ServerFlags);
194 PVRSRVSyncPrimOpReadyKM(SERVER_OP_COOKIE *psServerCookie,
198 PVRSRVSyncPrimOpCompleteKM(SERVER_OP_COOKIE *psServerCookie);
201 PVRSRVSyncPrimOpDestroyKM(SERVER_OP_COOKIE *psServerCookie);
203 IMG_UINT32 ServerSyncGetId(SERVER_SYNC_PRIMITIVE *psSync);
205 IMG_UINT32 ServerSyncGetFWAddr(SERVER_SYNC_PRIMITIVE *psSync);
207 IMG_UINT32 ServerSyncGetValue(SERVER_SYNC_PRIMITIVE *psSync);
209 IMG_UINT32 ServerSyncGetNextValue(SERVER_SYNC_PRIMITIVE *psSync);
211 IMG_VOID ServerSyncDumpPending(IMG_VOID);
213 PVRSRV_ERROR SyncRegisterConnection(SYNC_CONNECTION_DATA **ppsSyncConnectionData);
214 IMG_VOID SyncUnregisterConnection(SYNC_CONNECTION_DATA *ppsSyncConnectionData);
215 IMG_VOID SyncConnectionPDumpSyncBlocks(SYNC_CONNECTION_DATA *ppsSyncConnectionData);
217 PVRSRV_ERROR ServerSyncInit(IMG_VOID);
218 IMG_VOID ServerSyncDeinit(IMG_VOID);
222 PVRSRVSyncPrimPDumpKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk, IMG_UINT32 ui32Offset);
225 PVRSRVSyncPrimPDumpValueKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk, IMG_UINT32 ui32Offset,
226 IMG_UINT32 ui32Value);
229 PVRSRVSyncPrimPDumpPolKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk, IMG_UINT32 ui32Offset,
230 IMG_UINT32 ui32Value, IMG_UINT32 ui32Mask,
231 PDUMP_POLL_OPERATOR eOperator,
232 PDUMP_FLAGS_T uiDumpFlags);
235 PVRSRVSyncPrimOpPDumpPolKM(SERVER_OP_COOKIE *psServerCookie,
236 PDUMP_POLL_OPERATOR eOperator,
237 PDUMP_FLAGS_T ui32PDumpFlags);
240 PVRSRVSyncPrimPDumpCBPKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk, IMG_UINT64 ui32Offset,
241 IMG_UINT64 uiWriteOffset, IMG_UINT64 uiPacketSize,
242 IMG_UINT64 uiBufferSize);
246 #ifdef INLINE_IS_PRAGMA
247 #pragma inline(PVRSRVSyncPrimPDumpKM)
249 static INLINE PVRSRV_ERROR
250 PVRSRVSyncPrimPDumpKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk, IMG_UINT32 ui32Offset)
252 PVR_UNREFERENCED_PARAMETER(psSyncBlk);
253 PVR_UNREFERENCED_PARAMETER(ui32Offset);
257 #ifdef INLINE_IS_PRAGMA
258 #pragma inline(PVRSRVSyncPrimPDumpValueKM)
260 static INLINE PVRSRV_ERROR
261 PVRSRVSyncPrimPDumpValueKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk, IMG_UINT32 ui32Offset,
262 IMG_UINT32 ui32Value)
264 PVR_UNREFERENCED_PARAMETER(psSyncBlk);
265 PVR_UNREFERENCED_PARAMETER(ui32Offset);
266 PVR_UNREFERENCED_PARAMETER(ui32Value);
270 #ifdef INLINE_IS_PRAGMA
271 #pragma inline(PVRSRVSyncPrimPDumpPolKM)
273 static INLINE PVRSRV_ERROR
274 PVRSRVSyncPrimPDumpPolKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk, IMG_UINT32 ui32Offset,
275 IMG_UINT32 ui32Value, IMG_UINT32 ui32Mask,
276 PDUMP_POLL_OPERATOR eOperator,
277 PDUMP_FLAGS_T uiDumpFlags)
279 PVR_UNREFERENCED_PARAMETER(psSyncBlk);
280 PVR_UNREFERENCED_PARAMETER(ui32Offset);
281 PVR_UNREFERENCED_PARAMETER(ui32Value);
282 PVR_UNREFERENCED_PARAMETER(ui32Mask);
283 PVR_UNREFERENCED_PARAMETER(eOperator);
284 PVR_UNREFERENCED_PARAMETER(uiDumpFlags);
288 #ifdef INLINE_IS_PRAGMA
289 #pragma inline(PVRSRVSyncPrimOpPDumpPolKM)
291 static INLINE PVRSRV_ERROR
292 PVRSRVSyncPrimOpPDumpPolKM(SERVER_OP_COOKIE *psServerCookie,
293 PDUMP_POLL_OPERATOR eOperator,
294 PDUMP_FLAGS_T uiDumpFlags)
296 PVR_UNREFERENCED_PARAMETER(psServerCookie);
297 PVR_UNREFERENCED_PARAMETER(eOperator);
298 PVR_UNREFERENCED_PARAMETER(uiDumpFlags);
302 #ifdef INLINE_IS_PRAGMA
303 #pragma inline(PVRSRVSyncPrimPDumpCBPKM)
305 static INLINE PVRSRV_ERROR
306 PVRSRVSyncPrimPDumpCBPKM(SYNC_PRIMITIVE_BLOCK *psSyncBlk, IMG_UINT64 ui32Offset,
307 IMG_UINT64 uiWriteOffset, IMG_UINT64 uiPacketSize,
308 IMG_UINT64 uiBufferSize)
310 PVR_UNREFERENCED_PARAMETER(psSyncBlk);
311 PVR_UNREFERENCED_PARAMETER(ui32Offset);
312 PVR_UNREFERENCED_PARAMETER(uiWriteOffset);
313 PVR_UNREFERENCED_PARAMETER(uiPacketSize);
314 PVR_UNREFERENCED_PARAMETER(uiBufferSize);
318 #endif /*_SYNC_SERVER_H_ */