- Timestamp:
- Aug 24, 2007 12:42:53 PM (17 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c
r4265 r4343 1 #define LOG_ENABLED 2 1 3 #ifdef VBOX_WITH_DDRAW 2 4 … … 213 215 pCallBacks->dwFlags = 0; 214 216 215 pCallBacks->dwFlags = DDHAL_CB32_CREATESURFACE | DDHAL_CB32_CANCREATESURFACE ;217 pCallBacks->dwFlags = DDHAL_CB32_CREATESURFACE | DDHAL_CB32_CANCREATESURFACE | DDHAL_CB32_MAPMEMORY; 216 218 pCallBacks->CreateSurface = DdCreateSurface; 217 219 pCallBacks->CanCreateSurface = DdCanCreateSurface; 220 pCallBacks->MapMemory = DdMapMemory; 218 221 // pCallBacks->WaitForVerticalBlank = DdWaitForVerticalBlank; 219 222 // pCallBacks->GetScanLine = DdGetScanLine; 220 // pCallBacks->MapMemory = DdMapMemory; 221 // DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_MAPMEMORY | DDHAL_CB32_GETSCANLINE 223 // DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_GETSCANLINE 222 224 /* Note: pCallBacks->SetMode & pCallBacks->DestroyDriver are unused in Windows 2000 and up */ 223 225 224 226 /* Fill in the Surface Callback pointers */ 225 227 pSurfaceCallBacks->dwSize = sizeof(DD_SURFACECALLBACKS); 226 pSurfaceCallBacks->dwFlags = 0; 228 pSurfaceCallBacks->dwFlags = DDHAL_SURFCB32_LOCK | DDHAL_SURFCB32_UNLOCK; 229 pSurfaceCallBacks->Lock = DdLock; 230 pSurfaceCallBacks->Unlock = DdUnlock; 227 231 228 232 /* 229 233 pSurfaceCallBacks->dwFlags = DDHAL_SURFCB32_DESTROYSURFACE | DDHAL_SURFCB32_LOCK; // DDHAL_SURFCB32_UNLOCK; 230 234 pSurfaceCallBacks->DestroySurface = DdDestroySurface; 231 pSurfaceCallBacks->Lock = DdLock;232 pSurfaceCallBacks->Unlock = DdUnlock;233 235 pSurfaceCallBacks->Flip = DdFlip; 234 236 pSurfaceCallBacks->GetBltStatus = DdGetBltStatus; … … 584 586 } 585 587 588 // ***************************WIN NT ONLY********************************** 589 // 590 // DdMapMemory 591 // 592 // Maps application-modifiable portions of the frame buffer into the 593 // user-mode address space of the specified process, or unmaps memory. 594 // 595 // DdMapMemory is called to perform memory mapping before the first call to 596 // DdLock. The handle returned by the driver in fpProcess will be passed to 597 // every DdLock call made on the driver. 598 // 599 // DdMapMemory is also called to unmap memory after the last DdUnLock call is 600 // made. 601 // 602 // To prevent driver crashes, the driver must not map any portion of the frame 603 // buffer that must not be modified by an application. 604 // 605 // Parameters 606 // lpMapMemory 607 // Points to a DD_MAPMEMORYDATA structure that contains details for 608 // the memory mapping or unmapping operation. 609 // 610 // .lpDD 611 // Points to a DD_DIRECTDRAW_GLOBAL structure that represents 612 // the driver. 613 // .bMap 614 // Specifies the memory operation that the driver should perform. 615 // A value of TRUE indicates that the driver should map memory; 616 // FALSE means that the driver should unmap memory. 617 // .hProcess 618 // Specifies a handle to the process whose address space is 619 // affected. 620 // .fpProcess 621 // Specifies the location in which the driver should return the 622 // base address of the process's memory mapped space when bMap 623 // is TRUE. When bMap is FALSE, fpProcess contains the base 624 // address of the memory to be unmapped by the driver. 625 // .ddRVal 626 // Specifies the location in which the driver writes the return 627 // value of the DdMapMemory callback. A return code of DD_OK 628 // indicates success. 629 // 630 //----------------------------------------------------------------------------- 631 632 DWORD CALLBACK DdMapMemory(PDD_MAPMEMORYDATA lpMapMemory) 633 { 634 PPDEV pDev = (PPDEV)lpMapMemory->lpDD->dhpdev; 635 636 VIDEO_SHARE_MEMORY ShareMemory; 637 VIDEO_SHARE_MEMORY_INFORMATION ShareMemoryInformation; 638 DWORD ReturnedDataLength; 639 640 DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev)); 641 642 if (lpMapMemory->bMap) 643 { 644 ShareMemory.ProcessHandle = lpMapMemory->hProcess; 645 646 // 'RequestedVirtualAddress' isn't actually used for the SHARE IOCTL: 647 648 ShareMemory.RequestedVirtualAddress = 0; 649 650 // We map in starting at the top of the frame buffer: 651 652 ShareMemory.ViewOffset = 0; 653 ShareMemory.ViewSize = pDev->cyScreen * pDev->lDeltaScreen; 654 655 DISPDBG((0, "ViewSize = %x", ShareMemory.ViewSize)); 656 657 if (EngDeviceIoControl(pDev->hDriver, 658 IOCTL_VIDEO_SHARE_VIDEO_MEMORY, 659 &ShareMemory, 660 sizeof(VIDEO_SHARE_MEMORY), 661 &ShareMemoryInformation, 662 sizeof(VIDEO_SHARE_MEMORY_INFORMATION), 663 &ReturnedDataLength)) 664 { 665 DISPDBG((0, "Failed IOCTL_VIDEO_SHARE_MEMORY")); 666 667 lpMapMemory->ddRVal = DDERR_GENERIC; 668 669 DISPDBG((0, "DdMapMemory: Exit GEN, DDHAL_DRIVER_HANDLED")); 670 671 return(DDHAL_DRIVER_HANDLED); 672 } 673 674 lpMapMemory->fpProcess = 675 (FLATPTR) ShareMemoryInformation.VirtualAddress; 676 } 677 else 678 { 679 ShareMemory.ProcessHandle = lpMapMemory->hProcess; 680 ShareMemory.ViewOffset = 0; 681 ShareMemory.ViewSize = 0; 682 ShareMemory.RequestedVirtualAddress = (VOID*) lpMapMemory->fpProcess; 683 684 if (EngDeviceIoControl(pDev->hDriver, 685 IOCTL_VIDEO_UNSHARE_VIDEO_MEMORY, 686 &ShareMemory, 687 sizeof(VIDEO_SHARE_MEMORY), 688 NULL, 689 0, 690 &ReturnedDataLength)) 691 { 692 DISPDBG((0, "Failed IOCTL_VIDEO_UNSHARE_MEMORY")); 693 } 694 } 695 696 lpMapMemory->ddRVal = DD_OK; 697 698 return(DDHAL_DRIVER_HANDLED); 699 } 700 586 701 /** 587 702 * DdLock … … 611 726 // care of adding in the user-mode frame buffer address if we return 612 727 // DDHAL_DRIVER_NOTHANDLED: 728 lpLock->ddRVal = DD_OK; 613 729 return DDHAL_DRIVER_NOTHANDLED; 614 730 } … … 636 752 DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev)); 637 753 754 lpUnlock->ddRVal = DD_OK; 638 755 return DDHAL_DRIVER_NOTHANDLED; 639 756 } -
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.h
r4071 r4343 33 33 DWORD APIENTRY DdFlipToGDISurface(PDD_FLIPTOGDISURFACEDATA lpFlipToGDISurface); 34 34 HBITMAP DrvDeriveSurface(DD_DIRECTDRAW_GLOBAL* pDirectDraw, DD_SURFACE_LOCAL* pSurface); 35 DWORD CALLBACK DdMapMemory(PDD_MAPMEMORYDATA lpMapMemory); 35 36 36 37 #endif /* __VBOX_DD_H__*/
Note:
See TracChangeset
for help on using the changeset viewer.