1 /*************************************************************************/ /*!
3 @Title Server bridge for rgxtq
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Implements the server side of the bridge for rgxtq
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 */ /**************************************************************************/
45 #include <asm/uaccess.h>
49 #include "rgxtransfer.h"
52 #include "common_rgxtq_bridge.h"
55 #include "pvr_debug.h"
56 #include "connection_server.h"
57 #include "pvr_bridge.h"
58 #include "rgx_bridge.h"
62 #include <linux/slab.h>
69 /* ***************************************************************************
70 * Server-side bridge entry points
74 PVRSRVBridgeRGXCreateTransferContext(IMG_UINT32 ui32DispatchTableEntry,
75 PVRSRV_BRIDGE_IN_RGXCREATETRANSFERCONTEXT *psRGXCreateTransferContextIN,
76 PVRSRV_BRIDGE_OUT_RGXCREATETRANSFERCONTEXT *psRGXCreateTransferContextOUT,
77 CONNECTION_DATA *psConnection)
79 IMG_BYTE *psFrameworkCmdInt = NULL;
80 IMG_HANDLE hPrivData = psRGXCreateTransferContextIN->hPrivData;
81 IMG_HANDLE hPrivDataInt = NULL;
82 RGX_SERVER_TQ_CONTEXT * psTransferContextInt = NULL;
84 IMG_UINT32 ui32NextOffset = 0;
85 IMG_BYTE *pArrayArgsBuffer = NULL;
86 #if !defined(INTEGRITY_OS)
87 IMG_BOOL bHaveEnoughSpace = IMG_FALSE;
90 IMG_UINT32 ui32BufferSize =
91 (psRGXCreateTransferContextIN->ui32FrameworkCmdize * sizeof(IMG_BYTE)) +
98 if (ui32BufferSize != 0)
100 #if !defined(INTEGRITY_OS)
101 /* Try to use remainder of input buffer for copies if possible, word-aligned for safety. */
102 IMG_UINT32 ui32InBufferOffset = PVR_ALIGN(sizeof(*psRGXCreateTransferContextIN), sizeof(unsigned long));
103 IMG_UINT32 ui32InBufferExcessSize = ui32InBufferOffset >= PVRSRV_MAX_BRIDGE_IN_SIZE ? 0 :
104 PVRSRV_MAX_BRIDGE_IN_SIZE - ui32InBufferOffset;
106 bHaveEnoughSpace = ui32BufferSize <= ui32InBufferExcessSize;
107 if (bHaveEnoughSpace)
109 IMG_BYTE *pInputBuffer = (IMG_BYTE *)psRGXCreateTransferContextIN;
111 pArrayArgsBuffer = &pInputBuffer[ui32InBufferOffset]; }
115 pArrayArgsBuffer = OSAllocMemNoStats(ui32BufferSize);
117 if(!pArrayArgsBuffer)
119 psRGXCreateTransferContextOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
120 goto RGXCreateTransferContext_exit;
125 if (psRGXCreateTransferContextIN->ui32FrameworkCmdize != 0)
127 psFrameworkCmdInt = (IMG_BYTE*)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
128 ui32NextOffset += psRGXCreateTransferContextIN->ui32FrameworkCmdize * sizeof(IMG_BYTE);
131 /* Copy the data over */
132 if (psRGXCreateTransferContextIN->ui32FrameworkCmdize * sizeof(IMG_BYTE) > 0)
134 if ( OSCopyFromUser(NULL, psFrameworkCmdInt, psRGXCreateTransferContextIN->psFrameworkCmd, psRGXCreateTransferContextIN->ui32FrameworkCmdize * sizeof(IMG_BYTE)) != PVRSRV_OK )
136 psRGXCreateTransferContextOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
138 goto RGXCreateTransferContext_exit;
142 /* Lock over handle lookup. */
150 /* Look up the address from the handle */
151 psRGXCreateTransferContextOUT->eError =
152 PVRSRVLookupHandleUnlocked(psConnection->psHandleBase,
153 (void **) &hPrivDataInt,
155 PVRSRV_HANDLE_TYPE_DEV_PRIV_DATA,
157 if(psRGXCreateTransferContextOUT->eError != PVRSRV_OK)
160 goto RGXCreateTransferContext_exit;
163 /* Release now we have looked up handles. */
166 psRGXCreateTransferContextOUT->eError =
167 PVRSRVRGXCreateTransferContextKM(psConnection, OSGetDevData(psConnection),
168 psRGXCreateTransferContextIN->ui32Priority,
169 psRGXCreateTransferContextIN->sMCUFenceAddr,
170 psRGXCreateTransferContextIN->ui32FrameworkCmdize,
173 &psTransferContextInt);
174 /* Exit early if bridged call fails */
175 if(psRGXCreateTransferContextOUT->eError != PVRSRV_OK)
177 goto RGXCreateTransferContext_exit;
180 /* Lock over handle creation. */
187 psRGXCreateTransferContextOUT->eError = PVRSRVAllocHandleUnlocked(psConnection->psHandleBase,
189 &psRGXCreateTransferContextOUT->hTransferContext,
190 (void *) psTransferContextInt,
191 PVRSRV_HANDLE_TYPE_RGX_SERVER_TQ_CONTEXT,
192 PVRSRV_HANDLE_ALLOC_FLAG_MULTI
193 ,(PFN_HANDLE_RELEASE)&PVRSRVRGXDestroyTransferContextKM);
194 if (psRGXCreateTransferContextOUT->eError != PVRSRV_OK)
197 goto RGXCreateTransferContext_exit;
200 /* Release now we have created handles. */
205 RGXCreateTransferContext_exit:
207 /* Lock over handle lookup cleanup. */
216 /* Unreference the previously looked up handle */
219 PVRSRVReleaseHandleUnlocked(psConnection->psHandleBase,
221 PVRSRV_HANDLE_TYPE_DEV_PRIV_DATA);
224 /* Release now we have cleaned up look up handles. */
227 if (psRGXCreateTransferContextOUT->eError != PVRSRV_OK)
229 if (psTransferContextInt)
231 PVRSRVRGXDestroyTransferContextKM(psTransferContextInt);
235 /* Allocated space should be equal to the last updated offset */
236 PVR_ASSERT(ui32BufferSize == ui32NextOffset);
238 #if defined(INTEGRITY_OS)
241 if(!bHaveEnoughSpace && pArrayArgsBuffer)
243 OSFreeMemNoStats(pArrayArgsBuffer);
251 PVRSRVBridgeRGXDestroyTransferContext(IMG_UINT32 ui32DispatchTableEntry,
252 PVRSRV_BRIDGE_IN_RGXDESTROYTRANSFERCONTEXT *psRGXDestroyTransferContextIN,
253 PVRSRV_BRIDGE_OUT_RGXDESTROYTRANSFERCONTEXT *psRGXDestroyTransferContextOUT,
254 CONNECTION_DATA *psConnection)
265 /* Lock over handle destruction. */
272 psRGXDestroyTransferContextOUT->eError =
273 PVRSRVReleaseHandleUnlocked(psConnection->psHandleBase,
274 (IMG_HANDLE) psRGXDestroyTransferContextIN->hTransferContext,
275 PVRSRV_HANDLE_TYPE_RGX_SERVER_TQ_CONTEXT);
276 if ((psRGXDestroyTransferContextOUT->eError != PVRSRV_OK) &&
277 (psRGXDestroyTransferContextOUT->eError != PVRSRV_ERROR_RETRY))
279 PVR_DPF((PVR_DBG_ERROR,
280 "PVRSRVBridgeRGXDestroyTransferContext: %s",
281 PVRSRVGetErrorStringKM(psRGXDestroyTransferContextOUT->eError)));
284 goto RGXDestroyTransferContext_exit;
287 /* Release now we have destroyed handles. */
292 RGXDestroyTransferContext_exit:
302 PVRSRVBridgeRGXSubmitTransfer(IMG_UINT32 ui32DispatchTableEntry,
303 PVRSRV_BRIDGE_IN_RGXSUBMITTRANSFER *psRGXSubmitTransferIN,
304 PVRSRV_BRIDGE_OUT_RGXSUBMITTRANSFER *psRGXSubmitTransferOUT,
305 CONNECTION_DATA *psConnection)
307 IMG_HANDLE hTransferContext = psRGXSubmitTransferIN->hTransferContext;
308 RGX_SERVER_TQ_CONTEXT * psTransferContextInt = NULL;
309 IMG_UINT32 *ui32ClientFenceCountInt = NULL;
310 SYNC_PRIMITIVE_BLOCK * **psFenceUFOSyncPrimBlockInt = NULL;
311 IMG_HANDLE **hFenceUFOSyncPrimBlockInt2 = NULL;
312 IMG_UINT32 **ui32FenceSyncOffsetInt = NULL;
313 IMG_UINT32 **ui32FenceValueInt = NULL;
314 IMG_UINT32 *ui32ClientUpdateCountInt = NULL;
315 SYNC_PRIMITIVE_BLOCK * **psUpdateUFOSyncPrimBlockInt = NULL;
316 IMG_HANDLE **hUpdateUFOSyncPrimBlockInt2 = NULL;
317 IMG_UINT32 **ui32UpdateSyncOffsetInt = NULL;
318 IMG_UINT32 **ui32UpdateValueInt = NULL;
319 IMG_UINT32 *ui32ServerSyncCountInt = NULL;
320 IMG_UINT32 **ui32ServerSyncFlagsInt = NULL;
321 SERVER_SYNC_PRIMITIVE * **psServerSyncInt = NULL;
322 IMG_HANDLE **hServerSyncInt2 = NULL;
323 IMG_CHAR *uiUpdateFenceNameInt = NULL;
324 IMG_UINT32 *ui32CommandSizeInt = NULL;
325 IMG_UINT8 **ui8FWCommandInt = NULL;
326 IMG_UINT32 *ui32TQPrepareFlagsInt = NULL;
327 IMG_UINT32 *ui32SyncPMRFlagsInt = NULL;
328 PMR * *psSyncPMRsInt = NULL;
329 IMG_HANDLE *hSyncPMRsInt2 = NULL;
331 IMG_UINT32 ui32NextOffset = 0;
332 IMG_BYTE *pArrayArgsBuffer = NULL;
333 IMG_BYTE *pArrayArgsBuffer2 = NULL;
334 #if !defined(INTEGRITY_OS)
335 IMG_BOOL bHaveEnoughSpace = IMG_FALSE;
338 IMG_UINT32 ui32BufferSize =
339 (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) +
340 (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) +
341 (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) +
342 (32 * sizeof(IMG_CHAR)) +
343 (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) +
344 (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) +
345 (psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(IMG_UINT32)) +
346 (psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(PMR *)) +
347 (psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(IMG_HANDLE)) +
349 IMG_UINT32 ui32BufferSize2 = 0;
350 IMG_UINT32 ui32NextOffset2 = 0;
352 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
355 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(SYNC_PRIMITIVE_BLOCK **);
356 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_HANDLE **);
357 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
358 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
359 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(SYNC_PRIMITIVE_BLOCK **);
360 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_HANDLE **);
361 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
362 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
363 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
364 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(SERVER_SYNC_PRIMITIVE **);
365 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_HANDLE **);
366 ui32BufferSize += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT8*);
374 if (ui32BufferSize != 0)
376 #if !defined(INTEGRITY_OS)
377 /* Try to use remainder of input buffer for copies if possible, word-aligned for safety. */
378 IMG_UINT32 ui32InBufferOffset = PVR_ALIGN(sizeof(*psRGXSubmitTransferIN), sizeof(unsigned long));
379 IMG_UINT32 ui32InBufferExcessSize = ui32InBufferOffset >= PVRSRV_MAX_BRIDGE_IN_SIZE ? 0 :
380 PVRSRV_MAX_BRIDGE_IN_SIZE - ui32InBufferOffset;
382 bHaveEnoughSpace = ui32BufferSize <= ui32InBufferExcessSize;
383 if (bHaveEnoughSpace)
385 IMG_BYTE *pInputBuffer = (IMG_BYTE *)psRGXSubmitTransferIN;
387 pArrayArgsBuffer = &pInputBuffer[ui32InBufferOffset]; }
391 pArrayArgsBuffer = OSAllocMemNoStats(ui32BufferSize);
393 if(!pArrayArgsBuffer)
395 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
396 goto RGXSubmitTransfer_exit;
401 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
403 ui32ClientFenceCountInt = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
404 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32);
407 /* Copy the data over */
408 if (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32) > 0)
410 if ( OSCopyFromUser(NULL, ui32ClientFenceCountInt, psRGXSubmitTransferIN->pui32ClientFenceCount, psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) != PVRSRV_OK )
412 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
414 goto RGXSubmitTransfer_exit;
417 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
419 /* Assigning psFenceUFOSyncPrimBlockInt to the right offset in the pool buffer for first dimension */
420 psFenceUFOSyncPrimBlockInt = (SYNC_PRIMITIVE_BLOCK ***)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
421 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(SYNC_PRIMITIVE_BLOCK **);
422 /* Assigning hFenceUFOSyncPrimBlockInt2 to the right offset in the pool buffer for first dimension */
423 hFenceUFOSyncPrimBlockInt2 = (IMG_HANDLE **)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
424 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_HANDLE);
427 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
429 /* Assigning ui32FenceSyncOffsetInt to the right offset in the pool buffer for first dimension */
430 ui32FenceSyncOffsetInt = (IMG_UINT32**)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
431 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
434 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
436 /* Assigning ui32FenceValueInt to the right offset in the pool buffer for first dimension */
437 ui32FenceValueInt = (IMG_UINT32**)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
438 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
441 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
443 ui32ClientUpdateCountInt = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
444 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32);
447 /* Copy the data over */
448 if (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32) > 0)
450 if ( OSCopyFromUser(NULL, ui32ClientUpdateCountInt, psRGXSubmitTransferIN->pui32ClientUpdateCount, psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) != PVRSRV_OK )
452 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
454 goto RGXSubmitTransfer_exit;
457 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
459 /* Assigning psUpdateUFOSyncPrimBlockInt to the right offset in the pool buffer for first dimension */
460 psUpdateUFOSyncPrimBlockInt = (SYNC_PRIMITIVE_BLOCK ***)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
461 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(SYNC_PRIMITIVE_BLOCK **);
462 /* Assigning hUpdateUFOSyncPrimBlockInt2 to the right offset in the pool buffer for first dimension */
463 hUpdateUFOSyncPrimBlockInt2 = (IMG_HANDLE **)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
464 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_HANDLE);
467 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
469 /* Assigning ui32UpdateSyncOffsetInt to the right offset in the pool buffer for first dimension */
470 ui32UpdateSyncOffsetInt = (IMG_UINT32**)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
471 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
474 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
476 /* Assigning ui32UpdateValueInt to the right offset in the pool buffer for first dimension */
477 ui32UpdateValueInt = (IMG_UINT32**)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
478 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
481 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
483 ui32ServerSyncCountInt = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
484 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32);
487 /* Copy the data over */
488 if (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32) > 0)
490 if ( OSCopyFromUser(NULL, ui32ServerSyncCountInt, psRGXSubmitTransferIN->pui32ServerSyncCount, psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) != PVRSRV_OK )
492 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
494 goto RGXSubmitTransfer_exit;
497 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
499 /* Assigning ui32ServerSyncFlagsInt to the right offset in the pool buffer for first dimension */
500 ui32ServerSyncFlagsInt = (IMG_UINT32**)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
501 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32*);
504 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
506 /* Assigning psServerSyncInt to the right offset in the pool buffer for first dimension */
507 psServerSyncInt = (SERVER_SYNC_PRIMITIVE ***)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
508 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(SERVER_SYNC_PRIMITIVE **);
509 /* Assigning hServerSyncInt2 to the right offset in the pool buffer for first dimension */
510 hServerSyncInt2 = (IMG_HANDLE **)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
511 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_HANDLE);
516 uiUpdateFenceNameInt = (IMG_CHAR*)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
517 ui32NextOffset += 32 * sizeof(IMG_CHAR);
520 /* Copy the data over */
521 if (32 * sizeof(IMG_CHAR) > 0)
523 if ( OSCopyFromUser(NULL, uiUpdateFenceNameInt, psRGXSubmitTransferIN->puiUpdateFenceName, 32 * sizeof(IMG_CHAR)) != PVRSRV_OK )
525 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
527 goto RGXSubmitTransfer_exit;
530 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
532 ui32CommandSizeInt = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
533 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32);
536 /* Copy the data over */
537 if (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32) > 0)
539 if ( OSCopyFromUser(NULL, ui32CommandSizeInt, psRGXSubmitTransferIN->pui32CommandSize, psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) != PVRSRV_OK )
541 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
543 goto RGXSubmitTransfer_exit;
546 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
548 /* Assigning ui8FWCommandInt to the right offset in the pool buffer for first dimension */
549 ui8FWCommandInt = (IMG_UINT8**)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
550 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT8*);
553 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
555 ui32TQPrepareFlagsInt = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
556 ui32NextOffset += psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32);
559 /* Copy the data over */
560 if (psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32) > 0)
562 if ( OSCopyFromUser(NULL, ui32TQPrepareFlagsInt, psRGXSubmitTransferIN->pui32TQPrepareFlags, psRGXSubmitTransferIN->ui32PrepareCount * sizeof(IMG_UINT32)) != PVRSRV_OK )
564 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
566 goto RGXSubmitTransfer_exit;
569 if (psRGXSubmitTransferIN->ui32SyncPMRCount != 0)
571 ui32SyncPMRFlagsInt = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
572 ui32NextOffset += psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(IMG_UINT32);
575 /* Copy the data over */
576 if (psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(IMG_UINT32) > 0)
578 if ( OSCopyFromUser(NULL, ui32SyncPMRFlagsInt, psRGXSubmitTransferIN->pui32SyncPMRFlags, psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(IMG_UINT32)) != PVRSRV_OK )
580 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
582 goto RGXSubmitTransfer_exit;
585 if (psRGXSubmitTransferIN->ui32SyncPMRCount != 0)
587 psSyncPMRsInt = (PMR **)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
588 ui32NextOffset += psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(PMR *);
589 hSyncPMRsInt2 = (IMG_HANDLE *)(((IMG_UINT8 *)pArrayArgsBuffer) + ui32NextOffset);
590 ui32NextOffset += psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(IMG_HANDLE);
593 /* Copy the data over */
594 if (psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(IMG_HANDLE) > 0)
596 if ( OSCopyFromUser(NULL, hSyncPMRsInt2, psRGXSubmitTransferIN->phSyncPMRs, psRGXSubmitTransferIN->ui32SyncPMRCount * sizeof(IMG_HANDLE)) != PVRSRV_OK )
598 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
600 goto RGXSubmitTransfer_exit;
604 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
607 for (i = 0; i < psRGXSubmitTransferIN->ui32PrepareCount; i++)
609 ui32BufferSize2 += ui32ClientFenceCountInt[i] * sizeof(SYNC_PRIMITIVE_BLOCK *);
610 ui32BufferSize2 += ui32ClientFenceCountInt[i] * sizeof(IMG_HANDLE *);
611 ui32BufferSize2 += ui32ClientFenceCountInt[i] * sizeof(IMG_UINT32);
612 ui32BufferSize2 += ui32ClientFenceCountInt[i] * sizeof(IMG_UINT32);
613 ui32BufferSize2 += ui32ClientUpdateCountInt[i] * sizeof(SYNC_PRIMITIVE_BLOCK *);
614 ui32BufferSize2 += ui32ClientUpdateCountInt[i] * sizeof(IMG_HANDLE *);
615 ui32BufferSize2 += ui32ClientUpdateCountInt[i] * sizeof(IMG_UINT32);
616 ui32BufferSize2 += ui32ClientUpdateCountInt[i] * sizeof(IMG_UINT32);
617 ui32BufferSize2 += ui32ServerSyncCountInt[i] * sizeof(IMG_UINT32);
618 ui32BufferSize2 += ui32ServerSyncCountInt[i] * sizeof(SERVER_SYNC_PRIMITIVE *);
619 ui32BufferSize2 += ui32ServerSyncCountInt[i] * sizeof(IMG_HANDLE *);
620 ui32BufferSize2 += ui32CommandSizeInt[i] * sizeof(IMG_UINT8);
624 if (ui32BufferSize2 != 0)
626 pArrayArgsBuffer2 = OSAllocMemNoStats(ui32BufferSize2);
628 if(!pArrayArgsBuffer2)
630 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_OUT_OF_MEMORY;
631 goto RGXSubmitTransfer_exit;
635 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
638 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
640 /* Assigning each psFenceUFOSyncPrimBlockInt to the right offset in the pool buffer (this is the second dimension) */
641 psFenceUFOSyncPrimBlockInt[i] = (SYNC_PRIMITIVE_BLOCK **)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
642 ui32NextOffset2 += ui32ClientFenceCountInt[i] * sizeof(SYNC_PRIMITIVE_BLOCK *);
643 /* Assigning each hFenceUFOSyncPrimBlockInt2 to the right offset in the pool buffer (this is the second dimension) */
644 hFenceUFOSyncPrimBlockInt2[i] = (IMG_HANDLE *)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
645 ui32NextOffset2 += ui32ClientFenceCountInt[i] * sizeof(IMG_HANDLE);
648 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
651 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
653 /* Assigning each ui32FenceSyncOffsetInt to the right offset in the pool buffer (this is the second dimension) */
654 ui32FenceSyncOffsetInt[i] = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
655 ui32NextOffset2 += ui32ClientFenceCountInt[i] * sizeof(IMG_UINT32);
658 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
661 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
663 /* Assigning each ui32FenceValueInt to the right offset in the pool buffer (this is the second dimension) */
664 ui32FenceValueInt[i] = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
665 ui32NextOffset2 += ui32ClientFenceCountInt[i] * sizeof(IMG_UINT32);
668 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
671 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
673 /* Assigning each psUpdateUFOSyncPrimBlockInt to the right offset in the pool buffer (this is the second dimension) */
674 psUpdateUFOSyncPrimBlockInt[i] = (SYNC_PRIMITIVE_BLOCK **)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
675 ui32NextOffset2 += ui32ClientUpdateCountInt[i] * sizeof(SYNC_PRIMITIVE_BLOCK *);
676 /* Assigning each hUpdateUFOSyncPrimBlockInt2 to the right offset in the pool buffer (this is the second dimension) */
677 hUpdateUFOSyncPrimBlockInt2[i] = (IMG_HANDLE *)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
678 ui32NextOffset2 += ui32ClientUpdateCountInt[i] * sizeof(IMG_HANDLE);
681 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
684 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
686 /* Assigning each ui32UpdateSyncOffsetInt to the right offset in the pool buffer (this is the second dimension) */
687 ui32UpdateSyncOffsetInt[i] = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
688 ui32NextOffset2 += ui32ClientUpdateCountInt[i] * sizeof(IMG_UINT32);
691 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
694 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
696 /* Assigning each ui32UpdateValueInt to the right offset in the pool buffer (this is the second dimension) */
697 ui32UpdateValueInt[i] = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
698 ui32NextOffset2 += ui32ClientUpdateCountInt[i] * sizeof(IMG_UINT32);
701 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
704 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
706 /* Assigning each ui32ServerSyncFlagsInt to the right offset in the pool buffer (this is the second dimension) */
707 ui32ServerSyncFlagsInt[i] = (IMG_UINT32*)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
708 ui32NextOffset2 += ui32ServerSyncCountInt[i] * sizeof(IMG_UINT32);
711 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
714 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
716 /* Assigning each psServerSyncInt to the right offset in the pool buffer (this is the second dimension) */
717 psServerSyncInt[i] = (SERVER_SYNC_PRIMITIVE **)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
718 ui32NextOffset2 += ui32ServerSyncCountInt[i] * sizeof(SERVER_SYNC_PRIMITIVE *);
719 /* Assigning each hServerSyncInt2 to the right offset in the pool buffer (this is the second dimension) */
720 hServerSyncInt2[i] = (IMG_HANDLE *)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
721 ui32NextOffset2 += ui32ServerSyncCountInt[i] * sizeof(IMG_HANDLE);
724 if (psRGXSubmitTransferIN->ui32PrepareCount != 0)
727 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
729 /* Assigning each ui8FWCommandInt to the right offset in the pool buffer (this is the second dimension) */
730 ui8FWCommandInt[i] = (IMG_UINT8*)(((IMG_UINT8 *)pArrayArgsBuffer2) + ui32NextOffset2);
731 ui32NextOffset2 += ui32CommandSizeInt[i] * sizeof(IMG_UINT8);
739 /* Loop over all the pointers in the array copying the data into the kernel */
740 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
742 /* Copy the pointer over from the client side */
743 if ( OSCopyFromUser(NULL, &psPtr, &psRGXSubmitTransferIN->phFenceUFOSyncPrimBlock[i],
744 sizeof(IMG_HANDLE **)) != PVRSRV_OK )
746 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
748 goto RGXSubmitTransfer_exit;
751 /* Copy the data over */
752 if ((ui32ClientFenceCountInt[i] * sizeof(IMG_HANDLE)) > 0)
754 if ( OSCopyFromUser(NULL, (hFenceUFOSyncPrimBlockInt2[i]), psPtr, (ui32ClientFenceCountInt[i] * sizeof(IMG_HANDLE))) != PVRSRV_OK )
756 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
758 goto RGXSubmitTransfer_exit;
768 /* Loop over all the pointers in the array copying the data into the kernel */
769 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
771 /* Copy the pointer over from the client side */
772 if ( OSCopyFromUser(NULL, &psPtr, &psRGXSubmitTransferIN->pui32FenceSyncOffset[i],
773 sizeof(IMG_UINT32 **)) != PVRSRV_OK )
775 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
777 goto RGXSubmitTransfer_exit;
780 /* Copy the data over */
781 if ((ui32ClientFenceCountInt[i] * sizeof(IMG_UINT32)) > 0)
783 if ( OSCopyFromUser(NULL, (ui32FenceSyncOffsetInt[i]), psPtr, (ui32ClientFenceCountInt[i] * sizeof(IMG_UINT32))) != PVRSRV_OK )
785 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
787 goto RGXSubmitTransfer_exit;
797 /* Loop over all the pointers in the array copying the data into the kernel */
798 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
800 /* Copy the pointer over from the client side */
801 if ( OSCopyFromUser(NULL, &psPtr, &psRGXSubmitTransferIN->pui32FenceValue[i],
802 sizeof(IMG_UINT32 **)) != PVRSRV_OK )
804 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
806 goto RGXSubmitTransfer_exit;
809 /* Copy the data over */
810 if ((ui32ClientFenceCountInt[i] * sizeof(IMG_UINT32)) > 0)
812 if ( OSCopyFromUser(NULL, (ui32FenceValueInt[i]), psPtr, (ui32ClientFenceCountInt[i] * sizeof(IMG_UINT32))) != PVRSRV_OK )
814 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
816 goto RGXSubmitTransfer_exit;
826 /* Loop over all the pointers in the array copying the data into the kernel */
827 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
829 /* Copy the pointer over from the client side */
830 if ( OSCopyFromUser(NULL, &psPtr, &psRGXSubmitTransferIN->phUpdateUFOSyncPrimBlock[i],
831 sizeof(IMG_HANDLE **)) != PVRSRV_OK )
833 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
835 goto RGXSubmitTransfer_exit;
838 /* Copy the data over */
839 if ((ui32ClientUpdateCountInt[i] * sizeof(IMG_HANDLE)) > 0)
841 if ( OSCopyFromUser(NULL, (hUpdateUFOSyncPrimBlockInt2[i]), psPtr, (ui32ClientUpdateCountInt[i] * sizeof(IMG_HANDLE))) != PVRSRV_OK )
843 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
845 goto RGXSubmitTransfer_exit;
855 /* Loop over all the pointers in the array copying the data into the kernel */
856 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
858 /* Copy the pointer over from the client side */
859 if ( OSCopyFromUser(NULL, &psPtr, &psRGXSubmitTransferIN->pui32UpdateSyncOffset[i],
860 sizeof(IMG_UINT32 **)) != PVRSRV_OK )
862 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
864 goto RGXSubmitTransfer_exit;
867 /* Copy the data over */
868 if ((ui32ClientUpdateCountInt[i] * sizeof(IMG_UINT32)) > 0)
870 if ( OSCopyFromUser(NULL, (ui32UpdateSyncOffsetInt[i]), psPtr, (ui32ClientUpdateCountInt[i] * sizeof(IMG_UINT32))) != PVRSRV_OK )
872 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
874 goto RGXSubmitTransfer_exit;
884 /* Loop over all the pointers in the array copying the data into the kernel */
885 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
887 /* Copy the pointer over from the client side */
888 if ( OSCopyFromUser(NULL, &psPtr, &psRGXSubmitTransferIN->pui32UpdateValue[i],
889 sizeof(IMG_UINT32 **)) != PVRSRV_OK )
891 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
893 goto RGXSubmitTransfer_exit;
896 /* Copy the data over */
897 if ((ui32ClientUpdateCountInt[i] * sizeof(IMG_UINT32)) > 0)
899 if ( OSCopyFromUser(NULL, (ui32UpdateValueInt[i]), psPtr, (ui32ClientUpdateCountInt[i] * sizeof(IMG_UINT32))) != PVRSRV_OK )
901 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
903 goto RGXSubmitTransfer_exit;
913 /* Loop over all the pointers in the array copying the data into the kernel */
914 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
916 /* Copy the pointer over from the client side */
917 if ( OSCopyFromUser(NULL, &psPtr, &psRGXSubmitTransferIN->pui32ServerSyncFlags[i],
918 sizeof(IMG_UINT32 **)) != PVRSRV_OK )
920 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
922 goto RGXSubmitTransfer_exit;
925 /* Copy the data over */
926 if ((ui32ServerSyncCountInt[i] * sizeof(IMG_UINT32)) > 0)
928 if ( OSCopyFromUser(NULL, (ui32ServerSyncFlagsInt[i]), psPtr, (ui32ServerSyncCountInt[i] * sizeof(IMG_UINT32))) != PVRSRV_OK )
930 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
932 goto RGXSubmitTransfer_exit;
942 /* Loop over all the pointers in the array copying the data into the kernel */
943 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
945 /* Copy the pointer over from the client side */
946 if ( OSCopyFromUser(NULL, &psPtr, &psRGXSubmitTransferIN->phServerSync[i],
947 sizeof(IMG_HANDLE **)) != PVRSRV_OK )
949 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
951 goto RGXSubmitTransfer_exit;
954 /* Copy the data over */
955 if ((ui32ServerSyncCountInt[i] * sizeof(IMG_HANDLE)) > 0)
957 if ( OSCopyFromUser(NULL, (hServerSyncInt2[i]), psPtr, (ui32ServerSyncCountInt[i] * sizeof(IMG_HANDLE))) != PVRSRV_OK )
959 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
961 goto RGXSubmitTransfer_exit;
971 /* Loop over all the pointers in the array copying the data into the kernel */
972 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
974 /* Copy the pointer over from the client side */
975 if ( OSCopyFromUser(NULL, &psPtr, &psRGXSubmitTransferIN->pui8FWCommand[i],
976 sizeof(IMG_UINT8 **)) != PVRSRV_OK )
978 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
980 goto RGXSubmitTransfer_exit;
983 /* Copy the data over */
984 if ((ui32CommandSizeInt[i] * sizeof(IMG_UINT8)) > 0)
986 if ( OSCopyFromUser(NULL, (ui8FWCommandInt[i]), psPtr, (ui32CommandSizeInt[i] * sizeof(IMG_UINT8))) != PVRSRV_OK )
988 psRGXSubmitTransferOUT->eError = PVRSRV_ERROR_INVALID_PARAMS;
990 goto RGXSubmitTransfer_exit;
995 /* Lock over handle lookup. */
1003 /* Look up the address from the handle */
1004 psRGXSubmitTransferOUT->eError =
1005 PVRSRVLookupHandleUnlocked(psConnection->psHandleBase,
1006 (void **) &psTransferContextInt,
1008 PVRSRV_HANDLE_TYPE_RGX_SERVER_TQ_CONTEXT,
1010 if(psRGXSubmitTransferOUT->eError != PVRSRV_OK)
1013 goto RGXSubmitTransfer_exit;
1024 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
1027 for (j=0;j<ui32ClientFenceCountInt[i];j++)
1030 /* Look up the address from the handle */
1031 psRGXSubmitTransferOUT->eError =
1032 PVRSRVLookupHandleUnlocked(psConnection->psHandleBase,
1033 (void **) &psFenceUFOSyncPrimBlockInt[i][j],
1034 hFenceUFOSyncPrimBlockInt2[i][j],
1035 PVRSRV_HANDLE_TYPE_SYNC_PRIMITIVE_BLOCK,
1037 if(psRGXSubmitTransferOUT->eError != PVRSRV_OK)
1040 goto RGXSubmitTransfer_exit;
1054 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
1057 for (j=0;j<ui32ClientUpdateCountInt[i];j++)
1060 /* Look up the address from the handle */
1061 psRGXSubmitTransferOUT->eError =
1062 PVRSRVLookupHandleUnlocked(psConnection->psHandleBase,
1063 (void **) &psUpdateUFOSyncPrimBlockInt[i][j],
1064 hUpdateUFOSyncPrimBlockInt2[i][j],
1065 PVRSRV_HANDLE_TYPE_SYNC_PRIMITIVE_BLOCK,
1067 if(psRGXSubmitTransferOUT->eError != PVRSRV_OK)
1070 goto RGXSubmitTransfer_exit;
1084 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
1087 for (j=0;j<ui32ServerSyncCountInt[i];j++)
1090 /* Look up the address from the handle */
1091 psRGXSubmitTransferOUT->eError =
1092 PVRSRVLookupHandleUnlocked(psConnection->psHandleBase,
1093 (void **) &psServerSyncInt[i][j],
1094 hServerSyncInt2[i][j],
1095 PVRSRV_HANDLE_TYPE_SERVER_SYNC_PRIMITIVE,
1097 if(psRGXSubmitTransferOUT->eError != PVRSRV_OK)
1100 goto RGXSubmitTransfer_exit;
1114 for (i=0;i<psRGXSubmitTransferIN->ui32SyncPMRCount;i++)
1117 /* Look up the address from the handle */
1118 psRGXSubmitTransferOUT->eError =
1119 PVRSRVLookupHandleUnlocked(psConnection->psHandleBase,
1120 (void **) &psSyncPMRsInt[i],
1122 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR,
1124 if(psRGXSubmitTransferOUT->eError != PVRSRV_OK)
1127 goto RGXSubmitTransfer_exit;
1132 /* Release now we have looked up handles. */
1135 psRGXSubmitTransferOUT->eError =
1136 PVRSRVRGXSubmitTransferKM(
1137 psTransferContextInt,
1138 psRGXSubmitTransferIN->ui32ClientCacheOpSeqNum,
1139 psRGXSubmitTransferIN->ui32PrepareCount,
1140 ui32ClientFenceCountInt,
1141 psFenceUFOSyncPrimBlockInt,
1142 ui32FenceSyncOffsetInt,
1144 ui32ClientUpdateCountInt,
1145 psUpdateUFOSyncPrimBlockInt,
1146 ui32UpdateSyncOffsetInt,
1148 ui32ServerSyncCountInt,
1149 ui32ServerSyncFlagsInt,
1151 psRGXSubmitTransferIN->i32CheckFenceFD,
1152 psRGXSubmitTransferIN->i32UpdateTimelineFD,
1153 &psRGXSubmitTransferOUT->i32UpdateFenceFD,
1154 uiUpdateFenceNameInt,
1157 ui32TQPrepareFlagsInt,
1158 psRGXSubmitTransferIN->ui32ExtJobRef,
1159 psRGXSubmitTransferIN->ui32SyncPMRCount,
1160 ui32SyncPMRFlagsInt,
1166 RGXSubmitTransfer_exit:
1168 /* Lock over handle lookup cleanup. */
1177 /* Unreference the previously looked up handle */
1178 if(psTransferContextInt)
1180 PVRSRVReleaseHandleUnlocked(psConnection->psHandleBase,
1182 PVRSRV_HANDLE_TYPE_RGX_SERVER_TQ_CONTEXT);
1193 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
1196 for (j=0;j<ui32ClientFenceCountInt[i];j++)
1199 /* Unreference the previously looked up handle */
1200 if(psFenceUFOSyncPrimBlockInt[i][j])
1202 PVRSRVReleaseHandleUnlocked(psConnection->psHandleBase,
1203 hFenceUFOSyncPrimBlockInt2[i][j],
1204 PVRSRV_HANDLE_TYPE_SYNC_PRIMITIVE_BLOCK);
1218 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
1221 for (j=0;j<ui32ClientUpdateCountInt[i];j++)
1224 /* Unreference the previously looked up handle */
1225 if(psUpdateUFOSyncPrimBlockInt[i][j])
1227 PVRSRVReleaseHandleUnlocked(psConnection->psHandleBase,
1228 hUpdateUFOSyncPrimBlockInt2[i][j],
1229 PVRSRV_HANDLE_TYPE_SYNC_PRIMITIVE_BLOCK);
1243 for (i=0;i<psRGXSubmitTransferIN->ui32PrepareCount;i++)
1246 for (j=0;j<ui32ServerSyncCountInt[i];j++)
1249 /* Unreference the previously looked up handle */
1250 if(psServerSyncInt[i][j])
1252 PVRSRVReleaseHandleUnlocked(psConnection->psHandleBase,
1253 hServerSyncInt2[i][j],
1254 PVRSRV_HANDLE_TYPE_SERVER_SYNC_PRIMITIVE);
1268 for (i=0;i<psRGXSubmitTransferIN->ui32SyncPMRCount;i++)
1271 /* Unreference the previously looked up handle */
1272 if(psSyncPMRsInt[i])
1274 PVRSRVReleaseHandleUnlocked(psConnection->psHandleBase,
1276 PVRSRV_HANDLE_TYPE_PHYSMEM_PMR);
1281 /* Release now we have cleaned up look up handles. */
1284 /* Allocated space should be equal to the last updated offset */
1285 PVR_ASSERT(ui32BufferSize == ui32NextOffset);
1287 #if defined(INTEGRITY_OS)
1288 if(pArrayArgsBuffer)
1290 if(!bHaveEnoughSpace && pArrayArgsBuffer)
1292 OSFreeMemNoStats(pArrayArgsBuffer);
1294 /* Allocated space should be equal to the last updated offset */
1295 PVR_ASSERT(ui32BufferSize2 == ui32NextOffset2);
1297 if(pArrayArgsBuffer2)
1298 OSFreeMemNoStats(pArrayArgsBuffer2);
1305 PVRSRVBridgeRGXSetTransferContextPriority(IMG_UINT32 ui32DispatchTableEntry,
1306 PVRSRV_BRIDGE_IN_RGXSETTRANSFERCONTEXTPRIORITY *psRGXSetTransferContextPriorityIN,
1307 PVRSRV_BRIDGE_OUT_RGXSETTRANSFERCONTEXTPRIORITY *psRGXSetTransferContextPriorityOUT,
1308 CONNECTION_DATA *psConnection)
1310 IMG_HANDLE hTransferContext = psRGXSetTransferContextPriorityIN->hTransferContext;
1311 RGX_SERVER_TQ_CONTEXT * psTransferContextInt = NULL;
1319 /* Lock over handle lookup. */
1327 /* Look up the address from the handle */
1328 psRGXSetTransferContextPriorityOUT->eError =
1329 PVRSRVLookupHandleUnlocked(psConnection->psHandleBase,
1330 (void **) &psTransferContextInt,
1332 PVRSRV_HANDLE_TYPE_RGX_SERVER_TQ_CONTEXT,
1334 if(psRGXSetTransferContextPriorityOUT->eError != PVRSRV_OK)
1337 goto RGXSetTransferContextPriority_exit;
1340 /* Release now we have looked up handles. */
1343 psRGXSetTransferContextPriorityOUT->eError =
1344 PVRSRVRGXSetTransferContextPriorityKM(psConnection, OSGetDevData(psConnection),
1345 psTransferContextInt,
1346 psRGXSetTransferContextPriorityIN->ui32Priority);
1351 RGXSetTransferContextPriority_exit:
1353 /* Lock over handle lookup cleanup. */
1362 /* Unreference the previously looked up handle */
1363 if(psTransferContextInt)
1365 PVRSRVReleaseHandleUnlocked(psConnection->psHandleBase,
1367 PVRSRV_HANDLE_TYPE_RGX_SERVER_TQ_CONTEXT);
1370 /* Release now we have cleaned up look up handles. */
1380 /* ***************************************************************************
1381 * Server bridge dispatch related glue
1384 static IMG_BOOL bUseLock = IMG_TRUE;
1386 PVRSRV_ERROR InitRGXTQBridge(void);
1387 PVRSRV_ERROR DeinitRGXTQBridge(void);
1390 * Register all RGXTQ functions with services
1392 PVRSRV_ERROR InitRGXTQBridge(void)
1395 SetDispatchTableEntry(PVRSRV_BRIDGE_RGXTQ, PVRSRV_BRIDGE_RGXTQ_RGXCREATETRANSFERCONTEXT, PVRSRVBridgeRGXCreateTransferContext,
1398 SetDispatchTableEntry(PVRSRV_BRIDGE_RGXTQ, PVRSRV_BRIDGE_RGXTQ_RGXDESTROYTRANSFERCONTEXT, PVRSRVBridgeRGXDestroyTransferContext,
1401 SetDispatchTableEntry(PVRSRV_BRIDGE_RGXTQ, PVRSRV_BRIDGE_RGXTQ_RGXSUBMITTRANSFER, PVRSRVBridgeRGXSubmitTransfer,
1404 SetDispatchTableEntry(PVRSRV_BRIDGE_RGXTQ, PVRSRV_BRIDGE_RGXTQ_RGXSETTRANSFERCONTEXTPRIORITY, PVRSRVBridgeRGXSetTransferContextPriority,
1412 * Unregister all rgxtq functions with services
1414 PVRSRV_ERROR DeinitRGXTQBridge(void)