dd.c revision 427661c1296ebe749cfa5f4f244c3ea8752fb8af
#ifdef VBOX_WITH_DDRAW
/******************************Module*Header**********************************\
*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*
* Based in part on Microsoft DDK sample code
*
* **************************
* * DirectDraw SAMPLE CODE *
* **************************
*
* Module Name: ddenable.c
*
* Content:
*
* Copyright (c) 1994-1998 3Dlabs Inc. Ltd. All rights reserved.
* Copyright (c) 1995-1999 Microsoft Corporation. All rights reserved.
\*****************************************************************************/
#include "driver.h"
#include "dd.h"
#include <winerror.h>
#if 0
#endif
#ifdef VBOX_WITH_VIDEOHWACCEL
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);
#endif
/**
* DrvGetDirectDrawInfo
*
* The DrvGetDirectDrawInfo function returns the capabilities of the graphics hardware.
*
* Parameters:
*
* dhpdev
* Handle to the PDEV returned by the driver�s DrvEnablePDEV routine.
* pHalInfo
* Points to a DD_HALINFO structure in which the driver should return the hardware capabilities that it supports.
* pdwNumHeaps
* Points to the location in which the driver should return the number of VIDEOMEMORY structures pointed to by pvmList.
* pvmList
* 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.
* pdwNumFourCCCodes
* Points to the location in which the driver should return the number of DWORDs pointed to by pdwFourCC.
* pdwFourCC
* 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.
*
* Return Value:
*
* DrvGetDirectDrawInfo returns TRUE if it succeeds; otherwise, it returns FALSE.
*
*/
)
{
DISPDBG((0, "%s: %p, %p, %p, %p, %p. %p\n", __FUNCTION__, dhpdev, pHalInfo, pdwNumHeaps, pvmList, pdwNumFourCCCodes, pdwFourCC));
*pdwNumFourCCCodes = 0;
*pdwNumHeaps = 0;
/* Setup the HAL driver caps. */
#ifndef VBOX_WITH_VIDEOHWACCEL
#endif
{
#ifdef VBOX_WITH_VIDEOHWACCEL
vboxVHWAInit();
#else
#endif
/* Declare we can handle textures wider than the primary */
/* Create primary surface attributes */
{
DISPDBG((0, "DDPF_PALETTEINDEXED8\n"));
}
#ifdef VBOX_WITH_VIDEOHWACCEL
{
}
#endif
}
cHeaps = 0;
/* Do we have sufficient videomemory to create an off-screen heap for DDraw? */
{
cHeaps++;
}
*pdwNumHeaps = cHeaps;
// If pvmList is not NULL then we can go ahead and fill out the VIDEOMEMORY
// structures which define our requested heaps.
if(pvmList) {
//
// Snag a pointer to the video-memory list so that we can use it to
// call back to DirectDraw to allocate video memory:
//
//
// Define the heap for DirectDraw
//
if ( bDefineDDrawHeap )
{
#ifndef VBOX_WITH_VIDEOHWACCEL
#endif
pVm++;
}
}
#ifdef VBOX_WITH_VIDEOHWACCEL
{
// // TODO: filter out hw-unsupported fourccs
//#define FOURCC_YUV422 (MAKEFOURCC('Y','U','Y','2'))
//#define FOURCC_YUV411 (MAKEFOURCC('Y','4','1','1'))
//
// static DWORD fourCC[] = { FOURCC_YUV422, FOURCC_YUV411 }; // The FourCC's we support
{
if(RT_FAILURE(rc))
{
*pdwNumFourCCCodes = 0;
}
}
}
#endif
#ifdef VBOX_WITH_VIDEOHWACCEL
{
/* we need it to set DDHAL_PRIVATECAP_NOTIFYPRIMARYCREATION to make ddraw call us for primary surface creation */
/* DX5 and up */
}
#endif
#if 0
/* No 3D capabilities */
{
LPD3DHAL_GLOBALDRIVERDATA lpD3DGlobalDriverData = (LPD3DHAL_GLOBALDRIVERDATA)pHalInfo->lpD3DGlobalDriverData;
}
#endif
return TRUE;
}
/**
* DrvEnableDirectDraw
*
* The DrvEnableDirectDraw function enables hardware for DirectDraw use.
*
* Parameters
*
* dhpdev
* Handle to the PDEV returned by the driver�s DrvEnablePDEV routine.
* pCallBacks
* Points to the DD_CALLBACKS structure to be initialized by the driver.
* pSurfaceCallBacks
* Points to the DD_SURFACECALLBACKS structure to be initialized by the driver.
* pPaletteCallBacks
* Points to the DD_PALETTECALLBACKS structure to be initialized by the driver.
*
* Return Value
*
* DrvEnableDirectDraw returns TRUE if it succeeds; otherwise, it returns FALSE.
*
*/
)
{
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif
DISPDBG((0, "%s: %p, %p, %p, %p\n", __FUNCTION__, dhpdev, pCallBacks, pSurfaceCallBacks, pPaletteCallBacks));
/* Fill in the HAL Callback pointers */
pCallBacks->dwFlags = 0;
pCallBacks->dwFlags = DDHAL_CB32_CREATESURFACE | DDHAL_CB32_CANCREATESURFACE | DDHAL_CB32_MAPMEMORY;
// pCallBacks->WaitForVerticalBlank = DdWaitForVerticalBlank;
// pCallBacks->GetScanLine = DdGetScanLine;
// DDHAL_CB32_WAITFORVERTICALBLANK | DDHAL_CB32_GETSCANLINE
/* Note: pCallBacks->SetMode & pCallBacks->DestroyDriver are unused in Windows 2000 and up */
/* Fill in the Surface Callback pointers */
/*
pSurfaceCallBacks->dwFlags = DDHAL_SURFCB32_DESTROYSURFACE | DDHAL_SURFCB32_LOCK; // DDHAL_SURFCB32_UNLOCK;
pSurfaceCallBacks->DestroySurface = DdDestroySurface;
pSurfaceCallBacks->Flip = DdFlip;
pSurfaceCallBacks->GetBltStatus = DdGetBltStatus;
pSurfaceCallBacks->GetFlipStatus = DdGetFlipStatus;
pSurfaceCallBacks->Blt = DdBlt;
DDHAL_SURFCB32_FLIP | DDHAL_SURFCB32_BLT | DDHAL_SURFCB32_GETBLTSTATUS | DDHAL_SURFCB32_GETFLIPSTATUS;
*/
// pSurfaceCallBacks.SetColorKey = DdSetColorKey;
// pSurfaceCallBacks.dwFlags |= DDHAL_SURFCB32_SETCOLORKEY;
/* Fill in the Palette Callback pointers */
pPaletteCallBacks->dwFlags = 0;
#ifdef VBOX_WITH_VIDEOHWACCEL
{
//TODO: filter out those we do not need in case not supported by hw
// pSurfaceCallBacks->Lock = DdLock;
// pSurfaceCallBacks->Unlock = DdUnlock;
// | DDHAL_SURFCB32_LOCK
// | DDHAL_SURFCB32_UNLOCK
;
{
DDHAL_SURFCB32_UPDATEOVERLAY | // Now supporting
DDHAL_SURFCB32_SETOVERLAYPOSITION ; // overlays.
}
}
#endif
return TRUE;
}
/**
* DrvDisableDirectDraw
*
* The DrvDisableDirectDraw function disables hardware for DirectDraw use.
*
* Parameters
*
* dhpdev
* Handle to the PDEV returned by the driver�s DrvEnablePDEV routine.
*
*/
{
}
/**
* DdGetDriverInfo
*
* The DdGetDriverInfo function queries the driver for additional DirectDraw and Direct3D functionality that the driver supports.
*
* Parameters
* lpGetDriverInfo
* Points to a DD_GETDRIVERINFODATA structure that contains the information required to perform the query.
*
* Return Value
*
* DdGetDriverInfo must return DDHAL_DRIVER_HANDLED.
*
*/
{
/* Default to 'not supported' */
/* Fill in supported stuff */
{
DISPDBG((0, " -> GUID_D3DCallbacks3\n"));
}
else
{
DISPDBG((0, " -> GUID_D3DExtendedCaps\n"));
}
else
{
DISPDBG((0, " -> GUID_ZPixelFormats\n"));
}
else
{
DISPDBG((0, " -> GUID_D3DParseUnknownCommandCallback\n"));
}
else
{
DISPDBG((0, " -> GUID_Miscellaneous2Callbacks\n"));
}
else
{
DISPDBG((0, " -> GUID_UpdateNonLocalHeap\n"));
}
else
{
DISPDBG((0, " -> GUID_GetHeapAlignment\n"));
}
else
{
DISPDBG((0, " -> GUID_NTPrivateDriverCaps\n"));
#ifndef VBOX_WITH_VIDEOHWACCEL
DDPrivateDriverCaps.dwPrivateCaps = 0; /* DDHAL_PRIVATECAP_NOTIFYPRIMARYCREATION -> call CreateSurface for the primary surface */
#else
DDPrivateDriverCaps.dwPrivateCaps = DDHAL_PRIVATECAP_NOTIFYPRIMARYCREATION; /* -> call CreateSurface for the primary surface */
#endif
}
else
{
#ifndef VBOX_WITH_VIDEOHWACCEL
DISPDBG((0, " -> GUID_DDMoreSurfaceCaps\n"));
// fill in everything until expectedsize...
// Caps for heaps 2..n
// now fill in other heaps...
{
sizeof(DDSCAPSEX));
sizeof(DDSCAPSEX));
}
#else
DISPDBG((0, " -> GUID_DDMoreSurfaceCaps\n"));
#endif
}
else
{
DISPDBG((0, " -> GUID_DDStereoMode\n"));
}
else
{
DISPDBG((0, " -> GUID_NonLocalVidMemCaps\n"));
}
else
{
#ifndef VBOX_WITH_VIDEOHWACCEL
DISPDBG((0, " -> GUID_NTCallbacks\n"));
;
#else
DISPDBG((0, " -> GUID_NTCallbacks\n"));
#endif
}
else
{
DISPDBG((0, " -> GUID_KernelCaps\n"));
}
else
{
DISPDBG((0, " -> GUID_KernelCallbacks\n"));
}
else
{
DISPDBG((0, " -> GUID_MotionCompCallbacks\n"));
}
else
{
DISPDBG((0, " -> GUID_VideoPortCallbacks\n"));
}
else
{
DISPDBG((0, " -> GUID_ColorControlCallbacks\n"));
}
else
{
DISPDBG((0, " -> GUID_VideoPortCaps\n"));
}
else
{
DISPDBG((0, " -> GUID_D3DCallbacks2\n"));
}
else
{
DISPDBG((0, " -> GUID_D3DCallbacks3\n"));
}
/* Always return this */
return DDHAL_DRIVER_HANDLED;
}
/**
* DdCreateSurface
*
* The DdCreateSurface callback function creates a DirectDraw surface.
*
* lpCreateSurface
* Points to a DD_CREATESURFACEDATA structure that contains the information required to create a surface.
*
* Return Value
*
* DdCreateSurface returns one of the following callback codes:
* DDHAL_DRIVER_HANDLED
* DDHAL_DRIVER_NOTHANDLED
*
*/
{
#ifdef VBOX_WITH_VIDEOHWACCEL
{
{
}
else
{
{
lBpp = 4;
}
else
{
lBpp = 8;
}
else
{
}
}
#if 0
#else
#endif
#if 0
#endif
//
// Modify surface descriptions as appropriate and let Direct
// Draw perform the allocation if the surface was not the primary
//
{
DISPDBG((0, "-> primary surface\n"));
lpSurfaceGlobal->fpVidMem = 0;
}
else
{
DISPDBG((0, "-> secondary surface\n"));
}
if(pCmd)
{
int rc;
{
}
else
{
}
if(pDesc)
{
{
}
else
{
}
}
}
return DDHAL_DRIVER_NOTHANDLED;
}
#endif
lpSurfaceGlobal->dwReserved1 = 0;
{
lBpp = 4;
}
else
{
lBpp = 8;
}
else
{
}
//
// Modify surface descriptions as appropriate and let Direct
// Draw perform the allocation if the surface was not the primary
//
{
DISPDBG((0, "-> primary surface\n"));
lpSurfaceGlobal->fpVidMem = 0;
}
else
{
DISPDBG((0, "-> secondary surface\n"));
}
return DDHAL_DRIVER_NOTHANDLED;
}
/**
* DdCanCreateSurface
*
* The DdCanCreateSurface callback function indicates whether the driver can create a surface of the specified surface description.
*
*
* Parameters
* lpCanCreateSurface
* Points to the DD_CANCREATESURFACEDATA structure containing the information required for the driver to determine whether a surface can be created.
*
* Return Value
*
* DdCanCreateSurface returns one of the following callback codes:
*
* DDHAL_DRIVER_HANDLED
* DDHAL_DRIVER_NOTHANDLED
*
*/
{
#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;
{
{
}
else
{
}
}
else
{
}
}
else
{
}
return DDHAL_DRIVER_HANDLED;
}
#endif
{
DISPDBG((0, "No Z-Bufer support\n"));
return DDHAL_DRIVER_HANDLED;
}
{
DISPDBG((0, "No texture support\n"));
return DDHAL_DRIVER_HANDLED;
}
{
DISPDBG((0, "FOURCC not supported\n"));
return DDHAL_DRIVER_HANDLED;
}
return DDHAL_DRIVER_HANDLED;
}
// ***************************WIN NT ONLY**********************************
//
// DdMapMemory
//
// Maps application-modifiable portions of the frame buffer into the
// user-mode address space of the specified process, or unmaps memory.
//
// DdMapMemory is called to perform memory mapping before the first call to
// DdLock. The handle returned by the driver in fpProcess will be passed to
// every DdLock call made on the driver.
//
// DdMapMemory is also called to unmap memory after the last DdUnLock call is
// made.
//
// To prevent driver crashes, the driver must not map any portion of the frame
// buffer that must not be modified by an application.
//
// Parameters
// lpMapMemory
// Points to a DD_MAPMEMORYDATA structure that contains details for
// the memory mapping or unmapping operation.
//
// .lpDD
// Points to a DD_DIRECTDRAW_GLOBAL structure that represents
// the driver.
// .bMap
// Specifies the memory operation that the driver should perform.
// A value of TRUE indicates that the driver should map memory;
// FALSE means that the driver should unmap memory.
// .hProcess
// Specifies a handle to the process whose address space is
// affected.
// .fpProcess
// Specifies the location in which the driver should return the
// base address of the process's memory mapped space when bMap
// is TRUE. When bMap is FALSE, fpProcess contains the base
// address of the memory to be unmapped by the driver.
// .ddRVal
// Specifies the location in which the driver writes the return
// value of the DdMapMemory callback. A return code of DD_OK
// indicates success.
//
//-----------------------------------------------------------------------------
{
if (lpMapMemory->bMap)
{
// 'RequestedVirtualAddress' isn't actually used for the SHARE IOCTL:
// We map in starting at the top of the frame buffer:
ShareMemory.ViewOffset = 0;
// We map down to the end of the frame buffer, including the offscreen heap.
sizeof(VIDEO_SHARE_MEMORY),
sizeof(VIDEO_SHARE_MEMORY_INFORMATION),
{
DISPDBG((0, "Failed IOCTL_VIDEO_SHARE_MEMORY\n"));
DISPDBG((0, "DdMapMemory: Exit GEN, DDHAL_DRIVER_HANDLED\n"));
return(DDHAL_DRIVER_HANDLED);
}
}
else
{
ShareMemory.ViewOffset = 0;
ShareMemory.ViewSize = 0;
sizeof(VIDEO_SHARE_MEMORY),
NULL,
0,
{
DISPDBG((0, "Failed IOCTL_VIDEO_UNSHARE_MEMORY\n"));
}
}
return(DDHAL_DRIVER_HANDLED);
}
/**
* DdLock
*
* 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.
*
* Parameters
* lpLock
* Points to a DD_LOCKDATA structure that contains the information required to perform the lockdown.
*
* Return Value
*
* DdLock returns one of the following callback codes:
*
* DDHAL_DRIVER_HANDLED
* DDHAL_DRIVER_NOTHANDLED
*
*/
{
DISPDBG((0, "%s: %p bHasRect = %d fpProcess = %p\n", __FUNCTION__, pDev, lpLock->bHasRect, lpLock->fpProcess));
#ifdef VBOX_WITH_VIDEOHWACCEL
{
/* ensure we have host cmds processed to update pending blits and flips */
// if(VBOXDD_CHECKFLAG(lpLock, DDLOCK_DONOTWAIT))
{
{
return DDHAL_DRIVER_HANDLED;
}
}
// if(VBOXDD_CHECKFLAG(lpLock->dwFlags, DDLOCK_SURFACEMEMORYPTR))
// {
// lpLock->lpSurfData = (LPVOID)(lpSurfaceGlobal->fpVidMem + lpSurfaceGlobal->lPitch * lpLock->rArea.top
// + lpLock->rArea.left * pDesc->cBitsPerPixel/8);
// }
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));
}
else
{
}
{
/* we're not interested in completion, just send the command */
}
else
{
/* wait for the surface to be locked and memory buffer updated */
}
}
else
{
}
return DDHAL_DRIVER_NOTHANDLED;
}
#endif
{
/* The updated rectangle must be reported only for the primary surface. */
{
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));
}
else
{
}
}
else
{
}
// Because we correctly set 'fpVidMem' to be the offset into our frame
// buffer when we created the surface, DirectDraw will automatically take
// care of adding in the user-mode frame buffer address if we return
// DDHAL_DRIVER_NOTHANDLED:
return DDHAL_DRIVER_NOTHANDLED;
}
/**
* DdUnlock
*
* The DdUnLock callback function releases the lock held on the specified surface.
*
* Parameters
* lpUnlock
* Points to a DD_UNLOCKDATA structure that contains the information required to perform the lock release. *
*
* Return Value
*
* DdLock returns one of the following callback codes:
*
* DDHAL_DRIVER_HANDLED
* DDHAL_DRIVER_NOTHANDLED
*
*/
{
#ifdef VBOX_WITH_VIDEOHWACCEL
{
//TODO: hadle vrdp properly
{
}
/* ensure we have host cmds processed to update pending blits and flips */
// int rc = VERR_GENERAL_FAILURE;
if(pCmd)
{
}
else
{
}
return DDHAL_DRIVER_HANDLED;
}
#endif
{
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
{
{
}
{
}
}
#else
{
{
}
{
}
}
#endif /* VBOX_WITH_HGSMI */
}
return DDHAL_DRIVER_NOTHANDLED;
}
/**
* DdDestroySurface
*
* The DdDestroySurface callback function destroys a DirectDraw surface.
*
* Parameters
* lpDestroySurface
* Points to a DD_DESTROYSURFACEDATA structure that contains the information needed to destroy a surface.
*
* Return Value
*
* DdDestroySurface returns one of the following callback codes:
*
* DDHAL_DRIVER_HANDLED
* DDHAL_DRIVER_NOTHANDLED
*
*/
{
#ifdef VBOX_WITH_VIDEOHWACCEL
{
pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_DESTROY, sizeof(VBOXVHWACMD_SURF_DESTROY));
// int rc = VERR_GENERAL_FAILURE;
if(pCmd)
{
/* we're not interested in completion, just send the command */
}
else
{
}
}
else
#endif
return DDHAL_DRIVER_HANDLED;
}
//-----------------------------------------------------------------------------
//
// DdSetExclusiveMode
//
// This function is called by DirectDraw when we switch from the GDI surface,
// to DirectDraw exclusive mode, e.g. to run a game in fullcreen mode.
// You only need to implement this function when you are using the
// 'HeapVidMemAllocAligned' function and allocate memory for Device Bitmaps
// and DirectDraw surfaces from the same heap.
//
// We use this call to disable GDI DeviceBitMaps when we are running in
// DirectDraw exclusive mode. Otherwise a DD app gets confused if both GDI and
// DirectDraw allocate memory from the same heap.
//
// See also DdFlipToGDISurface.
//
//-----------------------------------------------------------------------------
{
// remember setting of exclusive mode in pDev,
// so GDI can stop to promote DeviceBitmaps into
// video memory
return DDHAL_DRIVER_HANDLED;
}
//-----------------------------------------------------------------------------
//
// DWORD DdFlipToGDISurface
//
// This function is called by DirectDraw when it flips to the surface on which
// GDI can write to.
//
//-----------------------------------------------------------------------------
{
//
// we return NOTHANDLED, then the ddraw runtime takes
// care that we flip back to the primary...
//
return DDHAL_DRIVER_NOTHANDLED;
}
//-----------------------------------------------------------------------------
//
// DWORD DdFreeDriverMemory
//
// This function called by DirectDraw when it's running low on memory in
// our heap. You only need to implement this function if you use the
// DirectDraw 'HeapVidMemAllocAligned' function in your driver, and you
// can boot those allocations out of memory to make room for DirectDraw.
//
//-----------------------------------------------------------------------------
{
return DDHAL_DRIVER_HANDLED;
}
#ifdef VBOX_WITH_VIDEOHWACCEL
{
pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_COLORKEY_SET, sizeof(VBOXVHWACMD_SURF_COLORKEY_SET));
// int rc = VERR_GENERAL_FAILURE;
if(pCmd)
{
}
return DDHAL_DRIVER_HANDLED;
}
{
return DDHAL_DRIVER_HANDLED;
}
{
#if DX9_DDI
{
}
else
#endif
{
VBOXVHWACMD* pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_BLT, sizeof(VBOXVHWACMD_SURF_BLT));
// int rc = VERR_GENERAL_FAILURE;
if(pCmd)
{
// if(VBOXDD_CHECKFLAG(lpBlt->dwFlags, DDBLT_ASYNC))
// {
// }
// else
// {
// vboxVHWACommandSubmit(pDev, pCmd);
// }
}
else
{
}
}
return DDHAL_DRIVER_HANDLED;
}
//DWORD APIENTRY DdDestroySurface(PDD_DESTROYSURFACEDATA lpDestroySurface)
//{
// DISPDBG((0, "%s\n", __FUNCTION__));
// lpDestroySurface->ddRVal = DD_OK;
// return DDHAL_DRIVER_HANDLED;
//}
{
/* ensure we have host cmds processed to update pending blits and flips */
// if(VBOXDD_CHECKFLAG(lpLock, DDLOCK_DONOTWAIT))
{
if(
// ASMAtomicUoReadU32(&pDesc->cPendingBltsSrc)
// || ASMAtomicUoReadU32(&pDesc->cPendingBltsDst)
// ||
{
return DDHAL_DRIVER_HANDLED;
}
}
// int rc = VERR_GENERAL_FAILURE;
if(pCmd)
{
// pBody->u.in.flags = vboxVHWAFromDDFLIPs(lpFlip->dwFlags);
}
else
{
}
return DDHAL_DRIVER_HANDLED;
}
{
{
}
else /* DDGBS_ISBLTDONE */
{
/* ensure we have host cmds processed to update pending blits and flips */
if(
// || ASMAtomicUoReadU32(&pDesc->cPendingFlipsTarg)
// || ASMAtomicUoReadU32(&pDesc->cPendingFlipsCurr)
)
{
}
else
{
}
}
return DDHAL_DRIVER_HANDLED;
}
{
/* ensure we have host cmds processed to update pending blits and flips */
if(
// ASMAtomicUoReadU32(&pDesc->cPendingBltsSrc)
// || ASMAtomicUoReadU32(&pDesc->cPendingBltsDst)
// ||
)
{
}
else
{
}
// if(lpGetFlipStatus->dwFlags == DDGFS_CANFLIP)
// {
// lpGetFlipStatus->ddRVal = DD_OK;
// }
// else
// {
// lpGetFlipStatus->ddRVal = DD_OK;
// }
return DDHAL_DRIVER_HANDLED;
}
{
{
return DDHAL_DRIVER_HANDLED;
}
pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_OVERLAY_SETPOSITION, sizeof(VBOXVHWACMD_SURF_OVERLAY_SETPOSITION));
// int rc = VERR_GENERAL_FAILURE;
if(pCmd)
{
VBOXVHWACMD_SURF_OVERLAY_SETPOSITION * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_OVERLAY_SETPOSITION);
}
return DDHAL_DRIVER_HANDLED;
}
{
{
return DDHAL_DRIVER_HANDLED;
}
pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE, sizeof(VBOXVHWACMD_SURF_OVERLAY_UPDATE));
// int rc = VERR_GENERAL_FAILURE;
if(pCmd)
{
}
return DDHAL_DRIVER_HANDLED;
}
//-----------------------------------------------------------------------------
// setupRops
//
// Build array for supported ROPS
//-----------------------------------------------------------------------------
static void
int cnt )
{
int i;
for(i=0; i<cnt; i++)
{
}
} // setupRops
//-----------------------------------------------------------------------------
//
// Function: __GetDDHALInfo
//
// Returns: void
//
// Description:
//
// Takes a pointer to a partially or fully filled in pThisDisplay and a pointer
// to an empty DDHALINFO and fills in the DDHALINFO. This eases porting to NT
// and means that caps changes are done in only one place. The pThisDisplay
// may not be fully constructed here, so you should only:
// a) Query the registry
// b) DISPDBG
// If you need to add anything to pThisDisplay for NT, you should fill it in
// during the DrvGetDirectDraw call.
//
// The problem here is when the code is run on NT. If there was any other way...
//
// The following caps have been found to cause NT to bail....
// DDCAPS_GDI, DDFXCAPS_BLTMIRRORUPDOWN, DDFXCAPS_BLTMIRRORLEFTRIGHT
//
//
//-----------------------------------------------------------------------------
//
// use bits to indicate which ROPs you support.
//
// DWORD 0, bit 0 == ROP 0
// DWORD 8, bit 31 == ROP 255
//
//static DWORD ropsAGP[DD_ROP_SPACE] = { 0 };
{
SRCCOPY >> 16
// WHITENESS >> 16,
// BLACKNESS >> 16
};
static bool
{
int i;
return false;
{
// Setup the ROPS we do.
//TODO: hardcoded for now
rops,
}
// | DDCAPS_READSCANLINE
//disabled
// pHALInfo->ddCaps.dwCaps |= DDCAPS_3D |
// DDCAPS_BLTDEPTHFILL;
//
// pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE |
// DDSCAPS_ZBUFFER |
// DDSCAPS_ALPHA;
//#if DX7_TEXMANAGEMENT
// We need to set this bit up in order to be able to do
// out own texture management
// pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_CANMANAGETEXTURE;
//#if DX8_DDI
// pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_CANMANAGERESOURCE;
//#endif
//#endif
//#if DX8_DDI
// We need to flag we can run in windowed mode, otherwise we
// might get restricted by apps to run in fullscreen only
// Also permit surfaces wider than the display buffer.
//#endif
//#if DX8_DDI
// We need to flag we support dynamic textures. That is , apps can
// lock with high frequency video memory textures without paying a
// penalty for it. Since on this sample driver we only support
// linear memory formats for textures we don't need to do anything
// else for this support. Otherwise we would have to keep two surfaces
// for textures created with the DDSCAPS2_HINTDYNAMIC hint in order
// to efficiently do the linear<->swizzled transformation or keep the
// texture permanantly in an unswizzled state.
// pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_DYNAMICTEXTURES;
#if DX9_DDI
// Notice that dynamic textures MUST be supported in order to instantiate a DX9 device
#endif // DX9_DDI
//#endif
// pHALInfo->ddCaps.dwFXCaps = 0;
// P3RX can do:
// 1. Stretching/Shrinking
// 2. YUV->RGB conversion
// 3. Mirroring in X and Y
// 4. ColorKeying from a source color and a source color space
{
// Special effects caps
//TODO: filter them out
// DDFXCAPS_BLTARITHSTRETCHY
// DDFXCAPS_BLTARITHSTRETCHYN
// DDFXCAPS_BLTMIRRORLEFTRIGHT
// DDFXCAPS_BLTMIRRORUPDOWN
// DDFXCAPS_BLTROTATION90
}
{
// Special effects caps
//TODO: filter them out
// DDFXCAPS_OVERLAYARITHSTRETCHY
// DDFXCAPS_OVERLAYARITHSTRETCHYN
// DDFXCAPS_OVERLAYMIRRORLEFTRIGHT
// DDFXCAPS_OVERLAYMIRRORUPDOWN
}
{
// Enable copy blts between Four CC formats for DShow acceleration
}
{
}
// pHALInfo->ddCaps.dwSVBCaps = DDCAPS_BLT;
// // We can do a texture from sysmem to video mem.
// pHALInfo->ddCaps.dwSVBCKeyCaps |= DDCKEYCAPS_DESTBLT |
// DDCKEYCAPS_DESTBLTCLRSPACE;
// // Fill in the sysmem->vidmem rops (only can copy);
// for( i=0;i<DD_ROP_SPACE;i++ )
// {
// pHALInfo->ddCaps.dwSVBRops[i] = rops[i];
// }
//disabled
// pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_TEXTURE;
//#if DX7_STEREO
// // Report the stereo capability back to runtime
// pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_STEREO;
// pHALInfo->ddCaps.dwSVCaps = DDSVCAPS_STEREOSEQUENTIAL;
//#endif
// Z Buffer is only 16 Bits
// pHALInfo->ddCaps.dwZBufferBitDepths = DDBD_16;
// pHALInfo->ddCaps.ddsCaps.dwCaps |= DDSCAPS_MIPMAP;
{
//#ifdef SUPPORT_VIDEOPORT
// // We support 1 video port. Must set CurrVideoPorts to 0
// // We can't do interleaved bobbing yet - maybe in the future.
// pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_VIDEOPORT |
// DDCAPS2_CANBOBNONINTERLEAVED;
//
// pHALInfo->ddCaps.dwMaxVideoPorts = 1;
// pHALInfo->ddCaps.dwCurrVideoPorts = 0;
//
//
//#endif // SUPPORT_VIDEOPORT
{
// Overlay is free to use.
// Indicates that Perm3 has no stretch ratio limitation
}
}
//#ifdef W95_DDRAW
//#ifdef USE_DD_CONTROL_COLOR
// // Enable colour control asc brightness, contrast, gamma.
// pHALInfo->ddCaps.dwCaps2 |= DDCAPS2_COLORCONTROLPRIMARY;
//#endif
//#endif
// Won't do Video-Sys mem Blits.
for( i=0;i<DD_ROP_SPACE;i++ )
{
}
// Won't do Sys-Sys mem Blits
for( i=0;i<DD_ROP_SPACE;i++ )
{
}
//
// bit depths supported for alpha and Z
//
// pHALInfo->ddCaps.dwAlphaBltConstBitDepths = DDBD_2 |
// DDBD_4 |
// DDBD_8;
//
// pHALInfo->ddCaps.dwAlphaBltPixelBitDepths = DDBD_1 |
// DDBD_8;
// pHALInfo->ddCaps.dwAlphaBltSurfaceBitDepths = DDBD_1 |
// DDBD_2 |
// DDBD_4 |
// DDBD_8;
//disabled
// // No alpha blending for overlays, so I'm not sure what these should be.
// // Because we support 32bpp overlays, it's just that you can't use the
// // alpha bits for blending. Pass.
// pHALInfo->ddCaps.dwAlphaBltConstBitDepths = DDBD_2 |
// DDBD_4 |
// DDBD_8;
//
// pHALInfo->ddCaps.dwAlphaBltPixelBitDepths = DDBD_1 |
// DDBD_8;
//
// pHALInfo->ddCaps.dwAlphaBltSurfaceBitDepths = DDBD_1 |
// DDBD_2 |
// DDBD_4 |
// DDBD_8;
//
// ROPS supported
//
for( i=0;i<DD_ROP_SPACE;i++ )
{
}
//Reenable: // For DX5 and beyond we support this new informational callback.
// pHALInfo->GetDriverInfo = DdGetDriverInfo;
// pHALInfo->dwFlags |= DDHALINFO_GETDRIVERINFOSET;
//
//#if DX8_DDI
// // Flag our support for a new class of GUIDs that may come through
// // GetDriverInfo for DX8 drivers. (This support will be compulsory)
// pHALInfo->dwFlags |= DDHALINFO_GETDRIVERINFO2;
//#endif DX8_DDI
return true;
} // getDDHALInfo
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)
{
}
#endif
#endif /* VBOX_WITH_DDRAW */