dd.c revision 07707949d184b9870f60f8b8784dc17d9fbe6e4f
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync/******************************Module*Header**********************************\
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync * available from http://www.virtualbox.org. This file is free software;
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync * you can redistribute it and/or modify it under the terms of the GNU
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync * General Public License (GPL) as published by the Free Software
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5f40efb5cd27c6ff21ca70bf3271564e7e79e3a4vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
08122b11035de1e54ce1e665dff7260fc548db72vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
08122b11035de1e54ce1e665dff7260fc548db72vboxsync * additional information or have any questions.
08122b11035de1e54ce1e665dff7260fc548db72vboxsync* Based in part on Microsoft DDK sample code
08122b11035de1e54ce1e665dff7260fc548db72vboxsync* **************************
2561352ae77d8f2f825526a6cbafa34b45f16972vboxsync* * DirectDraw SAMPLE CODE *
2561352ae77d8f2f825526a6cbafa34b45f16972vboxsync* **************************
08122b11035de1e54ce1e665dff7260fc548db72vboxsync* Module Name: ddenable.c
a2c132bb887bbbff1490a680748413f8cfc9cd20vboxsync* Copyright (c) 1994-1998 3Dlabs Inc. Ltd. All rights reserved.
08122b11035de1e54ce1e665dff7260fc548db72vboxsync* Copyright (c) 1995-1999 Microsoft Corporation. All rights reserved.
08122b11035de1e54ce1e665dff7260fc548db72vboxsync\*****************************************************************************/
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsyncstatic DWORD APIENTRY DdCreateSurface(PDD_CREATESURFACEDATA lpCreateSurface);
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync#define VBOXVHWA_CAP(_pdev, _cap) ((_pdev)->vhwaInfo.caps & (_cap))
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsyncstatic bool getDDHALInfo(PPDEV pDev, DD_HALINFO* pHALInfo);
aaa80e9df329609078dea844a11f2611443b677avboxsyncstatic DECLCALLBACK(void) vboxVHWAFreeCmdCompletion(PPDEV ppdev, VBOXVHWACMD * pCmd, void * pContext);
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsyncstatic DECLCALLBACK(void) vboxVHWASurfBltCompletion(PPDEV ppdev, VBOXVHWACMD * pCmd, void * pContext);
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsyncstatic DECLCALLBACK(void) vboxVHWASurfFlipCompletion(PPDEV ppdev, VBOXVHWACMD * pCmd, void * pContext);
aaa80e9df329609078dea844a11f2611443b677avboxsync * DrvGetDirectDrawInfo
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * The DrvGetDirectDrawInfo function returns the capabilities of the graphics hardware.
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * Parameters:
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * Handle to the PDEV returned by the driver�s DrvEnablePDEV routine.
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * Points to a DD_HALINFO structure in which the driver should return the hardware capabilities that it supports.
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * pdwNumHeaps
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * Points to the location in which the driver should return the number of VIDEOMEMORY structures pointed to by pvmList.
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * Points to an array of VIDEOMEMORY structures in which the driver should return information about each display memory chunk that it controls. The driver should ignore this parameter when it is NULL.
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * pdwNumFourCCCodes
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * Points to the location in which the driver should return the number of DWORDs pointed to by pdwFourCC.
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * pdwFourCC
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * Points to an array of DWORDs in which the driver should return information about each FOURCC that it supports. The driver should ignore this parameter when it is NULL.
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * Return Value:
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync * DrvGetDirectDrawInfo returns TRUE if it succeeds; otherwise, it returns FALSE.
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync DISPDBG((0, "%s: %p, %p, %p, %p, %p. %p\n", __FUNCTION__, dhpdev, pHalInfo, pdwNumHeaps, pvmList, pdwNumFourCCCodes, pdwFourCC));
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync /* Setup the HAL driver caps. */
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync memset(&pHalInfo->ddCaps, 0, sizeof(DDNTCORECAPS));
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync pHalInfo->ddCaps.dwVidMemTotal = pDev->layout.cbDDRAWHeap;
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync pHalInfo->ddCaps.dwVidMemFree = pHalInfo->ddCaps.dwVidMemTotal;
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync /* Declare we can handle textures wider than the primary */
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync pHalInfo->ddCaps.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync /* Create primary surface attributes */
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync pHalInfo->vmiData.dwDisplayHeight = pDev->cyScreen;
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync pHalInfo->vmiData.lDisplayPitch = pDev->lDeltaScreen;
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync pHalInfo->vmiData.ddpfDisplay.dwSize = sizeof(DDPIXELFORMAT);
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync pHalInfo->vmiData.ddpfDisplay.dwRGBBitCount = pDev->ulBitCount;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DISPDBG((0, "pvPrimary %x\n", pHalInfo->vmiData.pvPrimary));
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DISPDBG((0, "fpPrimary %x\n", pHalInfo->vmiData.fpPrimary));
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DISPDBG((0, "dwDisplayWidth %d\n", pHalInfo->vmiData.dwDisplayWidth));
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DISPDBG((0, "dwDisplayHeight %d\n", pHalInfo->vmiData.dwDisplayHeight));
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DISPDBG((0, "lDisplayPitch %d\n", pHalInfo->vmiData.lDisplayPitch));
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DISPDBG((0, "dwRGBBitCount %d\n", pHalInfo->vmiData.ddpfDisplay.dwRGBBitCount));
08122b11035de1e54ce1e665dff7260fc548db72vboxsync pHalInfo->vmiData.ddpfDisplay.dwFlags |= DDPF_PALETTEINDEXED8;
7baa1c3bb51b48e79eee63a69e341442e342a18evboxsync pHalInfo->vmiData.ddpfDisplay.dwRBitMask = pDev->flRed;
7baa1c3bb51b48e79eee63a69e341442e342a18evboxsync pHalInfo->vmiData.ddpfDisplay.dwGBitMask = pDev->flGreen;
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync pHalInfo->vmiData.ddpfDisplay.dwBBitMask = pDev->flBlue;
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync pDev->vhwaInfo.bVHWAEnabled = getDDHALInfo(pDev, pHalInfo);
7baa1c3bb51b48e79eee63a69e341442e342a18evboxsync /* Do we have sufficient videomemory to create an off-screen heap for DDraw? */
08122b11035de1e54ce1e665dff7260fc548db72vboxsync // If pvmList is not NULL then we can go ahead and fill out the VIDEOMEMORY
da570ef57fe454ae2d9d5d88a7bfea214723dbb1vboxsync // structures which define our requested heaps.
08122b11035de1e54ce1e665dff7260fc548db72vboxsync // Snag a pointer to the video-memory list so that we can use it to
08122b11035de1e54ce1e665dff7260fc548db72vboxsync // call back to DirectDraw to allocate video memory:
a23d9b6011c292ab4d858fc7d83a2216843cd54evboxsync // Define the heap for DirectDraw
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync pVm->fpEnd = pDev->layout.offDDRAWHeap + pDev->layout.cbDDRAWHeap - 1; /* inclusive */
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DISPDBG((0, "fpStart %x fpEnd %x\n", pVm->fpStart, pVm->fpEnd));
8b2f1e9e24bf9cb4340412463a0e75c4e0b035a6vboxsync// // TODO: filter out hw-unsupported fourccs
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync//#define FOURCC_YUV422 (MAKEFOURCC('Y','U','Y','2'))
8b2f1e9e24bf9cb4340412463a0e75c4e0b035a6vboxsync//#define FOURCC_YUV411 (MAKEFOURCC('Y','4','1','1'))
5cb8545771849c97101a5ee9bb57d0fdac922c44vboxsync// static DWORD fourCC[] = { FOURCC_YUV422, FOURCC_YUV411 }; // The FourCC's we support
08122b11035de1e54ce1e665dff7260fc548db72vboxsync /* we need it to set DDHAL_PRIVATECAP_NOTIFYPRIMARYCREATION to make ddraw call us for primary surface creation */
08122b11035de1e54ce1e665dff7260fc548db72vboxsync /* DX5 and up */
2fd917a77df587742609eaa229c7cf4922458ae8vboxsync /* No 3D capabilities */
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync LPD3DHAL_GLOBALDRIVERDATA lpD3DGlobalDriverData = (LPD3DHAL_GLOBALDRIVERDATA)pHalInfo->lpD3DGlobalDriverData;
d6bdf8a836b8e7d95eec19c254cd39161731d48fvboxsync lpD3DGlobalDriverData->dwSize = sizeof(D3DHAL_GLOBALDRIVERDATA);
a23d9b6011c292ab4d858fc7d83a2216843cd54evboxsync * DrvEnableDirectDraw
d6bdf8a836b8e7d95eec19c254cd39161731d48fvboxsync * The DrvEnableDirectDraw function enables hardware for DirectDraw use.
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync * Parameters
5c57f3ae389a4fd2d1614c2a02a52bc7d56ee7b5vboxsync * Handle to the PDEV returned by the driver�s DrvEnablePDEV routine.
0637d4d8793a5ce81c481f2cac4a8daf0fb91683vboxsync * pCallBacks
8b2f1e9e24bf9cb4340412463a0e75c4e0b035a6vboxsync * Points to the DD_CALLBACKS structure to be initialized by the driver.
bf3b45b409e14f2fde6b2bdde95332c45fd72d46vboxsync * pSurfaceCallBacks
0637d4d8793a5ce81c481f2cac4a8daf0fb91683vboxsync * Points to the DD_SURFACECALLBACKS structure to be initialized by the driver.
3acd338a7a2154c8d73de9a2629bc7057b051334vboxsync * pPaletteCallBacks
5c57f3ae389a4fd2d1614c2a02a52bc7d56ee7b5vboxsync * Points to the DD_PALETTECALLBACKS structure to be initialized by the driver.
d6bdf8a836b8e7d95eec19c254cd39161731d48fvboxsync * Return Value
08122b11035de1e54ce1e665dff7260fc548db72vboxsync * DrvEnableDirectDraw returns TRUE if it succeeds; otherwise, it returns FALSE.
a23d9b6011c292ab4d858fc7d83a2216843cd54evboxsync DISPDBG((0, "%s: %p, %p, %p, %p\n", __FUNCTION__, dhpdev, pCallBacks, pSurfaceCallBacks, pPaletteCallBacks));
a23d9b6011c292ab4d858fc7d83a2216843cd54evboxsync /* Fill in the HAL Callback pointers */
c792fe5d6a56055c4d060db36316c4dac5311c7evboxsync pCallBacks->dwFlags = DDHAL_CB32_CREATESURFACE | DDHAL_CB32_CANCREATESURFACE | DDHAL_CB32_MAPMEMORY;
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync // pCallBacks->WaitForVerticalBlank = DdWaitForVerticalBlank;
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync // pCallBacks->GetScanLine = DdGetScanLine;
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync // DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_GETSCANLINE
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync /* Note: pCallBacks->SetMode & pCallBacks->DestroyDriver are unused in Windows 2000 and up */
c792fe5d6a56055c4d060db36316c4dac5311c7evboxsync /* Fill in the Surface Callback pointers */
c792fe5d6a56055c4d060db36316c4dac5311c7evboxsync pSurfaceCallBacks->dwSize = sizeof(DD_SURFACECALLBACKS);
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync pSurfaceCallBacks->dwFlags = DDHAL_SURFCB32_LOCK | DDHAL_SURFCB32_UNLOCK;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync pSurfaceCallBacks->dwFlags = DDHAL_SURFCB32_DESTROYSURFACE | DDHAL_SURFCB32_LOCK; // DDHAL_SURFCB32_UNLOCK;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync pSurfaceCallBacks->DestroySurface = DdDestroySurface;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync pSurfaceCallBacks->Flip = DdFlip;
5857f4e58ce2ef50d7f0c450fe4897026f9a9c3dvboxsync pSurfaceCallBacks->GetBltStatus = DdGetBltStatus;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync pSurfaceCallBacks->GetFlipStatus = DdGetFlipStatus;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync pSurfaceCallBacks->Blt = DdBlt;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DDHAL_SURFCB32_FLIP | DDHAL_SURFCB32_BLT | DDHAL_SURFCB32_GETBLTSTATUS | DDHAL_SURFCB32_GETFLIPSTATUS;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync// pSurfaceCallBacks.SetColorKey = DdSetColorKey;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync// pSurfaceCallBacks.dwFlags |= DDHAL_SURFCB32_SETCOLORKEY;
08122b11035de1e54ce1e665dff7260fc548db72vboxsync /* Fill in the Palette Callback pointers */
36a0cf44771c76b56b4a6489136e3adf0343df0bvboxsync pPaletteCallBacks->dwSize = sizeof(DD_PALETTECALLBACKS);
08122b11035de1e54ce1e665dff7260fc548db72vboxsync //TODO: filter out those we do not need in case not supported by hw
2fd917a77df587742609eaa229c7cf4922458ae8vboxsync pSurfaceCallBacks->DestroySurface = DdDestroySurface;
5c57f3ae389a4fd2d1614c2a02a52bc7d56ee7b5vboxsync// pSurfaceCallBacks->Lock = DdLock;
5c57f3ae389a4fd2d1614c2a02a52bc7d56ee7b5vboxsync// pSurfaceCallBacks->Unlock = DdUnlock;
2fd917a77df587742609eaa229c7cf4922458ae8vboxsync pSurfaceCallBacks->GetFlipStatus = DdGetFlipStatus;
d6bdf8a836b8e7d95eec19c254cd39161731d48fvboxsync pSurfaceCallBacks->dwFlags |= DDHAL_SURFCB32_DESTROYSURFACE |
3acd338a7a2154c8d73de9a2629bc7057b051334vboxsync// | DDHAL_SURFCB32_LOCK
3acd338a7a2154c8d73de9a2629bc7057b051334vboxsync// | DDHAL_SURFCB32_UNLOCK
d6bdf8a836b8e7d95eec19c254cd39161731d48fvboxsync pSurfaceCallBacks->UpdateOverlay = DdUpdateOverlay; // Now supporting overlays.
c792fe5d6a56055c4d060db36316c4dac5311c7evboxsync pSurfaceCallBacks->SetOverlayPosition = DdSetOverlayPosition;
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync * DrvDisableDirectDraw
08122b11035de1e54ce1e665dff7260fc548db72vboxsync * The DrvDisableDirectDraw function disables hardware for DirectDraw use.
0c657f93ac727a3a1644497331d86fbcbc3722aavboxsync * Parameters
5857f4e58ce2ef50d7f0c450fe4897026f9a9c3dvboxsync * Handle to the PDEV returned by the driver�s DrvEnablePDEV routine.
5857f4e58ce2ef50d7f0c450fe4897026f9a9c3dvboxsync * DdGetDriverInfo
08122b11035de1e54ce1e665dff7260fc548db72vboxsync * The DdGetDriverInfo function queries the driver for additional DirectDraw and Direct3D functionality that the driver supports.
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync * Parameters
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync * lpGetDriverInfo
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync * Points to a DD_GETDRIVERINFODATA structure that contains the information required to perform the query.
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync * Return Value
355edde34018a687b4a4d17054c378b780e3d8abvboxsync * DdGetDriverInfo must return DDHAL_DRIVER_HANDLED.
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsyncDWORD CALLBACK DdGetDriverInfo(DD_GETDRIVERINFODATA *lpData)
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync DISPDBG((0, "%s: %p\n", __FUNCTION__, lpData->dhpdev));
355edde34018a687b4a4d17054c378b780e3d8abvboxsync /* Default to 'not supported' */
08122b11035de1e54ce1e665dff7260fc548db72vboxsync /* Fill in supported stuff */
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync if (IsEqualIID(&lpData->guidInfo, &GUID_D3DCallbacks3))
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync if (IsEqualIID(&lpData->guidInfo, &GUID_D3DExtendedCaps))
08122b11035de1e54ce1e665dff7260fc548db72vboxsync if (IsEqualIID(&lpData->guidInfo, &GUID_ZPixelFormats))
2fd917a77df587742609eaa229c7cf4922458ae8vboxsync if (IsEqualIID(&(lpData->guidInfo), &GUID_D3DParseUnknownCommandCallback))
2fd917a77df587742609eaa229c7cf4922458ae8vboxsync DISPDBG((0, " -> GUID_D3DParseUnknownCommandCallback\n"));
08122b11035de1e54ce1e665dff7260fc548db72vboxsync if (IsEqualIID(&(lpData->guidInfo), &GUID_Miscellaneous2Callbacks))
d6bdf8a836b8e7d95eec19c254cd39161731d48fvboxsync DISPDBG((0, " -> GUID_Miscellaneous2Callbacks\n"));
c2e62d39261f9f69ab4e14b2bbd986bf1b1faaf9vboxsync if (IsEqualIID(&(lpData->guidInfo), &GUID_UpdateNonLocalHeap))
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync if (IsEqualIID(&(lpData->guidInfo), &GUID_GetHeapAlignment))
08122b11035de1e54ce1e665dff7260fc548db72vboxsync if (IsEqualIID(&(lpData->guidInfo), &GUID_NTPrivateDriverCaps))
08122b11035de1e54ce1e665dff7260fc548db72vboxsync memset(&DDPrivateDriverCaps, 0, sizeof(DDPrivateDriverCaps));
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DDPrivateDriverCaps.dwSize=sizeof(DDPrivateDriverCaps);
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DDPrivateDriverCaps.dwPrivateCaps = 0; /* DDHAL_PRIVATECAP_NOTIFYPRIMARYCREATION -> call CreateSurface for the primary surface */
08122b11035de1e54ce1e665dff7260fc548db72vboxsync DDPrivateDriverCaps.dwPrivateCaps = DDHAL_PRIVATECAP_NOTIFYPRIMARYCREATION; /* -> call CreateSurface for the primary surface */
760ec8be64fa28d2bc7f493d707385c757a12e8evboxsync dwSize = min(sizeof(DDPrivateDriverCaps),lpData->dwExpectedSize);
760ec8be64fa28d2bc7f493d707385c757a12e8evboxsync memcpy(lpData->lpvData, &DDPrivateDriverCaps, dwSize);
0c657f93ac727a3a1644497331d86fbcbc3722aavboxsync if (IsEqualIID(&(lpData->guidInfo), &GUID_DDMoreSurfaceCaps))
08122b11035de1e54ce1e665dff7260fc548db72vboxsync // fill in everything until expectedsize...
08122b11035de1e54ce1e665dff7260fc548db72vboxsync memset(&DDMoreSurfaceCaps, 0, sizeof(DDMoreSurfaceCaps));
b24a4c8472377f462bad08867b6203fe8bbe9663vboxsync // Caps for heaps 2..n
08122b11035de1e54ce1e665dff7260fc548db72vboxsync dwSize = min(sizeof(DDMoreSurfaceCaps),lpData->dwExpectedSize);
08122b11035de1e54ce1e665dff7260fc548db72vboxsync memcpy(lpData->lpvData, &DDMoreSurfaceCaps, dwSize);
08122b11035de1e54ce1e665dff7260fc548db72vboxsync // now fill in other heaps...
1a9a9af4ac32622963b734736acbe9c79411f138vboxsync if (IsEqualIID(&(lpData->guidInfo), &GUID_DDStereoMode))
d6bdf8a836b8e7d95eec19c254cd39161731d48fvboxsync if (IsEqualIID(&(lpData->guidInfo), &GUID_NonLocalVidMemCaps))
c792fe5d6a56055c4d060db36316c4dac5311c7evboxsync if (IsEqualIID(&lpData->guidInfo, &GUID_NTCallbacks))
return DDHAL_DRIVER_HANDLED;
* Points to a DD_CREATESURFACEDATA structure that contains the information required to create a surface.
#ifdef VBOX_WITH_VIDEOHWACCEL
if(pCmd)
int rc;
if(pDesc)
return DDHAL_DRIVER_NOTHANDLED;
return DDHAL_DRIVER_NOTHANDLED;
* The DdCanCreateSurface callback function indicates whether the driver can create a surface of the specified surface description.
* Points to the DD_CANCREATESURFACEDATA structure containing the information required for the driver to determine whether a surface can be created.
#ifdef VBOX_WITH_VIDEOHWACCEL
if(unsupportedSCaps)
return DDHAL_DRIVER_HANDLED;
if(unsupportedSCaps)
return DDHAL_DRIVER_HANDLED;
pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_CANCREATE, sizeof(VBOXVHWACMD_SURF_CANCREATE));
if(pCmd)
int rc;
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
sizeof(VIDEO_SHARE_MEMORY),
sizeof(VIDEO_SHARE_MEMORY_INFORMATION),
return(DDHAL_DRIVER_HANDLED);
sizeof(VIDEO_SHARE_MEMORY),
NULL,
return(DDHAL_DRIVER_HANDLED);
* The DdLock callback function locks a specified area of surface memory and provides a valid pointer to a block of memory associated with a surface.
DISPDBG((0, "%s: %p bHasRect = %d fpProcess = %p\n", __FUNCTION__, pDev, lpLock->bHasRect, lpLock->fpProcess));
#ifdef VBOX_WITH_VIDEOHWACCEL
return DDHAL_DRIVER_HANDLED;
// lpLock->lpSurfData = (LPVOID)(lpSurfaceGlobal->fpVidMem + lpSurfaceGlobal->lPitch * lpLock->rArea.top
if(pCmd)
DISPDBG((0, "%d,%d %dx%d\n", lpLock->rArea.left, lpLock->rArea.top, lpLock->rArea.right - lpLock->rArea.left, lpLock->rArea.bottom - lpLock->rArea.top));
return DDHAL_DRIVER_NOTHANDLED;
DISPDBG((0, "%d,%d %dx%d\n", lpLock->rArea.left, lpLock->rArea.top, lpLock->rArea.right - lpLock->rArea.left, lpLock->rArea.bottom - lpLock->rArea.top));
return DDHAL_DRIVER_NOTHANDLED;
* Points to a DD_UNLOCKDATA structure that contains the information required to perform the lock release. *
#ifdef VBOX_WITH_VIDEOHWACCEL
if(pCmd)
return DDHAL_DRIVER_NOTHANDLED;
DISPDBG((0, "%d,%d %dx%d\n", pDev->ddLock.rArea.left, pDev->ddLock.rArea.top, pDev->ddLock.rArea.right - pDev->ddLock.rArea.left, pDev->ddLock.rArea.bottom - pDev->ddLock.rArea.top));
#ifndef VBOX_WITH_HGSMI
return DDHAL_DRIVER_NOTHANDLED;
* Points to a DD_DESTROYSURFACEDATA structure that contains the information needed to destroy a surface.
#ifdef VBOX_WITH_VIDEOHWACCEL
pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_DESTROY, sizeof(VBOXVHWACMD_SURF_DESTROY));
if(pCmd)
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_NOTHANDLED;
return DDHAL_DRIVER_HANDLED;
#ifdef VBOX_WITH_VIDEOHWACCEL
pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_COLORKEY_SET, sizeof(VBOXVHWACMD_SURF_COLORKEY_SET));
if(pCmd)
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
#if DX9_DDI
VBOXVHWACMD* pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_BLT, sizeof(VBOXVHWACMD_SURF_BLT));
if(pCmd)
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
if(pCmd)
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
return DDHAL_DRIVER_HANDLED;
pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION, sizeof(VBOXVHWACMD_SURF_OVERLAY_SETPOSITION));
if(pCmd)
VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION);
return DDHAL_DRIVER_HANDLED;
pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE, sizeof(VBOXVHWACMD_SURF_OVERLAY_UPDATE));
if(pCmd)
return DDHAL_DRIVER_HANDLED;
int cnt )
for(i=0; i<cnt; i++)
rops,
#if DX9_DDI
// 1. Stretching/Shrinking
for( i=0;i<DD_ROP_SPACE;i++ )
for( i=0;i<DD_ROP_SPACE;i++ )
for( i=0;i<DD_ROP_SPACE;i++ )
static DECLCALLBACK(void) vboxVHWAFreeCmdCompletion(PPDEV ppdev, VBOXVHWACMD * pCmd, void * pContext)
static DECLCALLBACK(void) vboxVHWASurfBltCompletion(PPDEV ppdev, VBOXVHWACMD * pCmd, void * pContext)
static DECLCALLBACK(void) vboxVHWASurfFlipCompletion(PPDEV ppdev, VBOXVHWACMD * pCmd, void * pContext)