Changeset 4124 in vbox
- Timestamp:
- Aug 12, 2007 5:58:06 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 23597
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h
r4122 r4124 71 71 ULONG cbDisplayInformation; 72 72 } VRAMLAYOUT; 73 74 typedef struct 75 { 76 PPDEV ppdev; 77 } VBOXSURF, *PVBOXSURF; 73 78 74 79 struct _PDEV … … 121 126 VRAMLAYOUT layout; 122 127 128 PVBOXSURF pdsurfScreen; 129 123 130 #ifdef VBOX_WITH_DDRAW 124 131 BOOL bDdExclusiveMode; … … 201 208 if (ppdev) 202 209 { 203 if ( bIsScreenSurface(pso))210 if (ppdev->psoScreenBitmap && bIsScreenSurface(pso)) 204 211 { 205 212 pso = ppdev->psoScreenBitmap; -
trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c
r4123 r4124 304 304 gflHooks = HOOK_BITBLT | HOOK_TEXTOUT | HOOK_FILLPATH | 305 305 HOOK_COPYBITS | HOOK_STROKEPATH | HOOK_LINETO | 306 #ifdef VBOX_NEW_SURFACE_CODE 307 HOOK_PAINT | HOOK_STRETCHBLT | HOOK_SYNCHRONIZE; 308 #else 306 309 HOOK_PAINT | HOOK_STRETCHBLT | HOOK_SYNCHRONIZEACCESS; 307 310 #endif 308 311 // Set up g_bOnNT40 based on the value in iEngineVersion 309 312 if(iEngineVersion >= DDI_DRIVER_VERSION_NT5) … … 553 556 \**************************************************************************/ 554 557 555 HSURF DrvEnableSurface( 556 DHPDEV dhpdev) 558 HSURF DrvEnableSurface(DHPDEV dhpdev) 557 559 { 558 560 PPDEV ppdev; … … 561 563 ULONG ulBitmapType; 562 564 FLONG flHooks; 563 565 #ifdef VBOX_NEW_SURFACE_CODE 566 PVBOXSURF psurf; 567 #endif 564 568 DISPDBG((0, "DISP DrvEnableSurface called\n")); 565 569 … … 607 611 } 608 612 613 #ifdef VBOX_NEW_SURFACE_CODE 614 psurf = (PVBOXSURF)EngAllocMem(0, sizeof(VBOXSURF), ALLOC_TAG); 615 if (psurf == NULL) 616 { 617 DISPDBG((0, "DrvEnableSurface: failed pdsurf memory allocation\n")); 618 goto l_Failure; 619 } 620 ppdev->pdsurfScreen = psurf; 621 psurf->ppdev = ppdev; 622 623 // 624 // On NT4.0 we create a GDI managed bitmap as the primay surface. But 625 // on NT5.0 we create a device managed primary. 626 // 627 // On NT4.0 we still use our driver's accleration capabilities by 628 // doing a trick with EngLockSurface on the GDI managed primary. 629 // 630 631 if(g_bOnNT40) 632 { 633 hsurf = (HSURF) EngCreateBitmap(sizl, 634 ppdev->lDeltaScreen, 635 ulBitmapType, 636 (ppdev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0, 637 (PVOID)(ppdev->pjScreen)); 638 } 639 else 640 { 641 hsurf = (HSURF)EngCreateDeviceSurface((DHSURF)psurf, sizl, 642 ulBitmapType); 643 } 644 645 if ( hsurf == 0 ) 646 { 647 DISPDBG((0, "DrvEnableSurface: failed EngCreateDeviceBitmap\n")); 648 goto l_Failure; 649 } 650 651 // 652 // On NT5.0 we call EngModifSurface to expose our device surface to 653 // GDI. We cant do this on NT4.0 hence we call EngAssociateSurface. 654 // 655 656 if(g_bOnNT40) 657 { 658 // 659 // We have to associate the surface we just created with our physical 660 // device so that GDI can get information related to the PDEV when 661 // it's drawing to the surface (such as, for example, the length of 662 // styles on the device when simulating styled lines). 663 // 664 665 // 666 // On NT4.0 we dont want to be called to Synchronize Access 667 // 668 LONG myflHooks = flHooks; 669 myflHooks &= ~HOOK_SYNCHRONIZE; 670 671 if (!EngAssociateSurface(hsurf, ppdev->hdevEng, myflHooks)) 672 { 673 DISPDBG((0, "DrvEnableSurface: failed EngAssociateSurface\n")); 674 goto l_Failure; 675 } 676 677 // 678 // Jam in the value of dhsurf into screen SURFOBJ. We do this to 679 // make sure the driver acclerates Drv calls we hook and not 680 // punt them back to GDI as the SURFOBJ's dhsurf = 0. 681 // 682 ppdev->psoScreenBitmap = EngLockSurface(hsurf); 683 if(ppdev->psoScreenBitmap == 0) 684 { 685 DISPDBG((0, "DrvEnableSurface: failed EngLockSurface\n")); 686 goto l_Failure; 687 } 688 689 ppdev->psoScreenBitmap->dhsurf = (DHSURF)hsurf; 690 691 } 692 else 693 { 694 // 695 // Tell GDI about the screen surface. This will enable GDI to render 696 // directly to the screen. 697 // 698 699 if ( !EngModifySurface(hsurf, 700 ppdev->hdevEng, 701 flHooks, 702 MS_NOTSYSTEMMEMORY, 703 (DHSURF)psurf, 704 ppdev->pjScreen, 705 ppdev->lDeltaScreen, 706 NULL)) 707 { 708 DISPDBG((0, "DrvEnableSurface: failed EngModifySurface")); 709 goto l_Failure; 710 } 711 } 712 ppdev->hsurfScreen = hsurf; 713 ppdev->flHooks = flHooks; 714 ppdev->ulBitmapType = ulBitmapType; 715 #else 609 716 hsurf = (HSURF) EngCreateBitmap(sizl, 610 717 ppdev->lDeltaScreen, … … 661 768 } 662 769 } 663 770 #endif /* VBOX_NEW_SURFACE_CODE */ 664 771 return ppdev->hsurfScreen; 665 772 … … 695 802 ppdev->hsurfScreen = (HSURF)0; 696 803 } 697 804 #ifdef VBOX_NEW_SURFACE_CODE 805 if (ppdev->pdsurfScreen) 806 { 807 EngFreeMem(ppdev->pdsurfScreen); 808 ppdev->pdsurfScreen = NULL; 809 } 810 #else 698 811 if (ppdev->hsurfScreenBitmap) 699 812 { … … 701 814 ppdev->hsurfScreenBitmap = (HSURF)0; 702 815 } 703 816 #endif 704 817 vDisableSURF(ppdev); 705 818 } … … 732 845 } 733 846 847 #ifdef VBOX_NEW_SURFACE_CODE 848 todo 849 #endif 734 850 if (pjScreen != ppdev->pjScreen) 735 851 {
Note:
See TracChangeset
for help on using the changeset viewer.