diff options
Diffstat (limited to 'drivers/gpu/pvr/deviceclass.c')
-rw-r--r-- | drivers/gpu/pvr/deviceclass.c | 119 |
1 files changed, 56 insertions, 63 deletions
diff --git a/drivers/gpu/pvr/deviceclass.c b/drivers/gpu/pvr/deviceclass.c index 471ce0cf12b..effcdfbf055 100644 --- a/drivers/gpu/pvr/deviceclass.c +++ b/drivers/gpu/pvr/deviceclass.c | |||
@@ -557,6 +557,17 @@ static PVRSRV_ERROR CloseDCDeviceCallBack(IMG_PVOID pvParam, | |||
557 | psDCPerContextInfo = (PVRSRV_DISPLAYCLASS_PERCONTEXT_INFO *)pvParam; | 557 | psDCPerContextInfo = (PVRSRV_DISPLAYCLASS_PERCONTEXT_INFO *)pvParam; |
558 | psDCInfo = psDCPerContextInfo->psDCInfo; | 558 | psDCInfo = psDCPerContextInfo->psDCInfo; |
559 | 559 | ||
560 | if(psDCInfo->sSystemBuffer.sDeviceClassBuffer.ui32MemMapRefCount != 0) | ||
561 | { | ||
562 | PVR_DPF((PVR_DBG_ERROR,"CloseDCDeviceCallBack: system buffer (0x%p) still mapped (refcount = %d)", | ||
563 | &psDCInfo->sSystemBuffer.sDeviceClassBuffer, | ||
564 | psDCInfo->sSystemBuffer.sDeviceClassBuffer.ui32MemMapRefCount)); | ||
565 | #if 0 | ||
566 | |||
567 | return PVRSRV_ERROR_STILL_MAPPED; | ||
568 | #endif | ||
569 | } | ||
570 | |||
560 | psDCInfo->ui32RefCount--; | 571 | psDCInfo->ui32RefCount--; |
561 | if(psDCInfo->ui32RefCount == 0) | 572 | if(psDCInfo->ui32RefCount == 0) |
562 | { | 573 | { |
@@ -658,6 +669,7 @@ PVRSRV_ERROR PVRSRVOpenDCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, | |||
658 | } | 669 | } |
659 | 670 | ||
660 | psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo->ui32RefCount++; | 671 | psDCInfo->sSystemBuffer.sDeviceClassBuffer.psKernelSyncInfo->ui32RefCount++; |
672 | psDCInfo->sSystemBuffer.sDeviceClassBuffer.ui32MemMapRefCount = 0; | ||
661 | } | 673 | } |
662 | 674 | ||
663 | psDCPerContextInfo->psDCInfo = psDCInfo; | 675 | psDCPerContextInfo->psDCInfo = psDCInfo; |
@@ -812,7 +824,6 @@ static PVRSRV_ERROR DestroyDCSwapChain(PVRSRV_DC_SWAPCHAIN *psSwapChain) | |||
812 | PVRSRV_DISPLAYCLASS_INFO *psDCInfo = psSwapChain->psDCInfo; | 824 | PVRSRV_DISPLAYCLASS_INFO *psDCInfo = psSwapChain->psDCInfo; |
813 | IMG_UINT32 i; | 825 | IMG_UINT32 i; |
814 | 826 | ||
815 | |||
816 | 827 | ||
817 | if( psDCInfo->psDCSwapChainShared ) | 828 | if( psDCInfo->psDCSwapChainShared ) |
818 | { | 829 | { |
@@ -873,9 +884,24 @@ static PVRSRV_ERROR DestroyDCSwapChainRefCallBack(IMG_PVOID pvParam, IMG_UINT32 | |||
873 | { | 884 | { |
874 | PVRSRV_DC_SWAPCHAIN_REF *psSwapChainRef = (PVRSRV_DC_SWAPCHAIN_REF *) pvParam; | 885 | PVRSRV_DC_SWAPCHAIN_REF *psSwapChainRef = (PVRSRV_DC_SWAPCHAIN_REF *) pvParam; |
875 | PVRSRV_ERROR eError = PVRSRV_OK; | 886 | PVRSRV_ERROR eError = PVRSRV_OK; |
887 | IMG_UINT32 i; | ||
876 | 888 | ||
877 | PVR_UNREFERENCED_PARAMETER(ui32Param); | 889 | PVR_UNREFERENCED_PARAMETER(ui32Param); |
878 | 890 | ||
891 | for (i = 0; i < psSwapChainRef->psSwapChain->ui32BufferCount; i++) | ||
892 | { | ||
893 | if (psSwapChainRef->psSwapChain->asBuffer[i].sDeviceClassBuffer.ui32MemMapRefCount != 0) | ||
894 | { | ||
895 | PVR_DPF((PVR_DBG_ERROR, "DestroyDCSwapChainRefCallBack: swapchain (0x%p) still mapped (ui32MemMapRefCount = %d)", | ||
896 | &psSwapChainRef->psSwapChain->asBuffer[i].sDeviceClassBuffer, | ||
897 | psSwapChainRef->psSwapChain->asBuffer[i].sDeviceClassBuffer.ui32MemMapRefCount)); | ||
898 | #if 0 | ||
899 | |||
900 | return PVRSRV_ERROR_STILL_MAPPED; | ||
901 | #endif | ||
902 | } | ||
903 | } | ||
904 | |||
879 | if(--psSwapChainRef->psSwapChain->ui32RefCount == 0) | 905 | if(--psSwapChainRef->psSwapChain->ui32RefCount == 0) |
880 | { | 906 | { |
881 | eError = DestroyDCSwapChain(psSwapChainRef->psSwapChain); | 907 | eError = DestroyDCSwapChain(psSwapChainRef->psSwapChain); |
@@ -1313,6 +1339,7 @@ PVRSRV_ERROR PVRSRVSwapToDCBufferKM(IMG_HANDLE hDeviceKM, | |||
1313 | IMG_UINT32 ui32NumSrcSyncs = 1; | 1339 | IMG_UINT32 ui32NumSrcSyncs = 1; |
1314 | PVRSRV_KERNEL_SYNC_INFO *apsSrcSync[2]; | 1340 | PVRSRV_KERNEL_SYNC_INFO *apsSrcSync[2]; |
1315 | PVRSRV_COMMAND *psCommand; | 1341 | PVRSRV_COMMAND *psCommand; |
1342 | SYS_DATA *psSysData; | ||
1316 | 1343 | ||
1317 | if(!hDeviceKM || !hBuffer || !psClipRect) | 1344 | if(!hDeviceKM || !hBuffer || !psClipRect) |
1318 | { | 1345 | { |
@@ -1320,14 +1347,6 @@ PVRSRV_ERROR PVRSRVSwapToDCBufferKM(IMG_HANDLE hDeviceKM, | |||
1320 | return PVRSRV_ERROR_INVALID_PARAMS; | 1347 | return PVRSRV_ERROR_INVALID_PARAMS; |
1321 | } | 1348 | } |
1322 | 1349 | ||
1323 | #if defined(SUPPORT_LMA) | ||
1324 | eError = PVRSRVPowerLock(KERNEL_ID, IMG_FALSE); | ||
1325 | if(eError != PVRSRV_OK) | ||
1326 | { | ||
1327 | return eError; | ||
1328 | } | ||
1329 | #endif | ||
1330 | |||
1331 | psBuffer = (PVRSRV_DC_BUFFER*)hBuffer; | 1350 | psBuffer = (PVRSRV_DC_BUFFER*)hBuffer; |
1332 | psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); | 1351 | psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); |
1333 | 1352 | ||
@@ -1427,28 +1446,15 @@ PVRSRV_ERROR PVRSRVSwapToDCBufferKM(IMG_HANDLE hDeviceKM, | |||
1427 | 1446 | ||
1428 | 1447 | ||
1429 | 1448 | ||
1449 | SysAcquireData(&psSysData); | ||
1450 | eError = OSScheduleMISR(psSysData); | ||
1430 | 1451 | ||
1431 | 1452 | if (eError != PVRSRV_OK) | |
1432 | |||
1433 | |||
1434 | |||
1435 | |||
1436 | |||
1437 | LOOP_UNTIL_TIMEOUT(MAX_HW_TIME_US) | ||
1438 | { | 1453 | { |
1439 | if(PVRSRVProcessQueues(KERNEL_ID, IMG_FALSE) != PVRSRV_ERROR_PROCESSING_BLOCKED) | 1454 | PVR_DPF((PVR_DBG_ERROR,"PVRSRVSwapToDCBufferKM: Failed to schedule MISR")); |
1440 | { | 1455 | goto Exit; |
1441 | goto ProcessedQueues; | 1456 | } |
1442 | } | ||
1443 | OSWaitus(MAX_HW_TIME_US/WAIT_TRY_COUNT); | ||
1444 | } END_LOOP_UNTIL_TIMEOUT(); | ||
1445 | |||
1446 | PVR_DPF((PVR_DBG_ERROR,"PVRSRVSwapToDCBufferKM: Failed to process queues")); | ||
1447 | |||
1448 | eError = PVRSRV_ERROR_FAILED_TO_PROCESS_QUEUE; | ||
1449 | goto Exit; | ||
1450 | 1457 | ||
1451 | ProcessedQueues: | ||
1452 | 1458 | ||
1453 | psBuffer->psSwapChain->psLastFlipBuffer = psBuffer; | 1459 | psBuffer->psSwapChain->psLastFlipBuffer = psBuffer; |
1454 | 1460 | ||
@@ -1459,9 +1465,6 @@ Exit: | |||
1459 | eError = PVRSRV_ERROR_RETRY; | 1465 | eError = PVRSRV_ERROR_RETRY; |
1460 | } | 1466 | } |
1461 | 1467 | ||
1462 | #if defined(SUPPORT_LMA) | ||
1463 | PVRSRVPowerUnlock(KERNEL_ID); | ||
1464 | #endif | ||
1465 | return eError; | 1468 | return eError; |
1466 | } | 1469 | } |
1467 | 1470 | ||
@@ -1481,6 +1484,7 @@ PVRSRV_ERROR PVRSRVSwapToDCSystemKM(IMG_HANDLE hDeviceKM, | |||
1481 | PVRSRV_COMMAND *psCommand; | 1484 | PVRSRV_COMMAND *psCommand; |
1482 | IMG_BOOL bAddReferenceToLast = IMG_TRUE; | 1485 | IMG_BOOL bAddReferenceToLast = IMG_TRUE; |
1483 | IMG_UINT16 ui16SwapCommandID = DC_FLIP_COMMAND; | 1486 | IMG_UINT16 ui16SwapCommandID = DC_FLIP_COMMAND; |
1487 | SYS_DATA *psSysData; | ||
1484 | 1488 | ||
1485 | if(!hDeviceKM || !hSwapChainRef) | 1489 | if(!hDeviceKM || !hSwapChainRef) |
1486 | { | 1490 | { |
@@ -1488,14 +1492,6 @@ PVRSRV_ERROR PVRSRVSwapToDCSystemKM(IMG_HANDLE hDeviceKM, | |||
1488 | return PVRSRV_ERROR_INVALID_PARAMS; | 1492 | return PVRSRV_ERROR_INVALID_PARAMS; |
1489 | } | 1493 | } |
1490 | 1494 | ||
1491 | #if defined(SUPPORT_LMA) | ||
1492 | eError = PVRSRVPowerLock(KERNEL_ID, IMG_FALSE); | ||
1493 | if(eError != PVRSRV_OK) | ||
1494 | { | ||
1495 | return eError; | ||
1496 | } | ||
1497 | #endif | ||
1498 | |||
1499 | psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); | 1495 | psDCInfo = DCDeviceHandleToDCInfo(hDeviceKM); |
1500 | psSwapChainRef = (PVRSRV_DC_SWAPCHAIN_REF*)hSwapChainRef; | 1496 | psSwapChainRef = (PVRSRV_DC_SWAPCHAIN_REF*)hSwapChainRef; |
1501 | psSwapChain = psSwapChainRef->psSwapChain; | 1497 | psSwapChain = psSwapChainRef->psSwapChain; |
@@ -1581,28 +1577,15 @@ PVRSRV_ERROR PVRSRVSwapToDCSystemKM(IMG_HANDLE hDeviceKM, | |||
1581 | } | 1577 | } |
1582 | 1578 | ||
1583 | 1579 | ||
1580 | SysAcquireData(&psSysData); | ||
1581 | eError = OSScheduleMISR(psSysData); | ||
1584 | 1582 | ||
1585 | 1583 | if (eError != PVRSRV_OK) | |
1586 | |||
1587 | |||
1588 | |||
1589 | |||
1590 | |||
1591 | LOOP_UNTIL_TIMEOUT(MAX_HW_TIME_US) | ||
1592 | { | 1584 | { |
1593 | if(PVRSRVProcessQueues(KERNEL_ID, IMG_FALSE) != PVRSRV_ERROR_PROCESSING_BLOCKED) | 1585 | PVR_DPF((PVR_DBG_ERROR,"PVRSRVSwapToDCSystemKM: Failed to schedule MISR")); |
1594 | { | 1586 | goto Exit; |
1595 | goto ProcessedQueues; | 1587 | } |
1596 | } | ||
1597 | |||
1598 | OSWaitus(MAX_HW_TIME_US/WAIT_TRY_COUNT); | ||
1599 | } END_LOOP_UNTIL_TIMEOUT(); | ||
1600 | |||
1601 | PVR_DPF((PVR_DBG_ERROR,"PVRSRVSwapToDCSystemKM: Failed to process queues")); | ||
1602 | eError = PVRSRV_ERROR_FAILED_TO_PROCESS_QUEUE; | ||
1603 | goto Exit; | ||
1604 | 1588 | ||
1605 | ProcessedQueues: | ||
1606 | 1589 | ||
1607 | psSwapChain->psLastFlipBuffer = &psDCInfo->sSystemBuffer; | 1590 | psSwapChain->psLastFlipBuffer = &psDCInfo->sSystemBuffer; |
1608 | 1591 | ||
@@ -1615,9 +1598,6 @@ Exit: | |||
1615 | eError = PVRSRV_ERROR_RETRY; | 1598 | eError = PVRSRV_ERROR_RETRY; |
1616 | } | 1599 | } |
1617 | 1600 | ||
1618 | #if defined(SUPPORT_LMA) | ||
1619 | PVRSRVPowerUnlock(KERNEL_ID); | ||
1620 | #endif | ||
1621 | return eError; | 1601 | return eError; |
1622 | } | 1602 | } |
1623 | 1603 | ||
@@ -1736,17 +1716,29 @@ static PVRSRV_ERROR CloseBCDeviceCallBack(IMG_PVOID pvParam, | |||
1736 | { | 1716 | { |
1737 | PVRSRV_BUFFERCLASS_PERCONTEXT_INFO *psBCPerContextInfo; | 1717 | PVRSRV_BUFFERCLASS_PERCONTEXT_INFO *psBCPerContextInfo; |
1738 | PVRSRV_BUFFERCLASS_INFO *psBCInfo; | 1718 | PVRSRV_BUFFERCLASS_INFO *psBCInfo; |
1719 | IMG_UINT32 i; | ||
1739 | 1720 | ||
1740 | PVR_UNREFERENCED_PARAMETER(ui32Param); | 1721 | PVR_UNREFERENCED_PARAMETER(ui32Param); |
1741 | 1722 | ||
1742 | psBCPerContextInfo = (PVRSRV_BUFFERCLASS_PERCONTEXT_INFO *)pvParam; | 1723 | psBCPerContextInfo = (PVRSRV_BUFFERCLASS_PERCONTEXT_INFO *)pvParam; |
1724 | |||
1743 | psBCInfo = psBCPerContextInfo->psBCInfo; | 1725 | psBCInfo = psBCPerContextInfo->psBCInfo; |
1744 | 1726 | ||
1727 | for (i = 0; i < psBCInfo->ui32BufferCount; i++) | ||
1728 | { | ||
1729 | if (psBCInfo->psBuffer[i].sDeviceClassBuffer.ui32MemMapRefCount != 0) | ||
1730 | { | ||
1731 | PVR_DPF((PVR_DBG_ERROR, "CloseBCDeviceCallBack: buffer %d (0x%p) still mapped (ui32MemMapRefCount = %d)", | ||
1732 | i, | ||
1733 | &psBCInfo->psBuffer[i].sDeviceClassBuffer, | ||
1734 | psBCInfo->psBuffer[i].sDeviceClassBuffer.ui32MemMapRefCount)); | ||
1735 | return PVRSRV_ERROR_STILL_MAPPED; | ||
1736 | } | ||
1737 | } | ||
1738 | |||
1745 | psBCInfo->ui32RefCount--; | 1739 | psBCInfo->ui32RefCount--; |
1746 | if(psBCInfo->ui32RefCount == 0) | 1740 | if(psBCInfo->ui32RefCount == 0) |
1747 | { | 1741 | { |
1748 | IMG_UINT32 i; | ||
1749 | |||
1750 | 1742 | ||
1751 | psBCInfo->psFuncTable->pfnCloseBCDevice(psBCInfo->ui32DeviceID, psBCInfo->hExtDevice); | 1743 | psBCInfo->psFuncTable->pfnCloseBCDevice(psBCInfo->ui32DeviceID, psBCInfo->hExtDevice); |
1752 | 1744 | ||
@@ -1900,6 +1892,7 @@ PVRSRV_ERROR PVRSRVOpenBCDeviceKM (PVRSRV_PER_PROCESS_DATA *psPerProc, | |||
1900 | psBCInfo->psBuffer[i].sDeviceClassBuffer.pfnGetBufferAddr = psBCInfo->psFuncTable->pfnGetBufferAddr; | 1892 | psBCInfo->psBuffer[i].sDeviceClassBuffer.pfnGetBufferAddr = psBCInfo->psFuncTable->pfnGetBufferAddr; |
1901 | psBCInfo->psBuffer[i].sDeviceClassBuffer.hDevMemContext = psBCInfo->hDevMemContext; | 1893 | psBCInfo->psBuffer[i].sDeviceClassBuffer.hDevMemContext = psBCInfo->hDevMemContext; |
1902 | psBCInfo->psBuffer[i].sDeviceClassBuffer.hExtDevice = psBCInfo->hExtDevice; | 1894 | psBCInfo->psBuffer[i].sDeviceClassBuffer.hExtDevice = psBCInfo->hExtDevice; |
1895 | psBCInfo->psBuffer[i].sDeviceClassBuffer.ui32MemMapRefCount = 0; | ||
1903 | } | 1896 | } |
1904 | } | 1897 | } |
1905 | 1898 | ||