[GFX-3D]Release last flip buffer after a while even if there is no new frame coming
authorYun Tu(Mark Tu) <yun.tu@intel.com>
Sat, 16 Jun 2012 06:55:29 +0000 (14:55 +0800)
committerbuildbot <buildbot@intel.com>
Tue, 19 Jun 2012 11:49:13 +0000 (04:49 -0700)
BZ:42074

Release last flip buffer after a while even if there is no new frame coming,
as looks like user space try to lock last frame without submitting a new frame first
and cause dead lock then
Signed-off-by: Yun Tu(Mark Tu) <yun.tu@intel.com>
Change-Id: Ifa76783985418cd2011546c01169c996baf25901
Reviewed-on: http://android.intel.com:8080/52876
Reviewed-by: Xu, Randy <randy.xu@intel.com>
Tested-by: Xu, Randy <randy.xu@intel.com>
Tested-by: Tong, BoX <box.tong@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/staging/mrst/pvr/services4/3rdparty/linux_framebuffer_drm/drmlfb_displayclass.c

index dbc2526..3219d41 100644 (file)
@@ -1109,7 +1109,7 @@ void MRSTLFBFlipTimerFn(unsigned long arg)
        MRSTLFB_DEVINFO *psDevInfo = (MRSTLFB_DEVINFO *)arg;
        unsigned long ulLockFlags;
        MRSTLFB_SWAPCHAIN *psSwapChain;
-       printk(KERN_WARNING "MRSTLFBFlipTimerFn trigered\n");
+       MRSTLFB_VSYNC_FLIP_ITEM *psLastItem;
 
        spin_lock_irqsave(&psDevInfo->sSwapChainLock, ulLockFlags);
 
@@ -1121,10 +1121,14 @@ void MRSTLFBFlipTimerFn(unsigned long arg)
        }
        if (psSwapChain->ulRemoveIndex == psSwapChain->ulInsertIndex)
        {
-               printk(KERN_INFO "MRSTLFBFlipTimerFn: swapchain is empty\n");
-               goto ExitUnlock;
+               psLastItem = &(psSwapChain->sLastItem);
+               if (psLastItem->bValid && psLastItem->bFlipped && psLastItem->bCmdCompleted == MRST_FALSE)
+               {
+                       MRSTFBFlipComplete(psSwapChain, NULL, MRST_TRUE);
+                       goto ExitUnlock;
+               }
        }
-       printk(KERN_WARNING "MRSTLFBFlipTimerFn: flush flip queue\n");
+       printk(KERN_WARNING "MRSTLFBFlipTimerFn: swapchain is not empty, flush queue\n");
        FlushInternalVSyncQueue(psSwapChain, MRST_TRUE);
 ExitUnlock:
        spin_unlock_irqrestore(&psDevInfo->sSwapChainLock, ulLockFlags);
@@ -1147,7 +1151,7 @@ static PVRSRV_ERROR SwapToDCSystem(IMG_HANDLE hDevice,
 static MRST_BOOL MRSTLFBVSyncIHandler(MRSTLFB_DEVINFO *psDevInfo, int iPipe)
 {
        MRST_BOOL bStatus = MRST_FALSE;
-       MRSTLFB_VSYNC_FLIP_ITEM *psFlipItem, *psLastItem;
+       MRSTLFB_VSYNC_FLIP_ITEM *psFlipItem;
        unsigned long ulMaxIndex;
        unsigned long ulLockFlags;
        MRSTLFB_SWAPCHAIN *psSwapChain;
@@ -1214,12 +1218,8 @@ static MRST_BOOL MRSTLFBVSyncIHandler(MRSTLFB_DEVINFO *psDevInfo, int iPipe)
 
                psFlipItem = &psSwapChain->psVSyncFlips[psSwapChain->ulRemoveIndex];
        }
-
        if (psSwapChain->ulRemoveIndex == psSwapChain->ulInsertIndex)
-       {
                bStatus = MRST_TRUE;
-               del_timer(&psDevInfo->sFlipTimer);
-       }
        else
                mod_timer(&psDevInfo->sFlipTimer, FLIP_TIMEOUT + jiffies);
 ExitUnlock: