Beispiel #1
0
/*!
******************************************************************************

 @Function	PVRSRVPerProcessDataDisconnect

 @Description	Decrement refcount for per-process data area,
 				and free the resources if necessary.

 @Input		ui32PID - process ID

 @Return	IMG_VOID

******************************************************************************/
IMG_VOID PVRSRVPerProcessDataDisconnect(IMG_UINT32	ui32PID)
{
	PVRSRV_ERROR eError;
	PVRSRV_PER_PROCESS_DATA *psPerProc;

	PVR_ASSERT(psHashTab != IMG_NULL);

	psPerProc = (PVRSRV_PER_PROCESS_DATA *)HASH_Retrieve(psHashTab, (IMG_UINTPTR_T)ui32PID);
	if (psPerProc == IMG_NULL)
	{
		PVR_DPF((PVR_DBG_ERROR, "PVRSRVPerProcessDataDealloc: Couldn't locate per-process data for PID %u", ui32PID));
	}
	else
	{
		psPerProc->ui32RefCount--;
		if (psPerProc->ui32RefCount == 0)
		{
			PVR_DPF((PVR_DBG_MESSAGE, "PVRSRVPerProcessDataDisconnect: "
					"Last close from process 0x%x received", ui32PID));

			/* Close the Resource Manager connection */
			PVRSRVResManDisconnect(psPerProc->hResManContext, IMG_FALSE);

#if defined (TTRACE)
			PVRSRVTimeTraceBufferDestroy(ui32PID);
#endif

			/* Free the per-process data */
			eError = FreePerProcessData(psPerProc);
			if (eError != PVRSRV_OK)
			{
				PVR_DPF((PVR_DBG_ERROR, "PVRSRVPerProcessDataDisconnect: Error freeing per-process data"));
			}
		}
	}

	eError = PVRSRVPurgeHandles(KERNEL_HANDLE_BASE);
	if (eError != PVRSRV_OK)
	{
		PVR_DPF((PVR_DBG_ERROR, "PVRSRVPerProcessDataDisconnect: Purge of global handle pool failed (%d)", eError));
	}
}
/* PVRSRVConnectionDisconnect */
IMG_VOID PVRSRVConnectionDisconnect(IMG_PVOID pvDataPtr)
{
	PVRSRV_ERROR eError;
	CONNECTION_DATA *psConnection = pvDataPtr;

	/* Close the Resource Manager connection */
	PVRSRVResManDisconnect(psConnection->hResManContext);
	
	/* Free the connection data */
	eError = FreeConnectionData(psConnection);
	if (eError != PVRSRV_OK)
	{
		PVR_DPF((PVR_DBG_ERROR, "PVRSRVConnectionDisconnect: Error freeing per-process data"));
	}

	/* FIXME: Is this still required? */
	eError = PVRSRVPurgeHandles(KERNEL_HANDLE_BASE);
	if (eError != PVRSRV_OK)
	{
		PVR_DPF((PVR_DBG_ERROR, "PVRSRVConnectionDisconnect: Purge of global handle pool failed (%d)", eError));
	}
}
Beispiel #3
0
void PVRSRVPerProcessDataDisconnect(u32 ui32PID)
{
	enum PVRSRV_ERROR eError;
	struct PVRSRV_PER_PROCESS_DATA *psPerProc;

	PVR_ASSERT(psHashTab != NULL);

	psPerProc = (struct PVRSRV_PER_PROCESS_DATA *)HASH_Retrieve(psHashTab,
							      (u32)ui32PID);
	if (psPerProc == NULL) {
		PVR_DPF(PVR_DBG_ERROR, "PVRSRVPerProcessDataDealloc: "
				"Couldn't locate per-process data for PID %u",
			 ui32PID);
	} else {
		psPerProc->ui32RefCount--;
		if (psPerProc->ui32RefCount == 0) {
			PVR_DPF(PVR_DBG_MESSAGE,
				 "PVRSRVPerProcessDataDisconnect: "
				 "Last close from process 0x%x received",
				 ui32PID);

			PVRSRVResManDisconnect(psPerProc->hResManContext,
					       IMG_FALSE);

			eError = FreePerProcessData(psPerProc);
			if (eError != PVRSRV_OK)
				PVR_DPF(PVR_DBG_ERROR,
					"PVRSRVPerProcessDataDisconnect: "
					"Error freeing per-process data");
		}
	}

	eError = PVRSRVPurgeHandles(KERNEL_HANDLE_BASE);
	if (eError != PVRSRV_OK)
		PVR_DPF(PVR_DBG_ERROR, "PVRSRVPerProcessDataDisconnect: "
				"Purge of global handle pool failed (%d)",
			 eError);
}
/* PVRSRVConnectionDisconnect */
IMG_VOID PVRSRVConnectionDisconnect(IMG_PVOID pvDataPtr)
{
	PVRSRV_ERROR eError;
	CONNECTION_DATA *psConnection = pvDataPtr;

	/* Close the Resource Manager connection */
	PVRSRVResManDisconnect(psConnection->hResManContext);

	/*
		Unregister with the sync core. Logically this is after resman to
		ensure that any sync block that haven't been freed by the app will
		be freed by resman 1st.
		However, due to the fact the resman can defer the free the Sync core
		needs to handle the case where the connection data is destroyed while
		Sync blocks are still in it.
	*/
	SyncUnregisterConnection(psConnection->psSyncConnectionData);

	/*
		Unregister with the PDump core, see the note above about logical order
		and refcounting as it also applies to the PDump connection data
	*/
	PDumpUnregisterConnection(psConnection->psPDumpConnectionData);

	/* Free the connection data */
	eError = FreeConnectionData(psConnection);
	if (eError != PVRSRV_OK)
	{
		PVR_DPF((PVR_DBG_ERROR, "PVRSRVConnectionDisconnect: Error freeing per-process data"));
	}

	eError = PVRSRVPurgeHandles(KERNEL_HANDLE_BASE);
	if (eError != PVRSRV_OK)
	{
		PVR_DPF((PVR_DBG_ERROR, "PVRSRVConnectionDisconnect: Purge of global handle pool failed (%d)", eError));
	}
}