static PVRSRV_ERROR _Destroy3DTransferContext(RGX_SERVER_TQ_3D_DATA *ps3DData, PVRSRV_DEVICE_NODE *psDeviceNode, PVRSRV_CLIENT_SYNC_PRIM *psCleanupSync) { PVRSRV_ERROR eError; /* Check if the FW has finished with this resource ... */ eError = RGXFWRequestCommonContextCleanUp(psDeviceNode, FWCommonContextGetFWAddress(ps3DData->psServerCommonContext), psCleanupSync, RGXFWIF_DM_3D); if (eError == PVRSRV_ERROR_RETRY) { return eError; } else if (eError != PVRSRV_OK) { PVR_LOG(("%s: Unexpected error from RGXFWRequestCommonContextCleanUp (%s)", __FUNCTION__, PVRSRVGetErrorStringKM(eError))); } /* ... it has so we can free it's resources */ DevmemFwFree(ps3DData->psFWContextStateMemDesc); FWCommonContextFree(ps3DData->psServerCommonContext); return PVRSRV_OK; }
IMG_EXPORT PVRSRV_ERROR PVRSRVRGXDestroyComputeContextKM(RGX_SERVER_COMPUTE_CONTEXT *psComputeContext) { PVRSRV_ERROR eError = PVRSRV_OK; /* Check if the FW has finished with this resource ... */ eError = RGXFWRequestCommonContextCleanUp(psComputeContext->psDeviceNode, FWCommonContextGetFWAddress(psComputeContext->psServerCommonContext), psComputeContext->psSync, RGXFWIF_DM_CDM); if (eError == PVRSRV_ERROR_RETRY) { return eError; } else if (eError != PVRSRV_OK) { PVR_LOG(("%s: Unexpected error from RGXFWRequestCommonContextCleanUp (%s)", __FUNCTION__, PVRSRVGetErrorStringKM(eError))); } /* ... it has so we can free its resources */ dllist_remove_node(&(psComputeContext->sListNode)); FWCommonContextFree(psComputeContext->psServerCommonContext); DevmemFwFree(psComputeContext->psFWFrameworkMemDesc); DevmemFwFree(psComputeContext->psFWComputeContextStateMemDesc); SyncPrimFree(psComputeContext->psSync); OSFreeMem(psComputeContext); return PVRSRV_OK; }
/* * PVRSRVRGXDestroyTQ2DContextKM */ IMG_EXPORT PVRSRV_ERROR PVRSRVRGXDestroyTQ2DContextKM(RGX_TQ2D_CLEANUP_DATA *psCleanupData) { PVRSRV_ERROR eError = PVRSRV_OK; PRGXFWIF_FWCOMMONCONTEXT psFWComContextFWAddr; RGXSetFirmwareAddress(&psFWComContextFWAddr, psCleanupData->psFWTQ2DContextMemDesc, 0, RFW_FWADDR_NOREF_FLAG); eError = RGXFWRequestCommonContextCleanUp(psCleanupData->psDeviceNode, psFWComContextFWAddr, psCleanupData->psCleanupSync, RGXFWIF_DM_2D); /* If we get retry error then we can't free this resource as it's still in use and we will be called again */ if (eError != PVRSRV_ERROR_RETRY) { eError = RGXDeinitFWCommonContext(&psCleanupData->sFWComContextCleanup); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR, "PVRSRVRGXDestroyTQ2DContextKM : failed to deinit fw common ctx. Error:%u", eError)); goto e0; } /* Free the framework buffer */ DevmemFwFree(psCleanupData->psFWFrameworkMemDesc); /* * Free the firmware common context. */ DevmemFwFree(psCleanupData->psFWTQ2DContextMemDesc); /* Free the cleanup sync */ SyncPrimFree(psCleanupData->psCleanupSync); OSFreeMem(psCleanupData); } e0: return eError; }
IMG_EXPORT PVRSRV_ERROR PVRSRVRGXDestroyComputeContextKM(RGX_SERVER_COMPUTE_CONTEXT *psComputeContext) { PVRSRV_ERROR eError = PVRSRV_OK; PVRSRV_RGXDEV_INFO *psDevInfo = psComputeContext->psDeviceNode->pvDevice; /* Check if the FW has finished with this resource ... */ eError = RGXFWRequestCommonContextCleanUp(psComputeContext->psDeviceNode, psComputeContext->psServerCommonContext, psComputeContext->psSync, RGXFWIF_DM_CDM); if (eError == PVRSRV_ERROR_RETRY) { return eError; } else if (eError != PVRSRV_OK) { PVR_LOG(("%s: Unexpected error from RGXFWRequestCommonContextCleanUp (%s)", __FUNCTION__, PVRSRVGetErrorStringKM(eError))); return eError; } /* ... it has so we can free its resources */ OSWRLockAcquireWrite(psDevInfo->hComputeCtxListLock); dllist_remove_node(&(psComputeContext->sListNode)); OSWRLockReleaseWrite(psDevInfo->hComputeCtxListLock); FWCommonContextFree(psComputeContext->psServerCommonContext); DevmemFwFree(psComputeContext->psFWFrameworkMemDesc); DevmemFwFree(psComputeContext->psFWComputeContextStateMemDesc); SyncPrimFree(psComputeContext->psSync); SyncAddrListDeinit(&psComputeContext->sSyncAddrListFence); SyncAddrListDeinit(&psComputeContext->sSyncAddrListUpdate); OSFreeMem(psComputeContext); return PVRSRV_OK; }
/* * PVRSRVRGXDestroyTQ3DContextKM */ IMG_EXPORT PVRSRV_ERROR PVRSRVRGXDestroyTQ3DContextKM(RGX_TQ3D_CLEANUP_DATA *psCleanupData) { PVRSRV_ERROR eError = PVRSRV_OK; PRGXFWIF_FWCOMMONCONTEXT psFWComContextFWAddr; RGXSetFirmwareAddress(&psFWComContextFWAddr, psCleanupData->psFWTQ3DContextMemDesc, 0, RFW_FWADDR_NOREF_FLAG); eError = RGXFWRequestCommonContextCleanUp(psCleanupData->psDeviceNode, psFWComContextFWAddr, psCleanupData->psCleanupSync, RGXFWIF_DM_3D); /* If we get retry error then we can't free this resource as it's still in use and we will be called again */ if (eError != PVRSRV_ERROR_RETRY) { eError = RGXDeinitFWCommonContext(&psCleanupData->sFWComContextCleanup); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR, "PVRSRVRGXDestroyTQ3DContextKM : failed to deinit fw common ctx. Error:%u", eError)); goto e0; } #if defined(DEBUG) /* Log the number of TQ3D context stores which occurred */ { RGXFWIF_3DCTX_STATE *psFWState; eError = DevmemAcquireCpuVirtAddr(psCleanupData->psFWTQ3DContextStateMemDesc, (IMG_VOID**)&psFWState); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"PVRSRVRGXCreateRenderContextKM: Failed to map firmware render context state (%u)", eError)); } else { PVR_DPF((PVR_DBG_WARNING,"Number of context stores on FW TQ3D context 0x%010x: %u", psFWComContextFWAddr.ui32Addr, psFWState->ui32NumStores)); /* Release the CPU virt addr */ DevmemReleaseCpuVirtAddr(psCleanupData->psFWTQ3DContextStateMemDesc); } } #endif /* * Unmap the TA/3D context state buffer pointers */ RGXUnsetFirmwareAddress(psCleanupData->psFWTQ3DContextStateMemDesc); /* * Free the firmware TQ/3D context state buffer */ DevmemFwFree(psCleanupData->psFWTQ3DContextStateMemDesc); /* Free the framework buffer */ DevmemFwFree(psCleanupData->psFWFrameworkMemDesc); /* * Free the firmware common context. */ DevmemFwFree(psCleanupData->psFWTQ3DContextMemDesc); /* Free the cleanup sync */ SyncPrimFree(psCleanupData->psCleanupSync); OSFreeMem(psCleanupData); } e0: return eError; }