summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jacinto6/sgx_src/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.c')
-rw-r--r--jacinto6/sgx_src/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.c1107
1 files changed, 208 insertions, 899 deletions
diff --git a/jacinto6/sgx_src/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.c b/jacinto6/sgx_src/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.c
index d98a71c..2321a69 100644
--- a/jacinto6/sgx_src/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.c
+++ b/jacinto6/sgx_src/eurasia_km/services4/srvkm/bridged/bridged_pvr_bridge.c
@@ -80,12 +80,24 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
80#endif 80#endif
81 81
82#include "env_data.h" 82#include "env_data.h"
83#include "ttrace.h"
84#include "ttrace_tokens.h"
83 85
84#if defined (__linux__) || defined(__QNXNTO__) 86#if defined (__linux__) || defined(__QNXNTO__)
85#include "mmap.h" 87#include "mmap.h"
86#endif 88#endif
87 89
88 90
91#if defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC)
92#include <linux/file.h>
93#include <linux/version.h>
94#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
95#include <linux/sync.h>
96#else
97#include <../drivers/staging/android/sync.h>
98#endif
99#endif
100
89#include "srvkm.h" 101#include "srvkm.h"
90 102
91/* FIXME: we should include an OS specific header here to allow configuration of 103/* FIXME: we should include an OS specific header here to allow configuration of
@@ -106,7 +118,7 @@ PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY g_BridgeDispatchTable[BRIDGE_DISPATCH_TABLE_E
106PVRSRV_BRIDGE_GLOBAL_STATS g_BridgeGlobalStats; 118PVRSRV_BRIDGE_GLOBAL_STATS g_BridgeGlobalStats;
107#endif 119#endif
108 120
109#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) 121#if defined(PVR_SECURE_HANDLES)
110static IMG_BOOL abSharedDeviceMemHeap[PVRSRV_MAX_CLIENT_HEAPS]; 122static IMG_BOOL abSharedDeviceMemHeap[PVRSRV_MAX_CLIENT_HEAPS];
111static IMG_BOOL *pbSharedDeviceMemHeap = abSharedDeviceMemHeap; 123static IMG_BOOL *pbSharedDeviceMemHeap = abSharedDeviceMemHeap;
112#else 124#else
@@ -202,9 +214,6 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
202 IMG_HANDLE hDevMemContextInt; 214 IMG_HANDLE hDevMemContextInt;
203 IMG_UINT32 i; 215 IMG_UINT32 i;
204 IMG_BOOL bCreated; 216 IMG_BOOL bCreated;
205#if defined (SUPPORT_SID_INTERFACE)
206 PVRSRV_HEAP_INFO_KM asHeapInfo[PVRSRV_MAX_CLIENT_HEAPS];
207#endif
208 217
209 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_CREATE_DEVMEMCONTEXT); 218 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_CREATE_DEVMEMCONTEXT);
210 219
@@ -229,11 +238,7 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
229 psPerProc, 238 psPerProc,
230 &hDevMemContextInt, 239 &hDevMemContextInt,
231 &psCreateDevMemContextOUT->ui32ClientHeapCount, 240 &psCreateDevMemContextOUT->ui32ClientHeapCount,
232#if defined (SUPPORT_SID_INTERFACE)
233 &asHeapInfo[0],
234#else
235 &psCreateDevMemContextOUT->sHeapInfo[0], 241 &psCreateDevMemContextOUT->sHeapInfo[0],
236#endif
237 &bCreated, 242 &bCreated,
238 pbSharedDeviceMemHeap); 243 pbSharedDeviceMemHeap);
239 244
@@ -270,13 +275,9 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
270 275
271 for(i = 0; i < psCreateDevMemContextOUT->ui32ClientHeapCount; i++) 276 for(i = 0; i < psCreateDevMemContextOUT->ui32ClientHeapCount; i++)
272 { 277 {
273#if defined (SUPPORT_SID_INTERFACE)
274 IMG_SID hDevMemHeapExt;
275#else
276 IMG_HANDLE hDevMemHeapExt; 278 IMG_HANDLE hDevMemHeapExt;
277#endif
278 279
279#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) 280#if defined(PVR_SECURE_HANDLES)
280 if(abSharedDeviceMemHeap[i]) 281 if(abSharedDeviceMemHeap[i])
281#endif 282#endif
282 { 283 {
@@ -287,20 +288,12 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
287 * driver, hence, we use shared handles for these 288 * driver, hence, we use shared handles for these
288 * heaps. 289 * heaps.
289 */ 290 */
290#if defined (SUPPORT_SID_INTERFACE)
291 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
292 &hDevMemHeapExt,
293 asHeapInfo[i].hDevMemHeap,
294 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
295 PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
296#else
297 PVRSRVAllocHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt, 291 PVRSRVAllocHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt,
298 psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap, 292 psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap,
299 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP, 293 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
300 PVRSRV_HANDLE_ALLOC_FLAG_SHARED); 294 PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
301#endif
302 } 295 }
303#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) 296#if defined(PVR_SECURE_HANDLES)
304 else 297 else
305 { 298 {
306 /* 299 /*
@@ -311,31 +304,18 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
311 */ 304 */
312 if(bCreated) 305 if(bCreated)
313 { 306 {
314#if defined (SUPPORT_SID_INTERFACE)
315 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
316 &hDevMemHeapExt,
317 asHeapInfo[i].hDevMemHeap,
318 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
319 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
320 psCreateDevMemContextOUT->hDevMemContext);
321#else
322 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt, 307 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt,
323 psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap, 308 psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap,
324 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP, 309 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
325 PVRSRV_HANDLE_ALLOC_FLAG_NONE, 310 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
326 psCreateDevMemContextOUT->hDevMemContext); 311 psCreateDevMemContextOUT->hDevMemContext);
327#endif
328 } 312 }
329 else 313 else
330 { 314 {
331 psCreateDevMemContextOUT->eError = 315 psCreateDevMemContextOUT->eError =
332 PVRSRVFindHandle(psPerProc->psHandleBase, 316 PVRSRVFindHandle(psPerProc->psHandleBase,
333 &hDevMemHeapExt, 317 &hDevMemHeapExt,
334#if defined (SUPPORT_SID_INTERFACE)
335 asHeapInfo[i].hDevMemHeap,
336#else
337 psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap, 318 psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap,
338#endif
339 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP); 319 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP);
340 if(psCreateDevMemContextOUT->eError != PVRSRV_OK) 320 if(psCreateDevMemContextOUT->eError != PVRSRV_OK)
341 { 321 {
@@ -345,13 +325,6 @@ PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
345 } 325 }
346#endif 326#endif
347 psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap = hDevMemHeapExt; 327 psCreateDevMemContextOUT->sHeapInfo[i].hDevMemHeap = hDevMemHeapExt;
348#if defined (SUPPORT_SID_INTERFACE)
349 psCreateDevMemContextOUT->sHeapInfo[i].ui32HeapID = asHeapInfo[i].ui32HeapID;
350 psCreateDevMemContextOUT->sHeapInfo[i].sDevVAddrBase = asHeapInfo[i].sDevVAddrBase;
351 psCreateDevMemContextOUT->sHeapInfo[i].ui32HeapByteSize = asHeapInfo[i].ui32HeapByteSize;
352 psCreateDevMemContextOUT->sHeapInfo[i].ui32Attribs = asHeapInfo[i].ui32Attribs;
353 psCreateDevMemContextOUT->sHeapInfo[i].ui32XTileStride = asHeapInfo[i].ui32XTileStride;
354#endif
355 } 328 }
356 329
357 COMMIT_HANDLE_BATCH_OR_ERROR(psCreateDevMemContextOUT->eError, psPerProc) 330 COMMIT_HANDLE_BATCH_OR_ERROR(psCreateDevMemContextOUT->eError, psPerProc)
@@ -420,9 +393,6 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
420 IMG_HANDLE hDevCookieInt; 393 IMG_HANDLE hDevCookieInt;
421 IMG_HANDLE hDevMemContextInt; 394 IMG_HANDLE hDevMemContextInt;
422 IMG_UINT32 i; 395 IMG_UINT32 i;
423#if defined (SUPPORT_SID_INTERFACE)
424 PVRSRV_HEAP_INFO_KM asHeapInfo[PVRSRV_MAX_CLIENT_HEAPS];
425#endif
426 396
427 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_GET_DEVMEM_HEAPINFO); 397 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_GET_DEVMEM_HEAPINFO);
428 398
@@ -452,11 +422,7 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
452 PVRSRVGetDeviceMemHeapInfoKM(hDevCookieInt, 422 PVRSRVGetDeviceMemHeapInfoKM(hDevCookieInt,
453 hDevMemContextInt, 423 hDevMemContextInt,
454 &psGetDevMemHeapInfoOUT->ui32ClientHeapCount, 424 &psGetDevMemHeapInfoOUT->ui32ClientHeapCount,
455#if defined (SUPPORT_SID_INTERFACE)
456 &asHeapInfo[0],
457#else
458 &psGetDevMemHeapInfoOUT->sHeapInfo[0], 425 &psGetDevMemHeapInfoOUT->sHeapInfo[0],
459#endif
460 pbSharedDeviceMemHeap); 426 pbSharedDeviceMemHeap);
461 427
462 if(psGetDevMemHeapInfoOUT->eError != PVRSRV_OK) 428 if(psGetDevMemHeapInfoOUT->eError != PVRSRV_OK)
@@ -466,13 +432,9 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
466 432
467 for(i = 0; i < psGetDevMemHeapInfoOUT->ui32ClientHeapCount; i++) 433 for(i = 0; i < psGetDevMemHeapInfoOUT->ui32ClientHeapCount; i++)
468 { 434 {
469#if defined (SUPPORT_SID_INTERFACE)
470 IMG_SID hDevMemHeapExt;
471#else
472 IMG_HANDLE hDevMemHeapExt; 435 IMG_HANDLE hDevMemHeapExt;
473#endif
474 436
475#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) 437#if defined(PVR_SECURE_HANDLES)
476 if(abSharedDeviceMemHeap[i]) 438 if(abSharedDeviceMemHeap[i])
477#endif 439#endif
478 { 440 {
@@ -483,20 +445,12 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
483 * driver, hence, we use shared handles for these 445 * driver, hence, we use shared handles for these
484 * heaps. 446 * heaps.
485 */ 447 */
486#if defined (SUPPORT_SID_INTERFACE)
487 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
488 &hDevMemHeapExt,
489 asHeapInfo[i].hDevMemHeap,
490 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
491 PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
492#else
493 PVRSRVAllocHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt, 448 PVRSRVAllocHandleNR(psPerProc->psHandleBase, &hDevMemHeapExt,
494 psGetDevMemHeapInfoOUT->sHeapInfo[i].hDevMemHeap, 449 psGetDevMemHeapInfoOUT->sHeapInfo[i].hDevMemHeap,
495 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP, 450 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP,
496 PVRSRV_HANDLE_ALLOC_FLAG_SHARED); 451 PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
497#endif
498 } 452 }
499#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) 453#if defined(PVR_SECURE_HANDLES)
500 else 454 else
501 { 455 {
502 /* 456 /*
@@ -508,11 +462,7 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
508 psGetDevMemHeapInfoOUT->eError = 462 psGetDevMemHeapInfoOUT->eError =
509 PVRSRVFindHandle(psPerProc->psHandleBase, 463 PVRSRVFindHandle(psPerProc->psHandleBase,
510 &hDevMemHeapExt, 464 &hDevMemHeapExt,
511#if defined (SUPPORT_SID_INTERFACE)
512 asHeapInfo[i].hDevMemHeap,
513#else
514 psGetDevMemHeapInfoOUT->sHeapInfo[i].hDevMemHeap, 465 psGetDevMemHeapInfoOUT->sHeapInfo[i].hDevMemHeap,
515#endif
516 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP); 466 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP);
517 if(psGetDevMemHeapInfoOUT->eError != PVRSRV_OK) 467 if(psGetDevMemHeapInfoOUT->eError != PVRSRV_OK)
518 { 468 {
@@ -521,13 +471,6 @@ PVRSRVGetDeviceMemHeapInfoBW(IMG_UINT32 ui32BridgeID,
521 } 471 }
522#endif 472#endif
523 psGetDevMemHeapInfoOUT->sHeapInfo[i].hDevMemHeap = hDevMemHeapExt; 473 psGetDevMemHeapInfoOUT->sHeapInfo[i].hDevMemHeap = hDevMemHeapExt;
524#if defined (SUPPORT_SID_INTERFACE)
525 psGetDevMemHeapInfoOUT->sHeapInfo[i].ui32HeapID = asHeapInfo[i].ui32HeapID;
526 psGetDevMemHeapInfoOUT->sHeapInfo[i].sDevVAddrBase = asHeapInfo[i].sDevVAddrBase;
527 psGetDevMemHeapInfoOUT->sHeapInfo[i].ui32HeapByteSize = asHeapInfo[i].ui32HeapByteSize;
528 psGetDevMemHeapInfoOUT->sHeapInfo[i].ui32Attribs = asHeapInfo[i].ui32Attribs;
529 psGetDevMemHeapInfoOUT->sHeapInfo[i].ui32XTileStride = asHeapInfo[i].ui32XTileStride;
530#endif
531 } 474 }
532 475
533 COMMIT_HANDLE_BATCH_OR_ERROR(psGetDevMemHeapInfoOUT->eError, psPerProc) 476 COMMIT_HANDLE_BATCH_OR_ERROR(psGetDevMemHeapInfoOUT->eError, psPerProc)
@@ -672,8 +615,8 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
672 psPerProc, 615 psPerProc,
673 hDevMemHeapInt, 616 hDevMemHeapInt,
674 psAllocDeviceMemIN->ui32Attribs, 617 psAllocDeviceMemIN->ui32Attribs,
675 psAllocDeviceMemIN->ui32Size, 618 psAllocDeviceMemIN->uSize,
676 psAllocDeviceMemIN->ui32Alignment, 619 psAllocDeviceMemIN->uAlignment,
677 psAllocDeviceMemIN->pvPrivData, 620 psAllocDeviceMemIN->pvPrivData,
678 psAllocDeviceMemIN->ui32PrivDataLength, 621 psAllocDeviceMemIN->ui32PrivDataLength,
679 psAllocDeviceMemIN->ui32ChunkSize, 622 psAllocDeviceMemIN->ui32ChunkSize,
@@ -683,12 +626,6 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
683 &psMemInfo, 626 &psMemInfo,
684 "" /*FIXME: add something meaningful*/); 627 "" /*FIXME: add something meaningful*/);
685 628
686 /* Allow mapping this buffer to the GC MMU only on allocation time, if
687 * this buffer is mapped into another process context we don't want the
688 * GC MMU mapping to happen.
689 */
690 psAllocDeviceMemIN->ui32Attribs &= ~PVRSRV_MAP_GC_MMU;
691
692 if (bUseShareMemWorkaround) 629 if (bUseShareMemWorkaround)
693 { 630 {
694 PVR_ASSERT(ui32ShareIndex != 7654321); 631 PVR_ASSERT(ui32ShareIndex != 7654321);
@@ -707,8 +644,8 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
707 psMemInfo->sShareMemWorkaround.ui32ShareIndex = ui32ShareIndex; 644 psMemInfo->sShareMemWorkaround.ui32ShareIndex = ui32ShareIndex;
708 psMemInfo->sShareMemWorkaround.hDevCookieInt = hDevCookieInt; 645 psMemInfo->sShareMemWorkaround.hDevCookieInt = hDevCookieInt;
709 psMemInfo->sShareMemWorkaround.ui32OrigReqAttribs = psAllocDeviceMemIN->ui32Attribs; 646 psMemInfo->sShareMemWorkaround.ui32OrigReqAttribs = psAllocDeviceMemIN->ui32Attribs;
710 psMemInfo->sShareMemWorkaround.ui32OrigReqSize = (IMG_UINT32)psAllocDeviceMemIN->ui32Size; 647 psMemInfo->sShareMemWorkaround.ui32OrigReqSize = (IMG_UINT32)psAllocDeviceMemIN->uSize;
711 psMemInfo->sShareMemWorkaround.ui32OrigReqAlignment = (IMG_UINT32)psAllocDeviceMemIN->ui32Alignment; 648 psMemInfo->sShareMemWorkaround.ui32OrigReqAlignment = (IMG_UINT32)psAllocDeviceMemIN->uAlignment;
712 } 649 }
713 650
714 OSMemSet(&psAllocDeviceMemOUT->sClientMemInfo, 651 OSMemSet(&psAllocDeviceMemOUT->sClientMemInfo,
@@ -726,13 +663,7 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
726 psAllocDeviceMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr; 663 psAllocDeviceMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr;
727 psAllocDeviceMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags; 664 psAllocDeviceMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags;
728 psAllocDeviceMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize; 665 psAllocDeviceMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize;
729 OSMemCopy(psAllocDeviceMemOUT->sClientMemInfo.planeOffsets, psMemInfo->planeOffsets,
730 sizeof(psMemInfo->planeOffsets));
731#if defined (SUPPORT_SID_INTERFACE)
732 /* see below */
733#else
734 psAllocDeviceMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle; 666 psAllocDeviceMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle;
735#endif
736 667
737 PVRSRVAllocHandleNR(psPerProc->psHandleBase, 668 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
738 &psAllocDeviceMemOUT->sClientMemInfo.hKernelMemInfo, 669 &psAllocDeviceMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -740,23 +671,6 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
740 PVRSRV_HANDLE_TYPE_MEM_INFO, 671 PVRSRV_HANDLE_TYPE_MEM_INFO,
741 PVRSRV_HANDLE_ALLOC_FLAG_NONE); 672 PVRSRV_HANDLE_ALLOC_FLAG_NONE);
742 673
743#if defined (SUPPORT_SID_INTERFACE)
744 PVR_ASSERT(psAllocDeviceMemOUT->sClientMemInfo.hKernelMemInfo != 0);
745
746 if (psMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
747 {
748 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
749 &psAllocDeviceMemOUT->sClientMemInfo.hMappingInfo,
750 psMemInfo->sMemBlk.hOSMemHandle,
751 PVRSRV_HANDLE_TYPE_MEM_INFO,
752 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
753 psAllocDeviceMemOUT->sClientMemInfo.hKernelMemInfo);
754 }
755 else
756 {
757 psAllocDeviceMemOUT->sClientMemInfo.hMappingInfo = 0;
758 }
759#endif
760 674
761 if(psAllocDeviceMemIN->ui32Attribs & PVRSRV_MEM_NO_SYNCOBJ) 675 if(psAllocDeviceMemIN->ui32Attribs & PVRSRV_MEM_NO_SYNCOBJ)
762 { 676 {
@@ -780,25 +694,9 @@ PVRSRVAllocDeviceMemBW(IMG_UINT32 ui32BridgeID,
780 psAllocDeviceMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr = 694 psAllocDeviceMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
781 psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr; 695 psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
782 696
783#if defined (SUPPORT_SID_INTERFACE)
784 if (psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL)
785 {
786 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
787 &psAllocDeviceMemOUT->sClientSyncInfo.hMappingInfo,
788 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
789 PVRSRV_HANDLE_TYPE_SYNC_INFO,
790 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
791 psAllocDeviceMemOUT->sClientMemInfo.hKernelMemInfo);
792 }
793 else
794 {
795 psAllocDeviceMemOUT->sClientSyncInfo.hMappingInfo = 0;
796 }
797#else
798 psAllocDeviceMemOUT->sClientSyncInfo.hMappingInfo = 697 psAllocDeviceMemOUT->sClientSyncInfo.hMappingInfo =
799 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle; 698 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
800#endif 699#endif
801#endif
802 700
803 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, 701 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
804 &psAllocDeviceMemOUT->sClientSyncInfo.hKernelSyncInfo, 702 &psAllocDeviceMemOUT->sClientSyncInfo.hKernelSyncInfo,
@@ -842,11 +740,7 @@ PVRSRVFreeDeviceMemBW(IMG_UINT32 ui32BridgeID,
842 psRetOUT->eError = 740 psRetOUT->eError =
843 PVRSRVLookupHandle(psPerProc->psHandleBase, 741 PVRSRVLookupHandle(psPerProc->psHandleBase,
844 &pvKernelMemInfo, 742 &pvKernelMemInfo,
845#if defined (SUPPORT_SID_INTERFACE)
846 psFreeDeviceMemIN->hKernelMemInfo,
847#else
848 psFreeDeviceMemIN->psKernelMemInfo, 743 psFreeDeviceMemIN->psKernelMemInfo,
849#endif
850 PVRSRV_HANDLE_TYPE_MEM_INFO); 744 PVRSRV_HANDLE_TYPE_MEM_INFO);
851 745
852 if(psRetOUT->eError != PVRSRV_OK) 746 if(psRetOUT->eError != PVRSRV_OK)
@@ -863,11 +757,7 @@ PVRSRVFreeDeviceMemBW(IMG_UINT32 ui32BridgeID,
863 757
864 psRetOUT->eError = 758 psRetOUT->eError =
865 PVRSRVReleaseHandle(psPerProc->psHandleBase, 759 PVRSRVReleaseHandle(psPerProc->psHandleBase,
866#if defined (SUPPORT_SID_INTERFACE)
867 psFreeDeviceMemIN->hKernelMemInfo,
868#else
869 psFreeDeviceMemIN->psKernelMemInfo, 760 psFreeDeviceMemIN->psKernelMemInfo,
870#endif
871 PVRSRV_HANDLE_TYPE_MEM_INFO); 761 PVRSRV_HANDLE_TYPE_MEM_INFO);
872 762
873 return 0; 763 return 0;
@@ -875,228 +765,13 @@ PVRSRVFreeDeviceMemBW(IMG_UINT32 ui32BridgeID,
875 765
876 766
877static IMG_INT 767static IMG_INT
878PVRSRVMultiManageDevMemBW(IMG_UINT32 ui32BridgeID,
879 PVRSRV_BRIDGE_IN_MULTI_MANAGE_DEV_MEM *psMultiMemDevRequestIN,
880 PVRSRV_BRIDGE_OUT_MULTI_MANAGE_DEV_MEM *psMultiMemDevRequestOUT,
881 PVRSRV_PER_PROCESS_DATA *psPerProc)
882{
883 IMG_HANDLE hDevCookieInt;
884 PVRSRV_KERNEL_MEM_INFO *psSharedBuffKernelMemInfo = NULL;
885 PVRSRV_MANAGE_DEV_MEM_REQUEST* pRequestsArray;
886 PVRSRV_MANAGE_DEV_MEM_RESPONSE* pResponseArray;
887 IMG_UINT32 reqNum;
888
889 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_MULTI_MANAGE_DEV_MEM);
890
891 psMultiMemDevRequestOUT->eError =
892 PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevCookieInt,
893 psMultiMemDevRequestIN->hDevCookie,
894 PVRSRV_HANDLE_TYPE_DEV_NODE);
895
896 if(psMultiMemDevRequestOUT->eError != PVRSRV_OK)
897 {
898 PVR_DPF((PVR_DBG_ERROR,"%s: invalid hDevCookie", __FUNCTION__));
899 return 0;
900 }
901
902 if(psMultiMemDevRequestIN->hKernelMemInfo)
903 {
904 PVRSRV_MULTI_MANAGE_DEV_MEM_REQUESTS* psMultiMemDevRequest;
905 psMultiMemDevRequestOUT->eError =
906 PVRSRVLookupHandle(psPerProc->psHandleBase,
907 (IMG_VOID **)&psSharedBuffKernelMemInfo,
908 #if defined (SUPPORT_SID_INTERFACE)
909 psMultiMemDevRequestIN->hKernelMemInfo,
910 #else
911 psMultiMemDevRequestIN->hKernelMemInfo,
912 #endif
913 PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
914
915 if(psMultiMemDevRequestOUT->eError != PVRSRV_OK)
916 {
917 PVR_DPF((PVR_DBG_ERROR,"%s: invalid shared memory hKernelMemInfo", __FUNCTION__));
918 return 0;
919 }
920
921 psMultiMemDevRequest = (PVRSRV_MULTI_MANAGE_DEV_MEM_REQUESTS*)psSharedBuffKernelMemInfo->pvLinAddrKM;
922 if( (psMultiMemDevRequest->psSharedMemClientMemInfo != psMultiMemDevRequestIN->psSharedMemClientMemInfo ) ||
923 (psMultiMemDevRequest->ui32MaxNumberOfRequests != psMultiMemDevRequestIN->ui32MaxNumberOfRequests) ||
924 psMultiMemDevRequest->ui32NumberOfValidRequests != psMultiMemDevRequestIN->ui32NumberOfValidRequests ||
925 psMultiMemDevRequest->ui32CtrlFlags != psMultiMemDevRequestIN->ui32CtrlFlags)
926 {
927 psMultiMemDevRequestOUT->eError = PVRSRV_ERROR_BAD_MAPPING;
928 return 0;
929 }
930 pRequestsArray = psMultiMemDevRequest->sMemRequests;
931 pResponseArray = psMultiMemDevRequest->sMemRequests;
932 }
933 else
934 {
935 pRequestsArray = psMultiMemDevRequestIN->sMemRequests;
936 pResponseArray = psMultiMemDevRequestOUT->sMemResponse;
937 }
938
939 PVR_DPF((PVR_DBG_MESSAGE, "\n%s: %s %d Number of request/s, Control flag = 0x%08x\n",
940 __FUNCTION__,
941 (psMultiMemDevRequestIN->hKernelMemInfo ? "Shared" : "Direct"),
942 psMultiMemDevRequestIN->ui32NumberOfValidRequests,
943 psMultiMemDevRequestIN->ui32CtrlFlags));
944
945 for(reqNum = 0; reqNum < psMultiMemDevRequestIN->ui32NumberOfValidRequests; reqNum++)
946 {
947 PVRSRV_MANAGE_DEV_MEM_REQUEST *pRequest = &pRequestsArray[reqNum];
948 PVRSRV_MANAGE_DEV_MEM_REQUEST *pResponse = &pResponseArray[reqNum];
949 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = NULL;
950
951 /* At the kernel size, psClientMemInfo only works as a verification token */
952 if(psMultiMemDevRequestIN->hKernelMemInfo == NULL)
953 {
954 pResponse->psClientMemInfo = pRequest->psClientMemInfo;
955 pResponse->eReqType = pRequest->eReqType;
956 }
957
958 PVR_DPF((PVR_DBG_MESSAGE, "%s: Request %d for ClientMemInfo %p\n"
959 "DevVirtAddr 0x%08x, GpuRefCount %d "
960 "CpuVirtAddr %p, CpuRefCount %d, Kernel Handle %p, sync %p\n"
961 "Size %d, Attrib 0x%08x, Align %d, Subsystem 0x%llx, Hints 0x%08x "
962 "transfer slot %d\n",
963 __FUNCTION__, pResponse->eReqType,
964 pRequest->psClientMemInfo,
965 pRequest->sDevVAddr.uiAddr,
966 pRequest->ui32GpuMapRefCount,
967 pRequest->pvLinAddr,
968 pRequest->ui32CpuMapRefCount,
969 pRequest->hKernelMemInfo,
970 pRequest->hKernelSyncInfo,
971 pRequest->uSize,
972 pRequest->ui32Attribs,
973 pRequest->uAlignment,
974 pRequest->uiSubSystem,
975 pRequest->ui32Hints,
976 pRequest->ui32TransferFromToReqSlotIndx));
977
978 pResponse->eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
979 (IMG_PVOID *)&psKernelMemInfo,
980 #if defined (SUPPORT_SID_INTERFACE)
981 pRequest->hKernelMemInfo,
982 #else
983 pRequest->hKernelMemInfo,
984 #endif
985 PVRSRV_HANDLE_TYPE_MEM_INFO);
986 if(pResponse->eError != PVRSRV_OK)
987 {
988 PVR_DPF((PVR_DBG_ERROR,"%s: invalid hKernelMemInfo for slot %d",
989 __FUNCTION__, reqNum));
990 continue;
991 }
992
993 PVR_DPF((PVR_DBG_MESSAGE, "%s: KernelMemInfo %p -%s SHARED\n"
994 "DevVirtAddr 0x%08x, RefCount %d "
995 "Size %d, Flags 0x%08x, OrigAlign %d, Subsystem 0x%llx, Hints 0x%08x\n",
996 __FUNCTION__, psKernelMemInfo,
997 (psKernelMemInfo->sShareMemWorkaround.bInUse ? "" : "NOT"),
998 psKernelMemInfo->sDevVAddr.uiAddr,
999 psKernelMemInfo->ui32RefCount,
1000 psKernelMemInfo->uAllocSize,
1001 psKernelMemInfo->ui32Flags,
1002 psKernelMemInfo->sShareMemWorkaround.ui32OrigReqAlignment,
1003 (IMG_UINT64)0, 0));
1004
1005 if(psKernelMemInfo->sDevVAddr.uiAddr != pRequest->sDevVAddr.uiAddr)
1006 {
1007 PVR_DPF((PVR_DBG_WARNING, "%s: Kernel and Client MemInfo's "
1008 "virtual addresses are not equal\n"
1009 "Kernel DevVirtAddr 0x%08x != Client DevVirtAddr 0x%08x",
1010 __FUNCTION__,
1011 psKernelMemInfo->sDevVAddr.uiAddr, pRequest->sDevVAddr.uiAddr));
1012 }
1013
1014 switch(pResponse->eReqType)
1015 {
1016 case PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_MAP:
1017 case PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_LOCK_MAP:
1018 {
1019 IMG_INT32 result = PVRSRVRemapToDevKM(hDevCookieInt,
1020 psKernelMemInfo, &pResponse->sDevVAddr);
1021
1022 if(result < 0)
1023 {
1024 pResponse->eError = -result;
1025 PVR_DPF((PVR_DBG_ERROR, "Request for GPU Virtual "
1026 "memory mapping had failed "
1027 "with error %d",
1028 pResponse->eError));
1029 }
1030 else
1031 {
1032 pResponse->ui32GpuMapRefCount = result;
1033 pResponse->eError = PVRSRV_OK;
1034 }
1035 }
1036 break;
1037 case PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_SWAP_MAP_TO_NEXT:
1038 pResponse->eError = PVRSRV_OK;
1039 pResponse->ui32GpuMapRefCount = 1;
1040 pResponse->sDevVAddr = psKernelMemInfo->sDevVAddr;
1041 break;
1042 case PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_UNMAP:
1043 case PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_UNLOCK_MAP:
1044 {
1045 IMG_INT32 result = PVRSRVUnmapFromDevKM(hDevCookieInt, psKernelMemInfo);
1046 if(result < 0)
1047 {
1048 pResponse->eError = -result;
1049 PVR_DPF((PVR_DBG_ERROR, "Request for GPU Virtual memory "
1050 "un-mapping had failed "
1051 "with error %d",
1052 pResponse->eError));
1053 }
1054 else
1055 {
1056 pResponse->ui32GpuMapRefCount = result;
1057 pResponse->eError = PVRSRV_OK;
1058 }
1059 pResponse->sDevVAddr = psKernelMemInfo->sDevVAddr;
1060 }
1061 break;
1062 case PVRSRV_MULTI_MANAGE_DEV_MEM_RQST_SWAP_MAP_FROM_PREV:
1063 pResponse->eError = PVRSRV_OK;
1064 pResponse->ui32GpuMapRefCount = 1;
1065 pResponse->sDevVAddr = psKernelMemInfo->sDevVAddr;
1066 break;
1067 default:
1068 pResponse->eError = PVRSRV_ERROR_INVALID_PARAMS;
1069 break;
1070 }
1071
1072 PVR_DPF((PVR_DBG_MESSAGE, "%s: RETURN: ClientMemInfo %p "
1073 "DevVirtAddr 0x%08x, GpuMapRefCount %d, err %d\n",
1074 __FUNCTION__, pRequest->psClientMemInfo,
1075 pResponse->sDevVAddr.uiAddr,
1076 pResponse->ui32GpuMapRefCount,
1077 pResponse->eError));
1078 }
1079
1080 if(psMultiMemDevRequestIN->hKernelMemInfo == NULL)
1081 psMultiMemDevRequestOUT->ui32CtrlFlags = psMultiMemDevRequestIN->ui32CtrlFlags;
1082 /* No status implemented yet */
1083 psMultiMemDevRequestOUT->ui32StatusFlags = 0;
1084
1085 return 0;
1086}
1087
1088static IMG_INT
1089PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID, 768PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID,
1090 PVRSRV_BRIDGE_IN_EXPORTDEVICEMEM *psExportDeviceMemIN, 769 PVRSRV_BRIDGE_IN_EXPORTDEVICEMEM *psExportDeviceMemIN,
1091 PVRSRV_BRIDGE_OUT_EXPORTDEVICEMEM *psExportDeviceMemOUT, 770 PVRSRV_BRIDGE_OUT_EXPORTDEVICEMEM *psExportDeviceMemOUT,
1092 PVRSRV_PER_PROCESS_DATA *psPerProc) 771 PVRSRV_PER_PROCESS_DATA *psPerProc)
1093{ 772{
1094 IMG_HANDLE hDevCookieInt; 773 IMG_HANDLE hDevCookieInt;
1095#if defined (SUPPORT_SID_INTERFACE)
1096 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = IMG_NULL;
1097#else
1098 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo; 774 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo;
1099#endif
1100 775
1101 PVR_ASSERT(ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_EXPORT_DEVICEMEM) || 776 PVR_ASSERT(ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_EXPORT_DEVICEMEM) ||
1102 ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_EXPORT_DEVICEMEM_2)); 777 ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_EXPORT_DEVICEMEM_2));
@@ -1119,11 +794,7 @@ PVRSRVExportDeviceMemBW(IMG_UINT32 ui32BridgeID,
1119 psExportDeviceMemOUT->eError = 794 psExportDeviceMemOUT->eError =
1120 PVRSRVLookupHandle(psPerProc->psHandleBase, 795 PVRSRVLookupHandle(psPerProc->psHandleBase,
1121 (IMG_PVOID *)&psKernelMemInfo, 796 (IMG_PVOID *)&psKernelMemInfo,
1122#if defined (SUPPORT_SID_INTERFACE)
1123 psExportDeviceMemIN->hKernelMemInfo,
1124#else
1125 psExportDeviceMemIN->psKernelMemInfo, 797 psExportDeviceMemIN->psKernelMemInfo,
1126#endif
1127 PVRSRV_HANDLE_TYPE_MEM_INFO); 798 PVRSRV_HANDLE_TYPE_MEM_INFO);
1128 799
1129 if(psExportDeviceMemOUT->eError != PVRSRV_OK) 800 if(psExportDeviceMemOUT->eError != PVRSRV_OK)
@@ -1205,19 +876,6 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
1205 { 876 {
1206 PVR_DPF((PVR_DBG_MESSAGE, "using the mem wrap workaround.")); 877 PVR_DPF((PVR_DBG_MESSAGE, "using the mem wrap workaround."));
1207 878
1208 /* Check the XPROC mapping count -if it is "0",
1209 * then the object is about to go away - do not allow mapping */
1210 if(BM_XProcGetShareDataRefCount(psSrcKernelMemInfo->sShareMemWorkaround.ui32ShareIndex) < 1)
1211 {
1212 psMapDevMemOUT->eError = PVRSRV_ERROR_MAPPING_NOT_FOUND;
1213 PVR_DPF((PVR_DBG_WARNING, "%s: Can't map buffer with slot %d, size %d "
1214 "and refcount %d\n\t Invalid XPROC refcount of %d",
1215 __FUNCTION__, psSrcKernelMemInfo->sShareMemWorkaround.ui32ShareIndex,
1216 psSrcKernelMemInfo->uAllocSize, psSrcKernelMemInfo->ui32RefCount,
1217 BM_XProcGetShareDataRefCount(psSrcKernelMemInfo->sShareMemWorkaround.ui32ShareIndex)));
1218 return 0;
1219 }
1220
1221 /* Ensure we get the same ID for this allocation, such that it 879 /* Ensure we get the same ID for this allocation, such that it
1222 inherits the same physical block. Rather than add a lot of 880 inherits the same physical block. Rather than add a lot of
1223 plumbing to several APIs, we call into buffer manager directly 881 plumbing to several APIs, we call into buffer manager directly
@@ -1294,13 +952,7 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
1294 psMapDevMemOUT->sDstClientMemInfo.sDevVAddr = psDstKernelMemInfo->sDevVAddr; 952 psMapDevMemOUT->sDstClientMemInfo.sDevVAddr = psDstKernelMemInfo->sDevVAddr;
1295 psMapDevMemOUT->sDstClientMemInfo.ui32Flags = psDstKernelMemInfo->ui32Flags; 953 psMapDevMemOUT->sDstClientMemInfo.ui32Flags = psDstKernelMemInfo->ui32Flags;
1296 psMapDevMemOUT->sDstClientMemInfo.uAllocSize = psDstKernelMemInfo->uAllocSize; 954 psMapDevMemOUT->sDstClientMemInfo.uAllocSize = psDstKernelMemInfo->uAllocSize;
1297 OSMemCopy(psMapDevMemOUT->sDstClientMemInfo.planeOffsets, psDstKernelMemInfo->planeOffsets,
1298 sizeof(psDstKernelMemInfo->planeOffsets));
1299#if defined (SUPPORT_SID_INTERFACE)
1300 /* see below */
1301#else
1302 psMapDevMemOUT->sDstClientMemInfo.hMappingInfo = psDstKernelMemInfo->sMemBlk.hOSMemHandle; 955 psMapDevMemOUT->sDstClientMemInfo.hMappingInfo = psDstKernelMemInfo->sMemBlk.hOSMemHandle;
1303#endif
1304 956
1305 /* allocate handle to the DST kernel meminfo */ 957 /* allocate handle to the DST kernel meminfo */
1306 PVRSRVAllocHandleNR(psPerProc->psHandleBase, 958 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
@@ -1310,22 +962,6 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
1310 PVRSRV_HANDLE_ALLOC_FLAG_NONE); 962 PVRSRV_HANDLE_ALLOC_FLAG_NONE);
1311 psMapDevMemOUT->sDstClientSyncInfo.hKernelSyncInfo = IMG_NULL; 963 psMapDevMemOUT->sDstClientSyncInfo.hKernelSyncInfo = IMG_NULL;
1312 964
1313#if defined (SUPPORT_SID_INTERFACE)
1314 /* alloc subhandle for the mapping info */
1315 if (psDstKernelMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
1316 {
1317 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
1318 &psMapDevMemOUT->sDstClientMemInfo.hMappingInfo,
1319 psDstKernelMemInfo->sMemBlk.hOSMemHandle,
1320 PVRSRV_HANDLE_TYPE_MEM_INFO,
1321 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
1322 psMapDevMemOUT->sDstClientMemInfo.hKernelMemInfo);
1323 }
1324 else
1325 {
1326 psMapDevMemOUT->sDstClientMemInfo.hMappingInfo = 0;
1327 }
1328#endif
1329 965
1330 /* and setup the sync info */ 966 /* and setup the sync info */
1331 if(psDstKernelMemInfo->psKernelSyncInfo) 967 if(psDstKernelMemInfo->psKernelSyncInfo)
@@ -1340,26 +976,9 @@ PVRSRVMapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
1340 psMapDevMemOUT->sDstClientSyncInfo.sReadOps2CompleteDevVAddr = 976 psMapDevMemOUT->sDstClientSyncInfo.sReadOps2CompleteDevVAddr =
1341 psDstKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr; 977 psDstKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
1342 978
1343#if defined (SUPPORT_SID_INTERFACE)
1344 /* alloc subhandle for the mapping info */
1345 if (psDstKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL)
1346 {
1347 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
1348 &psMapDevMemOUT->sDstClientSyncInfo.hMappingInfo,
1349 psDstKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
1350 PVRSRV_HANDLE_TYPE_MEM_INFO,
1351 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
1352 psMapDevMemOUT->sDstClientMemInfo.hKernelMemInfo);
1353 }
1354 else
1355 {
1356 psMapDevMemOUT->sDstClientSyncInfo.hMappingInfo = 0;
1357 }
1358#else
1359 psMapDevMemOUT->sDstClientSyncInfo.hMappingInfo = 979 psMapDevMemOUT->sDstClientSyncInfo.hMappingInfo =
1360 psDstKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle; 980 psDstKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
1361#endif 981#endif
1362#endif
1363 982
1364 psMapDevMemOUT->sDstClientMemInfo.psClientSyncInfo = &psMapDevMemOUT->sDstClientSyncInfo; 983 psMapDevMemOUT->sDstClientMemInfo.psClientSyncInfo = &psMapDevMemOUT->sDstClientSyncInfo;
1365 /* 984 /*
@@ -1393,11 +1012,7 @@ PVRSRVUnmapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
1393 1012
1394 psRetOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, 1013 psRetOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
1395 (IMG_VOID**)&psKernelMemInfo, 1014 (IMG_VOID**)&psKernelMemInfo,
1396#if defined (SUPPORT_SID_INTERFACE)
1397 psUnmapDevMemIN->hKernelMemInfo,
1398#else
1399 psUnmapDevMemIN->psKernelMemInfo, 1015 psUnmapDevMemIN->psKernelMemInfo,
1400#endif
1401 PVRSRV_HANDLE_TYPE_MEM_INFO); 1016 PVRSRV_HANDLE_TYPE_MEM_INFO);
1402 if(psRetOUT->eError != PVRSRV_OK) 1017 if(psRetOUT->eError != PVRSRV_OK)
1403 { 1018 {
@@ -1423,17 +1038,13 @@ PVRSRVUnmapDeviceMemoryBW(IMG_UINT32 ui32BridgeID,
1423 } 1038 }
1424 1039
1425 psRetOUT->eError = PVRSRVReleaseHandle(psPerProc->psHandleBase, 1040 psRetOUT->eError = PVRSRVReleaseHandle(psPerProc->psHandleBase,
1426#if defined (SUPPORT_SID_INTERFACE)
1427 psUnmapDevMemIN->hKernelMemInfo,
1428#else
1429 psUnmapDevMemIN->psKernelMemInfo, 1041 psUnmapDevMemIN->psKernelMemInfo,
1430#endif
1431 PVRSRV_HANDLE_TYPE_MEM_INFO); 1042 PVRSRV_HANDLE_TYPE_MEM_INFO);
1432 1043
1433 return 0; 1044 return 0;
1434} 1045}
1435 1046
1436 1047#if defined(SUPPORT_PVRSRV_DEVICE_CLASS)
1437 1048
1438static IMG_INT 1049static IMG_INT
1439PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID, 1050PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
@@ -1482,7 +1093,7 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
1482 /* Having looked up the handle, now check its type */ 1093 /* Having looked up the handle, now check its type */
1483 switch(eHandleType) 1094 switch(eHandleType)
1484 { 1095 {
1485#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) 1096#if defined(PVR_SECURE_HANDLES)
1486 case PVRSRV_HANDLE_TYPE_DISP_BUFFER: 1097 case PVRSRV_HANDLE_TYPE_DISP_BUFFER:
1487 case PVRSRV_HANDLE_TYPE_BUF_BUFFER: 1098 case PVRSRV_HANDLE_TYPE_BUF_BUFFER:
1488#else 1099#else
@@ -1519,23 +1130,7 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
1519 psMapDevClassMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr; 1130 psMapDevClassMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr;
1520 psMapDevClassMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags; 1131 psMapDevClassMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags;
1521 psMapDevClassMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize; 1132 psMapDevClassMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize;
1522#if defined (SUPPORT_SID_INTERFACE)
1523 if (psMemInfo->sMemBlk.hOSMemHandle != 0)
1524 {
1525 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
1526 &psMapDevClassMemOUT->sClientMemInfo.hMappingInfo,
1527 psMemInfo->sMemBlk.hOSMemHandle,
1528 PVRSRV_HANDLE_TYPE_MEM_INFO,
1529 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
1530 psMapDevClassMemIN->hDeviceClassBuffer);
1531 }
1532 else
1533 {
1534 psMapDevClassMemOUT->sClientMemInfo.hMappingInfo = 0;
1535 }
1536#else
1537 psMapDevClassMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle; 1133 psMapDevClassMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle;
1538#endif
1539 1134
1540 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, 1135 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
1541 &psMapDevClassMemOUT->sClientMemInfo.hKernelMemInfo, 1136 &psMapDevClassMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -1559,25 +1154,9 @@ PVRSRVMapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
1559 psMapDevClassMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr = 1154 psMapDevClassMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
1560 psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr; 1155 psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
1561 1156
1562#if defined (SUPPORT_SID_INTERFACE)
1563 if (psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != 0)
1564 {
1565 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
1566 &psMapDevClassMemOUT->sClientSyncInfo.hMappingInfo,
1567 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
1568 PVRSRV_HANDLE_TYPE_SYNC_INFO,
1569 PVRSRV_HANDLE_ALLOC_FLAG_MULTI,
1570 psMapDevClassMemOUT->sClientMemInfo.hKernelMemInfo);
1571 }
1572 else
1573 {
1574 psMapDevClassMemOUT->sClientSyncInfo.hMappingInfo = 0;
1575 }
1576#else
1577 psMapDevClassMemOUT->sClientSyncInfo.hMappingInfo = 1157 psMapDevClassMemOUT->sClientSyncInfo.hMappingInfo =
1578 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle; 1158 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
1579#endif 1159#endif
1580#endif
1581 1160
1582 psMapDevClassMemOUT->sClientMemInfo.psClientSyncInfo = &psMapDevClassMemOUT->sClientSyncInfo; 1161 psMapDevClassMemOUT->sClientMemInfo.psClientSyncInfo = &psMapDevClassMemOUT->sClientSyncInfo;
1583 /* 1162 /*
@@ -1611,11 +1190,7 @@ PVRSRVUnmapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
1611 1190
1612 psRetOUT->eError = 1191 psRetOUT->eError =
1613 PVRSRVLookupHandle(psPerProc->psHandleBase, &pvKernelMemInfo, 1192 PVRSRVLookupHandle(psPerProc->psHandleBase, &pvKernelMemInfo,
1614#if defined (SUPPORT_SID_INTERFACE)
1615 psUnmapDevClassMemIN->hKernelMemInfo,
1616#else
1617 psUnmapDevClassMemIN->psKernelMemInfo, 1193 psUnmapDevClassMemIN->psKernelMemInfo,
1618#endif
1619 PVRSRV_HANDLE_TYPE_MEM_INFO); 1194 PVRSRV_HANDLE_TYPE_MEM_INFO);
1620 if(psRetOUT->eError != PVRSRV_OK) 1195 if(psRetOUT->eError != PVRSRV_OK)
1621 { 1196 {
@@ -1631,16 +1206,14 @@ PVRSRVUnmapDeviceClassMemoryBW(IMG_UINT32 ui32BridgeID,
1631 1206
1632 psRetOUT->eError = 1207 psRetOUT->eError =
1633 PVRSRVReleaseHandle(psPerProc->psHandleBase, 1208 PVRSRVReleaseHandle(psPerProc->psHandleBase,
1634#if defined (SUPPORT_SID_INTERFACE)
1635 psUnmapDevClassMemIN->hKernelMemInfo,
1636#else
1637 psUnmapDevClassMemIN->psKernelMemInfo, 1209 psUnmapDevClassMemIN->psKernelMemInfo,
1638#endif
1639 PVRSRV_HANDLE_TYPE_MEM_INFO); 1210 PVRSRV_HANDLE_TYPE_MEM_INFO);
1640 1211
1641 return 0; 1212 return 0;
1642} 1213}
1643 1214
1215#endif /* defined(SUPPORT_PVRSRV_DEVICE_CLASS) */
1216
1644 1217
1645#if defined(OS_PVRSRV_WRAP_EXT_MEM_BW) 1218#if defined(OS_PVRSRV_WRAP_EXT_MEM_BW)
1646IMG_INT 1219IMG_INT
@@ -1716,8 +1289,8 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID,
1716 PVRSRVWrapExtMemoryKM(hDevCookieInt, 1289 PVRSRVWrapExtMemoryKM(hDevCookieInt,
1717 psPerProc, 1290 psPerProc,
1718 hDevMemContextInt, 1291 hDevMemContextInt,
1719 psWrapExtMemIN->ui32ByteSize, 1292 psWrapExtMemIN->uByteSize,
1720 psWrapExtMemIN->ui32PageOffset, 1293 psWrapExtMemIN->uPageOffset,
1721 psWrapExtMemIN->bPhysContig, 1294 psWrapExtMemIN->bPhysContig,
1722 psSysPAddr, 1295 psSysPAddr,
1723 psWrapExtMemIN->pvLinAddr, 1296 psWrapExtMemIN->pvLinAddr,
@@ -1745,11 +1318,7 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID,
1745 psWrapExtMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr; 1318 psWrapExtMemOUT->sClientMemInfo.sDevVAddr = psMemInfo->sDevVAddr;
1746 psWrapExtMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags; 1319 psWrapExtMemOUT->sClientMemInfo.ui32Flags = psMemInfo->ui32Flags;
1747 psWrapExtMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize; 1320 psWrapExtMemOUT->sClientMemInfo.uAllocSize = psMemInfo->uAllocSize;
1748#if defined (SUPPORT_SID_INTERFACE)
1749/* see below */
1750#else
1751 psWrapExtMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle; 1321 psWrapExtMemOUT->sClientMemInfo.hMappingInfo = psMemInfo->sMemBlk.hOSMemHandle;
1752#endif
1753 1322
1754 PVRSRVAllocHandleNR(psPerProc->psHandleBase, 1323 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
1755 &psWrapExtMemOUT->sClientMemInfo.hKernelMemInfo, 1324 &psWrapExtMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -1757,22 +1326,6 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID,
1757 PVRSRV_HANDLE_TYPE_MEM_INFO, 1326 PVRSRV_HANDLE_TYPE_MEM_INFO,
1758 PVRSRV_HANDLE_ALLOC_FLAG_NONE); 1327 PVRSRV_HANDLE_ALLOC_FLAG_NONE);
1759 1328
1760#if defined (SUPPORT_SID_INTERFACE)
1761 /* alloc subhandle for the mapping info */
1762 if (psMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
1763 {
1764 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
1765 &psWrapExtMemOUT->sClientMemInfo.hMappingInfo,
1766 psMemInfo->sMemBlk.hOSMemHandle,
1767 PVRSRV_HANDLE_TYPE_MEM_INFO,
1768 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
1769 psWrapExtMemOUT->sClientMemInfo.hKernelMemInfo);
1770 }
1771 else
1772 {
1773 psWrapExtMemOUT->sClientMemInfo.hMappingInfo = 0;
1774 }
1775#endif
1776 1329
1777 /* setup the sync info */ 1330 /* setup the sync info */
1778#if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS) 1331#if !defined(PVRSRV_DISABLE_UM_SYNCOBJ_MAPPINGS)
@@ -1785,26 +1338,9 @@ PVRSRVWrapExtMemoryBW(IMG_UINT32 ui32BridgeID,
1785 psWrapExtMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr = 1338 psWrapExtMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
1786 psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr; 1339 psMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
1787 1340
1788#if defined (SUPPORT_SID_INTERFACE)
1789 /* alloc subhandle for the mapping info */
1790 if (psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL)
1791 {
1792 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
1793 &psWrapExtMemOUT->sClientSyncInfo.hMappingInfo,
1794 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
1795 PVRSRV_HANDLE_TYPE_MEM_INFO,
1796 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
1797 psWrapExtMemOUT->sClientMemInfo.hKernelMemInfo);
1798 }
1799 else
1800 {
1801 psWrapExtMemOUT->sClientSyncInfo.hMappingInfo = 0;
1802 }
1803#else
1804 psWrapExtMemOUT->sClientSyncInfo.hMappingInfo = 1341 psWrapExtMemOUT->sClientSyncInfo.hMappingInfo =
1805 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle; 1342 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
1806#endif 1343#endif
1807#endif
1808 1344
1809 psWrapExtMemOUT->sClientMemInfo.psClientSyncInfo = &psWrapExtMemOUT->sClientSyncInfo; 1345 psWrapExtMemOUT->sClientMemInfo.psClientSyncInfo = &psWrapExtMemOUT->sClientSyncInfo;
1810 1346
@@ -1864,6 +1400,7 @@ PVRSRVMapIonHandleBW(IMG_UINT32 ui32BridgeID,
1864 PVRSRV_PER_PROCESS_DATA *psPerProc) 1400 PVRSRV_PER_PROCESS_DATA *psPerProc)
1865{ 1401{
1866 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo; 1402 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo;
1403 IMG_UINT64 ui64Stamp;
1867 1404
1868 psMapIonOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, 1405 psMapIonOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
1869 &psMapIonIN->hDevCookie, 1406 &psMapIonIN->hDevCookie,
@@ -1876,9 +1413,9 @@ PVRSRVMapIonHandleBW(IMG_UINT32 ui32BridgeID,
1876 } 1413 }
1877 1414
1878 psMapIonOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase, 1415 psMapIonOUT->eError = PVRSRVLookupHandle(psPerProc->psHandleBase,
1879 &psMapIonIN->hDevMemContext, 1416 &psMapIonIN->hDevMemHeap,
1880 psMapIonIN->hDevMemContext, 1417 psMapIonIN->hDevMemHeap,
1881 PVRSRV_HANDLE_TYPE_DEV_MEM_CONTEXT); 1418 PVRSRV_HANDLE_TYPE_DEV_MEM_HEAP);
1882 if (psMapIonOUT->eError != PVRSRV_OK) 1419 if (psMapIonOUT->eError != PVRSRV_OK)
1883 { 1420 {
1884 PVR_DPF((PVR_DBG_ERROR, "%s: Failed to lookup memory context handle", __FUNCTION__)); 1421 PVR_DPF((PVR_DBG_ERROR, "%s: Failed to lookup memory context handle", __FUNCTION__));
@@ -1887,11 +1424,16 @@ PVRSRVMapIonHandleBW(IMG_UINT32 ui32BridgeID,
1887 1424
1888 psMapIonOUT->eError = PVRSRVMapIonHandleKM(psPerProc, 1425 psMapIonOUT->eError = PVRSRVMapIonHandleKM(psPerProc,
1889 psMapIonIN->hDevCookie, 1426 psMapIonIN->hDevCookie,
1890 psMapIonIN->hDevMemContext, 1427 psMapIonIN->hDevMemHeap,
1891 psMapIonIN->handle, 1428 psMapIonIN->ui32NumFDs,
1429 psMapIonIN->ai32BufferFDs,
1892 psMapIonIN->ui32Attribs, 1430 psMapIonIN->ui32Attribs,
1893 psMapIonIN->ui32Size, 1431 psMapIonIN->ui32ChunkCount,
1894 &psKernelMemInfo); 1432 psMapIonIN->auiOffset,
1433 psMapIonIN->auiSize,
1434 &psMapIonOUT->uiIonBufferSize,
1435 &psKernelMemInfo,
1436 &ui64Stamp);
1895 if (psMapIonOUT->eError != PVRSRV_OK) 1437 if (psMapIonOUT->eError != PVRSRV_OK)
1896 { 1438 {
1897 PVR_DPF((PVR_DBG_ERROR, "%s: Failed to map ion handle", __FUNCTION__)); 1439 PVR_DPF((PVR_DBG_ERROR, "%s: Failed to map ion handle", __FUNCTION__));
@@ -1913,6 +1455,9 @@ PVRSRVMapIonHandleBW(IMG_UINT32 ui32BridgeID,
1913 /* No mapping info, we map through ion */ 1455 /* No mapping info, we map through ion */
1914 psMapIonOUT->sClientMemInfo.hMappingInfo = IMG_NULL; 1456 psMapIonOUT->sClientMemInfo.hMappingInfo = IMG_NULL;
1915 1457
1458#if defined(SUPPORT_MEMINFO_IDS)
1459 psMapIonOUT->sClientMemInfo.ui64Stamp = ui64Stamp;
1460#endif
1916 1461
1917 PVRSRVAllocHandleNR(psPerProc->psHandleBase, 1462 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
1918 &psMapIonOUT->sClientMemInfo.hKernelMemInfo, 1463 &psMapIonOUT->sClientMemInfo.hKernelMemInfo,
@@ -1941,25 +1486,9 @@ PVRSRVMapIonHandleBW(IMG_UINT32 ui32BridgeID,
1941 psMapIonOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr = 1486 psMapIonOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
1942 psKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr; 1487 psKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
1943 1488
1944#if defined (SUPPORT_SID_INTERFACE)
1945 if (psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL)
1946 {
1947 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
1948 &psMapIonOUT->sClientSyncInfo.hMappingInfo,
1949 psMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
1950 PVRSRV_HANDLE_TYPE_SYNC_INFO,
1951 PVRSRV_HANDLE_ALLOC_FLAG_NONE,
1952 psMapIonOUT->sClientMemInfo.hKernelMemInfo);
1953 }
1954 else
1955 {
1956 psMapIonOUT->sClientSyncInfo.hMappingInfo = 0;
1957 }
1958#else
1959 psMapIonOUT->sClientSyncInfo.hMappingInfo = 1489 psMapIonOUT->sClientSyncInfo.hMappingInfo =
1960 psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle; 1490 psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
1961#endif 1491#endif
1962#endif
1963 1492
1964 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, 1493 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
1965 &psMapIonOUT->sClientSyncInfo.hKernelSyncInfo, 1494 &psMapIonOUT->sClientSyncInfo.hKernelSyncInfo,
@@ -1987,11 +1516,7 @@ PVRSRVUnmapIonHandleBW(IMG_UINT32 ui32BridgeID,
1987 psUnmapIonOUT->eError = 1516 psUnmapIonOUT->eError =
1988 PVRSRVLookupHandle(psPerProc->psHandleBase, 1517 PVRSRVLookupHandle(psPerProc->psHandleBase,
1989 &pvKernelMemInfo, 1518 &pvKernelMemInfo,
1990#if defined (SUPPORT_SID_INTERFACE)
1991 psUnmapIonIN->hKernelMemInfo,
1992#else
1993 psUnmapIonIN->psKernelMemInfo, 1519 psUnmapIonIN->psKernelMemInfo,
1994#endif
1995 PVRSRV_HANDLE_TYPE_MEM_INFO); 1520 PVRSRV_HANDLE_TYPE_MEM_INFO);
1996 1521
1997 if(psUnmapIonOUT->eError != PVRSRV_OK) 1522 if(psUnmapIonOUT->eError != PVRSRV_OK)
@@ -2008,11 +1533,7 @@ PVRSRVUnmapIonHandleBW(IMG_UINT32 ui32BridgeID,
2008 1533
2009 psUnmapIonOUT->eError = 1534 psUnmapIonOUT->eError =
2010 PVRSRVReleaseHandle(psPerProc->psHandleBase, 1535 PVRSRVReleaseHandle(psPerProc->psHandleBase,
2011#if defined (SUPPORT_SID_INTERFACE)
2012 psUnmapIonIN->hKernelMemInfo,
2013#else
2014 psUnmapIonIN->psKernelMemInfo, 1536 psUnmapIonIN->psKernelMemInfo,
2015#endif
2016 PVRSRV_HANDLE_TYPE_MEM_INFO); 1537 PVRSRV_HANDLE_TYPE_MEM_INFO);
2017 1538
2018 return 0; 1539 return 0;
@@ -2031,9 +1552,9 @@ PVRSRVGetFreeDeviceMemBW(IMG_UINT32 ui32BridgeID,
2031 1552
2032 psGetFreeDeviceMemOUT->eError = 1553 psGetFreeDeviceMemOUT->eError =
2033 PVRSRVGetFreeDeviceMemKM(psGetFreeDeviceMemIN->ui32Flags, 1554 PVRSRVGetFreeDeviceMemKM(psGetFreeDeviceMemIN->ui32Flags,
2034 &psGetFreeDeviceMemOUT->ui32Total, 1555 &psGetFreeDeviceMemOUT->uTotal,
2035 &psGetFreeDeviceMemOUT->ui32Free, 1556 &psGetFreeDeviceMemOUT->uFree,
2036 &psGetFreeDeviceMemOUT->ui32LargestBlock); 1557 &psGetFreeDeviceMemOUT->uLargestBlock);
2037 1558
2038 return 0; 1559 return 0;
2039} 1560}
@@ -2050,10 +1571,10 @@ PVRMMapOSMemHandleToMMapDataBW(IMG_UINT32 ui32BridgeID,
2050 psMMapDataOUT->eError = 1571 psMMapDataOUT->eError =
2051 PVRMMapOSMemHandleToMMapData(psPerProc, 1572 PVRMMapOSMemHandleToMMapData(psPerProc,
2052 psMMapDataIN->hMHandle, 1573 psMMapDataIN->hMHandle,
2053 &psMMapDataOUT->ui32MMapOffset, 1574 &psMMapDataOUT->uiMMapOffset,
2054 &psMMapDataOUT->ui32ByteOffset, 1575 &psMMapDataOUT->uiByteOffset,
2055 &psMMapDataOUT->ui32RealByteSize, 1576 &psMMapDataOUT->uiRealByteSize,
2056 &psMMapDataOUT->ui32UserVAddr); 1577 &psMMapDataOUT->uiUserVAddr);
2057#else 1578#else
2058 PVR_UNREFERENCED_PARAMETER(psPerProc); 1579 PVR_UNREFERENCED_PARAMETER(psPerProc);
2059 PVR_UNREFERENCED_PARAMETER(psMMapDataIN); 1580 PVR_UNREFERENCED_PARAMETER(psMMapDataIN);
@@ -2077,8 +1598,8 @@ PVRMMapReleaseMMapDataBW(IMG_UINT32 ui32BridgeID,
2077 PVRMMapReleaseMMapData(psPerProc, 1598 PVRMMapReleaseMMapData(psPerProc,
2078 psMMapDataIN->hMHandle, 1599 psMMapDataIN->hMHandle,
2079 &psMMapDataOUT->bMUnmap, 1600 &psMMapDataOUT->bMUnmap,
2080 &psMMapDataOUT->ui32RealByteSize, 1601 &psMMapDataOUT->uiRealByteSize,
2081 &psMMapDataOUT->ui32UserVAddr); 1602 &psMMapDataOUT->uiUserVAddr);
2082#else 1603#else
2083 1604
2084 PVR_UNREFERENCED_PARAMETER(psPerProc); 1605 PVR_UNREFERENCED_PARAMETER(psPerProc);
@@ -2090,34 +1611,6 @@ PVRMMapReleaseMMapDataBW(IMG_UINT32 ui32BridgeID,
2090} 1611}
2091 1612
2092 1613
2093#if defined (SUPPORT_SID_INTERFACE)
2094static IMG_INT
2095PVRSRVChangeDeviceMemoryAttributesBW(IMG_UINT32 ui32BridgeID,
2096 PVRSRV_BRIDGE_IN_CHG_DEV_MEM_ATTRIBS *psChgMemAttribIN,
2097 PVRSRV_BRIDGE_RETURN *psRetOUT,
2098 PVRSRV_PER_PROCESS_DATA *psPerProc)
2099{
2100 IMG_HANDLE hKernelMemInfo;
2101
2102 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_CHG_DEV_MEM_ATTRIBS);
2103
2104 psRetOUT->eError =
2105 PVRSRVLookupHandle(psPerProc->psHandleBase,
2106 &hKernelMemInfo,
2107 psChgMemAttribIN->hKernelMemInfo,
2108 PVRSRV_HANDLE_TYPE_MEM_INFO);
2109
2110 if(psRetOUT->eError != PVRSRV_OK)
2111 {
2112 return 0;
2113 }
2114
2115 psRetOUT->eError =
2116 PVRSRVChangeDeviceMemoryAttributesKM(hKernelMemInfo, psChgMemAttribIN->ui32Attribs);
2117
2118 return 0;
2119}
2120#else
2121static IMG_INT 1614static IMG_INT
2122PVRSRVChangeDeviceMemoryAttributesBW(IMG_UINT32 ui32BridgeID, 1615PVRSRVChangeDeviceMemoryAttributesBW(IMG_UINT32 ui32BridgeID,
2123 PVRSRV_BRIDGE_IN_CHG_DEV_MEM_ATTRIBS *psChgMemAttribIN, 1616 PVRSRV_BRIDGE_IN_CHG_DEV_MEM_ATTRIBS *psChgMemAttribIN,
@@ -2131,7 +1624,6 @@ PVRSRVChangeDeviceMemoryAttributesBW(IMG_UINT32 ui32BridgeID,
2131 1624
2132 return 0; 1625 return 0;
2133} 1626}
2134#endif
2135 1627
2136#ifdef PDUMP 1628#ifdef PDUMP
2137static IMG_INT 1629static IMG_INT
@@ -2251,11 +1743,7 @@ PDumpMemPolBW(IMG_UINT32 ui32BridgeID,
2251 psRetOUT->eError = 1743 psRetOUT->eError =
2252 PVRSRVLookupHandle(psPerProc->psHandleBase, 1744 PVRSRVLookupHandle(psPerProc->psHandleBase,
2253 &pvMemInfo, 1745 &pvMemInfo,
2254#if defined (SUPPORT_SID_INTERFACE)
2255 psPDumpMemPolIN->hKernelMemInfo,
2256#else
2257 psPDumpMemPolIN->psKernelMemInfo, 1746 psPDumpMemPolIN->psKernelMemInfo,
2258#endif
2259 PVRSRV_HANDLE_TYPE_MEM_INFO); 1747 PVRSRV_HANDLE_TYPE_MEM_INFO);
2260 if(psRetOUT->eError != PVRSRV_OK) 1748 if(psRetOUT->eError != PVRSRV_OK)
2261 { 1749 {
@@ -2287,11 +1775,7 @@ PDumpMemBW(IMG_UINT32 ui32BridgeID,
2287 psRetOUT->eError = 1775 psRetOUT->eError =
2288 PVRSRVLookupHandle(psPerProc->psHandleBase, 1776 PVRSRVLookupHandle(psPerProc->psHandleBase,
2289 &pvMemInfo, 1777 &pvMemInfo,
2290#if defined (SUPPORT_SID_INTERFACE)
2291 psPDumpMemDumpIN->hKernelMemInfo,
2292#else
2293 psPDumpMemDumpIN->psKernelMemInfo, 1778 psPDumpMemDumpIN->psKernelMemInfo,
2294#endif
2295 PVRSRV_HANDLE_TYPE_MEM_INFO); 1779 PVRSRV_HANDLE_TYPE_MEM_INFO);
2296 if(psRetOUT->eError != PVRSRV_OK) 1780 if(psRetOUT->eError != PVRSRV_OK)
2297 { 1781 {
@@ -2442,11 +1926,7 @@ PDumpSyncDumpBW(IMG_UINT32 ui32BridgeID,
2442 1926
2443 psRetOUT->eError = 1927 psRetOUT->eError =
2444 PVRSRVLookupHandle(psPerProc->psHandleBase, &pvSyncInfo, 1928 PVRSRVLookupHandle(psPerProc->psHandleBase, &pvSyncInfo,
2445#if defined (SUPPORT_SID_INTERFACE)
2446 psPDumpSyncDumpIN->hKernelSyncInfo,
2447#else
2448 psPDumpSyncDumpIN->psKernelSyncInfo, 1929 psPDumpSyncDumpIN->psKernelSyncInfo,
2449#endif
2450 PVRSRV_HANDLE_TYPE_SYNC_INFO); 1930 PVRSRV_HANDLE_TYPE_SYNC_INFO);
2451 if(psRetOUT->eError != PVRSRV_OK) 1931 if(psRetOUT->eError != PVRSRV_OK)
2452 { 1932 {
@@ -2482,11 +1962,7 @@ PDumpSyncPolBW(IMG_UINT32 ui32BridgeID,
2482 psRetOUT->eError = 1962 psRetOUT->eError =
2483 PVRSRVLookupHandle(psPerProc->psHandleBase, 1963 PVRSRVLookupHandle(psPerProc->psHandleBase,
2484 &pvSyncInfo, 1964 &pvSyncInfo,
2485#if defined (SUPPORT_SID_INTERFACE)
2486 psPDumpSyncPolIN->hKernelSyncInfo,
2487#else
2488 psPDumpSyncPolIN->psKernelSyncInfo, 1965 psPDumpSyncPolIN->psKernelSyncInfo,
2489#endif
2490 PVRSRV_HANDLE_TYPE_SYNC_INFO); 1966 PVRSRV_HANDLE_TYPE_SYNC_INFO);
2491 if(psRetOUT->eError != PVRSRV_OK) 1967 if(psRetOUT->eError != PVRSRV_OK)
2492 { 1968 {
@@ -2630,30 +2106,13 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
2630 PVRSRV_BRIDGE_OUT_GET_MISC_INFO *psGetMiscInfoOUT, 2106 PVRSRV_BRIDGE_OUT_GET_MISC_INFO *psGetMiscInfoOUT,
2631 PVRSRV_PER_PROCESS_DATA *psPerProc) 2107 PVRSRV_PER_PROCESS_DATA *psPerProc)
2632{ 2108{
2633#if defined (SUPPORT_SID_INTERFACE)
2634 PVRSRV_MISC_INFO_KM sMiscInfo = {0};
2635#endif
2636 PVRSRV_ERROR eError; 2109 PVRSRV_ERROR eError;
2637 2110
2638 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_GET_MISC_INFO); 2111 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_GET_MISC_INFO);
2639 2112
2640#if defined (SUPPORT_SID_INTERFACE)
2641 sMiscInfo.ui32StateRequest = psGetMiscInfoIN->sMiscInfo.ui32StateRequest;
2642 sMiscInfo.ui32StatePresent = psGetMiscInfoIN->sMiscInfo.ui32StatePresent;
2643 sMiscInfo.ui32MemoryStrLen = psGetMiscInfoIN->sMiscInfo.ui32MemoryStrLen;
2644 sMiscInfo.pszMemoryStr = psGetMiscInfoIN->sMiscInfo.pszMemoryStr;
2645
2646 OSMemCopy(&sMiscInfo.sCacheOpCtl,
2647 &psGetMiscInfoIN->sMiscInfo.sCacheOpCtl,
2648 sizeof(sMiscInfo.sCacheOpCtl));
2649 OSMemCopy(&sMiscInfo.sGetRefCountCtl,
2650 &psGetMiscInfoIN->sMiscInfo.sGetRefCountCtl,
2651 sizeof(sMiscInfo.sGetRefCountCtl));
2652#else
2653 OSMemCopy(&psGetMiscInfoOUT->sMiscInfo, 2113 OSMemCopy(&psGetMiscInfoOUT->sMiscInfo,
2654 &psGetMiscInfoIN->sMiscInfo, 2114 &psGetMiscInfoIN->sMiscInfo,
2655 sizeof(PVRSRV_MISC_INFO)); 2115 sizeof(PVRSRV_MISC_INFO));
2656#endif
2657 2116
2658 if (((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_MEMSTATS_PRESENT) != 0) && 2117 if (((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_MEMSTATS_PRESENT) != 0) &&
2659 ((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_DDKVERSION_PRESENT) != 0) && 2118 ((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_DDKVERSION_PRESENT) != 0) &&
@@ -2670,20 +2129,6 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
2670 ((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_FREEMEM_PRESENT) != 0)) 2129 ((psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_FREEMEM_PRESENT) != 0))
2671 { 2130 {
2672 /* Alloc kernel side buffer to write into */ 2131 /* Alloc kernel side buffer to write into */
2673#if defined (SUPPORT_SID_INTERFACE)
2674 ASSIGN_AND_EXIT_ON_ERROR(psGetMiscInfoOUT->eError,
2675 OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
2676 psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen,
2677 (IMG_VOID **)&sMiscInfo.pszMemoryStr, 0,
2678 "Output string buffer"));
2679 psGetMiscInfoOUT->eError = PVRSRVGetMiscInfoKM(&sMiscInfo);
2680
2681 /* Copy result to user */
2682 eError = CopyToUserWrapper(psPerProc, ui32BridgeID,
2683 psGetMiscInfoIN->sMiscInfo.pszMemoryStr,
2684 sMiscInfo.pszMemoryStr,
2685 sMiscInfo.ui32MemoryStrLen);
2686#else
2687 ASSIGN_AND_EXIT_ON_ERROR(psGetMiscInfoOUT->eError, 2132 ASSIGN_AND_EXIT_ON_ERROR(psGetMiscInfoOUT->eError,
2688 OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, 2133 OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
2689 psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen, 2134 psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen,
@@ -2697,18 +2142,11 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
2697 psGetMiscInfoIN->sMiscInfo.pszMemoryStr, 2142 psGetMiscInfoIN->sMiscInfo.pszMemoryStr,
2698 psGetMiscInfoOUT->sMiscInfo.pszMemoryStr, 2143 psGetMiscInfoOUT->sMiscInfo.pszMemoryStr,
2699 psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen); 2144 psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen);
2700#endif
2701 2145
2702 /* Free kernel side buffer again */ 2146 /* Free kernel side buffer again */
2703#if defined (SUPPORT_SID_INTERFACE)
2704 OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
2705 sMiscInfo.ui32MemoryStrLen,
2706 (IMG_VOID *)sMiscInfo.pszMemoryStr, 0);
2707#else
2708 OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, 2147 OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
2709 psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen, 2148 psGetMiscInfoOUT->sMiscInfo.ui32MemoryStrLen,
2710 (IMG_VOID *)psGetMiscInfoOUT->sMiscInfo.pszMemoryStr, 0); 2149 (IMG_VOID *)psGetMiscInfoOUT->sMiscInfo.pszMemoryStr, 0);
2711#endif
2712 2150
2713 /* Replace output buffer pointer with input pointer, as both are expected 2151 /* Replace output buffer pointer with input pointer, as both are expected
2714 * to point to the same userspace memory. 2152 * to point to the same userspace memory.
@@ -2726,11 +2164,7 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
2726 } 2164 }
2727 else 2165 else
2728 { 2166 {
2729#if defined (SUPPORT_SID_INTERFACE)
2730 psGetMiscInfoOUT->eError = PVRSRVGetMiscInfoKM(&sMiscInfo);
2731#else
2732 psGetMiscInfoOUT->eError = PVRSRVGetMiscInfoKM(&psGetMiscInfoOUT->sMiscInfo); 2167 psGetMiscInfoOUT->eError = PVRSRVGetMiscInfoKM(&psGetMiscInfoOUT->sMiscInfo);
2733#endif
2734 } 2168 }
2735 2169
2736 /* Return on error so exit status of PVRSRVGetMiscInfoKM is propagated to client. 2170 /* Return on error so exit status of PVRSRVGetMiscInfoKM is propagated to client.
@@ -2746,19 +2180,11 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
2746 * (a shared handle is allocated at most once), and there is no 2180 * (a shared handle is allocated at most once), and there is no
2747 * resource allocation to undo if the handle allocation fails. 2181 * resource allocation to undo if the handle allocation fails.
2748 */ 2182 */
2749#if defined (SUPPORT_SID_INTERFACE)
2750 if (sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT)
2751#else
2752 if (psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT) 2183 if (psGetMiscInfoIN->sMiscInfo.ui32StateRequest & PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT)
2753#endif
2754 { 2184 {
2755 psGetMiscInfoOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase, 2185 psGetMiscInfoOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase,
2756 &psGetMiscInfoOUT->sMiscInfo.sGlobalEventObject.hOSEventKM, 2186 &psGetMiscInfoOUT->sMiscInfo.sGlobalEventObject.hOSEventKM,
2757#if defined (SUPPORT_SID_INTERFACE)
2758 sMiscInfo.sGlobalEventObject.hOSEventKM,
2759#else
2760 psGetMiscInfoOUT->sMiscInfo.sGlobalEventObject.hOSEventKM, 2187 psGetMiscInfoOUT->sMiscInfo.sGlobalEventObject.hOSEventKM,
2761#endif
2762 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT, 2188 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT,
2763 PVRSRV_HANDLE_ALLOC_FLAG_SHARED); 2189 PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
2764 2190
@@ -2767,27 +2193,14 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
2767 return 0; 2193 return 0;
2768 } 2194 }
2769 2195
2770#if defined (SUPPORT_SID_INTERFACE)
2771 OSMemCopy(&psGetMiscInfoOUT->sMiscInfo.sGlobalEventObject.szName,
2772 sMiscInfo.sGlobalEventObject.szName,
2773 EVENTOBJNAME_MAXLENGTH);
2774#endif
2775 } 2196 }
2776 2197
2777#if defined (SUPPORT_SID_INTERFACE)
2778 if (sMiscInfo.hSOCTimerRegisterOSMemHandle)
2779#else
2780 if (psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle) 2198 if (psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle)
2781#endif
2782 { 2199 {
2783 /* Allocate handle for SOC OSMemHandle */ 2200 /* Allocate handle for SOC OSMemHandle */
2784 psGetMiscInfoOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase, 2201 psGetMiscInfoOUT->eError = PVRSRVAllocHandle(psPerProc->psHandleBase,
2785 &psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle, 2202 &psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle,
2786#if defined (SUPPORT_SID_INTERFACE)
2787 sMiscInfo.hSOCTimerRegisterOSMemHandle,
2788#else
2789 psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle, 2203 psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle,
2790#endif
2791 PVRSRV_HANDLE_TYPE_SOC_TIMER, 2204 PVRSRV_HANDLE_TYPE_SOC_TIMER,
2792 PVRSRV_HANDLE_ALLOC_FLAG_SHARED); 2205 PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
2793 2206
@@ -2796,32 +2209,6 @@ PVRSRVGetMiscInfoBW(IMG_UINT32 ui32BridgeID,
2796 return 0; 2209 return 0;
2797 } 2210 }
2798 } 2211 }
2799#if defined (SUPPORT_SID_INTERFACE)
2800 else
2801 {
2802 psGetMiscInfoOUT->sMiscInfo.hSOCTimerRegisterOSMemHandle = 0;
2803 }
2804
2805 /* copy data from local sMiscInfo to OUT */
2806 psGetMiscInfoOUT->sMiscInfo.ui32StateRequest = sMiscInfo.ui32StateRequest;
2807 psGetMiscInfoOUT->sMiscInfo.ui32StatePresent = sMiscInfo.ui32StatePresent;
2808
2809 psGetMiscInfoOUT->sMiscInfo.pvSOCTimerRegisterKM = sMiscInfo.pvSOCTimerRegisterKM;
2810 psGetMiscInfoOUT->sMiscInfo.pvSOCTimerRegisterUM = sMiscInfo.pvSOCTimerRegisterUM;
2811 psGetMiscInfoOUT->sMiscInfo.pvSOCClockGateRegs = sMiscInfo.pvSOCClockGateRegs;
2812
2813 psGetMiscInfoOUT->sMiscInfo.ui32SOCClockGateRegsSize = sMiscInfo.ui32SOCClockGateRegsSize;
2814
2815 OSMemCopy(&psGetMiscInfoOUT->sMiscInfo.aui32DDKVersion,
2816 &sMiscInfo.aui32DDKVersion,
2817 sizeof(psGetMiscInfoOUT->sMiscInfo.aui32DDKVersion));
2818 OSMemCopy(&psGetMiscInfoOUT->sMiscInfo.sCacheOpCtl,
2819 &sMiscInfo.sCacheOpCtl,
2820 sizeof(psGetMiscInfoOUT->sMiscInfo.sCacheOpCtl));
2821 OSMemCopy(&psGetMiscInfoOUT->sMiscInfo.sGetRefCountCtl,
2822 &sMiscInfo.sGetRefCountCtl,
2823 sizeof(psGetMiscInfoOUT->sMiscInfo.sGetRefCountCtl));
2824#endif
2825 2212
2826 return 0; 2213 return 0;
2827} 2214}
@@ -2882,6 +2269,8 @@ PVRSRVDisconnectBW(IMG_UINT32 ui32BridgeID,
2882 return 0; 2269 return 0;
2883} 2270}
2884 2271
2272#if defined(SUPPORT_PVRSRV_DEVICE_CLASS)
2273
2885static IMG_INT 2274static IMG_INT
2886PVRSRVEnumerateDCBW(IMG_UINT32 ui32BridgeID, 2275PVRSRVEnumerateDCBW(IMG_UINT32 ui32BridgeID,
2887 PVRSRV_BRIDGE_IN_ENUMCLASS *psEnumDispClassIN, 2276 PVRSRV_BRIDGE_IN_ENUMCLASS *psEnumDispClassIN,
@@ -3369,9 +2758,6 @@ PVRSRVGetDCBuffersBW(IMG_UINT32 ui32BridgeID,
3369 IMG_VOID *pvDispClassInfo; 2758 IMG_VOID *pvDispClassInfo;
3370 IMG_VOID *pvSwapChain; 2759 IMG_VOID *pvSwapChain;
3371 IMG_UINT32 i; 2760 IMG_UINT32 i;
3372#if defined (SUPPORT_SID_INTERFACE)
3373 IMG_HANDLE *pahBuffer;
3374#endif
3375 2761
3376 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_GET_DISPCLASS_BUFFERS); 2762 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_GET_DISPCLASS_BUFFERS);
3377 2763
@@ -3397,27 +2783,12 @@ PVRSRVGetDCBuffersBW(IMG_UINT32 ui32BridgeID,
3397 return 0; 2783 return 0;
3398 } 2784 }
3399 2785
3400#if defined (SUPPORT_SID_INTERFACE)
3401 psGetDispClassBuffersOUT->eError = OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
3402 sizeof(IMG_HANDLE) * PVRSRV_MAX_DC_SWAPCHAIN_BUFFERS,
3403 (IMG_PVOID *)&pahBuffer, 0,
3404 "Temp Swapchain Buffers");
3405
3406 if (psGetDispClassBuffersOUT->eError != PVRSRV_OK)
3407 {
3408 return 0;
3409 }
3410#endif
3411 2786
3412 psGetDispClassBuffersOUT->eError = 2787 psGetDispClassBuffersOUT->eError =
3413 PVRSRVGetDCBuffersKM(pvDispClassInfo, 2788 PVRSRVGetDCBuffersKM(pvDispClassInfo,
3414 pvSwapChain, 2789 pvSwapChain,
3415 &psGetDispClassBuffersOUT->ui32BufferCount, 2790 &psGetDispClassBuffersOUT->ui32BufferCount,
3416#if defined (SUPPORT_SID_INTERFACE)
3417 pahBuffer,
3418#else
3419 psGetDispClassBuffersOUT->ahBuffer, 2791 psGetDispClassBuffersOUT->ahBuffer,
3420#endif
3421 psGetDispClassBuffersOUT->asPhyAddr); 2792 psGetDispClassBuffersOUT->asPhyAddr);
3422 if (psGetDispClassBuffersOUT->eError != PVRSRV_OK) 2793 if (psGetDispClassBuffersOUT->eError != PVRSRV_OK)
3423 { 2794 {
@@ -3428,37 +2799,19 @@ PVRSRVGetDCBuffersBW(IMG_UINT32 ui32BridgeID,
3428 2799
3429 for(i = 0; i < psGetDispClassBuffersOUT->ui32BufferCount; i++) 2800 for(i = 0; i < psGetDispClassBuffersOUT->ui32BufferCount; i++)
3430 { 2801 {
3431#if defined (SUPPORT_SID_INTERFACE)
3432 IMG_SID hBufferExt;
3433#else
3434 IMG_HANDLE hBufferExt; 2802 IMG_HANDLE hBufferExt;
3435#endif
3436 2803
3437 /* PRQA S 1461 15 */ /* ignore warning about enum type being converted */ 2804 /* PRQA S 1461 15 */ /* ignore warning about enum type being converted */
3438#if defined (SUPPORT_SID_INTERFACE)
3439 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
3440 &hBufferExt,
3441 pahBuffer[i],
3442 PVRSRV_HANDLE_TYPE_DISP_BUFFER,
3443 (PVRSRV_HANDLE_ALLOC_FLAG)(PVRSRV_HANDLE_ALLOC_FLAG_PRIVATE | PVRSRV_HANDLE_ALLOC_FLAG_SHARED),
3444 psGetDispClassBuffersIN->hSwapChain);
3445#else
3446 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, 2805 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
3447 &hBufferExt, 2806 &hBufferExt,
3448 psGetDispClassBuffersOUT->ahBuffer[i], 2807 psGetDispClassBuffersOUT->ahBuffer[i],
3449 PVRSRV_HANDLE_TYPE_DISP_BUFFER, 2808 PVRSRV_HANDLE_TYPE_DISP_BUFFER,
3450 (PVRSRV_HANDLE_ALLOC_FLAG)(PVRSRV_HANDLE_ALLOC_FLAG_PRIVATE | PVRSRV_HANDLE_ALLOC_FLAG_SHARED), 2809 (PVRSRV_HANDLE_ALLOC_FLAG)(PVRSRV_HANDLE_ALLOC_FLAG_PRIVATE | PVRSRV_HANDLE_ALLOC_FLAG_SHARED),
3451 psGetDispClassBuffersIN->hSwapChain); 2810 psGetDispClassBuffersIN->hSwapChain);
3452#endif
3453 2811
3454 psGetDispClassBuffersOUT->ahBuffer[i] = hBufferExt; 2812 psGetDispClassBuffersOUT->ahBuffer[i] = hBufferExt;
3455 } 2813 }
3456 2814
3457#if defined (SUPPORT_SID_INTERFACE)
3458 OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
3459 sizeof(IMG_HANDLE) * PVRSRV_MAX_DC_SWAPCHAIN_BUFFERS,
3460 (IMG_PVOID)pahBuffer, 0);
3461#endif
3462 2815
3463 COMMIT_HANDLE_BATCH_OR_ERROR(psGetDispClassBuffersOUT->eError, psPerProc) 2816 COMMIT_HANDLE_BATCH_OR_ERROR(psGetDispClassBuffersOUT->eError, psPerProc)
3464 2817
@@ -3473,9 +2826,6 @@ PVRSRVSwapToDCBufferBW(IMG_UINT32 ui32BridgeID,
3473{ 2826{
3474 IMG_VOID *pvDispClassInfo; 2827 IMG_VOID *pvDispClassInfo;
3475 IMG_VOID *pvSwapChainBuf; 2828 IMG_VOID *pvSwapChainBuf;
3476#if defined (SUPPORT_SID_INTERFACE)
3477 IMG_HANDLE hPrivateTag;
3478#endif
3479 2829
3480 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER); 2830 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER);
3481 2831
@@ -3500,35 +2850,12 @@ PVRSRVSwapToDCBufferBW(IMG_UINT32 ui32BridgeID,
3500 return 0; 2850 return 0;
3501 } 2851 }
3502 2852
3503#if defined (SUPPORT_SID_INTERFACE)
3504 if (psSwapDispClassBufferIN->hPrivateTag != 0)
3505 {
3506 psRetOUT->eError =
3507 PVRSRVLookupSubHandle(psPerProc->psHandleBase,
3508 &hPrivateTag,
3509 psSwapDispClassBufferIN->hPrivateTag,
3510 PVRSRV_HANDLE_TYPE_DISP_BUFFER,
3511 psSwapDispClassBufferIN->hDeviceKM);
3512 if(psRetOUT->eError != PVRSRV_OK)
3513 {
3514 return 0;
3515 }
3516 }
3517 else
3518 {
3519 hPrivateTag = IMG_NULL;
3520 }
3521#endif
3522 2853
3523 psRetOUT->eError = 2854 psRetOUT->eError =
3524 PVRSRVSwapToDCBufferKM(pvDispClassInfo, 2855 PVRSRVSwapToDCBufferKM(pvDispClassInfo,
3525 pvSwapChainBuf, 2856 pvSwapChainBuf,
3526 psSwapDispClassBufferIN->ui32SwapInterval, 2857 psSwapDispClassBufferIN->ui32SwapInterval,
3527#if defined (SUPPORT_SID_INTERFACE)
3528 hPrivateTag,
3529#else
3530 psSwapDispClassBufferIN->hPrivateTag, 2858 psSwapDispClassBufferIN->hPrivateTag,
3531#endif
3532 psSwapDispClassBufferIN->ui32ClipRectCount, 2859 psSwapDispClassBufferIN->ui32ClipRectCount,
3533 psSwapDispClassBufferIN->sClipRect); 2860 psSwapDispClassBufferIN->sClipRect);
3534 2861
@@ -3538,34 +2865,45 @@ PVRSRVSwapToDCBufferBW(IMG_UINT32 ui32BridgeID,
3538static IMG_INT 2865static IMG_INT
3539PVRSRVSwapToDCBuffer2BW(IMG_UINT32 ui32BridgeID, 2866PVRSRVSwapToDCBuffer2BW(IMG_UINT32 ui32BridgeID,
3540 PVRSRV_BRIDGE_IN_SWAP_DISPCLASS_TO_BUFFER2 *psSwapDispClassBufferIN, 2867 PVRSRV_BRIDGE_IN_SWAP_DISPCLASS_TO_BUFFER2 *psSwapDispClassBufferIN,
3541 PVRSRV_BRIDGE_RETURN *psRetOUT, 2868 PVRSRV_BRIDGE_OUT_SWAP_DISPCLASS_TO_BUFFER2 *psSwapDispClassBufferOUT,
3542 PVRSRV_PER_PROCESS_DATA *psPerProc) 2869 PVRSRV_PER_PROCESS_DATA *psPerProc)
3543{ 2870{
3544 IMG_VOID *pvPrivData = IMG_NULL; 2871 IMG_VOID *pvPrivData = IMG_NULL;
2872 IMG_HANDLE hFence = IMG_NULL;
3545 IMG_VOID *pvDispClassInfo; 2873 IMG_VOID *pvDispClassInfo;
3546 IMG_VOID *pvSwapChain; 2874 IMG_VOID *pvSwapChain;
3547 IMG_UINT32 i; 2875 IMG_UINT32 i;
3548 2876
2877#if defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC)
2878 int iReleaseFd = get_unused_fd();
2879 if(iReleaseFd < 0)
2880 {
2881 PVR_DPF((PVR_DBG_ERROR, "%s: Failed to find unused fd (%d)",
2882 __func__, iReleaseFd));
2883 return 0;
2884 }
2885#endif /* defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC) */
2886
3549 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER2); 2887 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER2);
3550 2888
3551 psRetOUT->eError = 2889 psSwapDispClassBufferOUT->eError =
3552 PVRSRVLookupHandle(psPerProc->psHandleBase, 2890 PVRSRVLookupHandle(psPerProc->psHandleBase,
3553 &pvDispClassInfo, 2891 &pvDispClassInfo,
3554 psSwapDispClassBufferIN->hDeviceKM, 2892 psSwapDispClassBufferIN->hDeviceKM,
3555 PVRSRV_HANDLE_TYPE_DISP_INFO); 2893 PVRSRV_HANDLE_TYPE_DISP_INFO);
3556 if(psRetOUT->eError != PVRSRV_OK) 2894 if(psSwapDispClassBufferOUT->eError != PVRSRV_OK)
3557 { 2895 {
3558 PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up DISP_INFO handle")); 2896 PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up DISP_INFO handle"));
3559 return 0; 2897 return 0;
3560 } 2898 }
3561 2899
3562 psRetOUT->eError = 2900 psSwapDispClassBufferOUT->eError =
3563 PVRSRVLookupSubHandle(psPerProc->psHandleBase, 2901 PVRSRVLookupSubHandle(psPerProc->psHandleBase,
3564 &pvSwapChain, 2902 &pvSwapChain,
3565 psSwapDispClassBufferIN->hSwapChain, 2903 psSwapDispClassBufferIN->hSwapChain,
3566 PVRSRV_HANDLE_TYPE_DISP_SWAP_CHAIN, 2904 PVRSRV_HANDLE_TYPE_DISP_SWAP_CHAIN,
3567 psSwapDispClassBufferIN->hDeviceKM); 2905 psSwapDispClassBufferIN->hDeviceKM);
3568 if(psRetOUT->eError != PVRSRV_OK) 2906 if(psSwapDispClassBufferOUT->eError != PVRSRV_OK)
3569 { 2907 {
3570 PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up DISP_BUFFER handle")); 2908 PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up DISP_BUFFER handle"));
3571 return 0; 2909 return 0;
@@ -3589,33 +2927,37 @@ PVRSRVSwapToDCBuffer2BW(IMG_UINT32 ui32BridgeID,
3589 2927
3590 for (i = 0; i < psSwapDispClassBufferIN->ui32NumMemInfos; i++) 2928 for (i = 0; i < psSwapDispClassBufferIN->ui32NumMemInfos; i++)
3591 { 2929 {
3592 PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
3593 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo; 2930 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo;
3594 2931
3595 psRetOUT->eError = 2932 psSwapDispClassBufferOUT->eError =
3596 PVRSRVLookupHandle(psPerProc->psHandleBase, 2933 PVRSRVLookupHandle(psPerProc->psHandleBase,
3597 (IMG_PVOID *)&psKernelMemInfo, 2934 (IMG_PVOID *)&psKernelMemInfo,
3598 psSwapDispClassBufferIN->ppsKernelMemInfos[i], 2935 psSwapDispClassBufferIN->ppsKernelMemInfos[i],
3599 PVRSRV_HANDLE_TYPE_MEM_INFO); 2936 PVRSRV_HANDLE_TYPE_MEM_INFO);
3600 if(psRetOUT->eError != PVRSRV_OK) 2937 if(psSwapDispClassBufferOUT->eError != PVRSRV_OK)
3601 { 2938 {
3602 PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up MEM_INFO handle")); 2939 PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up MEM_INFO handle"));
3603 return 0; 2940 return 0;
3604 } 2941 }
2942 psSwapDispClassBufferIN->ppsKernelMemInfos[i] = psKernelMemInfo;
3605 2943
3606 psRetOUT->eError = 2944#if !defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC)
3607 PVRSRVLookupHandle(psPerProc->psHandleBase,
3608 (IMG_PVOID *)&psKernelSyncInfo,
3609 psSwapDispClassBufferIN->ppsKernelSyncInfos[i],
3610 PVRSRV_HANDLE_TYPE_SYNC_INFO);
3611 if(psRetOUT->eError != PVRSRV_OK)
3612 { 2945 {
3613 PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up SYNC_INFO handle")); 2946 PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo;
3614 return 0; 2947
2948 psSwapDispClassBufferOUT->eError =
2949 PVRSRVLookupHandle(psPerProc->psHandleBase,
2950 (IMG_PVOID *)&psKernelSyncInfo,
2951 psSwapDispClassBufferIN->ppsKernelSyncInfos[i],
2952 PVRSRV_HANDLE_TYPE_SYNC_INFO);
2953 if(psSwapDispClassBufferOUT->eError != PVRSRV_OK)
2954 {
2955 PVR_DPF((PVR_DBG_ERROR, "PVRSRVSwapToDCBuffer2BW: Failed to look up SYNC_INFO handle"));
2956 return 0;
2957 }
2958 psSwapDispClassBufferIN->ppsKernelSyncInfos[i] = psKernelSyncInfo;
3615 } 2959 }
3616 2960#endif /* !defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC) */
3617 psSwapDispClassBufferIN->ppsKernelMemInfos[i] = psKernelMemInfo;
3618 psSwapDispClassBufferIN->ppsKernelSyncInfos[i] = psKernelSyncInfo;
3619 } 2961 }
3620 2962
3621 if(psSwapDispClassBufferIN->ui32PrivDataLength > 0) 2963 if(psSwapDispClassBufferIN->ui32PrivDataLength > 0)
@@ -3643,7 +2985,7 @@ PVRSRVSwapToDCBuffer2BW(IMG_UINT32 ui32BridgeID,
3643 } 2985 }
3644 } 2986 }
3645 2987
3646 psRetOUT->eError = 2988 psSwapDispClassBufferOUT->eError =
3647 PVRSRVSwapToDCBuffer2KM(pvDispClassInfo, 2989 PVRSRVSwapToDCBuffer2KM(pvDispClassInfo,
3648 pvSwapChain, 2990 pvSwapChain,
3649 psSwapDispClassBufferIN->ui32SwapInterval, 2991 psSwapDispClassBufferIN->ui32SwapInterval,
@@ -3651,15 +2993,32 @@ PVRSRVSwapToDCBuffer2BW(IMG_UINT32 ui32BridgeID,
3651 psSwapDispClassBufferIN->ppsKernelSyncInfos, 2993 psSwapDispClassBufferIN->ppsKernelSyncInfos,
3652 psSwapDispClassBufferIN->ui32NumMemInfos, 2994 psSwapDispClassBufferIN->ui32NumMemInfos,
3653 pvPrivData, 2995 pvPrivData,
3654 psSwapDispClassBufferIN->ui32PrivDataLength); 2996 psSwapDispClassBufferIN->ui32PrivDataLength,
2997 &hFence);
3655 2998
3656 if(psRetOUT->eError != PVRSRV_OK) 2999 if(psSwapDispClassBufferOUT->eError != PVRSRV_OK)
3657 { 3000 {
3658 OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, 3001 OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
3659 psSwapDispClassBufferIN->ui32PrivDataLength, 3002 psSwapDispClassBufferIN->ui32PrivDataLength,
3660 pvPrivData, IMG_NULL); 3003 pvPrivData, IMG_NULL);
3661 } 3004 }
3662 3005
3006#if defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC)
3007 if(hFence)
3008 {
3009 struct sync_fence *psFence = hFence;
3010 sync_fence_install(psFence, iReleaseFd);
3011 psSwapDispClassBufferOUT->hFence = (IMG_HANDLE)iReleaseFd;
3012 }
3013 else
3014 {
3015 psSwapDispClassBufferOUT->hFence = (IMG_HANDLE)-1;
3016 put_unused_fd(iReleaseFd);
3017 }
3018#else /* defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC) */
3019 psSwapDispClassBufferOUT->hFence = (IMG_HANDLE)-1;
3020#endif /* defined(PVR_ANDROID_NATIVE_WINDOW_HAS_SYNC) */
3021
3663 return 0; 3022 return 0;
3664} 3023}
3665 3024
@@ -3854,6 +3213,7 @@ PVRSRVGetBCBufferBW(IMG_UINT32 ui32BridgeID,
3854 return 0; 3213 return 0;
3855} 3214}
3856 3215
3216#endif /* defined(SUPPORT_PVRSRV_DEVICE_CLASS) */
3857 3217
3858static IMG_INT 3218static IMG_INT
3859PVRSRVAllocSharedSysMemoryBW(IMG_UINT32 ui32BridgeID, 3219PVRSRVAllocSharedSysMemoryBW(IMG_UINT32 ui32BridgeID,
@@ -3870,7 +3230,7 @@ PVRSRVAllocSharedSysMemoryBW(IMG_UINT32 ui32BridgeID,
3870 psAllocSharedSysMemOUT->eError = 3230 psAllocSharedSysMemOUT->eError =
3871 PVRSRVAllocSharedSysMemoryKM(psPerProc, 3231 PVRSRVAllocSharedSysMemoryKM(psPerProc,
3872 psAllocSharedSysMemIN->ui32Flags, 3232 psAllocSharedSysMemIN->ui32Flags,
3873 psAllocSharedSysMemIN->ui32Size, 3233 psAllocSharedSysMemIN->uSize,
3874 &psKernelMemInfo); 3234 &psKernelMemInfo);
3875 if(psAllocSharedSysMemOUT->eError != PVRSRV_OK) 3235 if(psAllocSharedSysMemOUT->eError != PVRSRV_OK)
3876 { 3236 {
@@ -3889,22 +3249,7 @@ PVRSRVAllocSharedSysMemoryBW(IMG_UINT32 ui32BridgeID,
3889 psKernelMemInfo->ui32Flags; 3249 psKernelMemInfo->ui32Flags;
3890 psAllocSharedSysMemOUT->sClientMemInfo.uAllocSize = 3250 psAllocSharedSysMemOUT->sClientMemInfo.uAllocSize =
3891 psKernelMemInfo->uAllocSize; 3251 psKernelMemInfo->uAllocSize;
3892#if defined (SUPPORT_SID_INTERFACE)
3893 if (psKernelMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
3894 {
3895 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
3896 &psAllocSharedSysMemOUT->sClientMemInfo.hMappingInfo,
3897 psKernelMemInfo->sMemBlk.hOSMemHandle,
3898 PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO,
3899 PVRSRV_HANDLE_ALLOC_FLAG_NONE);
3900 }
3901 else
3902 {
3903 psAllocSharedSysMemOUT->sClientMemInfo.hMappingInfo = 0;
3904 }
3905#else
3906 psAllocSharedSysMemOUT->sClientMemInfo.hMappingInfo = psKernelMemInfo->sMemBlk.hOSMemHandle; 3252 psAllocSharedSysMemOUT->sClientMemInfo.hMappingInfo = psKernelMemInfo->sMemBlk.hOSMemHandle;
3907#endif
3908 3253
3909 PVRSRVAllocHandleNR(psPerProc->psHandleBase, 3254 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
3910 &psAllocSharedSysMemOUT->sClientMemInfo.hKernelMemInfo, 3255 &psAllocSharedSysMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -3930,11 +3275,7 @@ PVRSRVFreeSharedSysMemoryBW(IMG_UINT32 ui32BridgeID,
3930 psFreeSharedSysMemOUT->eError = 3275 psFreeSharedSysMemOUT->eError =
3931 PVRSRVLookupHandle(psPerProc->psHandleBase, 3276 PVRSRVLookupHandle(psPerProc->psHandleBase,
3932 (IMG_VOID **)&psKernelMemInfo, 3277 (IMG_VOID **)&psKernelMemInfo,
3933#if defined (SUPPORT_SID_INTERFACE)
3934 psFreeSharedSysMemIN->hKernelMemInfo,
3935#else
3936 psFreeSharedSysMemIN->psKernelMemInfo, 3278 psFreeSharedSysMemIN->psKernelMemInfo,
3937#endif
3938 PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO); 3279 PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
3939 3280
3940 if(psFreeSharedSysMemOUT->eError != PVRSRV_OK) 3281 if(psFreeSharedSysMemOUT->eError != PVRSRV_OK)
@@ -3944,27 +3285,10 @@ PVRSRVFreeSharedSysMemoryBW(IMG_UINT32 ui32BridgeID,
3944 PVRSRVFreeSharedSysMemoryKM(psKernelMemInfo); 3285 PVRSRVFreeSharedSysMemoryKM(psKernelMemInfo);
3945 if(psFreeSharedSysMemOUT->eError != PVRSRV_OK) 3286 if(psFreeSharedSysMemOUT->eError != PVRSRV_OK)
3946 return 0; 3287 return 0;
3947#if defined (SUPPORT_SID_INTERFACE)
3948 if (psFreeSharedSysMemIN->hMappingInfo != 0)
3949 {
3950 psFreeSharedSysMemOUT->eError =
3951 PVRSRVReleaseHandle(psPerProc->psHandleBase,
3952 psFreeSharedSysMemIN->hMappingInfo,
3953 PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
3954 if(psFreeSharedSysMemOUT->eError != PVRSRV_OK)
3955 {
3956 return 0;
3957 }
3958 }
3959#endif
3960 3288
3961 psFreeSharedSysMemOUT->eError = 3289 psFreeSharedSysMemOUT->eError =
3962 PVRSRVReleaseHandle(psPerProc->psHandleBase, 3290 PVRSRVReleaseHandle(psPerProc->psHandleBase,
3963#if defined (SUPPORT_SID_INTERFACE)
3964 psFreeSharedSysMemIN->hKernelMemInfo,
3965#else
3966 psFreeSharedSysMemIN->psKernelMemInfo, 3291 psFreeSharedSysMemIN->psKernelMemInfo,
3967#endif
3968 PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO); 3292 PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO);
3969 return 0; 3293 return 0;
3970} 3294}
@@ -3977,11 +3301,7 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
3977{ 3301{
3978 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo; 3302 PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo;
3979 PVRSRV_HANDLE_TYPE eHandleType; 3303 PVRSRV_HANDLE_TYPE eHandleType;
3980#if defined (SUPPORT_SID_INTERFACE)
3981 IMG_SID hParent;
3982#else
3983 IMG_HANDLE hParent; 3304 IMG_HANDLE hParent;
3984#endif
3985 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_MAP_MEMINFO_MEM); 3305 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_MAP_MEMINFO_MEM);
3986 3306
3987 NEW_HANDLE_BATCH_OR_ERROR(psMapMemInfoMemOUT->eError, psPerProc, 2) 3307 NEW_HANDLE_BATCH_OR_ERROR(psMapMemInfoMemOUT->eError, psPerProc, 2)
@@ -3998,7 +3318,7 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
3998 3318
3999 switch (eHandleType) 3319 switch (eHandleType)
4000 { 3320 {
4001#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE) 3321#if defined(PVR_SECURE_HANDLES)
4002 case PVRSRV_HANDLE_TYPE_MEM_INFO: 3322 case PVRSRV_HANDLE_TYPE_MEM_INFO:
4003 case PVRSRV_HANDLE_TYPE_MEM_INFO_REF: 3323 case PVRSRV_HANDLE_TYPE_MEM_INFO_REF:
4004 case PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO: 3324 case PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO:
@@ -4025,11 +3345,7 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
4025 { 3345 {
4026 return 0; 3346 return 0;
4027 } 3347 }
4028#if defined (SUPPORT_SID_INTERFACE)
4029 if (hParent == 0)
4030#else
4031 if (hParent == IMG_NULL) 3348 if (hParent == IMG_NULL)
4032#endif
4033 { 3349 {
4034 hParent = psMapMemInfoMemIN->hKernelMemInfo; 3350 hParent = psMapMemInfoMemIN->hKernelMemInfo;
4035 } 3351 }
@@ -4048,23 +3364,7 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
4048 psKernelMemInfo->ui32Flags; 3364 psKernelMemInfo->ui32Flags;
4049 psMapMemInfoMemOUT->sClientMemInfo.uAllocSize = 3365 psMapMemInfoMemOUT->sClientMemInfo.uAllocSize =
4050 psKernelMemInfo->uAllocSize; 3366 psKernelMemInfo->uAllocSize;
4051#if defined (SUPPORT_SID_INTERFACE)
4052 if (psKernelMemInfo->sMemBlk.hOSMemHandle != IMG_NULL)
4053 {
4054 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
4055 &psMapMemInfoMemOUT->sClientMemInfo.hMappingInfo,
4056 psKernelMemInfo->sMemBlk.hOSMemHandle,
4057 PVRSRV_HANDLE_TYPE_MEM_INFO_REF,
4058 PVRSRV_HANDLE_ALLOC_FLAG_MULTI,
4059 hParent);
4060 }
4061 else
4062 {
4063 psMapMemInfoMemOUT->sClientMemInfo.hMappingInfo = 0;
4064 }
4065#else
4066 psMapMemInfoMemOUT->sClientMemInfo.hMappingInfo = psKernelMemInfo->sMemBlk.hOSMemHandle; 3367 psMapMemInfoMemOUT->sClientMemInfo.hMappingInfo = psKernelMemInfo->sMemBlk.hOSMemHandle;
4067#endif
4068 3368
4069 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase, 3369 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
4070 &psMapMemInfoMemOUT->sClientMemInfo.hKernelMemInfo, 3370 &psMapMemInfoMemOUT->sClientMemInfo.hKernelMemInfo,
@@ -4093,25 +3393,9 @@ PVRSRVMapMemInfoMemBW(IMG_UINT32 ui32BridgeID,
4093 psMapMemInfoMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr = 3393 psMapMemInfoMemOUT->sClientSyncInfo.sReadOps2CompleteDevVAddr =
4094 psKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr; 3394 psKernelMemInfo->psKernelSyncInfo->sReadOps2CompleteDevVAddr;
4095 3395
4096#if defined (SUPPORT_SID_INTERFACE)
4097 if (psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle != IMG_NULL)
4098 {
4099 PVRSRVAllocSubHandleNR(psPerProc->psHandleBase,
4100 &psMapMemInfoMemOUT->sClientSyncInfo.hMappingInfo,
4101 psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle,
4102 PVRSRV_HANDLE_TYPE_SYNC_INFO,
4103 PVRSRV_HANDLE_ALLOC_FLAG_MULTI,
4104 psMapMemInfoMemOUT->sClientMemInfo.hKernelMemInfo);
4105 }
4106 else
4107 {
4108 psMapMemInfoMemOUT->sClientSyncInfo.hMappingInfo = 0;
4109 }
4110#else
4111 psMapMemInfoMemOUT->sClientSyncInfo.hMappingInfo = 3396 psMapMemInfoMemOUT->sClientSyncInfo.hMappingInfo =
4112 psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle; 3397 psKernelMemInfo->psKernelSyncInfo->psSyncDataMemInfoKM->sMemBlk.hOSMemHandle;
4113#endif 3398#endif
4114#endif
4115 3399
4116 psMapMemInfoMemOUT->sClientMemInfo.psClientSyncInfo = &psMapMemInfoMemOUT->sClientSyncInfo; 3400 psMapMemInfoMemOUT->sClientMemInfo.psClientSyncInfo = &psMapMemInfoMemOUT->sClientSyncInfo;
4117 3401
@@ -4174,7 +3458,7 @@ _SetDispatchTableEntry(IMG_UINT32 ui32Index,
4174 BridgeWrapperFunction pfFunction, 3458 BridgeWrapperFunction pfFunction,
4175 const IMG_CHAR *pszFunctionName) 3459 const IMG_CHAR *pszFunctionName)
4176{ 3460{
4177 static IMG_UINT32 ui32PrevIndex = ~0UL; /* -1 */ 3461 static IMG_UINT uiPrevIndex = ~0U; /* -1 */
4178#if !defined(DEBUG) 3462#if !defined(DEBUG)
4179 PVR_UNREFERENCED_PARAMETER(pszIOCName); 3463 PVR_UNREFERENCED_PARAMETER(pszIOCName);
4180#endif 3464#endif
@@ -4217,20 +3501,20 @@ _SetDispatchTableEntry(IMG_UINT32 ui32Index,
4217 * etc is likly to modify the available ioctls and thus be a point where 3501 * etc is likly to modify the available ioctls and thus be a point where
4218 * mistakes are exposed. This isn't run at at a performance critical time. 3502 * mistakes are exposed. This isn't run at at a performance critical time.
4219 */ 3503 */
4220// if((ui32PrevIndex != (IMG_UINT32)-1) && 3504// if((uiPrevIndex != (IMG_UINT)-1) &&
4221 if((ui32PrevIndex != ~0UL) && 3505 if((uiPrevIndex != ~0U) &&
4222 ((ui32Index >= ui32PrevIndex + DISPATCH_TABLE_GAP_THRESHOLD) || 3506 ((ui32Index >= uiPrevIndex + DISPATCH_TABLE_GAP_THRESHOLD) ||
4223 (ui32Index <= ui32PrevIndex))) 3507 (ui32Index <= uiPrevIndex)))
4224 { 3508 {
4225#if defined(DEBUG_BRIDGE_KM) 3509#if defined(DEBUG_BRIDGE_KM)
4226 PVR_DPF((PVR_DBG_WARNING, 3510 PVR_DPF((PVR_DBG_WARNING,
4227 "%s: There is a gap in the dispatch table between indices %u (%s) and %u (%s)", 3511 "%s: There is a gap in the dispatch table between indices %u (%s) and %u (%s)",
4228 __FUNCTION__, ui32PrevIndex, g_BridgeDispatchTable[ui32PrevIndex].pszIOCName, 3512 __FUNCTION__, uiPrevIndex, g_BridgeDispatchTable[uiPrevIndex].pszIOCName,
4229 ui32Index, pszIOCName)); 3513 ui32Index, pszIOCName));
4230#else 3514#else
4231 PVR_DPF((PVR_DBG_WARNING, 3515 PVR_DPF((PVR_DBG_WARNING,
4232 "%s: There is a gap in the dispatch table between indices %u and %u (%s)", 3516 "%s: There is a gap in the dispatch table between indices %u and %u (%s)",
4233 __FUNCTION__, (IMG_UINT)ui32PrevIndex, (IMG_UINT)ui32Index, pszIOCName)); 3517 __FUNCTION__, (IMG_UINT)uiPrevIndex, (IMG_UINT)ui32Index, pszIOCName));
4234#endif 3518#endif
4235 PVR_DPF((PVR_DBG_ERROR, "NOTE: Enabling DEBUG_BRIDGE_KM_DISPATCH_TABLE may help debug this issue.")); 3519 PVR_DPF((PVR_DBG_ERROR, "NOTE: Enabling DEBUG_BRIDGE_KM_DISPATCH_TABLE may help debug this issue."));
4236 } 3520 }
@@ -4243,7 +3527,7 @@ _SetDispatchTableEntry(IMG_UINT32 ui32Index,
4243 g_BridgeDispatchTable[ui32Index].ui32CopyFromUserTotalBytes = 0; 3527 g_BridgeDispatchTable[ui32Index].ui32CopyFromUserTotalBytes = 0;
4244#endif 3528#endif
4245 3529
4246 ui32PrevIndex = ui32Index; 3530 uiPrevIndex = ui32Index;
4247} 3531}
4248 3532
4249static IMG_INT 3533static IMG_INT
@@ -4340,10 +3624,6 @@ PVRSRVEventObjectOpenBW(IMG_UINT32 ui32BridgeID,
4340 PVRSRV_BRIDGE_OUT_EVENT_OBJECT_OPEN *psEventObjectOpenOUT, 3624 PVRSRV_BRIDGE_OUT_EVENT_OBJECT_OPEN *psEventObjectOpenOUT,
4341 PVRSRV_PER_PROCESS_DATA *psPerProc) 3625 PVRSRV_PER_PROCESS_DATA *psPerProc)
4342{ 3626{
4343#if defined (SUPPORT_SID_INTERFACE)
4344 PVRSRV_EVENTOBJECT_KM sEventObject;
4345 IMG_HANDLE hOSEvent;
4346#endif
4347 3627
4348 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_EVENT_OBJECT_OPEN); 3628 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_EVENT_OBJECT_OPEN);
4349 3629
@@ -4351,11 +3631,7 @@ PVRSRVEventObjectOpenBW(IMG_UINT32 ui32BridgeID,
4351 3631
4352 psEventObjectOpenOUT->eError = 3632 psEventObjectOpenOUT->eError =
4353 PVRSRVLookupHandle(psPerProc->psHandleBase, 3633 PVRSRVLookupHandle(psPerProc->psHandleBase,
4354#if defined (SUPPORT_SID_INTERFACE)
4355 &sEventObject.hOSEventKM,
4356#else
4357 &psEventObjectOpenIN->sEventObject.hOSEventKM, 3634 &psEventObjectOpenIN->sEventObject.hOSEventKM,
4358#endif
4359 psEventObjectOpenIN->sEventObject.hOSEventKM, 3635 psEventObjectOpenIN->sEventObject.hOSEventKM,
4360 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT); 3636 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT);
4361 3637
@@ -4364,38 +3640,18 @@ PVRSRVEventObjectOpenBW(IMG_UINT32 ui32BridgeID,
4364 return 0; 3640 return 0;
4365 } 3641 }
4366 3642
4367#if defined (SUPPORT_SID_INTERFACE)
4368 OSMemCopy(&sEventObject.szName,
4369 &psEventObjectOpenIN->sEventObject.szName,
4370 EVENTOBJNAME_MAXLENGTH);
4371
4372 psEventObjectOpenOUT->eError = OSEventObjectOpenKM(&sEventObject, &hOSEvent);
4373#else
4374 psEventObjectOpenOUT->eError = OSEventObjectOpenKM(&psEventObjectOpenIN->sEventObject, &psEventObjectOpenOUT->hOSEvent); 3643 psEventObjectOpenOUT->eError = OSEventObjectOpenKM(&psEventObjectOpenIN->sEventObject, &psEventObjectOpenOUT->hOSEvent);
4375#endif
4376 3644
4377 if(psEventObjectOpenOUT->eError != PVRSRV_OK) 3645 if(psEventObjectOpenOUT->eError != PVRSRV_OK)
4378 { 3646 {
4379 return 0; 3647 return 0;
4380 } 3648 }
4381 3649
4382#if defined (SUPPORT_SID_INTERFACE)
4383/* Windows7, WinXP and Vista already use an Index type handle which the client glue uses directly */
4384/* Linux requires a SID handle */
4385#if !defined (WINXP) && !defined(SUPPORT_VISTA)
4386 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
4387 &psEventObjectOpenOUT->hOSEvent,
4388 hOSEvent,
4389 PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT,
4390 PVRSRV_HANDLE_ALLOC_FLAG_MULTI);
4391#endif
4392#else
4393 PVRSRVAllocHandleNR(psPerProc->psHandleBase, 3650 PVRSRVAllocHandleNR(psPerProc->psHandleBase,
4394 &psEventObjectOpenOUT->hOSEvent, 3651 &psEventObjectOpenOUT->hOSEvent,
4395 psEventObjectOpenOUT->hOSEvent, 3652 psEventObjectOpenOUT->hOSEvent,
4396 PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT, 3653 PVRSRV_HANDLE_TYPE_EVENT_OBJECT_CONNECT,
4397 PVRSRV_HANDLE_ALLOC_FLAG_MULTI); 3654 PVRSRV_HANDLE_ALLOC_FLAG_MULTI);
4398#endif
4399 3655
4400 COMMIT_HANDLE_BATCH_OR_ERROR(psEventObjectOpenOUT->eError, psPerProc) 3656 COMMIT_HANDLE_BATCH_OR_ERROR(psEventObjectOpenOUT->eError, psPerProc)
4401 3657
@@ -4410,19 +3666,12 @@ PVRSRVEventObjectCloseBW(IMG_UINT32 ui32BridgeID,
4410 PVRSRV_PER_PROCESS_DATA *psPerProc) 3666 PVRSRV_PER_PROCESS_DATA *psPerProc)
4411{ 3667{
4412 IMG_HANDLE hOSEventKM; 3668 IMG_HANDLE hOSEventKM;
4413#if defined (SUPPORT_SID_INTERFACE)
4414 PVRSRV_EVENTOBJECT_KM sEventObject;
4415#endif
4416 3669
4417 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_EVENT_OBJECT_CLOSE); 3670 PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_EVENT_OBJECT_CLOSE);
4418 3671
4419 psRetOUT->eError = 3672 psRetOUT->eError =
4420 PVRSRVLookupHandle(psPerProc->psHandleBase, 3673 PVRSRVLookupHandle(psPerProc->psHandleBase,
4421#if defined (SUPPORT_SID_INTERFACE)
4422 &sEventObject.hOSEventKM,
4423#else
4424 &psEventObjectCloseIN->sEventObject.hOSEventKM, 3674 &psEventObjectCloseIN->sEventObject.hOSEventKM,
4425#endif
4426 psEventObjectCloseIN->sEventObject.hOSEventKM, 3675 psEventObjectCloseIN->sEventObject.hOSEventKM,
4427 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT); 3676 PVRSRV_HANDLE_TYPE_SHARED_EVENT_OBJECT);
4428 if(psRetOUT->eError != PVRSRV_OK) 3677 if(psRetOUT->eError != PVRSRV_OK)
@@ -4440,20 +3689,7 @@ PVRSRVEventObjectCloseBW(IMG_UINT32 ui32BridgeID,
4440 return 0; 3689 return 0;
4441 } 3690 }
4442 3691
4443#if defined (SUPPORT_SID_INTERFACE)
4444 if(CopyFromUserWrapper(psPerProc, ui32BridgeID,
4445 &sEventObject.szName,
4446 &psEventObjectCloseIN->sEventObject.szName,
4447 EVENTOBJNAME_MAXLENGTH) != PVRSRV_OK)
4448 {
4449 /*not nulling pointer, out of scope*/
4450 return -EFAULT;
4451 }
4452
4453 psRetOUT->eError = OSEventObjectCloseKM(&sEventObject, hOSEventKM);
4454#else
4455 psRetOUT->eError = OSEventObjectCloseKM(&psEventObjectCloseIN->sEventObject, hOSEventKM); 3692 psRetOUT->eError = OSEventObjectCloseKM(&psEventObjectCloseIN->sEventObject, hOSEventKM);
4456#endif
4457 3693
4458 return 0; 3694 return 0;
4459} 3695}
@@ -4581,6 +3817,17 @@ static PVRSRV_ERROR DoModifyCompleteSyncOps(MODIFY_SYNC_OP_INFO *psModSyncOpInfo
4581 psKernelSyncInfo->psSyncData->ui32ReadOpsComplete++; 3817 psKernelSyncInfo->psSyncData->ui32ReadOpsComplete++;
4582 } 3818 }
4583 3819
3820 /* update the ROp2Complete */
3821 if(psModSyncOpInfo->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_RO2_INC)
3822 {
3823 psKernelSyncInfo->psSyncData->ui32ReadOps2Complete++;
3824 }
3825
3826 PVR_TTRACE(PVRSRV_TRACE_GROUP_MODOBJ, PVRSRV_TRACE_CLASS_CMD_COMP_START, MODOBJ_TOKEN_COMPLETE_PENDING);
3827 PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_MODOBJ, MODOBJ_TOKEN_SYNC_UPDATE,
3828 psKernelSyncInfo, PVRSRV_SYNCOP_COMPLETE);
3829 PVR_TTRACE(PVRSRV_TRACE_GROUP_MODOBJ, PVRSRV_TRACE_CLASS_CMD_COMP_END, MODOBJ_TOKEN_COMPLETE_PENDING);
3830
4584 return PVRSRV_OK; 3831 return PVRSRV_OK;
4585} 3832}
4586 3833
@@ -4715,8 +3962,6 @@ PVRSRVDestroySyncInfoModObjBW(IMG_UINT32
4715 return 0; 3962 return 0;
4716 } 3963 }
4717 3964
4718 PVRSRVKernelSyncInfoDecRef(psModSyncOpInfo->psKernelSyncInfo, IMG_NULL);
4719
4720 psDestroySyncInfoModObjOUT->eError = PVRSRVReleaseHandle(psPerProc->psHandleBase, 3965 psDestroySyncInfoModObjOUT->eError = PVRSRVReleaseHandle(psPerProc->psHandleBase,
4721 psDestroySyncInfoModObjIN->hKernelSyncInfoModObj, 3966 psDestroySyncInfoModObjIN->hKernelSyncInfoModObj,
4722 PVRSRV_HANDLE_TYPE_SYNC_INFO_MOD_OBJ); 3967 PVRSRV_HANDLE_TYPE_SYNC_INFO_MOD_OBJ);
@@ -4799,14 +4044,42 @@ PVRSRVModifyPendingSyncOpsBW(IMG_UINT32 ui32BridgeID,
4799 psModifySyncOpsOUT->ui32WriteOpsPending = psKernelSyncInfo->psSyncData->ui32WriteOpsPending; 4044 psModifySyncOpsOUT->ui32WriteOpsPending = psKernelSyncInfo->psSyncData->ui32WriteOpsPending;
4800 psModifySyncOpsOUT->ui32ReadOps2Pending = psKernelSyncInfo->psSyncData->ui32ReadOps2Pending; 4045 psModifySyncOpsOUT->ui32ReadOps2Pending = psKernelSyncInfo->psSyncData->ui32ReadOps2Pending;
4801 4046
4047 PVR_TTRACE(PVRSRV_TRACE_GROUP_MODOBJ, PVRSRV_TRACE_CLASS_CMD_START, MODOBJ_TOKEN_MODIFY_PENDING);
4048 if(psModifySyncOpsIN->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_WO_INC)
4049 {
4050 PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_MODOBJ, MODOBJ_TOKEN_WRITE_SYNC,
4051 psKernelSyncInfo, PVRSRV_SYNCOP_SAMPLE);
4052 }
4053 else if (psModifySyncOpsIN->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_RO_INC)
4054 {
4055 PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_MODOBJ, MODOBJ_TOKEN_READ_SYNC,
4056 psKernelSyncInfo, PVRSRV_SYNCOP_SAMPLE);
4057 }
4058 else if (psModifySyncOpsIN->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_RO2_INC)
4059 {
4060 PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_MODOBJ, MODOBJ_TOKEN_READ2_SYNC,
4061 psKernelSyncInfo, PVRSRV_SYNCOP_SAMPLE);
4062 }
4063 else
4064 {
4065 PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_MODOBJ, MODOBJ_TOKEN_READ_WRITE_SYNC,
4066 psKernelSyncInfo, PVRSRV_SYNCOP_SAMPLE);
4067 }
4068 PVR_TTRACE(PVRSRV_TRACE_GROUP_MODOBJ, PVRSRV_TRACE_CLASS_CMD_END, MODOBJ_TOKEN_MODIFY_PENDING);
4069
4802 if(psModifySyncOpsIN->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_WO_INC) 4070 if(psModifySyncOpsIN->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_WO_INC)
4803 { 4071 {
4804 psKernelSyncInfo->psSyncData->ui32WriteOpsPending++; 4072 SyncTakeWriteOp(psKernelSyncInfo, SYNC_OP_CLASS_MODOBJ);
4805 } 4073 }
4806 4074
4807 if(psModifySyncOpsIN->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_RO_INC) 4075 if(psModifySyncOpsIN->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_RO_INC)
4808 { 4076 {
4809 psKernelSyncInfo->psSyncData->ui32ReadOpsPending++; 4077 SyncTakeReadOp(psKernelSyncInfo, SYNC_OP_CLASS_MODOBJ);
4078 }
4079
4080 if(psModifySyncOpsIN->ui32ModifyFlags & PVRSRV_MODIFYSYNCOPS_FLAGS_RO2_INC)
4081 {
4082 SyncTakeReadOp2(psKernelSyncInfo, SYNC_OP_CLASS_MODOBJ);
4810 } 4083 }
4811 4084
4812 /* pull the resman item to the front of the list */ 4085 /* pull the resman item to the front of the list */
@@ -5209,8 +4482,6 @@ CommonBridgeInit(IMG_VOID)
5209 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_EXT_MEMORY, DummyBW); 4482 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_EXT_MEMORY, DummyBW);
5210 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEV_MEMORY, PVRSRVMapDeviceMemoryBW); 4483 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEV_MEMORY, PVRSRVMapDeviceMemoryBW);
5211 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_DEV_MEMORY, PVRSRVUnmapDeviceMemoryBW); 4484 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_DEV_MEMORY, PVRSRVUnmapDeviceMemoryBW);
5212 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEVICECLASS_MEMORY, PVRSRVMapDeviceClassMemoryBW);
5213 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_DEVICECLASS_MEMORY, PVRSRVUnmapDeviceClassMemoryBW);
5214 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_MEM_INFO_TO_USER, DummyBW); 4485 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_MEM_INFO_TO_USER, DummyBW);
5215 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_MEM_INFO_FROM_USER, DummyBW); 4486 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_MEM_INFO_FROM_USER, DummyBW);
5216 SetDispatchTableEntry(PVRSRV_BRIDGE_EXPORT_DEVICEMEM, PVRSRVExportDeviceMemBW); 4487 SetDispatchTableEntry(PVRSRV_BRIDGE_EXPORT_DEVICEMEM, PVRSRVExportDeviceMemBW);
@@ -5218,10 +4489,6 @@ CommonBridgeInit(IMG_VOID)
5218 SetDispatchTableEntry(PVRSRV_BRIDGE_CHG_DEV_MEM_ATTRIBS, PVRSRVChangeDeviceMemoryAttributesBW); 4489 SetDispatchTableEntry(PVRSRV_BRIDGE_CHG_DEV_MEM_ATTRIBS, PVRSRVChangeDeviceMemoryAttributesBW);
5219 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEV_MEMORY_2, PVRSRVMapDeviceMemoryBW); 4490 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEV_MEMORY_2, PVRSRVMapDeviceMemoryBW);
5220 SetDispatchTableEntry(PVRSRV_BRIDGE_EXPORT_DEVICEMEM_2, PVRSRVExportDeviceMemBW); 4491 SetDispatchTableEntry(PVRSRV_BRIDGE_EXPORT_DEVICEMEM_2, PVRSRVExportDeviceMemBW);
5221 SetDispatchTableEntry(PVRSRV_BRIDGE_MULTI_MANAGE_DEV_MEM, PVRSRVMultiManageDevMemBW);
5222 SetDispatchTableEntry(PVRSRV_BRIDGE_CORE_CMD_RESERVED_1, DummyBW);
5223 SetDispatchTableEntry(PVRSRV_BRIDGE_CORE_CMD_RESERVED_2, DummyBW);
5224 SetDispatchTableEntry(PVRSRV_BRIDGE_CORE_CMD_RESERVED_3, DummyBW);
5225#if defined(SUPPORT_ION) 4492#if defined(SUPPORT_ION)
5226 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_ION_HANDLE, PVRSRVMapIonHandleBW); 4493 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_ION_HANDLE, PVRSRVMapIonHandleBW);
5227 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_ION_HANDLE, PVRSRVUnmapIonHandleBW); 4494 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_ION_HANDLE, PVRSRVUnmapIonHandleBW);
@@ -5275,6 +4542,10 @@ CommonBridgeInit(IMG_VOID)
5275 /* DisplayClass APIs */ 4542 /* DisplayClass APIs */
5276 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_OEMJTABLE, DummyBW); 4543 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_OEMJTABLE, DummyBW);
5277 4544
4545#if defined(SUPPORT_PVRSRV_DEVICE_CLASS)
4546 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEVICECLASS_MEMORY, PVRSRVMapDeviceClassMemoryBW);
4547 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_DEVICECLASS_MEMORY, PVRSRVUnmapDeviceClassMemoryBW);
4548
5278 /* device class enum */ 4549 /* device class enum */
5279 SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_CLASS, PVRSRVEnumerateDCBW); 4550 SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_CLASS, PVRSRVEnumerateDCBW);
5280 4551
@@ -5305,6 +4576,37 @@ CommonBridgeInit(IMG_VOID)
5305 SetDispatchTableEntry(PVRSRV_BRIDGE_CLOSE_BUFFERCLASS_DEVICE, PVRSRVCloseBCDeviceBW); 4576 SetDispatchTableEntry(PVRSRV_BRIDGE_CLOSE_BUFFERCLASS_DEVICE, PVRSRVCloseBCDeviceBW);
5306 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_BUFFERCLASS_INFO, PVRSRVGetBCInfoBW); 4577 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_BUFFERCLASS_INFO, PVRSRVGetBCInfoBW);
5307 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_BUFFERCLASS_BUFFER, PVRSRVGetBCBufferBW); 4578 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_BUFFERCLASS_BUFFER, PVRSRVGetBCBufferBW);
4579#else /* defined(SUPPORT_PVRSRV_DEVICE_CLASS) */
4580 SetDispatchTableEntry(PVRSRV_BRIDGE_MAP_DEVICECLASS_MEMORY, DummyBW);
4581 SetDispatchTableEntry(PVRSRV_BRIDGE_UNMAP_DEVICECLASS_MEMORY, DummyBW);
4582
4583 /* device class enum */
4584 SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_CLASS, DummyBW);
4585
4586 /* display class API */
4587 SetDispatchTableEntry(PVRSRV_BRIDGE_OPEN_DISPCLASS_DEVICE, DummyBW);
4588 SetDispatchTableEntry(PVRSRV_BRIDGE_CLOSE_DISPCLASS_DEVICE, DummyBW);
4589 SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_DISPCLASS_FORMATS, DummyBW);
4590 SetDispatchTableEntry(PVRSRV_BRIDGE_ENUM_DISPCLASS_DIMS, DummyBW);
4591 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_SYSBUFFER, DummyBW);
4592 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_INFO, DummyBW);
4593 SetDispatchTableEntry(PVRSRV_BRIDGE_CREATE_DISPCLASS_SWAPCHAIN, DummyBW);
4594 SetDispatchTableEntry(PVRSRV_BRIDGE_DESTROY_DISPCLASS_SWAPCHAIN, DummyBW);
4595 SetDispatchTableEntry(PVRSRV_BRIDGE_SET_DISPCLASS_DSTRECT, DummyBW);
4596 SetDispatchTableEntry(PVRSRV_BRIDGE_SET_DISPCLASS_SRCRECT, DummyBW);
4597 SetDispatchTableEntry(PVRSRV_BRIDGE_SET_DISPCLASS_DSTCOLOURKEY, DummyBW);
4598 SetDispatchTableEntry(PVRSRV_BRIDGE_SET_DISPCLASS_SRCCOLOURKEY, DummyBW);
4599 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_DISPCLASS_BUFFERS, DummyBW);
4600 SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER, DummyBW);
4601 SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_BUFFER2, DummyBW);
4602 SetDispatchTableEntry(PVRSRV_BRIDGE_SWAP_DISPCLASS_TO_SYSTEM, DummyBW);
4603
4604 /* buffer class API */
4605 SetDispatchTableEntry(PVRSRV_BRIDGE_OPEN_BUFFERCLASS_DEVICE, DummyBW);
4606 SetDispatchTableEntry(PVRSRV_BRIDGE_CLOSE_BUFFERCLASS_DEVICE, DummyBW);
4607 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_BUFFERCLASS_INFO, DummyBW);
4608 SetDispatchTableEntry(PVRSRV_BRIDGE_GET_BUFFERCLASS_BUFFER, DummyBW);
4609#endif /* defined(SUPPORT_PVRSRV_DEVICE_CLASS) */
5308 4610
5309 /* Wrap/Unwrap external memory */ 4611 /* Wrap/Unwrap external memory */
5310 SetDispatchTableEntry(PVRSRV_BRIDGE_WRAP_EXT_MEMORY, PVRSRVWrapExtMemoryBW); 4612 SetDispatchTableEntry(PVRSRV_BRIDGE_WRAP_EXT_MEMORY, PVRSRVWrapExtMemoryBW);
@@ -5416,6 +4718,7 @@ IMG_INT BridgedDispatchKM(PVRSRV_PER_PROCESS_DATA * psPerProc,
5416 case PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_DISCONNECT_SERVICES): 4718 case PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_DISCONNECT_SERVICES):
5417 case PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_INITSRV_CONNECT): 4719 case PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_INITSRV_CONNECT):
5418 case PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_INITSRV_DISCONNECT): 4720 case PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_INITSRV_DISCONNECT):
4721 case PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_UM_KM_COMPAT_CHECK):
5419 break; 4722 break;
5420 default: 4723 default:
5421 PVR_DPF((PVR_DBG_ERROR, "%s: Driver initialisation not completed yet.", 4724 PVR_DPF((PVR_DBG_ERROR, "%s: Driver initialisation not completed yet.",
@@ -5476,15 +4779,21 @@ IMG_INT BridgedDispatchKM(PVRSRV_PER_PROCESS_DATA * psPerProc,
5476 __FUNCTION__, ui32BridgeID)); 4779 __FUNCTION__, ui32BridgeID));
5477 goto return_fault; 4780 goto return_fault;
5478 } 4781 }
5479 pfBridgeHandler = 4782
5480 (BridgeWrapperFunction)g_BridgeDispatchTable[ui32BridgeID].pfFunction; 4783 if( ui32BridgeID == PVRSRV_GET_BRIDGE_ID(PVRSRV_BRIDGE_UM_KM_COMPAT_CHECK))
5481 err = pfBridgeHandler(ui32BridgeID, 4784 PVRSRVCompatCheckKM(psBridgeIn, psBridgeOut);
4785 else
4786 {
4787 pfBridgeHandler =
4788 (BridgeWrapperFunction)g_BridgeDispatchTable[ui32BridgeID].pfFunction;
4789 err = pfBridgeHandler(ui32BridgeID,
5482 psBridgeIn, 4790 psBridgeIn,
5483 psBridgeOut, 4791 psBridgeOut,
5484 psPerProc); 4792 psPerProc);
5485 if(err < 0) 4793 if(err < 0)
5486 { 4794 {
5487 goto return_fault; 4795 goto return_fault;
4796 }
5488 } 4797 }
5489 4798
5490#if defined(__linux__) 4799#if defined(__linux__)