VirtualBox

Changeset 4265 in vbox


Ignore:
Timestamp:
Aug 21, 2007 3:44:41 PM (17 years ago)
Author:
vboxsync
Message:

Implemented DrvDeriveSurface in the Windows guest diplay driver.

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

Legend:

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

    r4061 r4265  
    153153            pVm->dwFlags        = VIDMEM_ISLINEAR ;
    154154            pVm->fpStart        = pDev->layout.offDDRAWHeap;
    155             pVm->fpEnd          = pDev->layout.offDDRAWHeap + pDev->layout.cbDDRAWHeap;
     155            pVm->fpEnd          = pDev->layout.offDDRAWHeap + pDev->layout.cbDDRAWHeap - 1; /* inclusive */
    156156
    157157            pVm->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
    158             DISPDBG((0, "fpStart %ld fpEnd %ld\n", pVm->fpStart, pVm->fpEnd));
     158            DISPDBG((0, "fpStart %x fpEnd %x\n", pVm->fpStart, pVm->fpEnd));
    159159
    160160            pVm++;
     
    508508    DISPDBG((0, "BPP %d lPitch=%d\n", lBpp, lPitch));
    509509
    510     lpSurfaceGlobal->dwBlockSizeX   = lPitch * lpSurfaceGlobal->wHeight;
    511     lpSurfaceGlobal->dwBlockSizeY   = 1;
     510    lpSurfaceGlobal->dwBlockSizeX   = lPitch;
     511    lpSurfaceGlobal->dwBlockSizeY   = lpSurfaceGlobal->wHeight;
    512512    lpSurfaceGlobal->lPitch         = lPitch;
    513513
     
    524524    {
    525525        DISPDBG((0, "-> secondary surface\n"));
    526         lpSurfaceGlobal->dwUserMemSize  = lPitch * (DWORD)(lpSurfaceGlobal->wHeight);
    527526        lpSurfaceGlobal->fpVidMem       = DDHAL_PLEASEALLOC_BLOCKSIZE;
    528527    }
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h

    r4181 r4265  
    208208        if (ppdev)
    209209        {
    210             if (ppdev->psoScreenBitmap && bIsScreenSurface(pso))
     210            if (ppdev->psoScreenBitmap && pso->hsurf == ppdev->hsurfScreen)
    211211            {
     212                /* Convert the device PSO to the bitmap PSO which can be passed to Eng*. */
    212213                pso = ppdev->psoScreenBitmap;
    213214            }
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/drv.c

    r4181 r4265  
    8383    {
    8484        PPDEV ppdev = (PPDEV)pso->dhpdev;
    85         return (ppdev && pso->hsurf == ppdev->hsurfScreen);
     85       
     86        /* The screen surface has the 'pso->dhpdev' field,
     87         * and is either the screen device surface with handle = hsurfScreen,
     88         * or a surface derived from DDRAW with address equal to the framebuffer.
     89         */
     90        if (   ppdev
     91            && (   pso->hsurf == ppdev->hsurfScreen
     92                || pso->pvBits == ppdev->pjScreen
     93               )
     94           )
     95        {
     96            return TRUE;
     97        }
    8698    }
    8799
  • trunk/src/VBox/Additions/WINNT/Graphics/Display/enable.c

    r4262 r4265  
    3030    {   INDEX_DrvOffset,                (PFN) DrvOffset             },  //  6
    3131    {   INDEX_DrvDisableDriver,         (PFN) DrvDisableDriver      },  //  8
    32     {   INDEX_DrvCreateDeviceBitmap,    (PFN) DrvCreateDeviceBitmap },  // 10
    33     {   INDEX_DrvDeleteDeviceBitmap,    (PFN) DrvDeleteDeviceBitmap },  // 11
     32//    {   INDEX_DrvCreateDeviceBitmap,    (PFN) DrvCreateDeviceBitmap },  // 10
     33//    {   INDEX_DrvDeleteDeviceBitmap,    (PFN) DrvDeleteDeviceBitmap },  // 11
    3434    {   INDEX_DrvRealizeBrush,          (PFN) DrvRealizeBrush       },  // 12
    3535    {   INDEX_DrvDitherColor,           (PFN) DrvDitherColor        },  // 13
     
    5353    {   INDEX_DrvEnableDirectDraw,      (PFN) DrvEnableDirectDraw   },  // 60 0x3c
    5454    {   INDEX_DrvDisableDirectDraw,     (PFN) DrvDisableDirectDraw  },  // 61 0x3d
     55    {   INDEX_DrvDeriveSurface,         (PFN) DrvDeriveSurface      },  // 85 0x55
    5556#endif
    5657};
     
    248249    {   INDEX_DrvAssertMode,            (PFN) DrvAssertMode         },  //  5 0x5
    249250    {   INDEX_DrvDisableDriver,         (PFN) DrvDisableDriver      },  //  8 0x8
    250     {   INDEX_DrvCreateDeviceBitmap,    (PFN) DrvCreateDeviceBitmap },  // 10
    251     {   INDEX_DrvDeleteDeviceBitmap,    (PFN) DrvDeleteDeviceBitmap },  // 11
     251//    {   INDEX_DrvCreateDeviceBitmap,    (PFN) DrvCreateDeviceBitmap },  // 10
     252//    {   INDEX_DrvDeleteDeviceBitmap,    (PFN) DrvDeleteDeviceBitmap },  // 11
    252253    {   INDEX_DrvRealizeBrush,          (PFN) DrvRealizeBrush       },  // 12 0xc
    253254    {   INDEX_DrvDitherColor,           (PFN) DrvDitherColor        },  // 13 0xd
     
    271272    {   INDEX_DrvEnableDirectDraw,      (PFN) DrvEnableDirectDraw   },  // 60 0x3c
    272273    {   INDEX_DrvDisableDirectDraw,     (PFN) DrvDisableDirectDraw  },  // 61 0x3d
    273     /** @todo */
    274 ////    {   INDEX_DrvDeriveSurface,         (PFN) DrvDeriveSurface      },  // 85
     274    {   INDEX_DrvDeriveSurface,         (PFN) DrvDeriveSurface      },  // 85 0x55
    275275#endif
    276276    {   INDEX_DrvNotify,                (PFN) DrvNotify             },  // 87 0x57
     
    482482    memcpy(pGdiInfo, &GdiInfo, min(cjGdiInfo, sizeof(GDIINFO)));
    483483
    484     DISPDBG((0, "VBoxDisp::DrvEnablePDEV completed\n"));
     484    DISPDBG((0, "VBoxDisp::DrvEnablePDEV completed %x\n", ppdev));
    485485   
    486486    return((DHPDEV) ppdev);
     
    501501VOID DrvCompletePDEV(DHPDEV dhpdev, HDEV hdev)
    502502{
    503     DISPDBG((0, "VBoxDisp::DrvCompletePDEV called\n"));
     503    DISPDBG((0, "VBoxDisp::DrvCompletePDEV called %x\n", dhpdev));
    504504    ((PPDEV) dhpdev)->hdevEng = hdev;
    505505}
     
    515515VOID DrvDisablePDEV(DHPDEV dhpdev)
    516516{
    517     DISPDBG((0, "VBoxDisp::DrvDisablePDEV called\n"));
     517    DISPDBG((0, "VBoxDisp::DrvDisablePDEV called %x\n", dhpdev));
    518518//    vStopNotificationThread ((PPDEV) dhpdev);
    519519    vDisablePalette((PPDEV) dhpdev);
     
    934934}
    935935
     936#if 0
    936937/******************************Public*Routine**********************************\
    937938 * HBITMAP DrvCreateDeviceBitmap
     
    971972    DISPDBG((0, "DISP DrvDeleteDeviceBitmap %x", dhsurf));
    972973}
     974#endif /* 0 */
    973975
    974976/******************************Public*Routine******************************\
     
    11751177    if (pSurface->ddsCaps.dwCaps & DDSCAPS_NONLOCALVIDMEM)
    11761178    {
    1177         DISPDBG((0, "DrvDeriveSurface return NULL, surface in AGP memory"));
     1179        DISPDBG((0, "DrvDeriveSurface return NULL, surface in AGP memory\n"));
    11781180        return 0;
    11791181    }
     
    11831185    if (pSurface->lpSurfMore->ddsCapsEx.dwCaps2 & DDSCAPS2_TEXTUREMANAGE)
    11841186    {
    1185         DISPDBG((0, "DrvDeriveSurface return NULL, surface is managed"));
     1187        DISPDBG((0, "DrvDeriveSurface return NULL, surface is managed\n"));
    11861188        return 0;
    11871189    }
     
    12291231        }
    12301232
     1233        /* Create a bitmap that represents the DDRAW bits.
     1234         * Important is to calculate the address of the bitmap.
     1235         */
    12311236        hbmDevice = EngCreateBitmap(sizel,
    1232                                     pDev->lDeltaScreen,
     1237                                    pSurfaceGlobal->lPitch,
    12331238                                    ulBitmapType,
    12341239                                    (pDev->lDeltaScreen > 0) ? BMF_TOPDOWN : 0,
    1235                                     (PVOID) (pDev->pjScreen));
     1240                                    (PVOID) (pDev->pjScreen + pSurfaceGlobal->fpVidMem));
    12361241        if (hbmDevice)
    12371242        {
    1238             VOID* pvScan0 = pDev->pjScreen + pSurfaceGlobal->fpVidMem;
    1239 
    1240             //
    1241             // Note that HOOK_SYNCHRONIZE must always be hooked when we
    1242             // give GDI a pointer to the bitmap bits. We don't need to
    1243             // do it here since HOOK_SYNCHRONIZE is always set in our
    1244             // pdev->flHooks
    1245             //
    1246             ULONG   flags = MS_NOTSYSTEMMEMORY;
    1247 
    1248             if ( EngModifySurface((HSURF)hbmDevice,
    1249                                   pDev->hdevEng,
    1250                                   pDev->flHooks,
    1251                                   flags,
    1252                                   (DHSURF)hbmDevice,
    1253                                   pvScan0,
    1254                                   pSurfaceGlobal->lPitch,
    1255                                   NULL) )
    1256             {
    1257                 SURFOBJ*    surfobj = EngLockSurface((HSURF) hbmDevice);
    1258                 AssertMsg(surfobj->iType == STYPE_BITMAP, ("expected STYPE_BITMAP"));
    1259                 surfobj->iType = STYPE_DEVBITMAP;
    1260                 EngUnlockSurface(surfobj);
    1261 
    1262                 DISPDBG((0, "DrvDeriveSurface return succeed\n"));
     1243            if (pSurfaceGlobal->fpVidMem == 0)
     1244            {
     1245                /* Screen surface, mark it so it will be recognized by the driver.
     1246                 * and so the driver will be called on any operations on the surface
     1247                 * (required for VBVA and VRDP).
     1248                 */
     1249                if (EngAssociateSurface((HSURF)hbmDevice, pDev->hdevEng, flHooks))
     1250                {
     1251                    SURFOBJ *surfobj = EngLockSurface ((HSURF)hbmDevice);
     1252                    DISPDBG((0, "DrvDeriveSurface surfobj %x, hsurf = %x\n", surfobj, surfobj->hsurf));
     1253               
     1254                    surfobj->dhpdev = (DHPDEV)pDev;
     1255               
     1256                    EngUnlockSurface(surfobj);
     1257
     1258                    DISPDBG((0, "DrvDeriveSurface return succeed %x at %x\n", hbmDevice, pSurfaceGlobal->fpVidMem));
     1259                    return(hbmDevice);
     1260                }
     1261            }
     1262            else
     1263            {
     1264                DISPDBG((0, "DrvDeriveSurface return succeed %x at %x\n", hbmDevice, pSurfaceGlobal->fpVidMem));
    12631265                return(hbmDevice);
    12641266            }
    12651267
    1266             DISPDBG((0, "DrvDeriveSurface: EngModifySurface failed\n"));
     1268            DISPDBG((0, "DrvDeriveSurface: EngAssociateSurface failed\n"));
    12671269            EngDeleteSurface((HSURF)hbmDevice);
    12681270        }
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