Ejemplo n.º 1
0
IMG_EXPORT
PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeDeviceMemKM(IMG_HANDLE				hDevCookie,
												PVRSRV_KERNEL_MEM_INFO	*psMemInfo)
{
	PVRSRV_ERROR eError;

	PVR_UNREFERENCED_PARAMETER(hDevCookie);

	if (!psMemInfo)
	{
		return PVRSRV_ERROR_INVALID_PARAMS;
	}

	if (psMemInfo->sMemBlk.hResItem != IMG_NULL)
	{
		eError = ResManFreeResByPtr(psMemInfo->sMemBlk.hResItem, CLEANUP_WITH_POLL);
	}
	else
	{
		
		eError = FreeDeviceMemCallBack(psMemInfo, 0, CLEANUP_WITH_POLL);
	}

	return eError;
}
Ejemplo n.º 2
0
static PVRSRV_ERROR UnmapDeviceMemoryCallBack(IMG_PVOID pvParam, 
											  IMG_UINT32 ui32Param)
{
	PVRSRV_ERROR				eError;
	RESMAN_MAP_DEVICE_MEM_DATA	*psMapData = pvParam;

	PVR_UNREFERENCED_PARAMETER(ui32Param);

	if(psMapData->psMemInfo->sMemBlk.psIntSysPAddr)
	{
		OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(IMG_SYS_PHYADDR), psMapData->psMemInfo->sMemBlk.psIntSysPAddr, IMG_NULL);
		psMapData->psMemInfo->sMemBlk.psIntSysPAddr = IMG_NULL;
	}
	
	eError = FreeDeviceMem(psMapData->psMemInfo);
	if(eError != PVRSRV_OK)
	{
		PVR_DPF((PVR_DBG_ERROR,"UnmapDeviceMemoryCallBack: Failed to free DST meminfo"));
		return eError;
	}

	
	psMapData->psSrcMemInfo->ui32RefCount--;
	
	if (psMapData->psSrcMemInfo->ui32RefCount == 1 && 
		 psMapData->psSrcMemInfo->bPendingFree == IMG_TRUE)
	{
		


		if (psMapData->psSrcMemInfo->sMemBlk.hResItem != IMG_NULL)
		{
			

			eError = ResManFreeResByPtr(psMapData->psSrcMemInfo->sMemBlk.hResItem);
			if (eError != PVRSRV_OK)
			{
				PVR_DPF((PVR_DBG_ERROR,"UnmapDeviceMemoryCallBack: Failed to free SRC meminfo"));
				PVR_DBG_BREAK;
			}
		}
		else
		{
			
			eError = FreeDeviceMemCallBack(psMapData->psSrcMemInfo, 0);
		}
	}

	OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(RESMAN_MAP_DEVICE_MEM_DATA), psMapData, IMG_NULL);
	
	
	return eError;
}
enum PVRSRV_ERROR PVRSRVFreeDeviceMemKM(void *hDevCookie,
				   struct PVRSRV_KERNEL_MEM_INFO *psMemInfo)
{
	PVR_UNREFERENCED_PARAMETER(hDevCookie);

	if (!psMemInfo)
		return PVRSRV_ERROR_INVALID_PARAMS;

	if (psMemInfo->sMemBlk.hResItem != NULL)
		ResManFreeResByPtr(psMemInfo->sMemBlk.hResItem);
	else
		FreeDeviceMemCallBack(psMemInfo, 0);

	return PVRSRV_OK;
}