PVRSRV_ERROR PVRSRVServerSyncQueueSWOpKM(SERVER_SYNC_PRIMITIVE *psSync, IMG_UINT32 *pui32FenceValue, IMG_UINT32 *pui32UpdateValue, IMG_UINT32 ui32SyncRequesterID, IMG_BOOL bUpdate, IMG_BOOL *pbFenceRequired) { /* FIXME: Lock */ _ServerSyncRef(psSync); _ServerSyncTakeOperation(psSync, bUpdate, pui32FenceValue, pui32UpdateValue); /* The caller want to know if a fence command is required i.e. was the last operation done on this sync done by the the same sync requestor */ if (pbFenceRequired) { if (ui32SyncRequesterID == psSync->ui32LastSyncRequesterID) { *pbFenceRequired = IMG_FALSE; } else { *pbFenceRequired = IMG_TRUE; } } /* If we're transitioning from a HW operation to a SW operation we need to save the last update the HW will do so that when we PDump we can issue a POL for it before the next HW operation and then LDB in the last SW fence update */ if (psSync->bSWOperation == IMG_FALSE) { psSync->bSWOperation = IMG_TRUE; psSync->ui32LastHWUpdate = *pui32FenceValue; PDumpIsCaptureFrameKM(&psSync->bSWOpStartedInCaptRange); } if (pbFenceRequired) { if (*pbFenceRequired) { SYNC_UPDATES_PRINT("%s: sync: %p, fence: %d, value: %d", __FUNCTION__, psSync, *pui32FenceValue, *pui32UpdateValue); } } psSync->ui32LastSyncRequesterID = ui32SyncRequesterID; /* FIXME: Unlock */ return PVRSRV_OK; }
int PDumpTestNextFrame(u32 ui32CurrentFrame) { int bFrameDumped; (void)PDumpSetFrameKM(ui32CurrentFrame + 1); bFrameDumped = PDumpIsCaptureFrameKM(); (void)PDumpSetFrameKM(ui32CurrentFrame); return bFrameDumped; }
IMG_BOOL PDumpTestNextFrame(u32 ui32CurrentFrame) { IMG_BOOL bFrameDumped; bFrameDumped = IMG_FALSE; PDumpSetFrameKM(ui32CurrentFrame + 1); bFrameDumped = PDumpIsCaptureFrameKM(); PDumpSetFrameKM(ui32CurrentFrame); return bFrameDumped; }
/****************************************************************************** FUNCTION : RGXReleaseCCB PURPOSE : Release a CCB that we have been writing to. PARAMETERS : psDevData - device data psCCB - the CCB RETURNS : None ******************************************************************************/ IMG_INTERNAL IMG_VOID RGXReleaseCCB(RGX_CLIENT_CCB *psClientCCB, IMG_UINT32 ui32CmdSize, IMG_BOOL bPDumpContinuous) { IMG_UINT32 ui32PDumpFlags = bPDumpContinuous ? PDUMP_FLAGS_CONTINUOUS : 0; IMG_BOOL bInCaptureRange; IMG_BOOL bPdumpEnabled; PDumpIsCaptureFrameKM(&bInCaptureRange); bPdumpEnabled = (bInCaptureRange || bPDumpContinuous); /* Dump the CCB data */ if (bPdumpEnabled) { DevmemPDumpLoadMem(psClientCCB->psClientCCBMemDesc, psClientCCB->ui32HostWriteOffset, ui32CmdSize, ui32PDumpFlags); } /* * Update the CCB write offset. */ UPDATE_CCB_OFFSET(psClientCCB->ui32HostWriteOffset, ui32CmdSize, psClientCCB->ui32Size); /* PDumpSetFrame will detect as we Transition out of capture range for frame based data but if we are PDumping continuous data then we need to inform the PDump layer ourselves */ if (bPDumpContinuous && !bInCaptureRange) { PVRSRV_ERROR eError; /* Only Transitioning into capture range can cause an error */ eError = PDumpTransition(psClientCCB->psPDumpConnectionData, IMG_FALSE, IMG_TRUE); PVR_ASSERT(eError == PVRSRV_OK); } if (bPdumpEnabled) { /* Update the PDump write offset to show we PDumped this command */ psClientCCB->ui32LastPDumpWriteOffset = psClientCCB->ui32HostWriteOffset; } #if defined(NO_HARDWARE) /* The firmware is not running, it cannot update these; we do here instead. */ psClientCCB->psClientCCBCtrl->ui32ReadOffset = psClientCCB->ui32HostWriteOffset; psClientCCB->psClientCCBCtrl->ui32DepOffset = psClientCCB->ui32HostWriteOffset; #endif }
static IMG_VOID _ServerSyncTakeOperation(SERVER_SYNC_PRIMITIVE *psSync, IMG_BOOL bUpdate, IMG_UINT32 *pui32FenceValue, IMG_UINT32 *pui32UpdateValue) { IMG_BOOL bInCaptureRange; /* Only advance the pending if the an update is required */ if (bUpdate) { *pui32FenceValue = psSync->ui32NextOp++; } else { *pui32FenceValue = psSync->ui32NextOp; } *pui32UpdateValue = psSync->ui32NextOp; PDumpIsCaptureFrameKM(&bInCaptureRange); /* If this is the 1st operation (in this capture range) then PDump this sync */ if (!psSync->bPDumped && bInCaptureRange) { IMG_CHAR azTmp[100]; OSSNPrintf(azTmp, sizeof(azTmp), "Dump initial sync state (%p, FW VAddr = 0x%08x) = 0x%08x", psSync, SyncPrimGetFirmwareAddr(psSync->psSync), *psSync->psSync->pui32LinAddr); PDumpCommentKM(azTmp, 0); SyncPrimPDump(psSync->psSync); psSync->bPDumped = IMG_TRUE; } /* When exiting capture range clear down bPDumped as we might re-enter capture range and thus need to PDump this sync again */ if (!bInCaptureRange) { psSync->bPDumped = IMG_FALSE; } }
static IMG_INT PVRSRVBridgePVRSRVPDumpIsCapturing(IMG_UINT32 ui32BridgeID, PVRSRV_BRIDGE_IN_PVRSRVPDUMPISCAPTURING *psPVRSRVPDumpIsCapturingIN, PVRSRV_BRIDGE_OUT_PVRSRVPDUMPISCAPTURING *psPVRSRVPDumpIsCapturingOUT, CONNECTION_DATA *psConnection) { PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_PDUMP_PVRSRVPDUMPISCAPTURING); PVR_UNREFERENCED_PARAMETER(psConnection); PVR_UNREFERENCED_PARAMETER(psPVRSRVPDumpIsCapturingIN); psPVRSRVPDumpIsCapturingOUT->eError = PDumpIsCaptureFrameKM( &psPVRSRVPDumpIsCapturingOUT->bIsCapturing); return 0; }
/****************************************************************************** FUNCTION : RGXReleaseCCB PURPOSE : Release a CCB that we have been writing to. PARAMETERS : psDevData - device data psCCB - the CCB RETURNS : None ******************************************************************************/ IMG_INTERNAL IMG_VOID RGXReleaseCCB(RGX_CLIENT_CCB *psClientCCB, IMG_UINT32 ui32CmdSize, IMG_BOOL bPDumpContinuous) { IMG_UINT32 ui32PDumpFlags = bPDumpContinuous ? PDUMP_FLAGS_CONTINUOUS : 0; IMG_BOOL bInCaptureRange; IMG_BOOL bPdumpEnabled; PDumpIsCaptureFrameKM(&bInCaptureRange); bPdumpEnabled = (bInCaptureRange || bPDumpContinuous); /* Dump the CCB data */ if (bPdumpEnabled) { DevmemPDumpLoadMem(psClientCCB->psClientCCBMemDesc, psClientCCB->ui32HostWriteOffset, ui32CmdSize, ui32PDumpFlags); } /* * Check if there have been any fences written that will already be * satistified by a previously written update in this CCB. */ #if defined REDUNDANT_SYNCS_DEBUG { IMG_UINT8 *pui8BufferStart = (IMG_PVOID)((IMG_UINTPTR_T)psClientCCB->pui8ClientCCB + psClientCCB->ui32HostWriteOffset); IMG_UINT8 *pui8BufferEnd = (IMG_PVOID)((IMG_UINTPTR_T)psClientCCB->pui8ClientCCB + psClientCCB->ui32HostWriteOffset + ui32CmdSize); /* Walk through the commands in this section of CCB being released... */ while (pui8BufferStart < pui8BufferEnd) { RGXFWIF_CCB_CMD_HEADER *psCmdHeader = (RGXFWIF_CCB_CMD_HEADER *) pui8BufferStart; if (psCmdHeader->eCmdType == RGXFWIF_CCB_CMD_TYPE_UPDATE) { /* If an UPDATE then record the value incase a later fence depends on it. */ IMG_UINT32 ui32NumUpdates = psCmdHeader->ui32CmdSize / sizeof(RGXFWIF_UFO); IMG_UINT32 i; for (i = 0; i < ui32NumUpdates; i++) { RGXFWIF_UFO *psUFOPtr = ((RGXFWIF_UFO*)(pui8BufferStart + sizeof(RGXFWIF_CCB_CMD_HEADER))) + i; psClientCCB->asFenceUpdateList[psClientCCB->ui32UpdateWriteIndex++] = *psUFOPtr; psClientCCB->ui32UpdateWriteIndex &= (RGX_CCCB_FENCE_UPDATE_LIST_SIZE-1); } } else if (psCmdHeader->eCmdType == RGXFWIF_CCB_CMD_TYPE_FENCE) { IMG_UINT32 ui32NumFences = psCmdHeader->ui32CmdSize / sizeof(RGXFWIF_UFO); IMG_UINT32 i; for (i = 0; i < ui32NumFences; i++) { RGXFWIF_UFO *psUFOPtr = ((RGXFWIF_UFO*)(pui8BufferStart + sizeof(RGXFWIF_CCB_CMD_HEADER))) + i; IMG_UINT32 ui32UpdateIndex; /* Check recently queued updates to see if this fence will be satisfied by the time it is checked. */ for (ui32UpdateIndex = 0; ui32UpdateIndex < RGX_CCCB_FENCE_UPDATE_LIST_SIZE; ui32UpdateIndex++) { RGXFWIF_UFO *psUpdatePtr = &psClientCCB->asFenceUpdateList[ui32UpdateIndex]; if (psUFOPtr->puiAddrUFO.ui32Addr == psUpdatePtr->puiAddrUFO.ui32Addr && psUFOPtr->ui32Value == psUpdatePtr->ui32Value) { PVR_DPF((PVR_DBG_WARNING, "Redundant fence found in cCCB(%p) - 0x%x -> 0x%x", psClientCCB, psUFOPtr->puiAddrUFO.ui32Addr, psUFOPtr->ui32Value)); //psUFOPtr->puiAddrUFO.ui32Addr = 0; break; } } } } else if (psCmdHeader->eCmdType == RGXFWIF_CCB_CMD_TYPE_FENCE_PR) { IMG_UINT32 ui32NumFences = psCmdHeader->ui32CmdSize / sizeof(RGXFWIF_UFO); IMG_UINT32 i; for (i = 0; i < ui32NumFences; i++) { RGXFWIF_UFO *psUFOPtr = ((RGXFWIF_UFO*)(pui8BufferStart + sizeof(RGXFWIF_CCB_CMD_HEADER))) + i; IMG_UINT32 ui32UpdateIndex; /* Check recently queued updates to see if this fence will be satisfied by the time it is checked. */ for (ui32UpdateIndex = 0; ui32UpdateIndex < RGX_CCCB_FENCE_UPDATE_LIST_SIZE; ui32UpdateIndex++) { RGXFWIF_UFO *psUpdatePtr = &psClientCCB->asFenceUpdateList[ui32UpdateIndex]; /* * The PR-fence will be met if the update value is >= the required fence value. E.g. * the difference between the update value and fence value is positive. */ if (psUFOPtr->puiAddrUFO.ui32Addr == psUpdatePtr->puiAddrUFO.ui32Addr && ((psUpdatePtr->ui32Value - psUFOPtr->ui32Value) & (1U << 31)) == 0) { PVR_DPF((PVR_DBG_WARNING, "Redundant PR fence found in cCCB(%p) - 0x%x -> 0x%x", psClientCCB, psUFOPtr->puiAddrUFO.ui32Addr, psUFOPtr->ui32Value)); //psUFOPtr->puiAddrUFO.ui32Addr = 0; break; } } } } /* Move to the next command in this section of CCB being released... */ pui8BufferStart += sizeof(RGXFWIF_CCB_CMD_HEADER) + psCmdHeader->ui32CmdSize; } } #endif /* REDUNDANT_SYNCS_DEBUG */ /* * Update the CCB write offset. */ UPDATE_CCB_OFFSET(psClientCCB->ui32HostWriteOffset, ui32CmdSize, psClientCCB->ui32Size); /* PDumpSetFrame will detect as we Transition out of capture range for frame based data but if we are PDumping continuous data then we need to inform the PDump layer ourselves */ if (bPDumpContinuous && !bInCaptureRange) { PVRSRV_ERROR eError; /* Only Transitioning into capture range can cause an error */ eError = PDumpTransition(psClientCCB->psPDumpConnectionData, IMG_FALSE, IMG_TRUE); PVR_ASSERT(eError == PVRSRV_OK); } if (bPdumpEnabled) { /* Update the PDump write offset to show we PDumped this command */ psClientCCB->ui32LastPDumpWriteOffset = psClientCCB->ui32HostWriteOffset; } #if defined(NO_HARDWARE) /* The firmware is not running, it cannot update these; we do here instead. */ psClientCCB->psClientCCBCtrl->ui32ReadOffset = psClientCCB->ui32HostWriteOffset; psClientCCB->psClientCCBCtrl->ui32DepOffset = psClientCCB->ui32HostWriteOffset; #endif }
/****************************************************************************** FUNCTION : RGXAcquireCCB PURPOSE : Obtains access to write some commands to a CCB PARAMETERS : psClientCCB - The client CCB ui32CmdSize - How much space is required ppvBufferSpace - Pointer to space in the buffer bPDumpContinuous - Should this be PDump continuous? RETURNS : PVRSRV_ERROR ******************************************************************************/ IMG_INTERNAL PVRSRV_ERROR RGXAcquireCCB(RGX_CLIENT_CCB *psClientCCB, IMG_UINT32 ui32CmdSize, IMG_PVOID *ppvBufferSpace, IMG_BOOL bPDumpContinuous) { PVRSRV_ERROR eError; IMG_UINT32 ui32PDumpFlags = bPDumpContinuous ? PDUMP_FLAGS_CONTINUOUS : 0; IMG_BOOL bInCaptureRange; IMG_BOOL bPdumpEnabled; PDumpIsCaptureFrameKM(&bInCaptureRange); bPdumpEnabled = (bInCaptureRange || bPDumpContinuous); /* PDumpSetFrame will detect as we Transition into capture range for frame based data but if we are PDumping continuous data then we need to inform the PDump layer ourselves */ if (bPDumpContinuous && !bInCaptureRange) { eError = PDumpTransition(psClientCCB->psPDumpConnectionData, IMG_TRUE, IMG_TRUE); if (eError != PVRSRV_OK) { return eError; } } /* Check that the CCB can hold this command + padding */ if ((ui32CmdSize + PADDING_COMMAND_SIZE + 1) > psClientCCB->ui32Size) { PVR_DPF((PVR_DBG_ERROR, "Command size (%d bytes) too big for CCB (%d bytes)\n", ui32CmdSize, psClientCCB->ui32Size)); return PVRSRV_ERROR_CMD_TOO_BIG; } /* Check we don't overflow the end of the buffer and make sure we have enough for the padding command. */ if ((psClientCCB->ui32HostWriteOffset + ui32CmdSize + PADDING_COMMAND_SIZE) > psClientCCB->ui32Size) { RGXFWIF_CCB_CMD_HEADER *psHeader; IMG_VOID *pvHeader; PVRSRV_ERROR eError; IMG_UINT32 ui32Remain = psClientCCB->ui32Size - psClientCCB->ui32HostWriteOffset; /* We're at the end of the buffer without enough contiguous space */ eError = _RGXAcquireCCB(psClientCCB, ui32Remain, &pvHeader); if (eError != PVRSRV_OK) { /* It's possible no commands have been processed in which case as we can fail the padding allocation due to that fact we never allow the client CCB to be full */ return eError; } psHeader = pvHeader; psHeader->eCmdType = RGXFWIF_CCB_CMD_TYPE_PADDING; psHeader->ui32CmdSize = ui32Remain - sizeof(RGXFWIF_CCB_CMD_HEADER); PDUMPCOMMENTWITHFLAGS(ui32PDumpFlags, "cCCB(%p): Padding cmd %d", psClientCCB, psHeader->ui32CmdSize); if (bPdumpEnabled) { DevmemPDumpLoadMem(psClientCCB->psClientCCBMemDesc, psClientCCB->ui32HostWriteOffset, ui32Remain, ui32PDumpFlags); } UPDATE_CCB_OFFSET(psClientCCB->ui32HostWriteOffset, ui32Remain, psClientCCB->ui32Size); } return _RGXAcquireCCB(psClientCCB, ui32CmdSize, ppvBufferSpace); }
IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSFER_SGX_KICK *psKick) #endif { PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psKick->hCCBMemInfo; SGXMKIF_COMMAND sCommand = {0}; SGXMKIF_TRANSFERCMD_SHARED *psSharedTransferCmd; PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; PVRSRV_ERROR eError; IMG_UINT32 loop; IMG_HANDLE hDevMemContext = IMG_NULL; IMG_BOOL abSrcSyncEnable[SGX_MAX_TRANSFER_SYNC_OPS]; IMG_UINT32 ui32RealSrcSyncNum = 0; IMG_BOOL abDstSyncEnable[SGX_MAX_TRANSFER_SYNC_OPS]; IMG_UINT32 ui32RealDstSyncNum = 0; #if defined(PDUMP) IMG_BOOL bPersistentProcess = IMG_FALSE; /* * For persistent processes, the HW kicks should not go into the * extended init phase; only keep memory transactions from the * window system which are necessary to run the client app. */ { PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc != IMG_NULL) { bPersistentProcess = psPerProc->bPDumpPersistent; } } #endif /* PDUMP */ #if defined(FIX_HW_BRN_31620) hDevMemContext = psKick->hDevMemContext; #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_FUNCTION_ENTER, TRANSFER_TOKEN_SUBMIT); for (loop = 0; loop < SGX_MAX_TRANSFER_SYNC_OPS; loop++) { abSrcSyncEnable[loop] = IMG_TRUE; abDstSyncEnable[loop] = IMG_TRUE; } if (!CCB_OFFSET_IS_VALID(SGXMKIF_TRANSFERCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset)) { PVR_DPF((PVR_DBG_ERROR, "SGXSubmitTransferKM: Invalid CCB offset")); PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, TRANSFER_TOKEN_SUBMIT); return PVRSRV_ERROR_INVALID_PARAMS; } /* override QAC warning about stricter alignment */ /* PRQA S 3305 1 */ psSharedTransferCmd = CCB_DATA_FROM_OFFSET(SGXMKIF_TRANSFERCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset); PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_CMD_START, TRANSFER_TOKEN_SUBMIT); PVR_TTRACE_UI32(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_CCB, TRANSFER_TOKEN_CCB_OFFSET, psKick->ui32SharedCmdCCBOffset); if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_TRANSFER, TRANSFER_TOKEN_TA_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psSharedTransferCmd->ui32TASyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; psSharedTransferCmd->ui32TASyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->sTASyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->sTASyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } else { psSharedTransferCmd->sTASyncWriteOpsCompleteDevVAddr.uiAddr = 0; psSharedTransferCmd->sTASyncReadOpsCompleteDevVAddr.uiAddr = 0; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_TRANSFER, TRANSFER_TOKEN_3D_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psSharedTransferCmd->ui323DSyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; psSharedTransferCmd->ui323DSyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->s3DSyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->s3DSyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } else { psSharedTransferCmd->s3DSyncWriteOpsCompleteDevVAddr.uiAddr = 0; psSharedTransferCmd->s3DSyncReadOpsCompleteDevVAddr.uiAddr = 0; } /* filter out multiple occurrences of the same sync object from srcs or dests * note : the same sync can still be used to synchronize both src and dst. */ for (loop = 0; loop < MIN(SGX_MAX_TRANSFER_SYNC_OPS, psKick->ui32NumSrcSync); loop++) { IMG_UINT32 i; PVRSRV_KERNEL_SYNC_INFO * psMySyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; for (i = 0; i < loop; i++) { if (abSrcSyncEnable[i]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[i]; if (psSyncInfo->sWriteOpsCompleteDevVAddr.uiAddr == psMySyncInfo->sWriteOpsCompleteDevVAddr.uiAddr) { PVR_DPF((PVR_DBG_WARNING, "SGXSubmitTransferKM : Same src synchronized multiple times!")); abSrcSyncEnable[loop] = IMG_FALSE; break; } } } if (abSrcSyncEnable[loop]) { ui32RealSrcSyncNum++; } } for (loop = 0; loop < MIN(SGX_MAX_TRANSFER_SYNC_OPS, psKick->ui32NumDstSync); loop++) { IMG_UINT32 i; PVRSRV_KERNEL_SYNC_INFO * psMySyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; for (i = 0; i < loop; i++) { if (abDstSyncEnable[i]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[i]; if (psSyncInfo->sWriteOpsCompleteDevVAddr.uiAddr == psMySyncInfo->sWriteOpsCompleteDevVAddr.uiAddr) { PVR_DPF((PVR_DBG_WARNING, "SGXSubmitTransferKM : Same dst synchronized multiple times!")); abDstSyncEnable[loop] = IMG_FALSE; break; } } } if (abDstSyncEnable[loop]) { ui32RealDstSyncNum++; } } psSharedTransferCmd->ui32NumSrcSyncs = ui32RealSrcSyncNum; psSharedTransferCmd->ui32NumDstSyncs = ui32RealDstSyncNum; if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { IMG_UINT32 i = 0; for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_TRANSFER, TRANSFER_TOKEN_SRC_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psSharedTransferCmd->asSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; psSharedTransferCmd->asSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->asSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->asSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; i++; } } PVR_ASSERT(i == ui32RealSrcSyncNum); i = 0; for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSyncInfo->psSyncData->ui64LastWrite = ui64KickCount; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_TRANSFER, TRANSFER_TOKEN_DST_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psSharedTransferCmd->asDstSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; psSharedTransferCmd->asDstSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->asDstSyncs[i].ui32ReadOps2PendingVal = psSyncInfo->psSyncData->ui32ReadOps2Pending; psSharedTransferCmd->asDstSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->asDstSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psSharedTransferCmd->asDstSyncs[i].sReadOps2CompleteDevVAddr = psSyncInfo->sReadOps2CompleteDevVAddr; i++; } } PVR_ASSERT(i == ui32RealDstSyncNum); /* * We allow source and destination sync objects to be the * same, which is why the read/write pending updates are delayed * until the transfer command has been updated with the current * values from the objects. */ for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32ReadOpsPending++; } } for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSyncInfo->psSyncData->ui32WriteOpsPending++; } } } #if defined(PDUMP) if ((PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) && (bPersistentProcess == IMG_FALSE) ) { PDUMPCOMMENT("Shared part of transfer command\r\n"); PDUMPMEM(psSharedTransferCmd, psCCBMemInfo, psKick->ui32CCBDumpWOff, sizeof(SGXMKIF_TRANSFERCMD_SHARED), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { IMG_UINT32 i = 0; for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = psKick->ahSrcSyncInfo[loop]; PDUMPCOMMENT("Tweak src surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asSrcSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Tweak src surface read op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asSrcSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); i++; } } i = 0; for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[i]) { IMG_UINT32 ui32PDumpReadOp2 = 0; psSyncInfo = psKick->ahDstSyncInfo[loop]; PDUMPCOMMENT("Tweak dest surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asDstSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Tweak dest surface read op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asDstSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Tweak dest surface read op2 in transfer cmd\r\n"); PDUMPMEM(&ui32PDumpReadOp2, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asDstSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOps2PendingVal)), sizeof(ui32PDumpReadOp2), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); i++; } } /* * We allow the first source and destination sync objects to be the * same, which is why the read/write pending updates are delayed * until the transfer command has been updated with the current * values from the objects. */ for (loop = 0; loop < (psKick->ui32NumSrcSync); loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } } for (loop = 0; loop < (psKick->ui32NumDstSync); loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[0]; psSyncInfo->psSyncData->ui32LastOpDumpVal++; } } } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = psKick->hTASyncInfo; PDUMPCOMMENT("Tweak TA/TQ surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, ui32TASyncWriteOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); psSyncInfo->psSyncData->ui32LastOpDumpVal++; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = psKick->h3DSyncInfo; PDUMPCOMMENT("Tweak 3D/TQ surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, ui323DSyncWriteOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); psSyncInfo->psSyncData->ui32LastOpDumpVal++; } } #endif sCommand.ui32Data[1] = psKick->sHWTransferContextDevVAddr.uiAddr; PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_CMD_END, TRANSFER_TOKEN_SUBMIT); eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_TRANSFER, &sCommand, KERNEL_ID, psKick->ui32PDumpFlags, hDevMemContext, IMG_FALSE); if (eError == PVRSRV_ERROR_RETRY) { /* Client will retry, so undo the sync ops pending increment(s) done above. */ if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32ReadOpsPending--; #if defined(PDUMP) if (PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) { psSyncInfo->psSyncData->ui32LastReadOpDumpVal--; } #endif } } for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSyncInfo->psSyncData->ui32WriteOpsPending--; #if defined(PDUMP) if (PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) { psSyncInfo->psSyncData->ui32LastOpDumpVal--; } #endif } } } /* Command needed to be synchronised with the TA? */ if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } /* Command needed to be synchronised with the 3D? */ if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } } else if (PVRSRV_OK != eError) { PVR_DPF((PVR_DBG_ERROR, "SGXSubmitTransferKM: SGXScheduleCCBCommandKM failed.")); PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, TRANSFER_TOKEN_SUBMIT); return eError; } #if defined(NO_HARDWARE) if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_NOSYNCUPDATE) == 0) { /* Update sync objects pretending that we have done the job*/ for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } } for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } } #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, TRANSFER_TOKEN_SUBMIT); return eError; }
IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK *psKick) #endif { PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psKick->hCCBMemInfo; SGXMKIF_COMMAND sCommand = {0}; SGXMKIF_2DCMD_SHARED *ps2DCmd; PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; PVRSRV_ERROR eError; IMG_UINT32 i; IMG_HANDLE hDevMemContext = IMG_NULL; #if defined(PDUMP) IMG_BOOL bPersistentProcess = IMG_FALSE; /* * For persistent processes, the HW kicks should not go into the * extended init phase; only keep memory transactions from the * window system which are necessary to run the client app. */ { PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc != IMG_NULL) { bPersistentProcess = psPerProc->bPDumpPersistent; } } #endif /* PDUMP */ #if defined(FIX_HW_BRN_31620) hDevMemContext = psKick->hDevMemContext; #endif if (!CCB_OFFSET_IS_VALID(SGXMKIF_2DCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset)) { PVR_DPF((PVR_DBG_ERROR, "SGXSubmit2DKM: Invalid CCB offset")); return PVRSRV_ERROR_INVALID_PARAMS; } /* override QAC warning about stricter alignment */ /* PRQA S 3305 1 */ ps2DCmd = CCB_DATA_FROM_OFFSET(SGXMKIF_2DCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset); OSMemSet(ps2DCmd, 0, sizeof(*ps2DCmd)); /* Command needs to be synchronised with the TA? */ if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; ps2DCmd->sTASyncData.ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; ps2DCmd->sTASyncData.ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; ps2DCmd->sTASyncData.sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; ps2DCmd->sTASyncData.sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } /* Command needs to be synchronised with the 3D? */ if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; ps2DCmd->s3DSyncData.ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; ps2DCmd->s3DSyncData.ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; ps2DCmd->s3DSyncData.sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; ps2DCmd->s3DSyncData.sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } /* * We allow the first source and destination sync objects to be the * same, which is why the read/write pending updates are delayed * until the transfer command has been updated with the current * values from the objects. */ ps2DCmd->ui32NumSrcSync = psKick->ui32NumSrcSync; for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; ps2DCmd->sSrcSyncData[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; ps2DCmd->sSrcSyncData[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; ps2DCmd->sSrcSyncData[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; ps2DCmd->sSrcSyncData[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; ps2DCmd->sDstSyncData.ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; ps2DCmd->sDstSyncData.ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; ps2DCmd->sDstSyncData.ui32ReadOps2PendingVal = psSyncInfo->psSyncData->ui32ReadOps2Pending; ps2DCmd->sDstSyncData.sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; ps2DCmd->sDstSyncData.sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; ps2DCmd->sDstSyncData.sReadOps2CompleteDevVAddr = psSyncInfo->sReadOps2CompleteDevVAddr; } /* Read/Write ops pending updates, delayed from above */ for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending++; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending++; } #if defined(PDUMP) if ((PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) && (bPersistentProcess == IMG_FALSE) ) { /* Pdump the command from the per context CCB */ PDUMPCOMMENT("Shared part of 2D command\r\n"); PDUMPMEM(ps2DCmd, psCCBMemInfo, psKick->ui32CCBDumpWOff, sizeof(SGXMKIF_2DCMD_SHARED), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; PDUMPCOMMENT("Tweak src surface write op in 2D cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sSrcSyncData[i].ui32WriteOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Tweak src surface read op in 2D cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sSrcSyncData[i].ui32ReadOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); } if (psKick->hDstSyncInfo != IMG_NULL) { IMG_UINT32 ui32PDumpReadOp2 = 0; psSyncInfo = psKick->hDstSyncInfo; PDUMPCOMMENT("Tweak dest surface write op in 2D cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sDstSyncData.ui32WriteOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Tweak dest surface read op in 2D cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sDstSyncData.ui32ReadOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Tweak dest surface read op2 in 2D cmd\r\n"); PDUMPMEM(&ui32PDumpReadOp2, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sDstSyncData.ui32ReadOps2PendingVal), sizeof(ui32PDumpReadOp2), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); } /* Read/Write ops pending updates, delayed from above */ for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32LastOpDumpVal++; } } #endif sCommand.ui32Data[1] = psKick->sHW2DContextDevVAddr.uiAddr; eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_2D, &sCommand, KERNEL_ID, psKick->ui32PDumpFlags, hDevMemContext, IMG_FALSE); if (eError == PVRSRV_ERROR_RETRY) { /* Client will retry, so undo the write ops pending increment done above. */ #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32LastReadOpDumpVal--; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32LastOpDumpVal--; } } #endif for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } /* Command needed to be synchronised with the TA? */ if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } /* Command needed to be synchronised with the 3D? */ if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } } #if defined(NO_HARDWARE) /* Update sync objects pretending that we have done the job*/ for(i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } #endif return eError; }
PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) #endif { PVRSRV_ERROR eError; PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo = (PVRSRV_KERNEL_MEM_INFO *) psCCBKick->hCCBKernelMemInfo; SGXMKIF_CMDTA_SHARED *psTACmd; IMG_UINT32 i; IMG_HANDLE hDevMemContext = IMG_NULL; #if defined(FIX_HW_BRN_31620) hDevMemContext = psCCBKick->hDevMemContext; #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_ENTER, KICK_TOKEN_DOKICK); if (!CCB_OFFSET_IS_VALID(SGXMKIF_CMDTA_SHARED, psCCBMemInfo, psCCBKick, ui32CCBOffset)) { PVR_DPF((PVR_DBG_ERROR, "SGXDoKickKM: Invalid CCB offset")); PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, KICK_TOKEN_DOKICK); return PVRSRV_ERROR_INVALID_PARAMS; } /* override QAC warning about stricter alignment */ /* PRQA S 3305 1 */ psTACmd = CCB_DATA_FROM_OFFSET(SGXMKIF_CMDTA_SHARED, psCCBMemInfo, psCCBKick, ui32CCBOffset); PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_CMD_START, KICK_TOKEN_DOKICK); #if defined(TTRACE) if (psCCBKick->bFirstKickOrResume) { PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FLAGS, KICK_TOKEN_FIRST_KICK); } if (psCCBKick->bLastInScene) { PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FLAGS, KICK_TOKEN_LAST_KICK); } #endif PVR_TTRACE_UI32(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_CCB, KICK_TOKEN_CCB_OFFSET, psCCBKick->ui32CCBOffset); /* TA/3D dependency */ if (psCCBKick->hTA3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTA3DSyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_TA3D_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psTACmd->sTA3DDependency.sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->sTA3DDependency.ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; if (psCCBKick->bTADependency) { psSyncInfo->psSyncData->ui32WriteOpsPending++; } } if (psCCBKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTASyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_TA_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psTACmd->sTATQSyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->sTATQSyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->ui32TATQSyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->ui32TATQSyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psCCBKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->h3DSyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_3D_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psTACmd->s3DTQSyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->s3DTQSyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->ui323DTQSyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->ui323DTQSyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } psTACmd->ui32NumTAStatusVals = psCCBKick->ui32NumTAStatusVals; if (psCCBKick->ui32NumTAStatusVals != 0) { /* Copy status vals over */ for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) psTACmd->sCtlTAStatusInfo[i] = psCCBKick->asTAStatusUpdate[i].sCtlStatus; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ahTAStatusSyncInfo[i]; psTACmd->sCtlTAStatusInfo[i].sStatusDevAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->sCtlTAStatusInfo[i].ui32StatusValue = psSyncInfo->psSyncData->ui32ReadOpsPending; #endif } } psTACmd->ui32Num3DStatusVals = psCCBKick->ui32Num3DStatusVals; if (psCCBKick->ui32Num3DStatusVals != 0) { /* Copy status vals over */ for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) psTACmd->sCtl3DStatusInfo[i] = psCCBKick->as3DStatusUpdate[i].sCtlStatus; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ah3DStatusSyncInfo[i]; psTACmd->sCtl3DStatusInfo[i].sStatusDevAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->sCtl3DStatusInfo[i].ui32StatusValue = psSyncInfo->psSyncData->ui32ReadOpsPending; #endif } } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) /* SRC and DST sync dependencies */ psTACmd->ui32NumTASrcSyncs = psCCBKick->ui32NumTASrcSyncs; for (i=0; i<psCCBKick->ui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTASrcKernelSyncInfo[i]; psTACmd->asTASrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asTASrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; /* Get ui32ReadOpsPending snapshot and copy into the CCB - before incrementing. */ psTACmd->asTASrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; /* Copy ui32WriteOpsPending snapshot into the CCB. */ psTACmd->asTASrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } psTACmd->ui32NumTADstSyncs = psCCBKick->ui32NumTADstSyncs; for (i=0; i<psCCBKick->ui32NumTADstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTADstKernelSyncInfo[i]; psTACmd->asTADstSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asTADstSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; /* Get ui32ReadOpsPending snapshot and copy into the CCB */ psTACmd->asTADstSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; /* Copy ui32WriteOpsPending snapshot into the CCB - before incrementing */ psTACmd->asTADstSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; } psTACmd->ui32Num3DSrcSyncs = psCCBKick->ui32Num3DSrcSyncs; for (i=0; i<psCCBKick->ui32Num3DSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ah3DSrcKernelSyncInfo[i]; psTACmd->as3DSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->as3DSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; /* Get ui32ReadOpsPending snapshot and copy into the CCB - before incrementing. */ psTACmd->as3DSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; /* Copy ui32WriteOpsPending snapshot into the CCB. */ psTACmd->as3DSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } #else /* SUPPORT_SGX_GENERALISED_SYNCOBJECTS */ /* texture dependencies */ psTACmd->ui32NumSrcSyncs = psCCBKick->ui32NumSrcSyncs; for (i=0; i<psCCBKick->ui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahSrcKernelSyncInfo[i]; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_SRC_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psTACmd->asSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; /* Get ui32ReadOpsPending snapshot and copy into the CCB - before incrementing. */ psTACmd->asSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; /* Copy ui32WriteOpsPending snapshot into the CCB. */ psTACmd->asSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } #endif/* SUPPORT_SGX_GENERALISED_SYNCOBJECTS */ if (psCCBKick->bFirstKickOrResume && psCCBKick->ui32NumDstSyncObjects > 0) { PVRSRV_KERNEL_MEM_INFO *psHWDstSyncListMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psCCBKick->hKernelHWSyncListMemInfo; SGXMKIF_HWDEVICE_SYNC_LIST *psHWDeviceSyncList = psHWDstSyncListMemInfo->pvLinAddrKM; IMG_UINT32 ui32NumDstSyncs = psCCBKick->ui32NumDstSyncObjects; PVR_ASSERT(((PVRSRV_KERNEL_MEM_INFO *)psCCBKick->hKernelHWSyncListMemInfo)->uAllocSize >= (sizeof(SGXMKIF_HWDEVICE_SYNC_LIST) + (sizeof(PVRSRV_DEVICE_SYNC_OBJECT) * ui32NumDstSyncs))); psHWDeviceSyncList->ui32NumSyncObjects = ui32NumDstSyncs; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { PDUMPCOMMENT("HWDeviceSyncList for TACmd\r\n"); PDUMPMEM(IMG_NULL, psHWDstSyncListMemInfo, 0, sizeof(SGXMKIF_HWDEVICE_SYNC_LIST), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); } #endif for (i=0; i<ui32NumDstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->pahDstSyncHandles[i]; if (psSyncInfo) { psSyncInfo->psSyncData->ui64LastWrite = ui64KickCount; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_DST_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psHWDeviceSyncList->asSyncData[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psHWDeviceSyncList->asSyncData[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psHWDeviceSyncList->asSyncData[i].sReadOps2CompleteDevVAddr = psSyncInfo->sReadOps2CompleteDevVAddr; psHWDeviceSyncList->asSyncData[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psHWDeviceSyncList->asSyncData[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; psHWDeviceSyncList->asSyncData[i].ui32ReadOps2PendingVal = psSyncInfo->psSyncData->ui32ReadOps2Pending; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { IMG_UINT32 ui32ModifiedValue; IMG_UINT32 ui32SyncOffset = offsetof(SGXMKIF_HWDEVICE_SYNC_LIST, asSyncData) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)); IMG_UINT32 ui32WOpsOffset = ui32SyncOffset + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal); IMG_UINT32 ui32ROpsOffset = ui32SyncOffset + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal); IMG_UINT32 ui32ROps2Offset = ui32SyncOffset + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOps2PendingVal); PDUMPCOMMENT("HWDeviceSyncObject for RT: %i\r\n", i); PDUMPMEM(IMG_NULL, psHWDstSyncListMemInfo, ui32SyncOffset, sizeof(PVRSRV_DEVICE_SYNC_OBJECT), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { /* * Init the ROpsComplete value to 0. */ PDUMPCOMMENT("Init RT ROpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); /* * Init the WOpsComplete value to 0. */ PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastOpDumpVal - 1; PDUMPCOMMENT("Modify RT %d WOpPendingVal in HWDevSyncList\r\n", i); PDUMPMEM(&ui32ModifiedValue, psHWDstSyncListMemInfo, ui32WOpsOffset, sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); ui32ModifiedValue = 0; PDUMPCOMMENT("Modify RT %d ROpsPendingVal in HWDevSyncList\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psHWDstSyncListMemInfo, ui32ROpsOffset, sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); /* * Force the ROps2Complete value to 0. */ PDUMPCOMMENT("Modify RT %d ROps2PendingVal in HWDevSyncList\r\n", i); PDUMPMEM(&ui32ModifiedValue, psHWDstSyncListMemInfo, ui32ROps2Offset, sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); } #endif /* defined(PDUMP) */ } else { psHWDeviceSyncList->asSyncData[i].sWriteOpsCompleteDevVAddr.uiAddr = 0; psHWDeviceSyncList->asSyncData[i].sReadOpsCompleteDevVAddr.uiAddr = 0; psHWDeviceSyncList->asSyncData[i].sReadOps2CompleteDevVAddr.uiAddr = 0; psHWDeviceSyncList->asSyncData[i].ui32ReadOpsPendingVal = 0; psHWDeviceSyncList->asSyncData[i].ui32ReadOps2PendingVal = 0; psHWDeviceSyncList->asSyncData[i].ui32WriteOpsPendingVal = 0; } } } /* NOTE: THIS MUST BE THE LAST THING WRITTEN TO THE TA COMMAND! Set the ready for so the uKernel will process the command. */ psTACmd->ui32CtrlFlags |= SGXMKIF_CMDTA_CTRLFLAGS_READY; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { PDUMPCOMMENT("Shared part of TA command\r\n"); PDUMPMEM(psTACmd, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff, sizeof(SGXMKIF_CMDTA_SHARED), 0, MAKEUNIQUETAG(psCCBMemInfo)); #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) for (i=0; i<psCCBKick->ui32NumTASrcSyncs; i++) { IMG_UINT32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTASrcKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { /* * Init the ROpsComplete value to 0. */ PDUMPCOMMENT("Init RT TA-SRC ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); /* * Init the WOpsComplete value to 0. */ PDUMPCOMMENT("Init RT TA-SRC WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastReadOpDumpVal - 1; PDUMPCOMMENT("Modify TA SrcSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTASrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify TA SrcSync %d WOpPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTASrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } for (i=0; i<psCCBKick->ui32NumTADstSyncs; i++) { IMG_UINT32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTADstKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { /* * Init the ROpsComplete value to 0. */ PDUMPCOMMENT("Init RT TA-DST ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); /* * Init the WOpsComplete value to 0. */ PDUMPCOMMENT("Init RT TA-DST WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastOpDumpVal - 1; PDUMPCOMMENT("Modify TA DstSync %d WOpPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTADstSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify TA DstSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTADstSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } for (i=0; i<psCCBKick->ui32Num3DSrcSyncs; i++) { IMG_UINT32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ah3DSrcKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { /* * Init the ROpsComplete value to 0. */ PDUMPCOMMENT("Init RT 3D-SRC ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); /* * Init the WOpsComplete value to 0. */ PDUMPCOMMENT("Init RT 3D-SRC WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastReadOpDumpVal - 1; PDUMPCOMMENT("Modify 3D SrcSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, as3DSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify 3D SrcSync %d WOpPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, as3DSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } #else/* SUPPORT_SGX_GENERALISED_SYNCOBJECTS */ for (i=0; i<psCCBKick->ui32NumSrcSyncs; i++) { IMG_UINT32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahSrcKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { /* * Init the ROpsComplete value to 0. */ PDUMPCOMMENT("Init RT ROpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); /* * Init the WOpsComplete value to 0. */ PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); /* * Init the ROps2Complete value to 0. */ PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOps2Complete), sizeof(psSyncInfo->psSyncData->ui32ReadOps2Complete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastReadOpDumpVal - 1; PDUMPCOMMENT("Modify SrcSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify SrcSync %d WOpPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } if (psCCBKick->hTA3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTA3DSyncInfo; PDUMPCOMMENT("Modify TA/3D dependency WOpPendingVal\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, sTA3DDependency.ui32WriteOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); if (psCCBKick->bTADependency) { psSyncInfo->psSyncData->ui32LastOpDumpVal++; } } if (psCCBKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTASyncInfo; PDUMPCOMMENT("Modify TA/TQ ROpPendingVal\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, ui32TATQSyncReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } if (psCCBKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->h3DSyncInfo; PDUMPCOMMENT("Modify 3D/TQ ROpPendingVal\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, ui323DTQSyncReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } #endif/* SUPPORT_SGX_GENERALISED_SYNCOBJECTS */ for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if !defined(SUPPORT_SGX_NEW_STATUS_VALS) psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ahTAStatusSyncInfo[i]; PDUMPCOMMENT("Modify TA status value in TA cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_CMDTA_SHARED, sCtlTAStatusInfo[i].ui32StatusValue), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); #endif } for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if !defined(SUPPORT_SGX_NEW_STATUS_VALS) psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ah3DStatusSyncInfo[i]; PDUMPCOMMENT("Modify 3D status value in TA cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_CMDTA_SHARED, sCtl3DStatusInfo[i].ui32StatusValue), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); #endif } } #endif /* defined(PDUMP) */ PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_CMD_END, KICK_TOKEN_DOKICK); eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_TA, &psCCBKick->sCommand, KERNEL_ID, 0, hDevMemContext, psCCBKick->bLastInScene); if (eError == PVRSRV_ERROR_RETRY) { if (psCCBKick->bFirstKickOrResume && psCCBKick->ui32NumDstSyncObjects > 0) { for (i=0; i < psCCBKick->ui32NumDstSyncObjects; i++) { /* Client will retry, so undo the write ops pending increment done above. */ psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->pahDstSyncHandles[i]; if (psSyncInfo) { psSyncInfo->psSyncData->ui32WriteOpsPending--; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { psSyncInfo->psSyncData->ui32LastOpDumpVal--; } #endif } } } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) for (i=0; i<psCCBKick->ui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTASrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } for (i=0; i<psCCBKick->ui32NumTADstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTADstKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32WriteOpsPending--; } for (i=0; i<psCCBKick->ui32Num3DSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ah3DSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } #else/* SUPPORT_SGX_GENERALISED_SYNCOBJECTS */ for (i=0; i<psCCBKick->ui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } #endif/* SUPPORT_SGX_GENERALISED_SYNCOBJECTS */ if (psCCBKick->hTA3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTA3DSyncInfo; psSyncInfo->psSyncData->ui32ReadOpsPending--; } if (psCCBKick->hTASyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTASyncInfo; psSyncInfo->psSyncData->ui32ReadOpsPending--; } if (psCCBKick->h3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32ReadOpsPending--; } PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, KICK_TOKEN_DOKICK); return eError; } else if (PVRSRV_OK != eError) { PVR_DPF((PVR_DBG_ERROR, "SGXDoKickKM: SGXScheduleCCBCommandKM failed.")); PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, KICK_TOKEN_DOKICK); return eError; } #if defined(NO_HARDWARE) /* TA/3D dependency */ if (psCCBKick->hTA3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTA3DSyncInfo; if (psCCBKick->bTADependency) { psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } } if (psCCBKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTASyncInfo; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } if (psCCBKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } /* Copy status vals over */ for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = (PVRSRV_KERNEL_MEM_INFO*)psCCBKick->asTAStatusUpdate[i].hKernelMemInfo; /* derive offset into meminfo and write the status value */ *(IMG_UINT32*)((IMG_UINTPTR_T)psKernelMemInfo->pvLinAddrKM + (psTACmd->sCtlTAStatusInfo[i].sStatusDevAddr.uiAddr - psKernelMemInfo->sDevVAddr.uiAddr)) = psTACmd->sCtlTAStatusInfo[i].ui32StatusValue; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ahTAStatusSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psTACmd->sCtlTAStatusInfo[i].ui32StatusValue; #endif } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) /* SRC and DST dependencies */ for (i=0; i<psCCBKick->ui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTASrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } for (i=0; i<psCCBKick->ui32NumTADstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTADstKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } for (i=0; i<psCCBKick->ui32Num3DSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ah3DSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } #else/* SUPPORT_SGX_GENERALISED_SYNCOBJECTS */ /* texture dependencies */ for (i=0; i<psCCBKick->ui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } #endif/* SUPPORT_SGX_GENERALISED_SYNCOBJECTS */ if (psCCBKick->bTerminateOrAbort) { if (psCCBKick->ui32NumDstSyncObjects > 0) { PVRSRV_KERNEL_MEM_INFO *psHWDstSyncListMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psCCBKick->hKernelHWSyncListMemInfo; SGXMKIF_HWDEVICE_SYNC_LIST *psHWDeviceSyncList = psHWDstSyncListMemInfo->pvLinAddrKM; for (i=0; i<psCCBKick->ui32NumDstSyncObjects; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->pahDstSyncHandles[i]; if (psSyncInfo) psSyncInfo->psSyncData->ui32WriteOpsComplete = psHWDeviceSyncList->asSyncData[i].ui32WriteOpsPendingVal+1; } } /* Copy status vals over */ for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = (PVRSRV_KERNEL_MEM_INFO*)psCCBKick->as3DStatusUpdate[i].hKernelMemInfo; /* derive offset into meminfo and write the status value */ *(IMG_UINT32*)((IMG_UINTPTR_T)psKernelMemInfo->pvLinAddrKM + (psTACmd->sCtl3DStatusInfo[i].sStatusDevAddr.uiAddr - psKernelMemInfo->sDevVAddr.uiAddr)) = psTACmd->sCtl3DStatusInfo[i].ui32StatusValue; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ah3DStatusSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psTACmd->sCtl3DStatusInfo[i].ui32StatusValue; #endif } } #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, KICK_TOKEN_DOKICK); return eError; }
IMG_EXPORT PVRSRV_ERROR SGXSubmit2DKM(IMG_HANDLE hDevHandle, PVRSRV_2D_SGX_KICK *psKick) #endif { PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psKick->hCCBMemInfo; SGXMKIF_COMMAND sCommand = {0}; SGXMKIF_2DCMD_SHARED *ps2DCmd; PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; PVRSRV_ERROR eError; IMG_UINT32 i; IMG_HANDLE hDevMemContext = IMG_NULL; #if defined(PDUMP) IMG_BOOL bPersistentProcess = IMG_FALSE; { PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc != IMG_NULL) { bPersistentProcess = psPerProc->bPDumpPersistent; } } #endif #if defined(FIX_HW_BRN_31620) hDevMemContext = psKick->hDevMemContext; #endif if (!CCB_OFFSET_IS_VALID(SGXMKIF_2DCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset)) { PVR_DPF((PVR_DBG_ERROR, "SGXSubmit2DKM: Invalid CCB offset")); return PVRSRV_ERROR_INVALID_PARAMS; } ps2DCmd = CCB_DATA_FROM_OFFSET(SGXMKIF_2DCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset); OSMemSet(ps2DCmd, 0, sizeof(*ps2DCmd)); if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; ps2DCmd->sTASyncData.ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; ps2DCmd->sTASyncData.ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; ps2DCmd->sTASyncData.sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; ps2DCmd->sTASyncData.sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; ps2DCmd->s3DSyncData.ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; ps2DCmd->s3DSyncData.ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; ps2DCmd->s3DSyncData.sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; ps2DCmd->s3DSyncData.sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } ps2DCmd->ui32NumSrcSync = psKick->ui32NumSrcSync; for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; ps2DCmd->sSrcSyncData[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; ps2DCmd->sSrcSyncData[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; ps2DCmd->sSrcSyncData[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; ps2DCmd->sSrcSyncData[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; ps2DCmd->sDstSyncData.ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; ps2DCmd->sDstSyncData.ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; ps2DCmd->sDstSyncData.ui32ReadOps2PendingVal = psSyncInfo->psSyncData->ui32ReadOps2Pending; ps2DCmd->sDstSyncData.sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; ps2DCmd->sDstSyncData.sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; ps2DCmd->sDstSyncData.sReadOps2CompleteDevVAddr = psSyncInfo->sReadOps2CompleteDevVAddr; } for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending++; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending++; } #if defined(PDUMP) if ((PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) && (bPersistentProcess == IMG_FALSE) ) { PDUMPCOMMENT("Shared part of 2D command\r\n"); PDUMPMEM(ps2DCmd, psCCBMemInfo, psKick->ui32CCBDumpWOff, sizeof(SGXMKIF_2DCMD_SHARED), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; PDUMPCOMMENT("Hack src surface write op in 2D cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sSrcSyncData[i].ui32WriteOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Hack src surface read op in 2D cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sSrcSyncData[i].ui32ReadOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); } if (psKick->hDstSyncInfo != IMG_NULL) { IMG_UINT32 ui32PDumpReadOp2 = 0; psSyncInfo = psKick->hDstSyncInfo; PDUMPCOMMENT("Hack dest surface write op in 2D cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sDstSyncData.ui32WriteOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Hack dest surface read op in 2D cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sDstSyncData.ui32ReadOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Hack dest surface read op2 in 2D cmd\r\n"); PDUMPMEM(&ui32PDumpReadOp2, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_2DCMD_SHARED, sDstSyncData.ui32ReadOps2PendingVal), sizeof(ui32PDumpReadOp2), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); } for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32LastOpDumpVal++; } } #endif sCommand.ui32Data[1] = psKick->sHW2DContextDevVAddr.uiAddr; eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_2D, &sCommand, KERNEL_ID, psKick->ui32PDumpFlags, hDevMemContext, IMG_FALSE); if (eError == PVRSRV_ERROR_RETRY) { #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32LastReadOpDumpVal--; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32LastOpDumpVal--; } } #endif for (i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } } #if defined(NO_HARDWARE) for(i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } if (psKick->hDstSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hDstSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } #endif return eError; }
IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSFER_SGX_KICK *psKick) #endif { PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psKick->hCCBMemInfo; SGXMKIF_COMMAND sCommand = {0}; SGXMKIF_TRANSFERCMD_SHARED *psSharedTransferCmd; PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; PVRSRV_ERROR eError; IMG_UINT32 loop; IMG_HANDLE hDevMemContext = IMG_NULL; IMG_BOOL abSrcSyncEnable[SGX_MAX_TRANSFER_SYNC_OPS]; IMG_UINT32 ui32RealSrcSyncNum = 0; IMG_BOOL abDstSyncEnable[SGX_MAX_TRANSFER_SYNC_OPS]; IMG_UINT32 ui32RealDstSyncNum = 0; #if defined(PDUMP) IMG_BOOL bPersistentProcess = IMG_FALSE; { PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc != IMG_NULL) { bPersistentProcess = psPerProc->bPDumpPersistent; } } #endif #if defined(FIX_HW_BRN_31620) hDevMemContext = psKick->hDevMemContext; #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_FUNCTION_ENTER, TRANSFER_TOKEN_SUBMIT); for (loop = 0; loop < SGX_MAX_TRANSFER_SYNC_OPS; loop++) { abSrcSyncEnable[loop] = IMG_TRUE; abDstSyncEnable[loop] = IMG_TRUE; } if (!CCB_OFFSET_IS_VALID(SGXMKIF_TRANSFERCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset)) { PVR_DPF((PVR_DBG_ERROR, "SGXSubmitTransferKM: Invalid CCB offset")); PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, TRANSFER_TOKEN_SUBMIT); return PVRSRV_ERROR_INVALID_PARAMS; } psSharedTransferCmd = CCB_DATA_FROM_OFFSET(SGXMKIF_TRANSFERCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset); PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_CMD_START, TRANSFER_TOKEN_SUBMIT); PVR_TTRACE_UI32(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_CCB, TRANSFER_TOKEN_CCB_OFFSET, psKick->ui32SharedCmdCCBOffset); if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_TRANSFER, TRANSFER_TOKEN_TA_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psSharedTransferCmd->ui32TASyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; psSharedTransferCmd->ui32TASyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->sTASyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->sTASyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } else { psSharedTransferCmd->sTASyncWriteOpsCompleteDevVAddr.uiAddr = 0; psSharedTransferCmd->sTASyncReadOpsCompleteDevVAddr.uiAddr = 0; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_TRANSFER, TRANSFER_TOKEN_3D_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psSharedTransferCmd->ui323DSyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; psSharedTransferCmd->ui323DSyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->s3DSyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->s3DSyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } else { psSharedTransferCmd->s3DSyncWriteOpsCompleteDevVAddr.uiAddr = 0; psSharedTransferCmd->s3DSyncReadOpsCompleteDevVAddr.uiAddr = 0; } for (loop = 0; loop < MIN(SGX_MAX_TRANSFER_SYNC_OPS, psKick->ui32NumSrcSync); loop++) { IMG_UINT32 i; PVRSRV_KERNEL_SYNC_INFO * psMySyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; for (i = 0; i < loop; i++) { if (abSrcSyncEnable[i]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[i]; if (psSyncInfo->sWriteOpsCompleteDevVAddr.uiAddr == psMySyncInfo->sWriteOpsCompleteDevVAddr.uiAddr) { PVR_DPF((PVR_DBG_WARNING, "SGXSubmitTransferKM : Same src synchronized multiple times!")); abSrcSyncEnable[loop] = IMG_FALSE; break; } } } if (abSrcSyncEnable[loop]) { ui32RealSrcSyncNum++; } } for (loop = 0; loop < MIN(SGX_MAX_TRANSFER_SYNC_OPS, psKick->ui32NumDstSync); loop++) { IMG_UINT32 i; PVRSRV_KERNEL_SYNC_INFO * psMySyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; for (i = 0; i < loop; i++) { if (abDstSyncEnable[i]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[i]; if (psSyncInfo->sWriteOpsCompleteDevVAddr.uiAddr == psMySyncInfo->sWriteOpsCompleteDevVAddr.uiAddr) { PVR_DPF((PVR_DBG_WARNING, "SGXSubmitTransferKM : Same dst synchronized multiple times!")); abDstSyncEnable[loop] = IMG_FALSE; break; } } } if (abDstSyncEnable[loop]) { ui32RealDstSyncNum++; } } psSharedTransferCmd->ui32NumSrcSyncs = ui32RealSrcSyncNum; psSharedTransferCmd->ui32NumDstSyncs = ui32RealDstSyncNum; if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { IMG_UINT32 i = 0; for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_TRANSFER, TRANSFER_TOKEN_SRC_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psSharedTransferCmd->asSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; psSharedTransferCmd->asSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->asSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->asSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; i++; } } PVR_ASSERT(i == ui32RealSrcSyncNum); i = 0; for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSyncInfo->psSyncData->ui64LastWrite = ui64KickCount; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_TRANSFER, TRANSFER_TOKEN_DST_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psSharedTransferCmd->asDstSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; psSharedTransferCmd->asDstSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->asDstSyncs[i].ui32ReadOps2PendingVal = psSyncInfo->psSyncData->ui32ReadOps2Pending; psSharedTransferCmd->asDstSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->asDstSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psSharedTransferCmd->asDstSyncs[i].sReadOps2CompleteDevVAddr = psSyncInfo->sReadOps2CompleteDevVAddr; i++; } } PVR_ASSERT(i == ui32RealDstSyncNum); for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32ReadOpsPending++; } } for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSyncInfo->psSyncData->ui32WriteOpsPending++; } } } #if defined(PDUMP) if ((PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) && (bPersistentProcess == IMG_FALSE) ) { PDUMPCOMMENT("Shared part of transfer command\r\n"); PDUMPMEM(psSharedTransferCmd, psCCBMemInfo, psKick->ui32CCBDumpWOff, sizeof(SGXMKIF_TRANSFERCMD_SHARED), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { IMG_UINT32 i = 0; for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = psKick->ahSrcSyncInfo[loop]; PDUMPCOMMENT("Hack src surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asSrcSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Hack src surface read op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asSrcSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); i++; } } i = 0; for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[i]) { IMG_UINT32 ui32PDumpReadOp2 = 0; psSyncInfo = psKick->ahDstSyncInfo[loop]; PDUMPCOMMENT("Hack dest surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asDstSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Hack dest surface read op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asDstSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Hack dest surface read op2 in transfer cmd\r\n"); PDUMPMEM(&ui32PDumpReadOp2, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, asDstSyncs) + i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOps2PendingVal)), sizeof(ui32PDumpReadOp2), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); i++; } } for (loop = 0; loop < (psKick->ui32NumSrcSync); loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } } for (loop = 0; loop < (psKick->ui32NumDstSync); loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[0]; psSyncInfo->psSyncData->ui32LastOpDumpVal++; } } } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = psKick->hTASyncInfo; PDUMPCOMMENT("Tweak TA/TQ surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, ui32TASyncWriteOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); psSyncInfo->psSyncData->ui32LastOpDumpVal++; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = psKick->h3DSyncInfo; PDUMPCOMMENT("Tweak 3D/TQ surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + (IMG_UINT32)(offsetof(SGXMKIF_TRANSFERCMD_SHARED, ui323DSyncWriteOpsPendingVal)), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); psSyncInfo->psSyncData->ui32LastOpDumpVal++; } } #endif sCommand.ui32Data[1] = psKick->sHWTransferContextDevVAddr.uiAddr; PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_CMD_END, TRANSFER_TOKEN_SUBMIT); eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_TRANSFER, &sCommand, KERNEL_ID, psKick->ui32PDumpFlags, hDevMemContext, IMG_FALSE); if (eError == PVRSRV_ERROR_RETRY) { if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32ReadOpsPending--; #if defined(PDUMP) if (PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) { psSyncInfo->psSyncData->ui32LastReadOpDumpVal--; } #endif } } for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSyncInfo->psSyncData->ui32WriteOpsPending--; #if defined(PDUMP) if (PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) { psSyncInfo->psSyncData->ui32LastOpDumpVal--; } #endif } } } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } } else if (PVRSRV_OK != eError) { PVR_DPF((PVR_DBG_ERROR, "SGXSubmitTransferKM: SGXScheduleCCBCommandKM failed.")); PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, TRANSFER_TOKEN_SUBMIT); return eError; } #if defined(NO_HARDWARE) if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_NOSYNCUPDATE) == 0) { for (loop = 0; loop < psKick->ui32NumSrcSync; loop++) { if (abSrcSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } } for (loop = 0; loop < psKick->ui32NumDstSync; loop++) { if (abDstSyncEnable[loop]) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } } #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_TRANSFER, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, TRANSFER_TOKEN_SUBMIT); return eError; }
IMG_EXPORT PVRSRV_ERROR SGXSubmitTransferKM(IMG_HANDLE hDevHandle, PVRSRV_TRANSFER_SGX_KICK *psKick) { PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psKick->hCCBMemInfo; SGXMKIF_COMMAND sCommand = {0}; SGXMKIF_TRANSFERCMD_SHARED *psSharedTransferCmd; PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; PVRSRV_ERROR eError; IMG_UINT32 loop; #if defined(PDUMP) IMG_BOOL bPersistentProcess = IMG_FALSE; { PVRSRV_PER_PROCESS_DATA* psPerProc = PVRSRVFindPerProcessData(); if(psPerProc != IMG_NULL) { bPersistentProcess = psPerProc->bPDumpPersistent; } } #endif if (!CCB_OFFSET_IS_VALID(SGXMKIF_TRANSFERCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset)) { PVR_DPF((PVR_DBG_ERROR, "SGXSubmitTransferKM: Invalid CCB offset")); return PVRSRV_ERROR_INVALID_PARAMS; } psSharedTransferCmd = CCB_DATA_FROM_OFFSET(SGXMKIF_TRANSFERCMD_SHARED, psCCBMemInfo, psKick, ui32SharedCmdCCBOffset); if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSharedTransferCmd->ui32TASyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; psSharedTransferCmd->ui32TASyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->sTASyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->sTASyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } else { psSharedTransferCmd->sTASyncWriteOpsCompleteDevVAddr.uiAddr = 0; psSharedTransferCmd->sTASyncReadOpsCompleteDevVAddr.uiAddr = 0; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSharedTransferCmd->ui323DSyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; psSharedTransferCmd->ui323DSyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->s3DSyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->s3DSyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } else { psSharedTransferCmd->s3DSyncWriteOpsCompleteDevVAddr.uiAddr = 0; psSharedTransferCmd->s3DSyncReadOpsCompleteDevVAddr.uiAddr = 0; } psSharedTransferCmd->ui32NumSrcSyncs = psKick->ui32NumSrcSync; psSharedTransferCmd->ui32NumDstSyncs = psKick->ui32NumDstSync; if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { for (loop=0; loop<psKick->ui32NumSrcSync; loop++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSharedTransferCmd->asSrcSyncs[loop].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; psSharedTransferCmd->asSrcSyncs[loop].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->asSrcSyncs[loop].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->asSrcSyncs[loop].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } for (loop=0; loop<psKick->ui32NumDstSync; loop++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSharedTransferCmd->asDstSyncs[loop].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; psSharedTransferCmd->asDstSyncs[loop].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psSharedTransferCmd->asDstSyncs[loop].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psSharedTransferCmd->asDstSyncs[loop].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; } for (loop=0; loop<psKick->ui32NumSrcSync; loop++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32ReadOpsPending++; } for (loop=0; loop<psKick->ui32NumDstSync; loop++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[loop]; psSyncInfo->psSyncData->ui32WriteOpsPending++; } } #if defined(PDUMP) if ((PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) && (bPersistentProcess == IMG_FALSE) ) { PDUMPCOMMENT("Shared part of transfer command\r\n"); PDUMPMEM(psSharedTransferCmd, psCCBMemInfo, psKick->ui32CCBDumpWOff, sizeof(SGXMKIF_TRANSFERCMD_SHARED), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { for (loop=0; loop<psKick->ui32NumSrcSync ; loop++) { psSyncInfo = psKick->ahSrcSyncInfo[loop]; PDUMPCOMMENT("Hack src surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + offsetof(SGXMKIF_TRANSFERCMD_SHARED, asSrcSyncs) + loop * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Hack src surface read op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + offsetof(SGXMKIF_TRANSFERCMD_SHARED, asSrcSyncs) + loop * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); } } if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { for (loop=0; loop< psKick->ui32NumDstSync; loop++) { psSyncInfo = psKick->ahDstSyncInfo[loop]; PDUMPCOMMENT("Hack dest surface write op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + offsetof(SGXMKIF_TRANSFERCMD_SHARED, asDstSyncs) + loop * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal) , sizeof(psSyncInfo->psSyncData->ui32LastOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Hack dest surface read op in transfer cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psKick->ui32CCBDumpWOff + offsetof(SGXMKIF_TRANSFERCMD_SHARED, asDstSyncs) + loop * sizeof(PVRSRV_DEVICE_SYNC_OBJECT) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(psSyncInfo->psSyncData->ui32LastReadOpDumpVal), psKick->ui32PDumpFlags, MAKEUNIQUETAG(psCCBMemInfo)); } } if((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING)== 0UL) { for (loop=0; loop<(psKick->ui32NumSrcSync); loop++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[loop]; psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } } if((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { for (loop=0; loop<(psKick->ui32NumDstSync); loop++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[0]; psSyncInfo->psSyncData->ui32LastOpDumpVal++; } } } #endif sCommand.ui32Data[1] = psKick->sHWTransferContextDevVAddr.uiAddr; eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_TRANSFER, &sCommand, KERNEL_ID, psKick->ui32PDumpFlags, IMG_FALSE); if (eError == PVRSRV_ERROR_RETRY) { if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_KEEPPENDING) == 0UL) { if (psKick->ui32NumSrcSync > 0) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[0]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } if (psKick->ui32NumDstSync > 0) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[0]; psSyncInfo->psSyncData->ui32WriteOpsPending--; } #if defined(PDUMP) if (PDumpIsCaptureFrameKM() || ((psKick->ui32PDumpFlags & PDUMP_FLAGS_CONTINUOUS) != 0)) { if (psKick->ui32NumSrcSync > 0) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[0]; psSyncInfo->psSyncData->ui32LastReadOpDumpVal--; } if (psKick->ui32NumDstSync > 0) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[0]; psSyncInfo->psSyncData->ui32LastOpDumpVal--; } } #endif } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsPending--; } } else if (PVRSRV_OK != eError) { PVR_DPF((PVR_DBG_ERROR, "SGXSubmitTransferKM: SGXScheduleCCBCommandKM failed.")); return eError; } #if defined(NO_HARDWARE) if ((psKick->ui32Flags & SGXMKIF_TQFLAGS_NOSYNCUPDATE) == 0) { IMG_UINT32 i; for(i = 0; i < psKick->ui32NumSrcSync; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahSrcSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } for(i = 0; i < psKick->ui32NumDstSync; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->ahDstSyncInfo[i]; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->hTASyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } } #endif return eError; }
PVRSRV_ERROR PVRSRVServerSyncQueueSWOpKM(SERVER_SYNC_PRIMITIVE *psSync, IMG_UINT32 *pui32FenceValue, IMG_UINT32 *pui32UpdateValue, IMG_UINT32 ui32SyncRequesterID, IMG_BOOL bUpdate, IMG_BOOL *pbFenceRequired) { ServerSyncRef(psSync); /* ServerSyncRef will acquire and release the lock but we need to reacquire here to ensure the state that we're modifying below will be consistent with itself. But it doesn't matter if another thread acquires the lock in between as we've ensured the sync wont go away */ OSLockAcquire(psSync->hLock); _ServerSyncTakeOperation(psSync, bUpdate, pui32FenceValue, pui32UpdateValue); /* The caller want to know if a fence command is required i.e. was the last operation done on this sync done by the the same sync requestor */ if (pbFenceRequired) { if (ui32SyncRequesterID == psSync->ui32LastSyncRequesterID) { *pbFenceRequired = IMG_FALSE; } else { *pbFenceRequired = IMG_TRUE; } } /* If we're transitioning from a HW operation to a SW operation we need to save the last update the HW will do so that when we PDump we can issue a POL for it before the next HW operation and then LDB in the last SW fence update */ if (psSync->bSWOperation == IMG_FALSE) { psSync->bSWOperation = IMG_TRUE; psSync->ui32LastHWUpdate = *pui32FenceValue; PDumpIsCaptureFrameKM(&psSync->bSWOpStartedInCaptRange); } if (pbFenceRequired) { if (*pbFenceRequired) { SYNC_UPDATES_PRINT("%s: sync: %p, fence: %d, value: %d", __FUNCTION__, psSync, *pui32FenceValue, *pui32UpdateValue); } } /* Only update the last requester id if we are make changes to this sync * object. */ if (bUpdate) psSync->ui32LastSyncRequesterID = ui32SyncRequesterID; OSLockRelease(psSync->hLock); return PVRSRV_OK; }
PVRSRV_ERROR SGXDoKickKM(IMG_HANDLE hDevHandle, SGX_CCB_KICK *psCCBKick) #endif { PVRSRV_ERROR eError; PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo = (PVRSRV_KERNEL_MEM_INFO *) psCCBKick->hCCBKernelMemInfo; SGXMKIF_CMDTA_SHARED *psTACmd; IMG_UINT32 i; IMG_HANDLE hDevMemContext = IMG_NULL; #if defined(FIX_HW_BRN_31620) hDevMemContext = psCCBKick->hDevMemContext; #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_ENTER, KICK_TOKEN_DOKICK); if (!CCB_OFFSET_IS_VALID(SGXMKIF_CMDTA_SHARED, psCCBMemInfo, psCCBKick, ui32CCBOffset)) { PVR_DPF((PVR_DBG_ERROR, "SGXDoKickKM: Invalid CCB offset")); PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, KICK_TOKEN_DOKICK); return PVRSRV_ERROR_INVALID_PARAMS; } psTACmd = CCB_DATA_FROM_OFFSET(SGXMKIF_CMDTA_SHARED, psCCBMemInfo, psCCBKick, ui32CCBOffset); PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_CMD_START, KICK_TOKEN_DOKICK); PVR_TTRACE_UI32(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_CCB, KICK_TOKEN_CCB_OFFSET, psCCBKick->ui32CCBOffset); if (psCCBKick->hTA3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTA3DSyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_TA3D_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psTACmd->sTA3DDependency.sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->sTA3DDependency.ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; if (psCCBKick->bTADependency) { psSyncInfo->psSyncData->ui32WriteOpsPending++; } } if (psCCBKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTASyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_TA_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psTACmd->sTATQSyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->sTATQSyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->ui32TATQSyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->ui32TATQSyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psCCBKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->h3DSyncInfo; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_3D_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psTACmd->s3DTQSyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->s3DTQSyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->ui323DTQSyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->ui323DTQSyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } psTACmd->ui32NumTAStatusVals = psCCBKick->ui32NumTAStatusVals; if (psCCBKick->ui32NumTAStatusVals != 0) { for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) psTACmd->sCtlTAStatusInfo[i] = psCCBKick->asTAStatusUpdate[i].sCtlStatus; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ahTAStatusSyncInfo[i]; psTACmd->sCtlTAStatusInfo[i].sStatusDevAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->sCtlTAStatusInfo[i].ui32StatusValue = psSyncInfo->psSyncData->ui32ReadOpsPending; #endif } } psTACmd->ui32Num3DStatusVals = psCCBKick->ui32Num3DStatusVals; if (psCCBKick->ui32Num3DStatusVals != 0) { for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) psTACmd->sCtl3DStatusInfo[i] = psCCBKick->as3DStatusUpdate[i].sCtlStatus; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ah3DStatusSyncInfo[i]; psTACmd->sCtl3DStatusInfo[i].sStatusDevAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->sCtl3DStatusInfo[i].ui32StatusValue = psSyncInfo->psSyncData->ui32ReadOpsPending; #endif } } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) psTACmd->ui32NumTASrcSyncs = psCCBKick->ui32NumTASrcSyncs; for (i=0; i<psCCBKick->ui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTASrcKernelSyncInfo[i]; psTACmd->asTASrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asTASrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->asTASrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->asTASrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } psTACmd->ui32NumTADstSyncs = psCCBKick->ui32NumTADstSyncs; for (i=0; i<psCCBKick->ui32NumTADstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTADstKernelSyncInfo[i]; psTACmd->asTADstSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asTADstSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->asTADstSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psTACmd->asTADstSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; } psTACmd->ui32Num3DSrcSyncs = psCCBKick->ui32Num3DSrcSyncs; for (i=0; i<psCCBKick->ui32Num3DSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ah3DSrcKernelSyncInfo[i]; psTACmd->as3DSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->as3DSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->as3DSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->as3DSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } #else psTACmd->ui32NumSrcSyncs = psCCBKick->ui32NumSrcSyncs; for (i=0; i<psCCBKick->ui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahSrcKernelSyncInfo[i]; PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_SRC_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psTACmd->asSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->asSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->asSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } #endif if (psCCBKick->bFirstKickOrResume && psCCBKick->ui32NumDstSyncObjects > 0) { PVRSRV_KERNEL_MEM_INFO *psHWDstSyncListMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psCCBKick->hKernelHWSyncListMemInfo; SGXMKIF_HWDEVICE_SYNC_LIST *psHWDeviceSyncList = psHWDstSyncListMemInfo->pvLinAddrKM; IMG_UINT32 ui32NumDstSyncs = psCCBKick->ui32NumDstSyncObjects; PVR_ASSERT(((PVRSRV_KERNEL_MEM_INFO *)psCCBKick->hKernelHWSyncListMemInfo)->uAllocSize >= (sizeof(SGXMKIF_HWDEVICE_SYNC_LIST) + (sizeof(PVRSRV_DEVICE_SYNC_OBJECT) * ui32NumDstSyncs))); psHWDeviceSyncList->ui32NumSyncObjects = ui32NumDstSyncs; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { PDUMPCOMMENT("HWDeviceSyncList for TACmd\r\n"); PDUMPMEM(IMG_NULL, psHWDstSyncListMemInfo, 0, sizeof(SGXMKIF_HWDEVICE_SYNC_LIST), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); } #endif for (i=0; i<ui32NumDstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->pahDstSyncHandles[i]; if (psSyncInfo) { PVR_TTRACE_SYNC_OBJECT(PVRSRV_TRACE_GROUP_KICK, KICK_TOKEN_DST_SYNC, psSyncInfo, PVRSRV_SYNCOP_SAMPLE); psHWDeviceSyncList->asSyncData[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psHWDeviceSyncList->asSyncData[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psHWDeviceSyncList->asSyncData[i].sReadOps2CompleteDevVAddr = psSyncInfo->sReadOps2CompleteDevVAddr; psHWDeviceSyncList->asSyncData[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psHWDeviceSyncList->asSyncData[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; psHWDeviceSyncList->asSyncData[i].ui32ReadOps2PendingVal = psSyncInfo->psSyncData->ui32ReadOps2Pending; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { IMG_UINT32 ui32ModifiedValue; IMG_UINT32 ui32SyncOffset = offsetof(SGXMKIF_HWDEVICE_SYNC_LIST, asSyncData) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)); IMG_UINT32 ui32WOpsOffset = ui32SyncOffset + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal); IMG_UINT32 ui32ROpsOffset = ui32SyncOffset + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal); IMG_UINT32 ui32ROps2Offset = ui32SyncOffset + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOps2PendingVal); PDUMPCOMMENT("HWDeviceSyncObject for RT: %i\r\n", i); PDUMPMEM(IMG_NULL, psHWDstSyncListMemInfo, ui32SyncOffset, sizeof(PVRSRV_DEVICE_SYNC_OBJECT), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT("Init RT ROpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastOpDumpVal - 1; PDUMPCOMMENT("Modify RT %d WOpPendingVal in HWDevSyncList\r\n", i); PDUMPMEM(&ui32ModifiedValue, psHWDstSyncListMemInfo, ui32WOpsOffset, sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); ui32ModifiedValue = 0; PDUMPCOMMENT("Modify RT %d ROpsPendingVal in HWDevSyncList\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psHWDstSyncListMemInfo, ui32ROpsOffset, sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); PDUMPCOMMENT("Modify RT %d ROps2PendingVal in HWDevSyncList\r\n", i); PDUMPMEM(&ui32ModifiedValue, psHWDstSyncListMemInfo, ui32ROps2Offset, sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); } #endif } else { psHWDeviceSyncList->asSyncData[i].sWriteOpsCompleteDevVAddr.uiAddr = 0; psHWDeviceSyncList->asSyncData[i].sReadOpsCompleteDevVAddr.uiAddr = 0; psHWDeviceSyncList->asSyncData[i].sReadOps2CompleteDevVAddr.uiAddr = 0; psHWDeviceSyncList->asSyncData[i].ui32ReadOpsPendingVal = 0; psHWDeviceSyncList->asSyncData[i].ui32ReadOps2PendingVal = 0; psHWDeviceSyncList->asSyncData[i].ui32WriteOpsPendingVal = 0; } } } psTACmd->ui32CtrlFlags |= SGXMKIF_CMDTA_CTRLFLAGS_READY; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { PDUMPCOMMENT("Shared part of TA command\r\n"); PDUMPMEM(psTACmd, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff, sizeof(SGXMKIF_CMDTA_SHARED), 0, MAKEUNIQUETAG(psCCBMemInfo)); #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) for (i=0; i<psCCBKick->ui32NumTASrcSyncs; i++) { IMG_UINT32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTASrcKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT("Init RT TA-SRC ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT TA-SRC WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastReadOpDumpVal - 1; PDUMPCOMMENT("Modify TA SrcSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTASrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify TA SrcSync %d WOpPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTASrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } for (i=0; i<psCCBKick->ui32NumTADstSyncs; i++) { IMG_UINT32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTADstKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT("Init RT TA-DST ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT TA-DST WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastOpDumpVal - 1; PDUMPCOMMENT("Modify TA DstSync %d WOpPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTADstSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify TA DstSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTADstSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } for (i=0; i<psCCBKick->ui32Num3DSrcSyncs; i++) { IMG_UINT32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ah3DSrcKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT("Init RT 3D-SRC ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT 3D-SRC WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastReadOpDumpVal - 1; PDUMPCOMMENT("Modify 3D SrcSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, as3DSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify 3D SrcSync %d WOpPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, as3DSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } #else for (i=0; i<psCCBKick->ui32NumSrcSyncs; i++) { IMG_UINT32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahSrcKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT("Init RT ROpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData->ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData->ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOps2Complete), sizeof(psSyncInfo->psSyncData->ui32ReadOps2Complete), 0, MAKEUNIQUETAG(psSyncInfo->psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastReadOpDumpVal - 1; PDUMPCOMMENT("Modify SrcSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify SrcSync %d WOpPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } if (psCCBKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTASyncInfo; PDUMPCOMMENT("Modify TA/TQ ROpPendingVal\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, ui32TATQSyncReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } if (psCCBKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->h3DSyncInfo; PDUMPCOMMENT("Modify 3D/TQ ROpPendingVal\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, ui323DTQSyncReadOpsPendingVal), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; } #endif for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if !defined(SUPPORT_SGX_NEW_STATUS_VALS) psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ahTAStatusSyncInfo[i]; PDUMPCOMMENT("Modify TA status value in TA cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_CMDTA_SHARED, sCtlTAStatusInfo[i].ui32StatusValue), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); #endif } for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if !defined(SUPPORT_SGX_NEW_STATUS_VALS) psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ah3DStatusSyncInfo[i]; PDUMPCOMMENT("Modify 3D status value in TA cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + (IMG_UINT32)offsetof(SGXMKIF_CMDTA_SHARED, sCtl3DStatusInfo[i].ui32StatusValue), sizeof(IMG_UINT32), 0, MAKEUNIQUETAG(psCCBMemInfo)); #endif } } #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_CMD_END, KICK_TOKEN_DOKICK); eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_TA, &psCCBKick->sCommand, KERNEL_ID, 0, hDevMemContext, psCCBKick->bLastInScene); if (eError == PVRSRV_ERROR_RETRY) { if (psCCBKick->bFirstKickOrResume && psCCBKick->ui32NumDstSyncObjects > 0) { for (i=0; i < psCCBKick->ui32NumDstSyncObjects; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->pahDstSyncHandles[i]; if (psSyncInfo) { psSyncInfo->psSyncData->ui32WriteOpsPending--; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { psSyncInfo->psSyncData->ui32LastOpDumpVal--; } #endif } } } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) for (i=0; i<psCCBKick->ui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTASrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } for (i=0; i<psCCBKick->ui32NumTADstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTADstKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32WriteOpsPending--; } for (i=0; i<psCCBKick->ui32Num3DSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ah3DSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } #else for (i=0; i<psCCBKick->ui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, KICK_TOKEN_DOKICK); return eError; } else if (PVRSRV_OK != eError) { PVR_DPF((PVR_DBG_ERROR, "SGXDoKickKM: SGXScheduleCCBCommandKM failed.")); PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, KICK_TOKEN_DOKICK); return eError; } #if defined(NO_HARDWARE) if (psCCBKick->hTA3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTA3DSyncInfo; if (psCCBKick->bTADependency) { psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } } if (psCCBKick->hTASyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->hTASyncInfo; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } if (psCCBKick->h3DSyncInfo != IMG_NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = (PVRSRV_KERNEL_MEM_INFO*)psCCBKick->asTAStatusUpdate[i].hKernelMemInfo; *(IMG_UINT32*)((IMG_UINTPTR_T)psKernelMemInfo->pvLinAddrKM + (psTACmd->sCtlTAStatusInfo[i].sStatusDevAddr.uiAddr - psKernelMemInfo->sDevVAddr.uiAddr)) = psTACmd->sCtlTAStatusInfo[i].ui32StatusValue; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ahTAStatusSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psTACmd->sCtlTAStatusInfo[i].ui32StatusValue; #endif } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) for (i=0; i<psCCBKick->ui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTASrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } for (i=0; i<psCCBKick->ui32NumTADstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahTADstKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } for (i=0; i<psCCBKick->ui32Num3DSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ah3DSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } #else for (i=0; i<psCCBKick->ui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->ahSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } #endif if (psCCBKick->bTerminateOrAbort) { if (psCCBKick->ui32NumDstSyncObjects > 0) { PVRSRV_KERNEL_MEM_INFO *psHWDstSyncListMemInfo = (PVRSRV_KERNEL_MEM_INFO *)psCCBKick->hKernelHWSyncListMemInfo; SGXMKIF_HWDEVICE_SYNC_LIST *psHWDeviceSyncList = psHWDstSyncListMemInfo->pvLinAddrKM; for (i=0; i<psCCBKick->ui32NumDstSyncObjects; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->pahDstSyncHandles[i]; if (psSyncInfo) psSyncInfo->psSyncData->ui32WriteOpsComplete = psHWDeviceSyncList->asSyncData[i].ui32WriteOpsPendingVal+1; } } for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = (PVRSRV_KERNEL_MEM_INFO*)psCCBKick->as3DStatusUpdate[i].hKernelMemInfo; *(IMG_UINT32*)((IMG_UINTPTR_T)psKernelMemInfo->pvLinAddrKM + (psTACmd->sCtl3DStatusInfo[i].sStatusDevAddr.uiAddr - psKernelMemInfo->sDevVAddr.uiAddr)) = psTACmd->sCtl3DStatusInfo[i].ui32StatusValue; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)psCCBKick->ah3DStatusSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psTACmd->sCtl3DStatusInfo[i].ui32StatusValue; #endif } } #endif PVR_TTRACE(PVRSRV_TRACE_GROUP_KICK, PVRSRV_TRACE_CLASS_FUNCTION_EXIT, KICK_TOKEN_DOKICK); return eError; }
PVRSRV_ERROR SGXDoKickKM(void *hDevHandle, SGX_CCB_KICK * psCCBKick) { PVRSRV_ERROR eError; PVRSRV_KERNEL_SYNC_INFO *psSyncInfo; PVRSRV_KERNEL_MEM_INFO *psCCBMemInfo = (PVRSRV_KERNEL_MEM_INFO *) psCCBKick->hCCBKernelMemInfo; SGXMKIF_CMDTA_SHARED *psTACmd; u32 i; #if defined(SUPPORT_SGX_HWPERF) PVRSRV_DEVICE_NODE *psDeviceNode; PVRSRV_SGXDEV_INFO *psDevInfo; psDeviceNode = (PVRSRV_DEVICE_NODE *) hDevHandle; psDevInfo = (PVRSRV_SGXDEV_INFO *) psDeviceNode->pvDevice; #endif #if defined(SUPPORT_SGX_HWPERF) if (psCCBKick->bKickRender) { ++psDevInfo->ui32KickTARenderCounter; } ++psDevInfo->ui32KickTACounter; #endif if (!CCB_OFFSET_IS_VALID (SGXMKIF_CMDTA_SHARED, psCCBMemInfo, psCCBKick, ui32CCBOffset)) { PVR_DPF((PVR_DBG_ERROR, "SGXDoKickKM: Invalid CCB offset")); return PVRSRV_ERROR_INVALID_PARAMS; } psTACmd = CCB_DATA_FROM_OFFSET(SGXMKIF_CMDTA_SHARED, psCCBMemInfo, psCCBKick, ui32CCBOffset); if (psCCBKick->hTA3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->hTA3DSyncInfo; psTACmd->sTA3DDependency.sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->sTA3DDependency.ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; if (psCCBKick->bTADependency) { psSyncInfo->psSyncData->ui32WriteOpsPending++; } } if (psCCBKick->hTASyncInfo != NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->hTASyncInfo; psTACmd->sTATQSyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->sTATQSyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->ui32TATQSyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->ui32TATQSyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } if (psCCBKick->h3DSyncInfo != NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->h3DSyncInfo; psTACmd->s3DTQSyncReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->s3DTQSyncWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->ui323DTQSyncReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->ui323DTQSyncWriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } psTACmd->ui32NumTAStatusVals = psCCBKick->ui32NumTAStatusVals; if (psCCBKick->ui32NumTAStatusVals != 0) { for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) psTACmd->sCtlTAStatusInfo[i] = psCCBKick->asTAStatusUpdate[i].sCtlStatus; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTAStatusSyncInfo[i]; psTACmd->sCtlTAStatusInfo[i].sStatusDevAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->sCtlTAStatusInfo[i].ui32StatusValue = psSyncInfo->psSyncData->ui32ReadOpsPending; #endif } } psTACmd->ui32Num3DStatusVals = psCCBKick->ui32Num3DStatusVals; if (psCCBKick->ui32Num3DStatusVals != 0) { for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) psTACmd->sCtl3DStatusInfo[i] = psCCBKick->as3DStatusUpdate[i].sCtlStatus; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ah3DStatusSyncInfo[i]; psTACmd->sCtl3DStatusInfo[i].sStatusDevAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->sCtl3DStatusInfo[i].ui32StatusValue = psSyncInfo->psSyncData->ui32ReadOpsPending; #endif } } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) psTACmd->ui32NumTASrcSyncs = psCCBKick->ui32NumTASrcSyncs; for (i = 0; i < psCCBKick->ui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTASrcKernelSyncInfo[i]; psTACmd->asTASrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asTASrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->asTASrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->asTASrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } psTACmd->ui32NumTADstSyncs = psCCBKick->ui32NumTADstSyncs; for (i = 0; i < psCCBKick->ui32NumTADstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTADstKernelSyncInfo[i]; psTACmd->asTADstSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asTADstSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->asTADstSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psTACmd->asTADstSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending++; } psTACmd->ui32Num3DSrcSyncs = psCCBKick->ui32Num3DSrcSyncs; for (i = 0; i < psCCBKick->ui32Num3DSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ah3DSrcKernelSyncInfo[i]; psTACmd->as3DSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->as3DSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->as3DSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->as3DSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } #else psTACmd->ui32NumSrcSyncs = psCCBKick->ui32NumSrcSyncs; for (i = 0; i < psCCBKick->ui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahSrcKernelSyncInfo[i]; psTACmd->asSrcSyncs[i].sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psTACmd->asSrcSyncs[i].sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psTACmd->asSrcSyncs[i].ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending++; psTACmd->asSrcSyncs[i].ui32WriteOpsPendingVal = psSyncInfo->psSyncData->ui32WriteOpsPending; } #endif if (psCCBKick->bFirstKickOrResume && psCCBKick->ui32NumDstSyncObjects > 0) { PVRSRV_KERNEL_MEM_INFO *psHWDstSyncListMemInfo = (PVRSRV_KERNEL_MEM_INFO *) psCCBKick-> hKernelHWSyncListMemInfo; SGXMKIF_HWDEVICE_SYNC_LIST *psHWDeviceSyncList = psHWDstSyncListMemInfo->pvLinAddrKM; u32 ui32NumDstSyncs = psCCBKick->ui32NumDstSyncObjects; PVR_ASSERT(((PVRSRV_KERNEL_MEM_INFO *) psCCBKick-> hKernelHWSyncListMemInfo)->ui32AllocSize >= (sizeof(SGXMKIF_HWDEVICE_SYNC_LIST) + (sizeof(PVRSRV_DEVICE_SYNC_OBJECT) * ui32NumDstSyncs))); psHWDeviceSyncList->ui32NumSyncObjects = ui32NumDstSyncs; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { PDUMPCOMMENT("HWDeviceSyncList for TACmd\r\n"); PDUMPMEM(NULL, psHWDstSyncListMemInfo, 0, sizeof(SGXMKIF_HWDEVICE_SYNC_LIST), 0, MAKEUNIQUETAG(psHWDstSyncListMemInfo)); } #endif for (i = 0; i < ui32NumDstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> pahDstSyncHandles[i]; if (psSyncInfo) { psHWDeviceSyncList->asSyncData[i]. sWriteOpsCompleteDevVAddr = psSyncInfo->sWriteOpsCompleteDevVAddr; psHWDeviceSyncList->asSyncData[i]. sReadOpsCompleteDevVAddr = psSyncInfo->sReadOpsCompleteDevVAddr; psHWDeviceSyncList->asSyncData[i]. ui32ReadOpsPendingVal = psSyncInfo->psSyncData->ui32ReadOpsPending; psHWDeviceSyncList->asSyncData[i]. ui32WriteOpsPendingVal = psSyncInfo->psSyncData-> ui32WriteOpsPending++; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { u32 ui32ModifiedValue; u32 ui32SyncOffset = offsetof(SGXMKIF_HWDEVICE_SYNC_LIST, asSyncData) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)); u32 ui32WOpsOffset = ui32SyncOffset + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal); u32 ui32ROpsOffset = ui32SyncOffset + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal); PDUMPCOMMENT ("HWDeviceSyncObject for RT: %i\r\n", i); PDUMPMEM(NULL, psHWDstSyncListMemInfo, ui32SyncOffset, sizeof (PVRSRV_DEVICE_SYNC_OBJECT), 0, MAKEUNIQUETAG (psHWDstSyncListMemInfo)); if ((psSyncInfo->psSyncData-> ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData-> ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT ("Init RT ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo-> psSyncData-> ui32LastReadOpDumpVal, psSyncInfo-> psSyncDataMemInfoKM, offsetof (PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo-> psSyncData-> ui32ReadOpsComplete), 0, MAKEUNIQUETAG (psSyncInfo-> psSyncDataMemInfoKM)); PDUMPCOMMENT ("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo-> psSyncData-> ui32LastOpDumpVal, psSyncInfo-> psSyncDataMemInfoKM, offsetof (PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo-> psSyncData-> ui32WriteOpsComplete), 0, MAKEUNIQUETAG (psSyncInfo-> psSyncDataMemInfoKM)); } psSyncInfo->psSyncData-> ui32LastOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData-> ui32LastOpDumpVal - 1; PDUMPCOMMENT ("Modify RT %d WOpPendingVal in HWDevSyncList\r\n", i); PDUMPMEM(&ui32ModifiedValue, psHWDstSyncListMemInfo, ui32WOpsOffset, sizeof(u32), 0, MAKEUNIQUETAG (psHWDstSyncListMemInfo)); ui32ModifiedValue = 0; PDUMPCOMMENT ("Modify RT %d ROpsPendingVal in HWDevSyncList\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData-> ui32LastReadOpDumpVal, psHWDstSyncListMemInfo, ui32ROpsOffset, sizeof(u32), 0, MAKEUNIQUETAG (psHWDstSyncListMemInfo)); } #endif } else { psHWDeviceSyncList->asSyncData[i]. sWriteOpsCompleteDevVAddr.uiAddr = 0; psHWDeviceSyncList->asSyncData[i]. sReadOpsCompleteDevVAddr.uiAddr = 0; psHWDeviceSyncList->asSyncData[i]. ui32ReadOpsPendingVal = 0; psHWDeviceSyncList->asSyncData[i]. ui32WriteOpsPendingVal = 0; } } } psTACmd->ui32CtrlFlags |= SGXMKIF_CMDTA_CTRLFLAGS_READY; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { PDUMPCOMMENT("Shared part of TA command\r\n"); PDUMPMEM(psTACmd, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff, sizeof(SGXMKIF_CMDTA_SHARED), 0, MAKEUNIQUETAG(psCCBMemInfo)); #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) for (i = 0; i < psCCBKick->ui32NumTASrcSyncs; i++) { u32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTASrcKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT("Init RT TA-SRC ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData-> ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData-> ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo-> psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT TA-SRC WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData-> ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData-> ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo-> psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastReadOpDumpVal - 1; PDUMPCOMMENT("Modify TA SrcSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTASrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify TA SrcSync %d WOpPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTASrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } for (i = 0; i < psCCBKick->ui32NumTADstSyncs; i++) { u32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTADstKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT("Init RT TA-DST ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData-> ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData-> ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo-> psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT TA-DST WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData-> ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData-> ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo-> psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastOpDumpVal - 1; PDUMPCOMMENT("Modify TA DstSync %d WOpPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTADstSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify TA DstSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastReadOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asTADstSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } for (i = 0; i < psCCBKick->ui32Num3DSrcSyncs; i++) { u32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ah3DSrcKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT("Init RT 3D-SRC ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData-> ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData-> ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo-> psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT 3D-SRC WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData-> ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData-> ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo-> psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastReadOpDumpVal - 1; PDUMPCOMMENT("Modify 3D SrcSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, as3DSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify 3D SrcSync %d WOpPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, as3DSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } #else for (i = 0; i < psCCBKick->ui32NumSrcSyncs; i++) { u32 ui32ModifiedValue; psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahSrcKernelSyncInfo[i]; if ((psSyncInfo->psSyncData->ui32LastOpDumpVal == 0) && (psSyncInfo->psSyncData->ui32LastReadOpDumpVal == 0)) { PDUMPCOMMENT("Init RT ROpsComplete\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData-> ui32LastReadOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32ReadOpsComplete), sizeof(psSyncInfo->psSyncData-> ui32ReadOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo-> psSyncDataMemInfoKM)); PDUMPCOMMENT("Init RT WOpsComplete\r\n"); PDUMPMEM(&psSyncInfo->psSyncData-> ui32LastOpDumpVal, psSyncInfo->psSyncDataMemInfoKM, offsetof(PVRSRV_SYNC_DATA, ui32WriteOpsComplete), sizeof(psSyncInfo->psSyncData-> ui32WriteOpsComplete), 0, MAKEUNIQUETAG(psSyncInfo-> psSyncDataMemInfoKM)); } psSyncInfo->psSyncData->ui32LastReadOpDumpVal++; ui32ModifiedValue = psSyncInfo->psSyncData->ui32LastReadOpDumpVal - 1; PDUMPCOMMENT("Modify SrcSync %d ROpsPendingVal\r\n", i); PDUMPMEM(&ui32ModifiedValue, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32ReadOpsPendingVal), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); PDUMPCOMMENT("Modify SrcSync %d WOpPendingVal\r\n", i); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, asSrcSyncs) + (i * sizeof(PVRSRV_DEVICE_SYNC_OBJECT)) + offsetof(PVRSRV_DEVICE_SYNC_OBJECT, ui32WriteOpsPendingVal), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); } #endif for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PDUMPCOMMENT("Modify TA status value in TA cmd\r\n"); PDUMPMEM(&psCCBKick->asTAStatusUpdate[i]. ui32LastStatusUpdateDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, sCtlTAStatusInfo[i].ui32StatusValue), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTAStatusSyncInfo[i]; PDUMPCOMMENT("Modify TA status value in TA cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, sCtlTAStatusInfo[i].ui32StatusValue), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); #endif } for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PDUMPCOMMENT("Modify 3D status value in TA cmd\r\n"); PDUMPMEM(&psCCBKick->as3DStatusUpdate[i]. ui32LastStatusUpdateDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, sCtl3DStatusInfo[i].ui32StatusValue), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ah3DStatusSyncInfo[i]; PDUMPCOMMENT("Modify 3D status value in TA cmd\r\n"); PDUMPMEM(&psSyncInfo->psSyncData->ui32LastOpDumpVal, psCCBMemInfo, psCCBKick->ui32CCBDumpWOff + offsetof(SGXMKIF_CMDTA_SHARED, sCtl3DStatusInfo[i].ui32StatusValue), sizeof(u32), 0, MAKEUNIQUETAG(psCCBMemInfo)); #endif } } #endif eError = SGXScheduleCCBCommandKM(hDevHandle, SGXMKIF_CMD_TA, &psCCBKick->sCommand, KERNEL_ID, 0); if (eError == PVRSRV_ERROR_RETRY) { if (psCCBKick->bFirstKickOrResume && psCCBKick->ui32NumDstSyncObjects > 0) { for (i = 0; i < psCCBKick->ui32NumDstSyncObjects; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> pahDstSyncHandles[i]; if (psSyncInfo) { psSyncInfo->psSyncData-> ui32WriteOpsPending--; #if defined(PDUMP) if (PDumpIsCaptureFrameKM()) { psSyncInfo->psSyncData-> ui32LastOpDumpVal--; } #endif } } } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) for (i = 0; i < psCCBKick->ui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTASrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } for (i = 0; i < psCCBKick->ui32NumTADstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTADstKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32WriteOpsPending--; } for (i = 0; i < psCCBKick->ui32Num3DSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ah3DSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } #else for (i = 0; i < psCCBKick->ui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsPending--; } #endif return eError; } else if (PVRSRV_OK != eError) { PVR_DPF((PVR_DBG_ERROR, "SGXDoKickKM: SGXScheduleCCBCommandKM failed.")); return eError; } #if defined(NO_HARDWARE) if (psCCBKick->hTA3DSyncInfo) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->hTA3DSyncInfo; if (psCCBKick->bTADependency) { psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } } if (psCCBKick->hTASyncInfo != NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->hTASyncInfo; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } if (psCCBKick->h3DSyncInfo != NULL) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick->h3DSyncInfo; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } for (i = 0; i < psCCBKick->ui32NumTAStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = (PVRSRV_KERNEL_MEM_INFO *) psCCBKick->asTAStatusUpdate[i]. hKernelMemInfo; *(u32 *) ((u32) psKernelMemInfo->pvLinAddrKM + (psTACmd->sCtlTAStatusInfo[i].sStatusDevAddr.uiAddr - psKernelMemInfo->sDevVAddr.uiAddr)) = psTACmd->sCtlTAStatusInfo[i].ui32StatusValue; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTAStatusSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psTACmd->sCtlTAStatusInfo[i].ui32StatusValue; #endif } #if defined(SUPPORT_SGX_GENERALISED_SYNCOBJECTS) for (i = 0; i < psCCBKick->ui32NumTASrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTASrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } for (i = 0; i < psCCBKick->ui32NumTADstSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahTADstKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32WriteOpsComplete = psSyncInfo->psSyncData->ui32WriteOpsPending; } for (i = 0; i < psCCBKick->ui32Num3DSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ah3DSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } #else for (i = 0; i < psCCBKick->ui32NumSrcSyncs; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ahSrcKernelSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psSyncInfo->psSyncData->ui32ReadOpsPending; } #endif if (psCCBKick->bTerminateOrAbort) { if (psCCBKick->ui32NumDstSyncObjects > 0) { PVRSRV_KERNEL_MEM_INFO *psHWDstSyncListMemInfo = (PVRSRV_KERNEL_MEM_INFO *) psCCBKick-> hKernelHWSyncListMemInfo; SGXMKIF_HWDEVICE_SYNC_LIST *psHWDeviceSyncList = psHWDstSyncListMemInfo->pvLinAddrKM; for (i = 0; i < psCCBKick->ui32NumDstSyncObjects; i++) { psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> pahDstSyncHandles[i]; if (psSyncInfo) psSyncInfo->psSyncData-> ui32WriteOpsComplete = psHWDeviceSyncList->asSyncData[i]. ui32WriteOpsPendingVal + 1; } } for (i = 0; i < psCCBKick->ui32Num3DStatusVals; i++) { #if defined(SUPPORT_SGX_NEW_STATUS_VALS) PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo = (PVRSRV_KERNEL_MEM_INFO *) psCCBKick-> as3DStatusUpdate[i].hKernelMemInfo; *(u32 *) ((u32) psKernelMemInfo->pvLinAddrKM + (psTACmd->sCtl3DStatusInfo[i].sStatusDevAddr. uiAddr - psKernelMemInfo->sDevVAddr.uiAddr)) = psTACmd->sCtl3DStatusInfo[i].ui32StatusValue; #else psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *) psCCBKick-> ah3DStatusSyncInfo[i]; psSyncInfo->psSyncData->ui32ReadOpsComplete = psTACmd->sCtl3DStatusInfo[i].ui32StatusValue; #endif } } #endif return eError; }