Graphics: Refine the PVRSRVGetDCFrontBufferKM to avoid duplicates blt
authorgwang23 <gang.a.wang@intel.com>
Sat, 28 Apr 2012 07:59:48 +0000 (15:59 +0800)
committerbuildbot <buildbot@intel.com>
Mon, 7 May 2012 09:24:36 +0000 (02:24 -0700)
BZ: 33328

In previous solution, PVRSRVGetDCFrontBufferKM would return the last
handled buffer in flip command queues. There is a delay between handling
the flip command and eglSwapBuffers(), there are in different threads,
so in some case, the old buffer would be used in PVR2DBltWidi();
Current solution is to return the last buffer used in eglSwapBuffers(),
Since in current pvr dirvers, eglSwapBuffers() would wait for the
buffer rendering complete, then the buffer can be returned for Widi.

Change-Id: Iaf65746c23c276ba0f21ceb929661a5a6d042c59
Signed-off-by: gwang23 <gang.a.wang@intel.com>
Reviewed-on: http://android.intel.com:8080/46657
Reviewed-by: Tao, Tao Q <tao.q.tao@intel.com>
Reviewed-by: Tong, BoX <box.tong@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/srvkm/common/deviceclass.c

index e23ab56..f3ce7ce 100644 (file)
@@ -1998,36 +1998,14 @@ PVRSRV_ERROR PVRSRVGetDCFrontBufferKM(IMG_HANDLE        hDeviceKM,
 
        psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM);
        psSwapChain = psDCInfo->psDCSwapChainCur;
-
-       eError = psDCInfo->psFuncTable->pfnGetDCFrontBuffer(psDCInfo->hExtDevice,
-                       pui32FlipChainID,
-                       &frontBuffer);
-       if (eError != PVRSRV_OK || *pui32FlipChainID == 0)
-       {
-               goto Exit;
-       }
-
-       if (psDCInfo->psDCSwapChainCur
-                       && psDCInfo->psDCSwapChainCur->ui32SwapChainID == *pui32FlipChainID)
-       {
-               psSwapChain = psDCInfo->psDCSwapChainCur;
-       }
-       else
-       {
-               psSwapChain = psDCInfo->psDCSwapChainShared;
-               while (psSwapChain
-                               && psSwapChain->ui32SwapChainID != *pui32FlipChainID)
-               {
-                       psSwapChain = psSwapChain->psNext;
-               }
-       }
-
        if (psSwapChain == IMG_NULL)
        {
                PVR_DPF((PVR_DBG_ERROR,"PVRSRVGetDCFrontBufferKM: No Swap Chain is in used"));
                goto Exit;
        }
 
+       frontBuffer = psSwapChain->psLastFlipBuffer->sDeviceClassBuffer.hExtBuffer;
+
        for (bufIndex = 0; bufIndex < psSwapChain->ui32BufferCount; bufIndex++)
        {
                if (frontBuffer ==