IMG_INTERNAL void PVRSRVKernelSyncInfoDecRef2(const IMG_CHAR *pszFile, IMG_INT iLine, PVRSRV_KERNEL_SYNC_INFO *psKernelSyncInfo, PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo) { if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_SYNCINFO)) goto skip; PVRSRV_LOCK_CCB(); gsRefCountCCB[giOffset].pszFile = pszFile; gsRefCountCCB[giOffset].iLine = iLine; gsRefCountCCB[giOffset].ui32PID = OSGetCurrentProcessIDKM(); snprintf(gsRefCountCCB[giOffset].pcMesg, PVRSRV_REFCOUNT_CCB_MESG_MAX - 1, PVRSRV_REFCOUNT_CCB_FMT_STRING, "SYNCINFO", psKernelSyncInfo, psKernelMemInfo, (psKernelMemInfo) ? psKernelMemInfo->sMemBlk.hOSMemHandle : NULL, NULL, psKernelSyncInfo->ui32RefCount, psKernelSyncInfo->ui32RefCount - 1, (psKernelMemInfo) ? psKernelMemInfo->uAllocSize : 0); gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; PVRSRV_UNLOCK_CCB(); skip: psKernelSyncInfo->ui32RefCount--; }
IMG_INTERNAL void PVRSRVOffsetStructDecMapped2(const IMG_CHAR *pszFile, IMG_INT iLine, PKV_OFFSET_STRUCT psOffsetStruct) { if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_MMAP2)) goto skip; PVRSRV_LOCK_CCB(); gsRefCountCCB[giOffset].pszFile = pszFile; gsRefCountCCB[giOffset].iLine = iLine; gsRefCountCCB[giOffset].ui32PID = OSGetCurrentProcessIDKM(); snprintf(gsRefCountCCB[giOffset].pcMesg, PVRSRV_REFCOUNT_CCB_MESG_MAX - 1, PVRSRV_REFCOUNT_CCB_FMT_STRING, "MMAP2", NULL, NULL, psOffsetStruct->psLinuxMemArea, psOffsetStruct, psOffsetStruct->ui32Mapped, psOffsetStruct->ui32Mapped - 1, psOffsetStruct->ui32RealByteSize); gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; PVRSRV_UNLOCK_CCB(); skip: psOffsetStruct->ui32Mapped--; }
IMG_INTERNAL void PVRSRVBMBufDecExport2(const IMG_CHAR *pszFile, IMG_INT iLine, BM_BUF *pBuf) { if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_BM_BUF2)) goto skip; PVRSRV_LOCK_CCB(); gsRefCountCCB[giOffset].pszFile = pszFile; gsRefCountCCB[giOffset].iLine = iLine; gsRefCountCCB[giOffset].ui32PID = OSGetCurrentProcessIDKM(); snprintf(gsRefCountCCB[giOffset].pcMesg, PVRSRV_REFCOUNT_CCB_MESG_MAX - 1, PVRSRV_REFCOUNT_CCB_FMT_STRING, "BM_BUF2", NULL, NULL, BM_HandleToOSMemHandle(pBuf), pBuf, pBuf->ui32ExportCount, pBuf->ui32ExportCount - 1, (pBuf->pMapping) ? pBuf->pMapping->uSize : 0); gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; PVRSRV_UNLOCK_CCB(); skip: pBuf->ui32ExportCount--; }
IMG_INTERNAL void PVRSRVBMXProcDecRef2(const IMG_CHAR *pszFile, IMG_INT iLine, IMG_UINT32 ui32Index) { if(!(guiDebugMask & PVRSRV_REFCOUNT_CCB_DEBUG_BM_XPROC)) goto skip; PVRSRV_LOCK_CCB(); gsRefCountCCB[giOffset].pszFile = pszFile; gsRefCountCCB[giOffset].iLine = iLine; gsRefCountCCB[giOffset].ui32PID = OSGetCurrentProcessIDKM(); snprintf(gsRefCountCCB[giOffset].pcMesg, PVRSRV_REFCOUNT_CCB_MESG_MAX - 1, PVRSRV_REFCOUNT_CCB_FMT_STRING, "BM_XPROC", NULL, NULL, gXProcWorkaroundShareData[ui32Index].hOSMemHandle, (IMG_VOID *) ui32Index, gXProcWorkaroundShareData[ui32Index].ui32RefCount, gXProcWorkaroundShareData[ui32Index].ui32RefCount - 1, gXProcWorkaroundShareData[ui32Index].ui32Size); gsRefCountCCB[giOffset].pcMesg[PVRSRV_REFCOUNT_CCB_MESG_MAX - 1] = 0; giOffset = (giOffset + 1) % PVRSRV_REFCOUNT_CCB_MAX; PVRSRV_UNLOCK_CCB(); skip: gXProcWorkaroundShareData[ui32Index].ui32RefCount--; }
IMG_INTERNAL void PVRSRVDumpRefCountCCB(void) { int i; PVRSRV_LOCK_CCB(); PVR_LOG(("%s", gszHeader)); for(i = 0; i < PVRSRV_REFCOUNT_CCB_MAX; i++) { PVRSRV_REFCOUNT_CCB *psRefCountCCBEntry = &gsRefCountCCB[(giOffset + i) % PVRSRV_REFCOUNT_CCB_MAX]; /* Early on, we won't have MAX_REFCOUNT_CCB_SIZE messages */ if(!psRefCountCCBEntry->pszFile) break; PVR_LOG(("%s %d %s:%d", psRefCountCCBEntry->pcMesg, psRefCountCCBEntry->ui32PID, psRefCountCCBEntry->pszFile, psRefCountCCBEntry->iLine)); } PVRSRV_UNLOCK_CCB(); }