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 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; }