void MTKLFBSwapHandler(MTKLFB_BUFFER *psBuffer)
{
	MTKLFB_DEVINFO *psDevInfo = psBuffer->psDevInfo;
	MTKLFB_SWAPCHAIN *psSwapChain = psDevInfo->psSwapChain;
	MTKLFB_BOOL bPreviouslyNotVSynced;

#if defined(SUPPORT_DRI_DRM)
	if (!MTKLFBAtomicBoolRead(&psDevInfo->sLeaveVT))
#endif
	{
		MTKLFBFlip(psDevInfo, psBuffer);
	}

	bPreviouslyNotVSynced = psSwapChain->bNotVSynced;
	psSwapChain->bNotVSynced = MTKLFB_TRUE;


	if (!DontWaitForVSync(psDevInfo))
	{
		MTKLFB_UPDATE_MODE eMode = MTKLFBGetUpdateMode(psDevInfo);
		int iBlankEvents = MTKLFBAtomicIntRead(&psDevInfo->sBlankEvents);

		switch(eMode)
		{
			case MTKLFB_UPDATE_MODE_AUTO:
				psSwapChain->bNotVSynced = MTKLFB_FALSE;

				if (bPreviouslyNotVSynced || psSwapChain->iBlankEvents != iBlankEvents)
				{
					psSwapChain->iBlankEvents = iBlankEvents;
					psSwapChain->bNotVSynced = !WaitForVSyncSettle(psDevInfo);
				} else if (psBuffer->ulSwapInterval != 0)
				{
					psSwapChain->bNotVSynced = !MTKLFBWaitForVSync(psDevInfo);
				}
				break;
#if defined(PVR_MTKFB3_MANUAL_UPDATE_SYNC_IN_SWAP)
			case MTKLFB_UPDATE_MODE_MANUAL:
				if (psBuffer->ulSwapInterval != 0)
				{
					(void) MTKLFBManualSync(psDevInfo);
				}
				break;
#endif
			default:
				break;
		}
	}

	psDevInfo->sPVRJTable.pfnPVRSRVCmdComplete((IMG_HANDLE)psBuffer->hCmdComplete, IMG_TRUE);
}
Exemplo n.º 2
0
MTKLFB_BOOL MTKLFBCheckModeAndSync(MTKLFB_DEVINFO *psDevInfo)
{
	MTKLFB_UPDATE_MODE eMode = MTKLFBGetUpdateMode(psDevInfo);

	switch(eMode)
	{
		case MTKLFB_UPDATE_MODE_AUTO:
		case MTKLFB_UPDATE_MODE_MANUAL:
			return MTKLFBManualSync(psDevInfo);
		default:
			break;
	}

	return MTKLFB_TRUE;
}