VirtualBox

Changeset 4124 in vbox


Ignore:
Timestamp:
Aug 12, 2007 5:58:06 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
23597
Message:

new surface code (disabled by default)

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  
    7171    ULONG cbDisplayInformation;
    7272} VRAMLAYOUT;
     73
     74typedef struct
     75{
     76    PPDEV   ppdev;
     77} VBOXSURF, *PVBOXSURF;
    7378
    7479struct  _PDEV
     
    121126    VRAMLAYOUT layout;
    122127
     128    PVBOXSURF   pdsurfScreen;
     129
    123130#ifdef VBOX_WITH_DDRAW
    124131    BOOL             bDdExclusiveMode;
     
    201208        if (ppdev)
    202209        {
    203             if (bIsScreenSurface(pso))
     210            if (ppdev->psoScreenBitmap && bIsScreenSurface(pso))
    204211            {
    205212                pso = ppdev->psoScreenBitmap;
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c

    r4123 r4124  
    304304    gflHooks = HOOK_BITBLT | HOOK_TEXTOUT | HOOK_FILLPATH |
    305305               HOOK_COPYBITS | HOOK_STROKEPATH | HOOK_LINETO |
     306#ifdef VBOX_NEW_SURFACE_CODE
     307               HOOK_PAINT | HOOK_STRETCHBLT | HOOK_SYNCHRONIZE;
     308#else
    306309               HOOK_PAINT | HOOK_STRETCHBLT | HOOK_SYNCHRONIZEACCESS;
    307 
     310#endif
    308311    // Set up g_bOnNT40 based on the value in iEngineVersion
    309312    if(iEngineVersion >= DDI_DRIVER_VERSION_NT5)
     
    553556\**************************************************************************/
    554557
    555 HSURF DrvEnableSurface(
    556 DHPDEV dhpdev)
     558HSURF DrvEnableSurface(DHPDEV dhpdev)
    557559{
    558560    PPDEV ppdev;
     
    561563    ULONG ulBitmapType;
    562564    FLONG flHooks;
    563 
     565#ifdef VBOX_NEW_SURFACE_CODE
     566    PVBOXSURF psurf;
     567#endif
    564568    DISPDBG((0, "DISP DrvEnableSurface called\n"));
    565569       
     
    607611    }
    608612
     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
    609716    hsurf = (HSURF) EngCreateBitmap(sizl,
    610717                                    ppdev->lDeltaScreen,
     
    661768        }
    662769    }
    663    
     770#endif /* VBOX_NEW_SURFACE_CODE */   
    664771    return ppdev->hsurfScreen;
    665772     
     
    695802        ppdev->hsurfScreen = (HSURF)0;
    696803    }
    697    
     804#ifdef VBOX_NEW_SURFACE_CODE
     805    if (ppdev->pdsurfScreen)
     806    {
     807        EngFreeMem(ppdev->pdsurfScreen);
     808        ppdev->pdsurfScreen = NULL;
     809    }
     810#else
    698811    if (ppdev->hsurfScreenBitmap)
    699812    {
     
    701814        ppdev->hsurfScreenBitmap = (HSURF)0;
    702815    }
    703    
     816#endif   
    704817    vDisableSURF(ppdev);
    705818}
     
    732845        }
    733846
     847#ifdef VBOX_NEW_SURFACE_CODE
     848        todo
     849#endif
    734850        if (pjScreen != ppdev->pjScreen)
    735851        {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette