Пример #1
0
static enum PVRSRV_ERROR DestroyDCSwapChain(void *hDevice, void *hSwapChain)
{
	struct OMAPLFB_DEVINFO *psDevInfo;
	struct OMAPLFB_SWAPCHAIN *psSwapChain;
	enum PVRSRV_ERROR eError;

	if (!hDevice || !hSwapChain)
		return PVRSRV_ERROR_INVALID_PARAMS;

	psDevInfo = (struct OMAPLFB_DEVINFO *)hDevice;
	psSwapChain = (struct OMAPLFB_SWAPCHAIN *)hSwapChain;
	if (psSwapChain != psDevInfo->psSwapChain)
		return PVRSRV_ERROR_INVALID_PARAMS;

	eError = DisableLFBEventNotification(psDevInfo);
	if (eError != PVRSRV_OK)
		printk(KERN_WARNING DRIVER_PREFIX
		       ": Couldn't disable framebuffer event notification\n");

	psDevInfo->psSwapChain = NULL;

	OMAPLFBFreeKernelMem(psSwapChain->psBuffer);
	OMAPLFBFreeKernelMem(psSwapChain);

	return PVRSRV_OK;
}
static PVRSRV_ERROR DestroyDCSwapChain(IMG_HANDLE hDevice,
	IMG_HANDLE hSwapChain)
{
	OMAPLFB_DEVINFO	*psDevInfo;
	OMAPLFB_SWAPCHAIN *psSwapChain;
	unsigned long ulLockFlags;
	OMAP_ERROR eError;

	
	if(!hDevice || !hSwapChain)
	{
		return (PVRSRV_ERROR_INVALID_PARAMS);
	}
	
	psDevInfo = (OMAPLFB_DEVINFO*)hDevice;
	psSwapChain = (OMAPLFB_SWAPCHAIN*)hSwapChain;
	if (psSwapChain != psDevInfo->psSwapChain)
	{
		return (PVRSRV_ERROR_INVALID_PARAMS);
	}

	eError = DisableLFBEventNotification(psDevInfo);
	if (eError != OMAP_OK)
	{
		printk(KERN_WARNING DRIVER_PREFIX ": Couldn't disable framebuffer event notification\n");
	}

	OMAPLFBFlip(psSwapChain, (unsigned long)psDevInfo->sFBInfo.sSysAddr.uiAddr);
	cancel_work_sync(&psDevInfo->active_work);
	INIT_LIST_HEAD(&psDevInfo->active_list);

	spin_lock_irqsave(&psDevInfo->sSwapChainLock, ulLockFlags);

	FlushInternalVSyncQueue(psSwapChain);

	psDevInfo->psSwapChain = NULL;

	spin_unlock_irqrestore(&psDevInfo->sSwapChainLock, ulLockFlags);

	OMAPLFBFreeKernelMem(psSwapChain->psVSyncFlips);
	OMAPLFBFreeKernelMem(psSwapChain->psBuffer);
	OMAPLFBFreeKernelMem(psSwapChain);

	return (PVRSRV_OK);
}