Changeset 49434 in vbox for trunk/src/VBox
- Timestamp:
- Nov 11, 2013 11:09:01 AM (11 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.h
r49420 r49434 434 434 435 435 struct { 436 uint32_t cPending;436 volatile uint32_t cPending; 437 437 uint32_t Padding1; 438 438 union -
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r49427 r49434 813 813 static void vbvaVHWACommandCompleteAllPending(PVGASTATE pVGAState, int rc) 814 814 { 815 if (! pVGAState->pendingVhwaCommands.cPending)815 if (!ASMAtomicUoReadU32(&pVGAState->pendingVhwaCommands.cPending)) 816 816 return; 817 817 818 818 VBOX_VHWA_PENDINGCMD *pIter, *pNext; 819 820 PDMCritSectEnter(&pVGAState->lock, VERR_SEM_BUSY); 821 819 822 RTListForEachSafe(&pVGAState->pendingVhwaCommands.PendingList, pIter, pNext, VBOX_VHWA_PENDINGCMD, Node) 820 823 { … … 824 827 /* the command is submitted/processed, remove from the pend list */ 825 828 RTListNodeRemove(&pIter->Node); 826 --pVGAState->pendingVhwaCommands.cPending;829 ASMAtomicDecU32(&pVGAState->pendingVhwaCommands.cPending); 827 830 RTMemFree(pIter); 828 831 } 829 } 830 831 static void vbvaVHWACommandCClearAllPending(PVGASTATE pVGAState) 832 { 833 if (!pVGAState->pendingVhwaCommands.cPending) 832 833 PDMCritSectLeave(&pVGAState->lock); 834 } 835 836 static void vbvaVHWACommandClearAllPending(PVGASTATE pVGAState) 837 { 838 if (!ASMAtomicUoReadU32(&pVGAState->pendingVhwaCommands.cPending)) 834 839 return; 835 840 836 841 VBOX_VHWA_PENDINGCMD *pIter, *pNext; 842 843 PDMCritSectEnter(&pVGAState->lock, VERR_SEM_BUSY); 844 837 845 RTListForEachSafe(&pVGAState->pendingVhwaCommands.PendingList, pIter, pNext, VBOX_VHWA_PENDINGCMD, Node) 838 846 { 839 847 RTListNodeRemove(&pIter->Node); 840 --pVGAState->pendingVhwaCommands.cPending;848 ASMAtomicDecU32(&pVGAState->pendingVhwaCommands.cPending); 841 849 RTMemFree(pIter); 842 850 } 851 852 PDMCritSectLeave(&pVGAState->lock); 843 853 } 844 854 … … 847 857 int rc = VERR_BUFFER_OVERFLOW; 848 858 849 if ( pVGAState->pendingVhwaCommands.cPending< VBOX_VHWA_MAX_PENDING_COMMANDS)859 if (ASMAtomicUoReadU32(&pVGAState->pendingVhwaCommands.cPending) < VBOX_VHWA_MAX_PENDING_COMMANDS) 850 860 { 851 861 VBOX_VHWA_PENDINGCMD *pPend = (VBOX_VHWA_PENDINGCMD*)RTMemAlloc(sizeof (*pPend)); … … 854 864 pCommand->Flags |= VBOXVHWACMD_FLAG_HG_ASYNCH; 855 865 pPend->pCommand = pCommand; 856 RTListAppend(&pVGAState->pendingVhwaCommands.PendingList, &pPend->Node); 857 ++pVGAState->pendingVhwaCommands.cPending; 858 return; 866 PDMCritSectEnter(&pVGAState->lock, VERR_SEM_BUSY); 867 if (ASMAtomicUoReadU32(&pVGAState->pendingVhwaCommands.cPending) < VBOX_VHWA_MAX_PENDING_COMMANDS) 868 { 869 RTListAppend(&pVGAState->pendingVhwaCommands.PendingList, &pPend->Node); 870 ASMAtomicIncU32(&pVGAState->pendingVhwaCommands.cPending); 871 PDMCritSectLeave(&pVGAState->lock); 872 return; 873 } 874 PDMCritSectLeave(&pVGAState->lock); 875 LogRel(("Pending command count has reached its threshold.. completing them all..")); 876 RTMemFree(pPend); 859 877 } 860 878 else … … 862 880 } 863 881 else 864 {865 882 LogRel(("Pending command count has reached its threshold, completing them all..")); 866 }867 883 868 884 vbvaVHWACommandCompleteAllPending(pVGAState, rc); … … 973 989 static bool vbvaVHWACheckPendingCommands(PVGASTATE pVGAState) 974 990 { 975 if (! pVGAState->pendingVhwaCommands.cPending)991 if (!ASMAtomicUoReadU32(&pVGAState->pendingVhwaCommands.cPending)) 976 992 return true; 977 993 978 994 VBOX_VHWA_PENDINGCMD *pIter, *pNext; 995 996 PDMCritSectEnter(&pVGAState->lock, VERR_SEM_BUSY); 997 979 998 RTListForEachSafe(&pVGAState->pendingVhwaCommands.PendingList, pIter, pNext, VBOX_VHWA_PENDINGCMD, Node) 980 999 { 981 1000 if (!vbvaVHWACommandSubmit(pVGAState, pIter->pCommand, true)) 1001 { 1002 PDMCritSectLeave(&pVGAState->lock); 982 1003 return false; /* the command should be pended still */ 1004 } 983 1005 984 1006 /* the command is submitted/processed, remove from the pend list */ 985 1007 RTListNodeRemove(&pIter->Node); 986 --pVGAState->pendingVhwaCommands.cPending;1008 ASMAtomicDecU32(&pVGAState->pendingVhwaCommands.cPending); 987 1009 RTMemFree(pIter); 988 1010 } 1011 1012 PDMCritSectLeave(&pVGAState->lock); 989 1013 990 1014 return true; … … 1045 1069 pVGAState->pendingVhwaCommands.cPending = 0; 1046 1070 RTListInit(&pVGAState->pendingVhwaCommands.PendingList); 1071 1047 1072 VBOXVHWACMD *pCmd = vbvaVHWAHHCommandCreate(pVGAState, VBOXVHWACMD_TYPE_HH_CONSTRUCT, 0, sizeof(VBOXVHWACMD_HH_CONSTRUCT)); 1048 1073 Assert(pCmd); … … 1098 1123 int vbvaVHWAReset (PVGASTATE pVGAState) 1099 1124 { 1100 vbvaVHWACommandC ClearAllPending(pVGAState);1125 vbvaVHWACommandClearAllPending(pVGAState); 1101 1126 1102 1127 /* ensure we have all pending cmds processed and h->g cmds disabled */
Note:
See TracChangeset
for help on using the changeset viewer.