Changeset 33022 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
- Timestamp:
- Oct 9, 2010 4:01:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
r32989 r33022 120 120 { 121 121 bool bLock = false; 122 if(!( PrimaryExtension->u.primary.pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING))122 if(!(commonFromDeviceExt(PrimaryExtension)->pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING)) 123 123 { 124 124 if(!bProcessing) … … 126 126 break; 127 127 } 128 VBOX_HGSMI_LOCK(PrimaryExtension, & PrimaryExtension->u.primary.pSynchLock, flags, &OldIrql);129 if(!( PrimaryExtension->u.primary.pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING))130 { 131 Assert( PrimaryExtension->u.primary.bHostCmdProcessing);132 PrimaryExtension->u.primary.bHostCmdProcessing = false;133 VBOX_HGSMI_UNLOCK(PrimaryExtension, & PrimaryExtension->u.primary.pSynchLock, flags, OldIrql);128 VBOX_HGSMI_LOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, &OldIrql); 129 if(!(commonFromDeviceExt(PrimaryExtension)->pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING)) 130 { 131 Assert(commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing); 132 commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing = false; 133 VBOX_HGSMI_UNLOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, OldIrql); 134 134 break; 135 135 } 136 VBOX_HGSMI_UNLOCK(PrimaryExtension, & PrimaryExtension->u.primary.pSynchLock, flags, OldIrql);136 VBOX_HGSMI_UNLOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, OldIrql); 137 137 } 138 138 else … … 140 140 if(!bProcessing) 141 141 { 142 VBOX_HGSMI_LOCK(PrimaryExtension, & PrimaryExtension->u.primary.pSynchLock, flags, &OldIrql);143 if(!( PrimaryExtension->u.primary.pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING)144 || PrimaryExtension->u.primary.bHostCmdProcessing)142 VBOX_HGSMI_LOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, &OldIrql); 143 if(!(commonFromDeviceExt(PrimaryExtension)->pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING) 144 || commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing) 145 145 { 146 VBOX_HGSMI_UNLOCK(PrimaryExtension, & PrimaryExtension->u.primary.pSynchLock, flags, OldIrql);146 VBOX_HGSMI_UNLOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, OldIrql); 147 147 break; 148 148 } 149 Assert(! PrimaryExtension->u.primary.bHostCmdProcessing);150 PrimaryExtension->u.primary.bHostCmdProcessing = true;151 VBOX_HGSMI_UNLOCK(PrimaryExtension, & PrimaryExtension->u.primary.pSynchLock, flags, OldIrql);149 Assert(!commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing); 150 commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing = true; 151 VBOX_HGSMI_UNLOCK(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock, flags, OldIrql); 152 152 bProcessing = true; 153 153 } … … 155 155 156 156 Assert(bProcessing); 157 Assert( PrimaryExtension->u.primary.bHostCmdProcessing);158 Assert(( PrimaryExtension->u.primary.pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING) != 0);157 Assert(commonFromDeviceExt(PrimaryExtension)->bHostCmdProcessing); 158 Assert((commonFromDeviceExt(PrimaryExtension)->pHostFlags->u32HostFlags & HGSMIHOSTFLAGS_COMMANDS_PENDING) != 0); 159 159 bProcessing = true; 160 160 … … 164 164 165 165 /* Detect whether HGSMI is supported by the host. */ 166 BOOLEAN VBoxHGSMIIsSupported ( PDEVICE_EXTENSION PrimaryExtension)166 BOOLEAN VBoxHGSMIIsSupported (void) 167 167 { 168 168 USHORT DispiId; … … 404 404 VBVAINFOHEAP *p = (VBVAINFOHEAP *)pvData; 405 405 406 p->u32HeapOffset = PrimaryExtension->u.primary.cbVRAM407 - PrimaryExtension->u.primary.cbMiniportHeap406 p->u32HeapOffset = commonFromDeviceExt(PrimaryExtension)->cbVRAM 407 - commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap 408 408 - VBVA_ADAPTER_INFORMATION_SIZE; 409 p->u32HeapSize = PrimaryExtension->u.primary.cbMiniportHeap;409 p->u32HeapSize = commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap; 410 410 411 411 return VINF_SUCCESS; … … 417 417 HGSMIBUFFERLOCATION *p = (HGSMIBUFFERLOCATION *)pvData; 418 418 419 p->offLocation = PrimaryExtension->u.primary.cbVRAM - sizeof (HGSMIHOSTFLAGS);419 p->offLocation = commonFromDeviceExt(PrimaryExtension)->cbVRAM - sizeof (HGSMIHOSTFLAGS); 420 420 p->cbLocation = sizeof (HGSMIHOSTFLAGS); 421 421 … … 724 724 /* Preinitialize the primary extension. 725 725 * Note: bVBoxVideoSupported is set to FALSE, because HGSMI is active instead. 726 * Note 2: shouldn't be needed for WDDM. 726 727 */ 727 728 PrimaryExtension->pNext = NULL; … … 737 738 PrimaryExtension->u.primary.cDisplays = 1; 738 739 #endif 739 PrimaryExtension->u.primary.cbVRAM = AdapterMemorySize;740 PrimaryExtension->u.primary.cbMiniportHeap = 0;741 PrimaryExtension->u.primary.pvMiniportHeap = NULL;742 PrimaryExtension->u.primary.pvAdapterInformation = NULL;743 PrimaryExtension->u.primary.pHostFlags = NULL;740 commonFromDeviceExt(PrimaryExtension)->cbVRAM = AdapterMemorySize; 741 commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap = 0; 742 commonFromDeviceExt(PrimaryExtension)->pvMiniportHeap = NULL; 743 commonFromDeviceExt(PrimaryExtension)->pvAdapterInformation = NULL; 744 commonFromDeviceExt(PrimaryExtension)->pHostFlags = NULL; 744 745 PrimaryExtension->u.primary.ulMaxFrameBufferSize = 0; 745 commonFromDeviceExt(PrimaryExtension)->bHGSMI = VBoxHGSMIIsSupported ( PrimaryExtension);746 commonFromDeviceExt(PrimaryExtension)->bHGSMI = VBoxHGSMIIsSupported (); 746 747 VBoxVideoCmnMemZero(&commonFromDeviceExt(PrimaryExtension)->areaHostHeap, sizeof(HGSMIAREA)); 747 748 VBoxVideoCmnMemZero(&PrimaryExtension->areaDisplay, sizeof(HGSMIAREA)); … … 756 757 /* Map the adapter information. It will be needed for HGSMI IO. */ 757 758 rc = VBoxMapAdapterMemory (PrimaryExtension, 758 & PrimaryExtension->u.primary.pvAdapterInformation,759 PrimaryExtension->u.primary.cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE,759 &commonFromDeviceExt(PrimaryExtension)->pvAdapterInformation, 760 commonFromDeviceExt(PrimaryExtension)->cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE, 760 761 VBVA_ADAPTER_INFORMATION_SIZE 761 762 ); … … 771 772 /* Setup a HGSMI heap within the adapter information area. */ 772 773 rc = HGSMIHeapSetup (&commonFromDeviceExt(PrimaryExtension)->hgsmiAdapterHeap, 773 PrimaryExtension->u.primary.pvAdapterInformation,774 commonFromDeviceExt(PrimaryExtension)->pvAdapterInformation, 774 775 VBVA_ADAPTER_INFORMATION_SIZE - sizeof(HGSMIHOSTFLAGS), 775 PrimaryExtension->u.primary.cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE,776 commonFromDeviceExt(PrimaryExtension)->cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE, 776 777 false /*fOffsetBased*/); 777 778 … … 785 786 else 786 787 { 787 PrimaryExtension->u.primary.pHostFlags = (HGSMIHOSTFLAGS*)(((uint8_t*)PrimaryExtension->u.primary.pvAdapterInformation)788 commonFromDeviceExt(PrimaryExtension)->pHostFlags = (HGSMIHOSTFLAGS*)(((uint8_t*)commonFromDeviceExt(PrimaryExtension)->pvAdapterInformation) 788 789 + VBVA_ADAPTER_INFORMATION_SIZE - sizeof(HGSMIHOSTFLAGS)); 789 790 } … … 814 815 815 816 /* Round up to 4096 bytes. */ 816 PrimaryExtension->u.primary.cbMiniportHeap = (cbMiniportHeap + 0xFFF) & ~0xFFF;817 commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap = (cbMiniportHeap + 0xFFF) & ~0xFFF; 817 818 818 819 dprintf(("VBoxVideo::VBoxSetupDisplays: cbMiniportHeap = 0x%08X, PrimaryExtension->u.primary.cbMiniportHeap = 0x%08X, cbMiniportHeapMaxSize = 0x%08X\n", 819 cbMiniportHeap, PrimaryExtension->u.primary.cbMiniportHeap, cbMiniportHeapMaxSize));820 cbMiniportHeap, commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap, cbMiniportHeapMaxSize)); 820 821 821 822 /* Map the heap region. … … 826 827 */ 827 828 rc = VBoxMapAdapterMemory (PrimaryExtension, 828 & PrimaryExtension->u.primary.pvMiniportHeap,829 PrimaryExtension->u.primary.cbVRAM829 &commonFromDeviceExt(PrimaryExtension)->pvMiniportHeap, 830 commonFromDeviceExt(PrimaryExtension)->cbVRAM 830 831 - VBVA_ADAPTER_INFORMATION_SIZE 831 - PrimaryExtension->u.primary.cbMiniportHeap,832 PrimaryExtension->u.primary.cbMiniportHeap832 - commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap, 833 commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap 833 834 ); 834 835 if (rc != NO_ERROR) 835 836 { 836 PrimaryExtension->u.primary.pvMiniportHeap = NULL;837 PrimaryExtension->u.primary.cbMiniportHeap = 0;837 commonFromDeviceExt(PrimaryExtension)->pvMiniportHeap = NULL; 838 commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap = 0; 838 839 commonFromDeviceExt(PrimaryExtension)->bHGSMI = FALSE; 839 840 } 840 841 else 841 842 { 842 HGSMIOFFSET offBase = PrimaryExtension->u.primary.cbVRAM843 HGSMIOFFSET offBase = commonFromDeviceExt(PrimaryExtension)->cbVRAM 843 844 - VBVA_ADAPTER_INFORMATION_SIZE 844 - PrimaryExtension->u.primary.cbMiniportHeap;845 - commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap; 845 846 846 847 /* Init the host hap area. Buffers from the host will be placed there. */ 847 848 HGSMIAreaInitialize (&commonFromDeviceExt(PrimaryExtension)->areaHostHeap, 848 PrimaryExtension->u.primary.pvMiniportHeap,849 PrimaryExtension->u.primary.cbMiniportHeap,849 commonFromDeviceExt(PrimaryExtension)->pvMiniportHeap, 850 commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap, 850 851 offBase); 851 852 } … … 854 855 { 855 856 /* Host has not requested a heap. */ 856 PrimaryExtension->u.primary.pvMiniportHeap = NULL;857 PrimaryExtension->u.primary.cbMiniportHeap = 0;857 commonFromDeviceExt(PrimaryExtension)->pvMiniportHeap = NULL; 858 commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap = 0; 858 859 } 859 860 } … … 953 954 if (commonFromDeviceExt(PrimaryExtension)->bHGSMI) 954 955 { 955 ULONG ulAvailable = PrimaryExtension->u.primary.cbVRAM956 - PrimaryExtension->u.primary.cbMiniportHeap956 ULONG ulAvailable = commonFromDeviceExt(PrimaryExtension)->cbVRAM 957 - commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap 957 958 - VBVA_ADAPTER_INFORMATION_SIZE; 958 959 … … 1047 1048 { 1048 1049 /* Unmap the memory if VBoxVideo is not supported. */ 1049 VBoxUnmapAdapterMemory (PrimaryExtension, & PrimaryExtension->u.primary.pvMiniportHeap, PrimaryExtension->u.primary.cbMiniportHeap);1050 VBoxUnmapAdapterMemory (PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pvMiniportHeap, commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap); 1050 1051 VBoxUnmapAdapterInformation (PrimaryExtension); 1051 1052 … … 1055 1056 if (commonFromDeviceExt(PrimaryExtension)->bHGSMI) 1056 1057 { 1057 VBoxVideoCmnSpinLockCreate(PrimaryExtension, & PrimaryExtension->u.primary.pSynchLock);1058 VBoxVideoCmnSpinLockCreate(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pSynchLock); 1058 1059 } 1059 1060 … … 1093 1094 if (RT_SUCCESS(rc)) 1094 1095 { 1095 /*rc = */VBoxUnmapAdapterMemory(PrimaryExtension, & PrimaryExtension->u.primary.pvMiniportHeap, PrimaryExtension->u.primary.cbMiniportHeap);1096 /*rc = */VBoxUnmapAdapterMemory(PrimaryExtension, &commonFromDeviceExt(PrimaryExtension)->pvMiniportHeap, commonFromDeviceExt(PrimaryExtension)->cbMiniportHeap); 1096 1097 /* 1097 1098 AssertRC(rc);
Note:
See TracChangeset
for help on using the changeset viewer.