Changeset 26000 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Jan 25, 2010 1:57:38 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Helper.h
r22540 r26000 62 62 # define dprintf(a) OSDBGPRINT(a) 63 63 # endif 64 /* flow log */ 65 # define dfprintf dprintf 66 /* release log */ 67 # define drprintf dprintf 64 68 #else 65 69 # define dprintf(a) do {} while (0) 70 /* flow log */ 71 # define dfprintf dprintf 72 /* release log */ 73 # define drprintf dprintf 66 74 #endif 67 75 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r25980 r26000 954 954 &VideoRamBase); 955 955 #else 956 VideoRamBase = MmMapIoSpace(FrameBuffer, 956 NTSTATUS ntStatus = PrimaryExtension->u.primary.DxgkInterface.DxgkCbMapMemory(PrimaryExtension->u.primary.DxgkInterface.DeviceHandle, 957 FrameBuffer, 957 958 VideoRamLength, 958 MmNonCached); 959 Status = VideoRamBase ? NO_ERROR : ERROR_INVALID_PARAMETER; /*<- this is what VideoPortMapMemory returns according to the docs */ 959 FALSE, /* IN BOOLEAN InIoSpace */ 960 FALSE, /* IN BOOLEAN MapToUserMode */ 961 MmNonCached, /* IN MEMORY_CACHING_TYPE CacheType */ 962 &VideoRamBase /*OUT PVOID *VirtualAddress*/ 963 ); 964 Status = ntStatus == STATUS_SUCCESS ? NO_ERROR : ERROR_INVALID_PARAMETER; /*<- this is what VideoPortMapMemory returns according to the docs */ 960 965 #endif 961 966 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r25980 r26000 201 201 /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */ 202 202 VBOXVIDEOPORTPROCS VideoPortProcs; 203 # else 204 /* Display Port handle and callbacks */ 205 DXGKRNL_INTERFACE DxgkInterface; 203 206 # endif 204 207 #endif /* VBOX_WITH_HGSMI */ … … 562 565 563 566 VOID VBoxSetupDisplaysHGSMI (PDEVICE_EXTENSION PrimaryExtension, 567 #ifndef VBOXWDDM 564 568 PVIDEO_PORT_CONFIG_INFO pConfigInfo, 569 #endif 565 570 ULONG AdapterMemorySize); 566 571 BOOLEAN vboxUpdatePointerShape (PDEVICE_EXTENSION DeviceExtension, -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
r25980 r26000 645 645 * to talk to the host. 646 646 */ 647 VOID VBoxSetupDisplaysHGSMI(PDEVICE_EXTENSION PrimaryExtension, PVIDEO_PORT_CONFIG_INFO pConfigInfo, ULONG AdapterMemorySize) 647 VOID VBoxSetupDisplaysHGSMI(PDEVICE_EXTENSION PrimaryExtension, 648 #ifndef VBOXWDDM 649 PVIDEO_PORT_CONFIG_INFO pConfigInfo, 650 #endif 651 ULONG AdapterMemorySize) 648 652 { 649 653 VP_STATUS rc = NO_ERROR; -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r25982 r26000 16 16 17 17 #include "../VBoxVideo.h" 18 #include "../Helper.h" 19 20 #include <VBox/VBoxGuestLib.h> 18 21 19 22 #define VBOXWDDM_MEMTAG 'MDBV' … … 36 39 } 37 40 41 NTSTATUS vboxWddmPickResources(PDEVICE_EXTENSION pContext, PDXGK_DEVICE_INFO pDeviceInfo, PULONG pAdapterMemorySize) 42 { 43 NTSTATUS Status = STATUS_SUCCESS; 44 USHORT DispiId; 45 *pAdapterMemorySize = VBE_DISPI_TOTAL_VIDEO_MEMORY_BYTES; 46 47 VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID); 48 VBoxVideoCmnPortWriteUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID2); 49 DispiId = VBoxVideoCmnPortReadUshort((PUSHORT)VBE_DISPI_IOPORT_DATA); 50 if (DispiId == VBE_DISPI_ID2) 51 { 52 dprintf(("VBoxVideoWddm: found the VBE card\n")); 53 /* 54 * Write some hardware information to registry, so that 55 * it's visible in Windows property dialog. 56 */ 57 58 /* 59 * Query the adapter's memory size. It's a bit of a hack, we just read 60 * an ULONG from the data port without setting an index before. 61 */ 62 *pAdapterMemorySize = VBoxVideoCmnPortReadUlong((PULONG)VBE_DISPI_IOPORT_DATA); 63 if (VBoxHGSMIIsSupported (pContext)) 64 { 65 pContext->u.primary.IOPortHost = (RTIOPORT)VGA_PORT_HGSMI_HOST; 66 pContext->u.primary.IOPortGuest = (RTIOPORT)VGA_PORT_HGSMI_GUEST; 67 68 PCM_RESOURCE_LIST pRcList = pDeviceInfo->TranslatedResourceList; 69 /* @todo: verify resources */ 70 for(ULONG i = 0; i < pRcList->Count; ++i) 71 { 72 PCM_FULL_RESOURCE_DESCRIPTOR pFRc = &pRcList->List[i]; 73 for(ULONG j = 0; j < pFRc->PartialResourceList.Count; ++j) 74 { 75 PCM_PARTIAL_RESOURCE_DESCRIPTOR pPRc = &pFRc->PartialResourceList.PartialDescriptors[j]; 76 switch(pPRc->Type) 77 { 78 case CmResourceTypePort: 79 break; 80 case CmResourceTypeInterrupt: 81 break; 82 case CmResourceTypeMemory: 83 break; 84 case CmResourceTypeDma: 85 break; 86 case CmResourceTypeDeviceSpecific: 87 break; 88 case CmResourceTypeBusNumber: 89 break; 90 default: 91 break; 92 } 93 } 94 } 95 } 96 else 97 { 98 drprintf(("VBoxVideoWddm: HGSMI unsupported, returning err\n")); 99 /* @todo: report a better status */ 100 Status = STATUS_UNSUCCESSFUL; 101 } 102 } 103 else 104 { 105 drprintf(("VBoxVideoWddm:: VBE card not found, returning err\n")); 106 Status = STATUS_UNSUCCESSFUL; 107 } 108 109 110 return Status; 111 } 112 38 113 /* driver callbacks */ 39 114 … … 43 118 ) 44 119 { 120 /* The DxgkDdiAddDevice function should be made pageable. */ 45 121 PAGED_CODE(); 122 123 dfprintf(("==> "__FUNCTION__ ", pdo(0x%x)\n", PhysicalDeviceObject)); 46 124 NTSTATUS Status = STATUS_UNSUCCESSFUL; 47 125 … … 49 127 if(pContext) 50 128 { 51 char guessBuffer[128]; 52 PVOID pvBuf = guessBuffer; 53 ULONG cbBuf = sizeof(guessBuffer); 54 ULONG cbBufUsed = 0; 55 bool bFreeBuf = false; 56 57 do 58 { 59 Status = IoGetDeviceProperty(PhysicalDeviceObject, 60 DevicePropertyBootConfigurationTranslated, 61 cbBuf, 62 pvBuf, 63 &cbBufUsed); 64 if(Status == STATUS_BUFFER_TOO_SMALL) 65 { 66 if(bFreeBuf) 67 vboxWddmMemFree(pvBuf); 68 69 pvBuf = vboxWddmMemAlloc(cbBufUsed); 70 cbBuf = cbBufUsed; 71 bFreeBuf = true; 72 } 73 else 74 { 75 break; 76 } 77 } while(true); 78 79 if(Status == STATUS_SUCCESS) 80 { 81 PCM_RESOURCE_LIST pRcList = (PCM_RESOURCE_LIST)pvBuf; 82 for(ULONG i = 0; i < pRcList->Count; ++i) 83 { 84 PCM_FULL_RESOURCE_DESCRIPTOR pFRc = &pRcList->List[i]; 85 for(ULONG j = 0; j < pFRc->PartialResourceList.Count; ++j) 86 { 87 PCM_PARTIAL_RESOURCE_DESCRIPTOR pPRc = &pFRc->PartialResourceList.PartialDescriptors[j]; 88 switch(pPRc->Type) 89 { 90 case CmResourceTypePort: 91 92 break; 93 case CmResourceTypeInterrupt: 94 break; 95 case CmResourceTypeMemory: 96 break; 97 case CmResourceTypeDma: 98 break; 99 case CmResourceTypeDeviceSpecific: 100 break; 101 case CmResourceTypeBusNumber: 102 break; 103 default: 104 break; 105 } 106 } 107 } 108 109 if(bFreeBuf) 110 vboxWddmMemFree(pvBuf); 111 112 *MiniportDeviceContext = pContext; 113 return STATUS_SUCCESS; 114 } 115 116 if(bFreeBuf) 117 vboxWddmMemFree(pvBuf); 118 119 vboxWddmMemFree(pContext); 129 *MiniportDeviceContext = pContext; 120 130 } 121 131 else 122 132 { 123 133 Status = STATUS_INSUFFICIENT_RESOURCES; 134 drprintf(("VBoxVideoWddm: ERROR, failed to create context\n")); 124 135 } 136 137 dfprintf(("<== "__FUNCTION__ ", status(0x%x), pContext(0x%x)\n", Status, pContext)); 125 138 126 139 return Status; … … 135 148 ) 136 149 { 137 return STATUS_NOT_IMPLEMENTED; 150 /* The DxgkDdiStartDevice function should be made pageable. */ 151 PAGED_CODE(); 152 153 NTSTATUS Status; 154 155 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", MiniportDeviceContext)); 156 157 if ( ARGUMENT_PRESENT(MiniportDeviceContext) && 158 ARGUMENT_PRESENT(DxgkInterface) && 159 ARGUMENT_PRESENT(DxgkStartInfo) && 160 ARGUMENT_PRESENT(NumberOfVideoPresentSources), 161 ARGUMENT_PRESENT(NumberOfChildren) 162 ) 163 { 164 PDEVICE_EXTENSION pContext = (PDEVICE_EXTENSION)MiniportDeviceContext; 165 166 /* Save DeviceHandle and function pointers supplied by the DXGKRNL_INTERFACE structure passed to DxgkInterface. */ 167 memcpy(&pContext->u.primary.DxgkInterface, DxgkInterface, sizeof(DXGKRNL_INTERFACE)); 168 169 /* Allocate a DXGK_DEVICE_INFO structure, and call DxgkCbGetDeviceInformation to fill in the members of that structure, which include the registry path, the PDO, and a list of translated resources for the display adapter represented by MiniportDeviceContext. Save selected members (ones that the display miniport driver will need later) 170 * of the DXGK_DEVICE_INFO structure in the context block represented by MiniportDeviceContext. */ 171 DXGK_DEVICE_INFO DeviceInfo; 172 Status = pContext->u.primary.DxgkInterface.DxgkCbGetDeviceInformation (pContext->u.primary.DxgkInterface.DeviceHandle, &DeviceInfo); 173 if(Status == STATUS_SUCCESS) 174 { 175 ULONG AdapterMemorySize; 176 Status = vboxWddmPickResources(pContext, &DeviceInfo, &AdapterMemorySize); 177 if(Status == STATUS_SUCCESS) 178 { 179 /* Initialize VBoxGuest library, which is used for requests which go through VMMDev. */ 180 VbglInit (); 181 182 /* Guest supports only HGSMI, the old VBVA via VMMDev is not supported. Old 183 * code will be ifdef'ed and later removed. 184 * The host will however support both old and new interface to keep compatibility 185 * with old guest additions. 186 */ 187 VBoxSetupDisplaysHGSMI(pContext, AdapterMemorySize); 188 if ((pContext)->u.primary.bHGSMI) 189 { 190 drprintf(("VBoxVideoWddm: using HGSMI\n")); 191 *NumberOfVideoPresentSources = pContext->u.primary.cDisplays; 192 *NumberOfChildren = pContext->u.primary.cDisplays; 193 dprintf(("VBoxVideoWddm: sources(%d), children(%d)\n", *NumberOfVideoPresentSources, *NumberOfChildren)); 194 } 195 else 196 { 197 drprintf(("VBoxVideoWddm: HGSMI failed to initialize, returning err\n")); 198 /* @todo: report a better status */ 199 Status = STATUS_UNSUCCESSFUL; 200 } 201 } 202 else 203 { 204 drprintf(("VBoxVideoWddm:: vboxWddmPickResources failed Status(0x%x), returning err\n", Status)); 205 Status = STATUS_UNSUCCESSFUL; 206 } 207 } 208 else 209 { 210 drprintf(("VBoxVideoWddm: DxgkCbGetDeviceInformation failed Status(0x%x), returning err\n", Status)); 211 } 212 } 213 else 214 { 215 drprintf(("VBoxVideoWddm: invalid parameter, returning err\n")); 216 Status = STATUS_INVALID_PARAMETER; 217 } 218 219 dfprintf(("<== "__FUNCTION__ ", status(0x%x)\n", Status)); 220 221 return Status; 138 222 } 139 223 … … 231 315 } 232 316 233 234 317 VOID DxgkDdiUnload( 235 318 VOID … … 667 750 ) 668 751 { 752 dprintf(("VBoxVideoWddm::DriverEntry. Built %s %s\n", __DATE__, __TIME__)); 753 669 754 DRIVER_INITIALIZATION_DATA DriverInitializationData = {'\0'}; 670 755
Note:
See TracChangeset
for help on using the changeset viewer.