VirtualBox

Ignore:
Timestamp:
Aug 3, 2007 7:53:12 PM (17 years ago)
Author:
vboxsync
Message:

Direct draw heap and miniport heap memory reservation for Windows guest additions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c

    r3397 r4027  
    1616
    1717#ifdef DEBUG
    18 #define LOG_ENABLED
     18#define LOG_ENABLED 1
    1919#endif
    2020
     
    6565{
    6666    PPDEV pDev = (PPDEV)dhpdev;
     67    BOOL bDefineDDrawHeap = FALSE;
     68    DWORD cHeaps = 0;
     69    VIDEOMEMORY *pVm = NULL;
    6770
    6871    DISPDBG((0, "%s: %p, %p, %p, %p, %p. %p\n", __FUNCTION__, dhpdev, pHalInfo, pdwNumHeaps, pvmList, pdwNumFourCCCodes, pdwFourCC));
     
    7780    if (!(pvmList && pdwFourCC))
    7881    {
     82        memset(&pHalInfo->ddCaps, 0, sizeof(DDNTCORECAPS));
     83        pHalInfo->ddCaps.dwSize         = sizeof(DDNTCORECAPS);
     84        pHalInfo->ddCaps.dwVidMemTotal  = pDev->cScreenSize - pDev->cFrameBufferSize;
     85        pHalInfo->ddCaps.dwVidMemFree   = pHalInfo->ddCaps.dwVidMemTotal;
     86
     87        pHalInfo->ddCaps.dwCaps         = 0;
     88        pHalInfo->ddCaps.dwCaps2        = 0;
     89
     90        /* Declare we can handle textures wider than the primary */
     91        pHalInfo->ddCaps.dwCaps2 |= DDCAPS2_WIDESURFACES;
     92
     93        pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
     94       
    7995        /* Create primary surface attributes */
    8096        pHalInfo->vmiData.pvPrimary                 = pDev->pjScreen;
     
    108124        pHalInfo->vmiData.dwTextureAlign            = 4;
    109125    }
    110     memset(&pHalInfo->ddCaps, 0, sizeof(DDNTCORECAPS));
    111     pHalInfo->ddCaps.dwSize         = sizeof(DDNTCORECAPS);
    112     pHalInfo->ddCaps.dwVidMemTotal  = pDev->cScreenSize;
    113     pHalInfo->ddCaps.dwVidMemFree   = pDev->cScreenSize;
    114 
    115     pHalInfo->ddCaps.dwCaps         = 0;
    116     pHalInfo->ddCaps.dwCaps2        = 0;
    117 
    118     /* Declare we can handle textures wider than the primary */
    119     pHalInfo->ddCaps.dwCaps2 |= DDCAPS2_WIDESURFACES;
    120 
    121     pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
     126   
     127    cHeaps = 0;
     128
     129    /* Do we have sufficient videomemory to create an off-screen heap for DDraw? */
     130    if (pDev->cScreenSize > pDev->cFrameBufferSize)
     131    {
     132        bDefineDDrawHeap = TRUE;
     133        cHeaps++;
     134    }
     135
     136    pDev->cHeaps = cHeaps;
     137    *pdwNumHeaps  = cHeaps;
     138
     139    // If pvmList is not NULL then we can go ahead and fill out the VIDEOMEMORY
     140    // structures which define our requested heaps.
     141
     142    if(pvmList) {
     143
     144        pVm=pvmList;
     145
     146        //
     147        // Snag a pointer to the video-memory list so that we can use it to
     148        // call back to DirectDraw to allocate video memory:
     149        //
     150        pDev->pvmList = pVm;
     151
     152        //
     153        // Define the heap for DirectDraw
     154        //
     155        if ( bDefineDDrawHeap )
     156        {
     157            pVm->dwFlags        = VIDMEM_ISLINEAR ;
     158            pVm->fpStart        = pDev->cFrameBufferSize;
     159            pVm->fpEnd          = pDev->cScreenSize;
     160
     161            pVm->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
     162            DISPDBG((0, "fpStart %ld fpEnd %ld\n", pVm->fpStart, pVm->fpEnd));
     163
     164            pVm++;
     165        }
     166    }
    122167
    123168#if 0 /* not mandatory */
     
    172217    pCallBacks->dwFlags               = 0;
    173218
    174     /*
    175219    pCallBacks->dwFlags               = DDHAL_CB32_CREATESURFACE | DDHAL_CB32_CANCREATESURFACE;
    176220    pCallBacks->CreateSurface         = DdCreateSurface;
    177221    pCallBacks->CanCreateSurface      = DdCanCreateSurface;
    178     pCallBacks->WaitForVerticalBlank  = DdWaitForVerticalBlank;
    179     pCallBacks->GetScanLine           = DdGetScanLine;
    180     pCallBacks->MapMemory             = DdMapMemory;
    181     DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_MAPMEMORY | DDHAL_CB32_GETSCANLINE
    182     */
     222    // pCallBacks->WaitForVerticalBlank  = DdWaitForVerticalBlank;
     223    // pCallBacks->GetScanLine           = DdGetScanLine;
     224    // pCallBacks->MapMemory             = DdMapMemory;
     225    // DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_MAPMEMORY | DDHAL_CB32_GETSCANLINE
    183226    /* Note: pCallBacks->SetMode & pCallBacks->DestroyDriver are unused in Windows 2000 and up */
    184227
     
    652695    DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev));
    653696
    654     // remember setting of exclusive mode in ppdev,
     697    // remember setting of exclusive mode in pDev,
    655698    // so GDI can stop to promote DeviceBitmaps into
    656699    // video memory
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