diff options
Diffstat (limited to 'jacinto6/sgx_src/eurasia_km/services4/srvkm/common/refcount.c')
-rw-r--r-- | jacinto6/sgx_src/eurasia_km/services4/srvkm/common/refcount.c | 97 |
1 files changed, 92 insertions, 5 deletions
diff --git a/jacinto6/sgx_src/eurasia_km/services4/srvkm/common/refcount.c b/jacinto6/sgx_src/eurasia_km/services4/srvkm/common/refcount.c index fa64b23..a6dcb19 100644 --- a/jacinto6/sgx_src/eurasia_km/services4/srvkm/common/refcount.c +++ b/jacinto6/sgx_src/eurasia_km/services4/srvkm/common/refcount.c | |||
@@ -71,9 +71,11 @@ static DEFINE_SPINLOCK(gsCCBLock); | |||
71 | #if defined(__linux__) | 71 | #if defined(__linux__) |
72 | #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP (1U << 16) | 72 | #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP (1U << 16) |
73 | #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2 (1U << 17) | 73 | #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2 (1U << 17) |
74 | #define PVRSRV_REFCOUNT_CCB_DEBUG_ION_SYNC (1U << 18) | ||
74 | #else | 75 | #else |
75 | #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP 0 | 76 | #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP 0 |
76 | #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2 0 | 77 | #define PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2 0 |
78 | #define PVRSRV_REFCOUNT_CCB_DEBUG_ION_SYNC 0 | ||
77 | #endif | 79 | #endif |
78 | 80 | ||
79 | #define PVRSRV_REFCOUNT_CCB_DEBUG_ALL ~0U | 81 | #define PVRSRV_REFCOUNT_CCB_DEBUG_ALL ~0U |
@@ -81,6 +83,9 @@ static DEFINE_SPINLOCK(gsCCBLock); | |||
81 | /*static const IMG_UINT guiDebugMask = PVRSRV_REFCOUNT_CCB_DEBUG_ALL;*/ | 83 | /*static const IMG_UINT guiDebugMask = PVRSRV_REFCOUNT_CCB_DEBUG_ALL;*/ |
82 | static const IMG_UINT guiDebugMask = | 84 | static const IMG_UINT guiDebugMask = |
83 | PVRSRV_REFCOUNT_CCB_DEBUG_SYNCINFO | | 85 | PVRSRV_REFCOUNT_CCB_DEBUG_SYNCINFO | |
86 | #if defined(SUPPORT_ION) | ||
87 | PVRSRV_REFCOUNT_CCB_DEBUG_ION_SYNC | | ||
88 | #endif | ||
84 | PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2; | 89 | PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2; |
85 | 90 | ||
86 | typedef struct | 91 | typedef struct |
@@ -120,7 +125,7 @@ void PVRSRVDumpRefCountCCB(void) | |||
120 | 125 | ||
121 | /* Early on, we won't have MAX_REFCOUNT_CCB_SIZE messages */ | 126 | /* Early on, we won't have MAX_REFCOUNT_CCB_SIZE messages */ |
122 | if(!psRefCountCCBEntry->pszFile) | 127 | if(!psRefCountCCBEntry->pszFile) |
123 | break; | 128 | continue; |
124 | 129 | ||
125 | PVR_LOG(("%s %d %s:%d", psRefCountCCBEntry->pcMesg, | 130 | PVR_LOG(("%s %d %s:%d", psRefCountCCBEntry->pcMesg, |
126 | psRefCountCCBEntry->ui32PID, | 131 | psRefCountCCBEntry->ui32PID, |
@@ -477,7 +482,7 @@ void PVRSRVOffsetStructIncRef2(const IMG_CHAR *pszFile, IMG_INT iLine, | |||
477 | psOffsetStruct, | 482 | psOffsetStruct, |
478 | psOffsetStruct->ui32RefCount, | 483 | psOffsetStruct->ui32RefCount, |
479 | psOffsetStruct->ui32RefCount + 1, | 484 | psOffsetStruct->ui32RefCount + 1, |
480 | psOffsetStruct->ui32RealByteSize); | 485 | psOffsetStruct->uiRealByteSize); |
481 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; | 486 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; |
482 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; | 487 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; |
483 | 488 | ||
@@ -509,7 +514,7 @@ void PVRSRVOffsetStructDecRef2(const IMG_CHAR *pszFile, IMG_INT iLine, | |||
509 | psOffsetStruct, | 514 | psOffsetStruct, |
510 | psOffsetStruct->ui32RefCount, | 515 | psOffsetStruct->ui32RefCount, |
511 | psOffsetStruct->ui32RefCount - 1, | 516 | psOffsetStruct->ui32RefCount - 1, |
512 | psOffsetStruct->ui32RealByteSize); | 517 | psOffsetStruct->uiRealByteSize); |
513 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; | 518 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; |
514 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; | 519 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; |
515 | 520 | ||
@@ -541,7 +546,7 @@ void PVRSRVOffsetStructIncMapped2(const IMG_CHAR *pszFile, IMG_INT iLine, | |||
541 | psOffsetStruct, | 546 | psOffsetStruct, |
542 | psOffsetStruct->ui32Mapped, | 547 | psOffsetStruct->ui32Mapped, |
543 | psOffsetStruct->ui32Mapped + 1, | 548 | psOffsetStruct->ui32Mapped + 1, |
544 | psOffsetStruct->ui32RealByteSize); | 549 | psOffsetStruct->uiRealByteSize); |
545 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; | 550 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; |
546 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; | 551 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; |
547 | 552 | ||
@@ -573,7 +578,7 @@ void PVRSRVOffsetStructDecMapped2(const IMG_CHAR *pszFile, IMG_INT iLine, | |||
573 | psOffsetStruct, | 578 | psOffsetStruct, |
574 | psOffsetStruct->ui32Mapped, | 579 | psOffsetStruct->ui32Mapped, |
575 | psOffsetStruct->ui32Mapped - 1, | 580 | psOffsetStruct->ui32Mapped - 1, |
576 | psOffsetStruct->ui32RealByteSize); | 581 | psOffsetStruct->uiRealByteSize); |
577 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; | 582 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; |
578 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; | 583 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; |
579 | 584 | ||
@@ -583,6 +588,88 @@ skip: | |||
583 | psOffsetStruct->ui32Mapped--; | 588 | psOffsetStruct->ui32Mapped--; |
584 | } | 589 | } |
585 | 590 | ||
591 | #if defined(SUPPORT_ION) | ||
592 | PVRSRV_ERROR PVRSRVIonBufferSyncInfoIncRef2(const IMG_CHAR *pszFile, IMG_INT iLine, | ||
593 | IMG_HANDLE hUnique, | ||
594 | IMG_HANDLE hDevCookie, | ||
595 | IMG_HANDLE hDevMemContext, | ||
596 | PVRSRV_ION_SYNC_INFO **ppsIonSyncInfo, | ||
597 | PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo) | ||
598 | { | ||
599 | PVRSRV_ERROR eError; | ||
600 | |||
601 | /* | ||
602 | We have to do the call 1st as we need to Ion syninfo which it returns | ||
603 | */ | ||
604 | eError = PVRSRVIonBufferSyncAcquire(hUnique, | ||
605 | hDevCookie, | ||
606 | hDevMemContext, | ||
607 | ppsIonSyncInfo); | ||
608 | |||
609 | if (eError == PVRSRV_OK) | ||
610 | { | ||
611 | if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_ION_SYNC)) | ||
612 | goto skip; | ||
613 | |||
614 | PVRSRV_LOCK_CCB(); | ||
615 | |||
616 | gsRefCountCCB[giOffset].pszFile = pszFile; | ||
617 | gsRefCountCCB[giOffset].iLine = iLine; | ||
618 | gsRefCountCCB[giOffset].ui32PID = OSGetCurrentProcessIDKM(); | ||
619 | snprintf(gsRefCountCCB[giOffset].pcMesg, | ||
620 | PVRSRV_REFCOUNT_CCB_MESG_MAX - 1, | ||
621 | PVRSRV_REFCOUNT_CCB_FMT_STRING, | ||
622 | "ION_SYNC", | ||
623 | (*ppsIonSyncInfo)->psSyncInfo, | ||
624 | psKernelMemInfo, | ||
625 | NULL, | ||
626 | *ppsIonSyncInfo, | ||
627 | (*ppsIonSyncInfo)->ui32RefCount - 1, | ||
628 | (*ppsIonSyncInfo)->ui32RefCount, | ||
629 | 0); | ||
630 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; | ||
631 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; | ||
632 | |||
633 | PVRSRV_UNLOCK_CCB(); | ||
634 | } | ||
635 | |||
636 | skip: | ||
637 | return eError; | ||
638 | } | ||
639 | |||
640 | void PVRSRVIonBufferSyncInfoDecRef2(const IMG_CHAR *pszFile, IMG_INT iLine, | ||
641 | PVRSRV_ION_SYNC_INFO *psIonSyncInfo, | ||
642 | PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo) | ||
643 | { | ||
644 | if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_ION_SYNC)) | ||
645 | goto skip; | ||
646 | |||
647 | PVRSRV_LOCK_CCB(); | ||
648 | |||
649 | gsRefCountCCB[giOffset].pszFile = pszFile; | ||
650 | gsRefCountCCB[giOffset].iLine = iLine; | ||
651 | gsRefCountCCB[giOffset].ui32PID = OSGetCurrentProcessIDKM(); | ||
652 | snprintf(gsRefCountCCB[giOffset].pcMesg, | ||
653 | PVRSRV_REFCOUNT_CCB_MESG_MAX - 1, | ||
654 | PVRSRV_REFCOUNT_CCB_FMT_STRING, | ||
655 | "ION_SYNC", | ||
656 | psIonSyncInfo->psSyncInfo, | ||
657 | psKernelMemInfo, | ||
658 | NULL, | ||
659 | psIonSyncInfo, | ||
660 | psIonSyncInfo->ui32RefCount, | ||
661 | psIonSyncInfo->ui32RefCount - 1, | ||
662 | 0); | ||
663 | gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; | ||
664 | giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; | ||
665 | |||
666 | PVRSRV_UNLOCK_CCB(); | ||
667 | skip: | ||
668 | PVRSRVIonBufferSyncRelease(psIonSyncInfo); | ||
669 | } | ||
670 | |||
671 | #endif /* defined (SUPPORT_ION) */ | ||
672 | |||
586 | #endif /* defined(__linux__) */ | 673 | #endif /* defined(__linux__) */ |
587 | 674 | ||
588 | #endif /* defined(PVRSRV_REFCOUNT_DEBUG) */ | 675 | #endif /* defined(PVRSRV_REFCOUNT_DEBUG) */ |