Changeset 25980 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
- Timestamp:
- Jan 22, 2010 5:38:13 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56845
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r24709 r25980 25 25 26 26 #ifdef VBOX_WITH_HGSMI 27 #include <iprt/thread.h>27 //#include <iprt/thread.h> 28 28 29 29 #include <VBox/HGSMI/HGSMI.h> … … 33 33 34 34 RT_C_DECLS_BEGIN 35 #ifndef VBOXWDDM 35 36 #include "dderror.h" 36 37 #include "devioctl.h" … … 38 39 #include "ntddvdeo.h" 39 40 #include "video.h" 41 #else 42 # define VBOX_WITH_WORKAROUND_MISSING_PACK 43 # if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK) 44 # define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap 45 # define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap 46 # define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap 47 # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap 48 # define _interlockedbittestandset _interlockedbittestandset_StupidDDKVsCompilerCrap 49 # define _interlockedbittestandreset _interlockedbittestandreset_StupidDDKVsCompilerCrap 50 # define _interlockedbittestandset64 _interlockedbittestandset64_StupidDDKVsCompilerCrap 51 # define _interlockedbittestandreset64 _interlockedbittestandreset64_StupidDDKVsCompilerCrap 52 # pragma warning(disable : 4163) 53 # ifdef VBOX_WITH_WORKAROUND_MISSING_PACK 54 # pragma warning(disable : 4103) 55 # endif 56 # include <ntddk.h> 57 # pragma warning(default : 4163) 58 # ifdef VBOX_WITH_WORKAROUND_MISSING_PACK 59 # pragma pack() 60 # pragma warning(default : 4103) 61 # endif 62 # undef _InterlockedExchange 63 # undef _InterlockedExchangeAdd 64 # undef _InterlockedCompareExchange 65 # undef _InterlockedAddLargeStatistic 66 # undef _interlockedbittestandset 67 # undef _interlockedbittestandreset 68 # undef _interlockedbittestandset64 69 # undef _interlockedbittestandreset64 70 # else 71 # include <ntddk.h> 72 # endif 73 #include "dispmprt.h" 74 #include "ntddvdeo.h" 75 #include "dderror.h" 76 #endif 40 77 RT_C_DECLS_END 41 78 … … 70 107 #endif /* VBOX_WITH_HGSMI */ 71 108 109 /* common API types */ 110 #ifndef VBOXWDDM 111 typedef PSPIN_LOCK VBOXVCMNSPIN_LOCK, *PVBOXVCMNSPIN_LOCK; 112 typedef UCHAR VBOXVCMNIRQL, *PVBOXVCMNIRQL; 113 114 typedef PEVENT VBOXVCMNEVENT, *PVBOXVCMNEVENT; 115 #else 116 typedef KSPIN_LOCK VBOXVCMNSPIN_LOCK, *PVBOXVCMNSPIN_LOCK; 117 typedef KIRQL VBOXVCMNIRQL, *PVBOXVCMNIRQL; 118 119 typedef KEVENT VBOXVCMNEVENT, *PVBOXVCMNEVENT; 120 #endif 121 72 122 typedef struct _DEVICE_EXTENSION 73 123 { … … 117 167 volatile HGSMIHOSTFLAGS * pHostFlags; /* HGSMI host flags */ 118 168 volatile bool bHostCmdProcessing; 119 PSPIN_LOCK pSynchLock;169 VBOXVCMNSPIN_LOCK pSynchLock; 120 170 #endif 121 171 … … 148 198 /* The IO Port Number for guest commands. */ 149 199 RTIOPORT IOPortGuest; 150 200 # ifndef VBOXWDDM 151 201 /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */ 152 202 VBOXVIDEOPORTPROCS VideoPortProcs; 203 # endif 153 204 #endif /* VBOX_WITH_HGSMI */ 154 205 } primary; … … 177 228 extern "C" 178 229 { 230 #ifndef VBOXWDDM 231 /* XPDM-WDDM common API */ 232 233 typedef PEVENT VBOXVCMNEVENT, *PVBOXVCMNEVENT; 234 235 DECLINLINE(VOID) VBoxVideoCmnPortWriteUchar(IN PUCHAR Port, IN UCHAR Value) 236 { 237 VideoPortWritePortUchar(Port,Value); 238 } 239 240 DECLINLINE(VOID) VBoxVideoCmnPortWriteUshort(IN PUSHORT Port, IN USHORT Value) 241 { 242 VideoPortWritePortUshort(Port,Value); 243 } 244 245 DECLINLINE(VOID) VBoxVideoCmnPortWriteUlong(IN PULONG Port, IN ULONG Value) 246 { 247 VideoPortWritePortUlong(Port,Value); 248 } 249 250 DECLINLINE(UCHAR) VBoxVideoCmnPortReadUchar(IN PUCHAR Port) 251 { 252 return VideoPortReadPortUchar(Port); 253 } 254 255 DECLINLINE(USHORT) VBoxVideoCmnPortReadUshort(IN PUSHORT Port) 256 { 257 return VideoPortReadPortUshort(Port); 258 } 259 260 DECLINLINE(ULONG) VBoxVideoCmnPortReadUlong(IN PULONG Port) 261 { 262 return VideoPortReadPortUlong(Port); 263 } 264 265 DECLINLINE(VOID) VBoxVideoCmnMemZero(PVOID pvMem, ULONG cbMem) 266 { 267 VideoPortZeroMemory(pvMem, cbMem); 268 } 269 270 DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquire(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, OUT PVBOXVCMNIRQL OldIrql) 271 { 272 pDeviceExtension->u.primary.VideoPortProcs.pfnAcquireSpinLock(pDeviceExtension, *SpinLock, OldIrql); 273 } 274 275 DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquireAtDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock) 276 { 277 pDeviceExtension->u.primary.VideoPortProcs.pfnAcquireSpinLockAtDpcLevel(pDeviceExtension, *SpinLock); 278 } 279 280 DECLINLINE(VOID) VBoxVideoCmnSpinLockRelease(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, IN VBOXVCMNIRQL NewIrql) 281 { 282 pDeviceExtension->u.primary.VideoPortProcs.pfnReleaseSpinLock(pDeviceExtension, *SpinLock, NewIrql); 283 } 284 285 DECLINLINE(VOID) VBoxVideoCmnSpinLockReleaseFromDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock) 286 { 287 pDeviceExtension->u.primary.VideoPortProcs.pfnReleaseSpinLockFromDpcLevel(pDeviceExtension, *SpinLock); 288 } 289 290 DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockCreate(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock) 291 { 292 return pDeviceExtension->u.primary.VideoPortProcs.pfnCreateSpinLock(pDeviceExtension, SpinLock); 293 } 294 295 DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock) 296 { 297 return pDeviceExtension->u.primary.VideoPortProcs.pfnDeleteSpinLock(pDeviceExtension, *SpinLock); 298 } 299 300 DECLINLINE(LONG) VBoxVideoCmnEventSet(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent) 301 { 302 return pDeviceExtension->u.primary.VideoPortProcs.pfnSetEvent(pDeviceExtension, *pEvent); 303 } 304 305 DECLINLINE(VP_STATUS) VBoxVideoCmnEventCreateNotification(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent, IN BOOLEAN bSignaled) 306 { 307 ULONG fFlags = NOTIFICATION_EVENT; 308 if(bSignaled) 309 fFlags |= INITIAL_EVENT_SIGNALED; 310 311 return pDeviceExtension->u.primary.VideoPortProcs.pfnCreateEvent(pDeviceExtension, fFlags, NULL, pEvent); 312 } 313 314 DECLINLINE(VP_STATUS) VBoxVideoCmnEventDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent) 315 { 316 return pDeviceExtension->u.primary.VideoPortProcs.pfnDeleteEvent(pDeviceExtension, *pEvent); 317 } 318 319 DECLINLINE(PVOID) VBoxVideoCmnMemAllocNonPaged(IN PDEVICE_EXTENSION pDeviceExtension, IN SIZE_T NumberOfBytes, IN ULONG Tag) 320 { 321 return pDeviceExtension->u.primary.VideoPortProcs.pfnAllocatePool(pDeviceExtension, (VBOXVP_POOL_TYPE)VpNonPagedPool, NumberOfBytes, Tag); 322 } 323 324 DECLINLINE(VOID) VBoxVideoCmnMemFree(IN PDEVICE_EXTENSION pDeviceExtension, IN PVOID Ptr) 325 { 326 pDeviceExtension->u.primary.VideoPortProcs.pfnFreePool(pDeviceExtension, Ptr); 327 } 328 /* */ 179 329 180 330 RT_C_DECLS_BEGIN … … 214 364 ULONG HwId, 215 365 PVIDEO_POWER_MANAGEMENT VideoPowerControl); 216 217 BOOLEAN FASTCALL VBoxVideoSetCurrentMode(218 PDEVICE_EXTENSION DeviceExtension,219 PVIDEO_MODE RequestedMode,220 PSTATUS_BLOCK StatusBlock);221 222 BOOLEAN FASTCALL VBoxVideoResetDevice(223 PDEVICE_EXTENSION DeviceExtension,224 PSTATUS_BLOCK StatusBlock);225 226 BOOLEAN FASTCALL VBoxVideoMapVideoMemory(227 PDEVICE_EXTENSION DeviceExtension,228 PVIDEO_MEMORY RequestedAddress,229 PVIDEO_MEMORY_INFORMATION MapInformation,230 PSTATUS_BLOCK StatusBlock);231 232 BOOLEAN FASTCALL VBoxVideoUnmapVideoMemory(233 PDEVICE_EXTENSION DeviceExtension,234 PVIDEO_MEMORY VideoMemory,235 PSTATUS_BLOCK StatusBlock);236 237 BOOLEAN FASTCALL VBoxVideoQueryNumAvailModes(238 PDEVICE_EXTENSION DeviceExtension,239 PVIDEO_NUM_MODES Modes,240 PSTATUS_BLOCK StatusBlock);241 242 BOOLEAN FASTCALL VBoxVideoQueryAvailModes(243 PDEVICE_EXTENSION DeviceExtension,244 PVIDEO_MODE_INFORMATION ReturnedModes,245 PSTATUS_BLOCK StatusBlock);246 247 BOOLEAN FASTCALL VBoxVideoQueryCurrentMode(248 PDEVICE_EXTENSION DeviceExtension,249 PVIDEO_MODE_INFORMATION VideoModeInfo,250 PSTATUS_BLOCK StatusBlock);251 252 BOOLEAN FASTCALL VBoxVideoSetColorRegisters(253 PDEVICE_EXTENSION DeviceExtension,254 PVIDEO_CLUT ColorLookUpTable,255 PSTATUS_BLOCK StatusBlock);256 366 257 367 VP_STATUS VBoxVideoGetChildDescriptor( … … 263 373 PULONG pUnused); 264 374 375 376 void VBoxSetupVideoPortFunctions(PDEVICE_EXTENSION PrimaryExtension, 377 VBOXVIDEOPORTPROCS *pCallbacks, 378 PVIDEO_PORT_CONFIG_INFO pConfigInfo); 379 380 #else 381 382 /* XPDM-WDDM common API */ 383 DECLINLINE(VOID) VBoxVideoCmnPortWriteUchar(IN PUCHAR Port, IN UCHAR Value) 384 { 385 WRITE_PORT_UCHAR(Port,Value); 386 } 387 388 DECLINLINE(VOID) VBoxVideoCmnPortWriteUshort(IN PUSHORT Port, IN USHORT Value) 389 { 390 WRITE_PORT_USHORT(Port,Value); 391 } 392 393 DECLINLINE(VOID) VBoxVideoCmnPortWriteUlong(IN PULONG Port, IN ULONG Value) 394 { 395 WRITE_PORT_ULONG(Port,Value); 396 } 397 398 DECLINLINE(UCHAR) VBoxVideoCmnPortReadUchar(IN PUCHAR Port) 399 { 400 return READ_PORT_UCHAR(Port); 401 } 402 403 DECLINLINE(USHORT) VBoxVideoCmnPortReadUshort(IN PUSHORT Port) 404 { 405 return READ_PORT_USHORT(Port); 406 } 407 408 DECLINLINE(ULONG) VBoxVideoCmnPortReadUlong(IN PULONG Port) 409 { 410 return READ_PORT_ULONG(Port); 411 } 412 413 DECLINLINE(VOID) VBoxVideoCmnMemZero(PVOID pvMem, ULONG cbMem) 414 { 415 memset(pvMem, 0, cbMem); 416 } 417 418 DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquire(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, OUT PVBOXVCMNIRQL OldIrql) 419 { 420 KeAcquireSpinLock(SpinLock, OldIrql); 421 } 422 423 DECLINLINE(VOID) VBoxVideoCmnSpinLockAcquireAtDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock) 424 { 425 KeAcquireSpinLockAtDpcLevel(SpinLock); 426 } 427 428 DECLINLINE(VOID) VBoxVideoCmnSpinLockRelease(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock, IN VBOXVCMNIRQL NewIrql) 429 { 430 KeReleaseSpinLock(SpinLock, NewIrql); 431 } 432 433 DECLINLINE(VOID) VBoxVideoCmnSpinLockReleaseFromDpcLevel(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock) 434 { 435 KeReleaseSpinLockFromDpcLevel(SpinLock); 436 } 437 438 DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockCreate(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock) 439 { 440 KeInitializeSpinLock(SpinLock); 441 return NO_ERROR; 442 } 443 444 DECLINLINE(VP_STATUS) VBoxVideoCmnSpinLockDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNSPIN_LOCK SpinLock) 445 { 446 return NO_ERROR; 447 } 448 449 DECLINLINE(LONG) VBoxVideoCmnEventSet(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent) 450 { 451 return KeSetEvent(pEvent, 0, FALSE); 452 } 453 454 DECLINLINE(VP_STATUS) VBoxVideoCmnEventCreateNotification(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent, IN BOOLEAN bSignaled) 455 { 456 KeInitializeEvent(pEvent, NotificationEvent, bSignaled); 457 return NO_ERROR; 458 } 459 460 DECLINLINE(VP_STATUS) VBoxVideoCmnEventDelete(IN PDEVICE_EXTENSION pDeviceExtension, IN PVBOXVCMNEVENT pEvent) 461 { 462 return NO_ERROR; 463 } 464 465 DECLINLINE(PVOID) VBoxVideoCmnMemAllocNonPaged(IN PDEVICE_EXTENSION pDeviceExtension, IN SIZE_T NumberOfBytes, IN ULONG Tag) 466 { 467 return ExAllocatePoolWithTag(NonPagedPool, NumberOfBytes, Tag); 468 } 469 470 DECLINLINE(VOID) VBoxVideoCmnMemFree(IN PDEVICE_EXTENSION pDeviceExtension, IN PVOID Ptr) 471 { 472 ExFreePool(Ptr); 473 } 474 475 /* */ 476 477 RT_C_DECLS_BEGIN 478 NTSTATUS 479 DriverEntry( 480 IN PDRIVER_OBJECT DriverObject, 481 IN PUNICODE_STRING RegistryPath 482 ); 483 RT_C_DECLS_END 484 #endif 485 486 BOOLEAN FASTCALL VBoxVideoSetCurrentMode( 487 PDEVICE_EXTENSION DeviceExtension, 488 PVIDEO_MODE RequestedMode, 489 PSTATUS_BLOCK StatusBlock); 490 491 BOOLEAN FASTCALL VBoxVideoResetDevice( 492 PDEVICE_EXTENSION DeviceExtension, 493 PSTATUS_BLOCK StatusBlock); 494 495 BOOLEAN FASTCALL VBoxVideoMapVideoMemory( 496 PDEVICE_EXTENSION DeviceExtension, 497 PVIDEO_MEMORY RequestedAddress, 498 PVIDEO_MEMORY_INFORMATION MapInformation, 499 PSTATUS_BLOCK StatusBlock); 500 501 BOOLEAN FASTCALL VBoxVideoUnmapVideoMemory( 502 PDEVICE_EXTENSION DeviceExtension, 503 PVIDEO_MEMORY VideoMemory, 504 PSTATUS_BLOCK StatusBlock); 505 506 BOOLEAN FASTCALL VBoxVideoQueryNumAvailModes( 507 PDEVICE_EXTENSION DeviceExtension, 508 PVIDEO_NUM_MODES Modes, 509 PSTATUS_BLOCK StatusBlock); 510 511 BOOLEAN FASTCALL VBoxVideoQueryAvailModes( 512 PDEVICE_EXTENSION DeviceExtension, 513 PVIDEO_MODE_INFORMATION ReturnedModes, 514 PSTATUS_BLOCK StatusBlock); 515 516 BOOLEAN FASTCALL VBoxVideoQueryCurrentMode( 517 PDEVICE_EXTENSION DeviceExtension, 518 PVIDEO_MODE_INFORMATION VideoModeInfo, 519 PSTATUS_BLOCK StatusBlock); 520 521 BOOLEAN FASTCALL VBoxVideoSetColorRegisters( 522 PDEVICE_EXTENSION DeviceExtension, 523 PVIDEO_CLUT ColorLookUpTable, 524 PSTATUS_BLOCK StatusBlock); 525 265 526 int VBoxMapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, 266 527 void **ppv, … … 269 530 270 531 void VBoxUnmapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, 271 void **ppv );532 void **ppv, ULONG ulSize); 272 533 273 534 void VBoxComputeFrameBufferSizes (PDEVICE_EXTENSION PrimaryExtension); … … 280 541 DECLINLINE(void) VBoxHGSMIHostWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data) 281 542 { 282 V ideoPortWritePortUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost, data);543 VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost, data); 283 544 } 284 545 285 546 DECLINLINE(ULONG) VBoxHGSMIHostRead(PDEVICE_EXTENSION PrimaryExtension) 286 547 { 287 return V ideoPortReadPortUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost);548 return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost); 288 549 } 289 550 290 551 DECLINLINE(void) VBoxHGSMIGuestWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data) 291 552 { 292 V ideoPortWritePortUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest, data);553 VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest, data); 293 554 } 294 555 295 556 DECLINLINE(ULONG) VBoxHGSMIGuestRead(PDEVICE_EXTENSION PrimaryExtension) 296 557 { 297 return V ideoPortReadPortUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest);558 return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest); 298 559 } 299 560 300 561 BOOLEAN VBoxHGSMIIsSupported (PDEVICE_EXTENSION PrimaryExtension); 301 302 void VBoxSetupVideoPortFunctions(PDEVICE_EXTENSION PrimaryExtension,303 VBOXVIDEOPORTPROCS *pCallbacks,304 PVIDEO_PORT_CONFIG_INFO pConfigInfo);305 562 306 563 VOID VBoxSetupDisplaysHGSMI (PDEVICE_EXTENSION PrimaryExtension,
Note:
See TracChangeset
for help on using the changeset viewer.