Changeset 26556 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
- Timestamp:
- Feb 15, 2010 10:10:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
r26505 r26556 186 186 typedef FNHGSMICALLFINALIZE *PFNHGSMICALLFINALIZE; 187 187 188 void* VBoxHGSMIBufferAlloc (PDEVICE_EXTENSION PrimaryExtension, 189 HGSMISIZE cbData, 190 uint8_t u8Ch, 191 uint16_t u16Op) 192 { 193 #ifdef VBOXWDDM 194 /* @todo: add synchronization */ 195 #endif 196 return HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op); 197 } 198 199 void* VBoxHGSMIBufferAlloc (PDEVICE_EXTENSION PrimaryExtension, 200 uint8_t u8Ch, 201 uint16_t u16Op, 202 HGSMISIZE cbData) 203 { 204 #ifdef VBOXWDDM 205 /* @todo: add synchronization */ 206 #endif 207 return HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op); 208 } 209 210 void VBoxHGSMIBufferFree (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer) 211 { 212 #ifdef VBOXWDDM 213 /* @todo: add synchronization */ 214 #endif 215 HGSMIHeapFree (&PrimaryExtension->u.primary.hgsmiAdapterHeap, pvBuffer); 216 } 217 218 int VBoxHGSMIBufferSubmit (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer) 219 { 220 /* Initialize the buffer and get the offset for port IO. */ 221 HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&PrimaryExtension->u.primary.hgsmiAdapterHeap, pvBuffer); 222 223 Assert(offBuffer != HGSMIOFFSET_VOID); 224 if (offBuffer != HGSMIOFFSET_VOID) 225 { 226 /* Submit the buffer to the host. */ 227 VBoxHGSMIGuestWrite(PrimaryExtension, offBuffer); 228 return VINF_SUCCESS; 229 } 230 231 return VERR_INVALID_PARAMETER; 232 } 233 188 234 static int vboxCallChannel (PDEVICE_EXTENSION PrimaryExtension, 189 235 uint8_t u8Ch, … … 197 243 198 244 /* Allocate the IO buffer. */ 245 #ifndef VBOXWDDM 199 246 if (PrimaryExtension->pPrimary != PrimaryExtension) 200 247 { … … 202 249 return VERR_INVALID_PARAMETER; 203 250 } 251 #endif 204 252 205 253 void *p = HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op); … … 315 363 return rc; 316 364 } 317 365 #ifndef VBOXWDDM 318 366 static int vbvaInitInfoDisplay (PDEVICE_EXTENSION PrimaryExtension, void *pvContext, void *pvData) 319 367 { … … 348 396 return VERR_INTERNAL_ERROR; 349 397 } 398 #endif 350 399 351 400 static int vbvaInitInfoHeap (PDEVICE_EXTENSION PrimaryExtension, void *pvContext, void *pvData) … … 389 438 if(RT_SUCCESS (rc)) 390 439 { 440 #ifndef VBOXWDDM 391 441 rc = vboxCallVBVA (PrimaryExtension, 392 442 VBVA_INFO_VIEW, … … 397 447 AssertRC(rc); 398 448 if (RT_SUCCESS (rc)) 449 #else 450 /* in case of WDDM we do not control the framebuffer location, 451 * i.e. it is assigned by Video Memory Manager, 452 * The FB information should be passed to guest from our DxgkDdiSetVidPnSourceAddress callback */ 453 #endif 399 454 { 400 455 /* Report the host heap location. */ … … 660 715 */ 661 716 PrimaryExtension->pNext = NULL; 717 #ifndef VBOXWDDM 662 718 PrimaryExtension->pPrimary = PrimaryExtension; 663 719 PrimaryExtension->iDevice = 0; 664 720 PrimaryExtension->ulFrameBufferOffset = 0; 665 721 PrimaryExtension->ulFrameBufferSize = 0; 722 #endif 666 723 PrimaryExtension->u.primary.ulVbvaEnabled = 0; 667 724 PrimaryExtension->u.primary.bVBoxVideoSupported = FALSE; … … 861 918 } 862 919 920 #ifndef VBOXWDDM 863 921 /* Now when the number of monitors is known and extensions are created, 864 922 * calculate the layout of framebuffers. 865 923 */ 866 924 VBoxComputeFrameBufferSizes (PrimaryExtension); 925 #endif 867 926 868 927 if (PrimaryExtension->u.primary.bHGSMI) … … 876 935 } 877 936 } 937 938 #ifdef VBOXWDDM 939 if (PrimaryExtension->u.primary.bHGSMI) 940 { 941 ULONG ulAvailable = PrimaryExtension->u.primary.cbVRAM 942 - PrimaryExtension->u.primary.cbMiniportHeap 943 - VBVA_ADAPTER_INFORMATION_SIZE; 944 945 /* use 25% od VRAM for DMA command buffer 946 * @todo: ^^^? */ 947 ULONG ulSize = ulAvailable / 4; 948 949 /* Align down to 4096 bytes. */ 950 ulSize &= ~0xFFF; 951 ULONG offset = ulAvailable - ulSize; 952 953 Assert(!(offset & 0xFFF)); 954 955 rc = vboxVdmaCreate (PrimaryExtension, &PrimaryExtension->u.primary.Vdma, offset, ulSize); 956 AssertRC(rc); 957 if (RT_SUCCESS(rc)) 958 { 959 /* can enable it right away since the host does not need any screen/FB info 960 * for basic DMA functionality */ 961 rc = vboxVdmaEnable(PrimaryExtension, &PrimaryExtension->u.primary.Vdma); 962 AssertRC(rc); 963 if (RT_FAILURE(rc)) 964 vboxVdmaDestroy(PrimaryExtension, &PrimaryExtension->u.primary.Vdma); 965 } 966 967 if (RT_FAILURE(rc)) 968 PrimaryExtension->u.primary.bHGSMI = FALSE; 969 } 970 #endif 878 971 879 972 if (!PrimaryExtension->u.primary.bHGSMI) … … 953 1046 uint32_t cbLength) 954 1047 { 1048 #ifndef VBOXWDDM 955 1049 PDEVICE_EXTENSION PrimaryExtension = DeviceExtension->pPrimary; 956 1050 … … 977 1071 return TRUE; 978 1072 } 1073 #else 1074 PDEVICE_EXTENSION PrimaryExtension = DeviceExtension; 1075 #endif 979 1076 980 1077 uint32_t cbData = 0; … … 1116 1213 } 1117 1214 1215 #ifndef VBOXWDDM 1118 1216 DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd) 1119 1217 { … … 1164 1262 return VERR_INVALID_PARAMETER; 1165 1263 } 1264 #endif 1166 1265 1167 1266 static DECLCALLBACK(int) vboxVBVAChannelGenericHandler(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
Note:
See TracChangeset
for help on using the changeset viewer.