PVRSRV_ERROR PVRSRVServerSyncQueueHWOpKM(SERVER_SYNC_PRIMITIVE *psSync, IMG_UINT32 *pui32FenceValue, IMG_UINT32 *pui32UpdateValue) { /* FIXME: Lock */ _ServerSyncTakeOperation(psSync, IMG_TRUE, pui32FenceValue, pui32UpdateValue); /* FIXME: Unlock */ /* Note: We might want to consider optimising the fences that we write for HW operations but for now just clear it back to unknown */ psSync->ui32LastSyncRequesterID = SYNC_REQUESTOR_UNKNOWN; if (psSync->bSWOperation) { IMG_CHAR azTmp[100]; OSSNPrintf(azTmp, sizeof(azTmp), "Wait for HW ops and dummy update for SW ops (%p, FW VAddr = 0x%08x, value = 0x%08x)", psSync, SyncPrimGetFirmwareAddr(psSync->psSync), *pui32FenceValue); PDumpCommentKM(azTmp, 0); if (psSync->bSWOpStartedInCaptRange) { /* Dump a POL for the previous HW operation */ SyncPrimPDumpPol(psSync->psSync, psSync->ui32LastHWUpdate, 0xffffffff, PDUMP_POLL_OPERATOR_EQUAL, 0); } /* Dump the expected value (i.e. the value after all the SW operations) */ SyncPrimPDumpValue(psSync->psSync, *pui32FenceValue); /* Reset the state as we've just done a HW operation */ psSync->bSWOperation = IMG_FALSE; } SYNC_UPDATES_PRINT("%s: sync: %p, fence: %d, value: %d", __FUNCTION__, psSync, *pui32FenceValue, *pui32UpdateValue); return PVRSRV_OK; }
PVRSRV_ERROR PVRSRVSyncPrimOpPDumpPolKM(SERVER_OP_COOKIE *psServerCookie, PDUMP_POLL_OPERATOR eOperator, PDUMP_FLAGS_T ui32PDumpFlags) { IMG_UINT32 i; PVRSRV_ERROR eError = PVRSRV_OK; if (!psServerCookie->bActive) { PVR_DPF((PVR_DBG_ERROR, "%s: Operation cookie not active (no take operation performed)", __FUNCTION__)); eError = PVRSRV_ERROR_BAD_SYNC_STATE; goto e0; } /* PDump POL on the client syncs */ for (i = 0; i < psServerCookie->ui32ClientSyncCount; i++) { if (psServerCookie->paui32Flags[i] & PVRSRV_CLIENT_SYNC_PRIM_OP_CHECK) { IMG_UINT32 ui32BlockIndex = psServerCookie->paui32SyncBlockIndex[i]; IMG_UINT32 ui32Index = psServerCookie->paui32Index[i]; SYNC_PRIMITIVE_BLOCK *psSyncBlock = psServerCookie->papsSyncPrimBlock[ui32BlockIndex]; PVRSRVSyncPrimPDumpPolKM(psSyncBlock, ui32Index*sizeof(IMG_UINT32), psServerCookie->paui32FenceValue[i], 0xFFFFFFFFU, eOperator, ui32PDumpFlags); } } /* PDump POL on the server syncs */ for (i = 0; i < psServerCookie->ui32ServerSyncCount; i++) { SERVER_SYNC_PRIMITIVE *psServerSync = psServerCookie->papsServerSync[i]; IMG_UINT32 ui32FenceValue = psServerCookie->paui32ServerFenceValue[i]; SyncPrimPDumpPol(psServerSync->psSync, ui32FenceValue, 0xFFFFFFFFU, PDUMP_POLL_OPERATOR_EQUAL, ui32PDumpFlags); } e0: return eError; }
PVRSRV_ERROR PVRSRVServerSyncQueueHWOpKM(SERVER_SYNC_PRIMITIVE *psSync, IMG_BOOL bUpdate, IMG_UINT32 *pui32FenceValue, IMG_UINT32 *pui32UpdateValue) { /* For HW operations the client is required to ensure the operation has completed before freeing the sync as we no way of dropping the refcount if we where to acquire it here. Take the lock to ensure the state that we're modifying below will be consistent with itself. */ OSLockAcquire(psSync->hLock); _ServerSyncTakeOperation(psSync, bUpdate, pui32FenceValue, pui32UpdateValue); /* Note: We might want to consider optimising the fences that we write for HW operations but for now just clear it back to unknown */ psSync->ui32LastSyncRequesterID = SYNC_REQUESTOR_UNKNOWN; if (psSync->bSWOperation) { IMG_CHAR azTmp[256]; OSSNPrintf(azTmp, sizeof(azTmp), "Wait for HW ops and dummy update for SW ops (0x%p, FW VAddr = 0x%08x, value = 0x%08x)\n", psSync, SyncPrimGetFirmwareAddr(psSync->psSync), *pui32FenceValue); PDumpCommentKM(azTmp, 0); if (psSync->bSWOpStartedInCaptRange) { /* Dump a POL for the previous HW operation */ SyncPrimPDumpPol(psSync->psSync, psSync->ui32LastHWUpdate, 0xffffffff, PDUMP_POLL_OPERATOR_EQUAL, 0); } /* Dump the expected value (i.e. the value after all the SW operations) */ SyncPrimPDumpValue(psSync->psSync, *pui32FenceValue); /* Reset the state as we've just done a HW operation */ psSync->bSWOperation = IMG_FALSE; } OSLockRelease(psSync->hLock); SYNC_UPDATES_PRINT("%s: sync: %p, fence: %d, value: %d", __FUNCTION__, psSync, *pui32FenceValue, *pui32UpdateValue); return PVRSRV_OK; }