VirtualBox

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

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

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Display
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified 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
  • TabularUnified trunk/src/VBox/Additions/WINNT/Graphics/Display/debug.c

    r3389 r4027  
    1515#include "driver.h"
    1616
    17 #ifdef DEBUG
     17#ifdef LOG_ENABLED
    1818
    1919#ifdef VBOX
  • TabularUnified trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h

    r3423 r4027  
    7070    ULONG   cScreenSize;                // size of video memory, including
    7171                                        // offscreen memory.
     72    ULONG   cFrameBufferSize;           // size of screen video memory
    7273    PVOID   pOffscreenList;             // linked list of DCI offscreen surfaces.
    7374    FLONG   flRed;                      // For bitfields device, Red Mask
     
    9899    VBOXDISPLAYINFO *pInfo;
    99100    ULONG iDevice;
     101    ULONG cbDisplayInformation;
    100102#ifdef VBOX_WITH_DDRAW
    101103    BOOL             bDdExclusiveMode;
    102104    DWORD            dwNewDDSurfaceOffset;
     105    DWORD            cHeaps;
     106    VIDEOMEMORY*     pvmList;
    103107#endif
    104108};
  • TabularUnified trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c

    r3560 r4027  
    1313\**************************************************************************/
    1414#ifdef DEBUG
    15 #define LOG_ENABLED
     15#define LOG_ENABLED 1
    1616#endif
    1717
     
    10001000{
    10011001    PPDEV               pDev = (PPDEV)pDirectDraw->dhpdev;
    1002     HBITMAP             hbmDevice;
     1002//    HBITMAP             hbmDevice;
    10031003    DD_SURFACE_GLOBAL*  pSurfaceGlobal;
    1004     SIZEL               sizl;
     1004//    SIZEL               sizl;
    10051005
    10061006    DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev));
  • TabularUnified trunk/src/VBox/Additions/WINNT/Graphics/Display/screen.c

    r3380 r4027  
    6666                 DispInfo.u32DisplayInfoSize, pMemoryInformation->VideoRamLength));
    6767        ppdev->pInfo = NULL;
     68        ppdev->cbDisplayInformation = 0;
    6869        return;
    6970    }
    7071   
    7172    ppdev->iDevice = DispInfo.iDevice;
     73    ppdev->cbDisplayInformation = DispInfo.u32DisplayInfoSize;
    7274
    7375    pu8 = (uint8_t *)pMemoryInformation->VideoRamBase;
     
    195197        }
    196198
    197         ppdev->cScreenSize = videoMemoryInformation.VideoRamLength;
    198        
    199199        //
    200200        // Initialize the head of the offscreen list to NULL.
     
    246246        /* Setup the display information. */
    247247        vboxSetupDisplayInfo (ppdev, &videoMemoryInformation);
     248       
     249        ppdev->cScreenSize = videoMemoryInformation.VideoRamLength - ppdev->cbDisplayInformation;
     250        ppdev->cFrameBufferSize = videoMemoryInformation.FrameBufferLength;
    248251    }
    249252
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