VBoxDispD3D.cpp revision c865ce0230a2fe5a804d1f71e4bdf9b38f669d42
/* $Id$ */
/** @file
* VBoxVideo Display D3D User mode dll
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* 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.
*/
#define INITGUID
#include <iprt/initterm.h>
#include <VBox/VBoxGuestLib.h>
#include "VBoxDispD3DCmn.h"
#include "VBoxDispD3D.h"
#include "VBoxScreen.h"
#include <VBox/VBoxCrHgsmi.h>
#include <Psapi.h>
#ifdef VBOX_WDDMDISP_WITH_PROFILE
volatile uint32_t g_u32VBoxDispProfileFunctionLoggerIndex = 0;
struct VBOXDISPPROFILE_GLOBAL {
/* uncomment to enable particular logging */
/* allows dumping fps + how much time is spent in ddi functions in comparison with the rest time */
//# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_ENABLE
/* allows dumping time spent in each function and the number of calls made for any given function */
extern volatile uint32_t g_u322VBoxDispProfileFunctionLoggerIndex = 0;
//static VBoxDispProfileSet g_VBoxDispProfileDDI("D3D_DDI");
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE(_pObj) VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE((_pObj)->ProfileDdiFunc)
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DUMP(_pObj) do {\
} while (0)
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_RESET(_pObj) do {\
} while (0)
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DISABLE_CURRENT() do {\
} while (0)
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_LOG_AND_DISABLE_CURRENT() VBOXDISPPROFILE_FUNCTION_LOGGER_LOG_AND_DISABLE_CURRENT()
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_REPORT_FRAME(_pObj) do { \
} \
} while (0)
# else
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE(_pObj) do {} while(0)
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DUMP(_pObj) do {} while(0)
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_RESET(_pObj) do {} while(0)
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DISABLE_CURRENT() do {} while (0)
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_LOG_AND_DISABLE_CURRENT() do {} while (0)
# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_REPORT_FRAME(_pDev) do {} while (0)
# endif
//static VBoxDispProfileFpsCounter g_VBoxDispFpsDDI(64);
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj) VBOXDISPPROFILE_STATISTIC_LOGGER_DEFINE(&(_pObj)->ProfileDdiFps)
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DISABLE_CURRENT() do {\
} while (0)
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DUMP(_pObj) do { \
} while (0)
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_REPORT_FRAME(_pObj) do { \
{ \
} \
} while (0)
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_LOG_AND_DISABLE_CURRENT() VBOXDISPPROFILE_STATISTIC_LOGGER_LOG_AND_DISABLE_CURRENT()
# else
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj) do {} while(0)
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DISABLE_CURRENT() do {} while (0)
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_LOG_AND_DISABLE_CURRENT() do {} while (0)
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_REPORT_FRAME(_pDev) do {} while (0)
# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DUMP(_pObj) do {} while (0)
# endif
# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE(_pObj) \
# define VBOXDISPPROFILE_DDI_LOG_AND_DISABLE_CURRENT() \
# define VBOXDISPPROFILE_DDI_REPORT_FRAME(_pDev) do {\
} while (0)
# define VBOXDISPPROFILE_DDI_REPORT_FLUSH(_pDev) do {\
} while (0)
} while (0)
# define VBOXDISPPROFILE_DDI_TERM_CMN(_pObj) do { \
} while (0)
# define VBOXDISPPROFILE_DDI_TERM(_pObj) do {\
} while (0)
# define VBOXDISPPROFILE_DDI_INIT_GLBL() VBOXDISPPROFILE_DDI_INIT_CMN(&g_VBoxDispProfile, "DDI_Adp", 64)
#else
# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE(_pObj) do {} while (0)
# define VBOXDISPPROFILE_DDI_REPORT_FRAME(_pDev) do {} while (0)
# define VBOXDISPPROFILE_DDI_REPORT_FLUSH(_pDev) do {} while (0)
# define VBOXDISPPROFILE_DDI_INIT_GLBL() do {} while (0)
# define VBOXDISPPROFILE_DDI_INIT_ADP(_pAdp) do {} while (0)
# define VBOXDISPPROFILE_DDI_INIT_DEV(_pDev) do {} while (0)
# define VBOXDISPPROFILE_DDI_TERM(_pObj) do {} while (0)
# define VBOXDISPPROFILE_DDI_PRINT(_m) do {} while (0)
#endif
* NOP in release */
#define VBOXDISP_DDI_PROLOGUE_CMN() \
VBOXVDBG_BREAK_DDI(); \
#define VBOXDISP_DDI_PROLOGUE_DEV(_hDevice) \
#define VBOXDISP_DDI_PROLOGUE_ADP(_hAdapter) \
#define VBOXDISP_DDI_PROLOGUE_GLBL() \
#ifdef VBOXDISPMP_TEST
#endif
#define VBOXDISP_WITH_WINE_BB_WORKAROUND
//#define VBOXWDDMOVERLAY_TEST
static D3DDDIQUERYTYPE gVBoxQueryTypes[] = {
// D3DDDIQUERYTYPE_OCCLUSION
};
static CRITICAL_SECTION g_VBoxCritSect;
void vboxDispLock()
{
}
void vboxDispUnlock()
{
}
void vboxDispLockInit()
{
}
#define VBOXDISPCRHGSMI_SCOPE_SET_DEV(_pDev) do {} while(0)
#define VBOXDISPCRHGSMI_SCOPE_SET_GLOBAL() do {} while(0)
typedef struct VBOXWDDMDISP_NSCADD
{
{
{
if (pAlloc->fDirtyWrite)
--pData->cAllocationList;
++pData->cAllocations;
++pData->pAllocationList;
}
else
return hr;
}
static BOOLEAN vboxWddmDalCheckRemove(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc)
{
{
}
return fRemoved;
}
{
do
{
if (bReinitRenderData)
{
NscAdd.cAllocations = 0;
return E_FAIL;
}
PVBOXWDDMDISP_ALLOCATION pAlloc = RTListGetFirst(&pDevice->DirtyAllocList, VBOXWDDMDISP_ALLOCATION, DirtyAllocListEntry);
if (pAlloc)
{
{
continue;
}
}
else
{
if (!NscAdd.cAllocations)
break;
}
D3DDDICB_RENDER RenderData = {0};
RenderData.CommandLength = pDevice->DefaultContext.ContextInfo.CommandBufferSize - NscAdd.cbCommandBuffer;
RenderData.CommandOffset = 0;
RenderData.NumAllocations = pDevice->DefaultContext.ContextInfo.AllocationListSize - NscAdd.cAllocationList;
RenderData.NumPatchLocations = pDevice->DefaultContext.ContextInfo.PatchLocationListSize - NscAdd.cPatchLocationList;
// RenderData.NewCommandBufferSize = sizeof (VBOXVDMACMD) + 4 * (100);
// RenderData.NewAllocationListSize = 100;
// RenderData.NewPatchLocationListSize = 100;
{
}
else
break;
} while (1);
return S_OK;
}
//#define VBOX_WDDM_SHRC_WO_NOTIFY
static BOOLEAN vboxWddmDalCheckAdd(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOLEAN fWrite)
{
#ifdef VBOX_WDDM_SHRC_WO_NOTIFY
|| !fWrite /* only write op matter */
#endif
)
{
#ifdef VBOX_WDDM_SHRC_WO_NOTIFY
Assert(!pAlloc->DirtyAllocListEntry.pNext || (!fWrite && pAlloc->hSharedHandle && pAlloc->fDirtyWrite));
#else
#endif
return FALSE;
}
{
}
return TRUE;
}
static DECLINLINE(BOOLEAN) vboxWddmDalCheckAddRc(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_RESOURCE pRc, BOOLEAN fWrite)
{
{
}
return fChanged;
}
{
{
{
}
}
{
if (!pDevice->aSamplerTextures[i]) continue;
++iSampler;
}
}
#ifdef VBOX_WITH_VIDEOHWACCEL
{
{
return true;
}
return false;
}
{
{
)
return true;
}
return false;
}
#endif
{
}
{
PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)RTMemAllocZ(RT_OFFSETOF(VBOXWDDMDISP_RESOURCE, aAllocations[cAllocs]));
if (pRc)
{
{
}
return pRc;
}
return NULL;
}
static void vboxWddmLockUnlockMemSynch(PVBOXWDDMDISP_ALLOCATION pAlloc, D3DLOCKED_RECT *pLockInfo, RECT *pRect, bool bToLockInfo)
{
if (!pRect)
{
{
if (bToLockInfo)
else
}
else
{
if (bToLockInfo)
{
}
else
{
}
{
}
}
}
else
{
uint32_t offAllocMemStart = vboxWddmCalcOffXYrd(pRect->left, pRect->top, pAlloc->SurfDesc.pitch, pAlloc->SurfDesc.format);
if (bToLockInfo)
{
}
else
{
}
{
uint32_t cbSize = vboxWddmCalcSize(pAlloc->SurfDesc.pitch, pRect->bottom - pRect->top, pAlloc->SurfDesc.format);
}
else
{
{
}
}
}
}
{
{
{
break;
}
{
break;
}
{
break;
}
{
break;
}
{
break;
}
default:
Assert(0);
break;
}
return hr;
}
{
{
{
break;
}
{
break;
}
{
break;
}
{
break;
}
{
break;
}
default:
Assert(0);
break;
}
return hr;
}
{
{
return S_OK;
}
{
{
return hr;
}
}
return S_OK;
}
#ifdef VBOXWDDMDISP_DEBUG
{
int iRc = 0;
{
}
else
{
if (1)
{
}
else
{
}
{
}
}
}
{
{
return;
}
{
{
return;
}
}
}
#endif
{
/* @todo: check they are all equal */
}
{
/* @todo: check they are all equal */
return (D3DMULTISAMPLE_TYPE)enmType;
}
{
/* @todo: check they are all equal */
switch (enmPool)
{
case D3DDDIPOOL_SYSTEMMEM:
return D3DPOOL_SYSTEMMEM;
case D3DDDIPOOL_VIDEOMEMORY:
case D3DDDIPOOL_LOCALVIDMEM:
/* @todo: what would be proper here? */
return D3DPOOL_DEFAULT;
default:
Assert(0);
}
return D3DPOOL_DEFAULT;
}
{
/* @todo: @fixme: not entirely correct, need to check */
return (D3DRENDERSTATETYPE)enmType;
}
{
static const VBOXWDDMDISP_TSS_LOOKUP lookup[] =
{
};
}
{
if (fFlags.AutogenMipmap)
fUsage |= D3DUSAGE_DMAP;
if (fFlags.RenderTarget)
//below are wddm 1.1-specific
// if (fFlags.RestrictedContent)
// fUsage |= D3DUSAGE_RESTRICTED_CONTENT;
// if (fFlags.RestrictSharedAccess)
// fUsage |= D3DUSAGE_RESTRICT_SHARED_RESOURCE;
return fUsage;
}
{
if (fLockFlags.Discard)
if (fLockFlags.NoOverwrite)
if (fLockFlags.ReadOnly)
if (fLockFlags.DoNotWait)
return fFlags;
}
{
{
/* no flags other than [Begin|Continue|End]PresentToDwm are set */
return D3DTEXF_POINT;
}
{
/* no flags other than [Begin|Continue|End]PresentToDwm are set */
return D3DTEXF_LINEAR;
}
/* no flags other than [Begin|Continue|End]PresentToDwm are set */
return D3DTEXF_NONE;
}
{
return (D3DQUERYTYPE)enmType;
}
{
fFlags |= D3DISSUE_BEGIN;
fFlags |= D3DISSUE_END;
return fFlags;
}
/******/
static HRESULT vboxWddmRenderTargetSet(PVBOXWDDMDISP_DEVICE pDevice, UINT iRt, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bOnSwapchainSynch);
{
}
static HRESULT vboxWddmSwapchainKmSynch(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
{
struct
{
} Buf;
// Buf.SwapchainInfo.SwapchainInfo.Rect;
// Buf.SwapchainInfo.SwapchainInfo.u32Reserved;
{
// Assert(pSwapchain->aRTs[i].pAlloc->hAllocation);
++cAllocsKm;
}
{
D3DDDICB_ESCAPE DdiEscape = {0};
// DdiEscape.Flags.Value = 0;
DdiEscape.PrivateDriverDataSize = RT_OFFSETOF(VBOXDISPIFESCAPE_SWAPCHAININFO, SwapchainInfo.ahAllocs[Buf.SwapchainInfo.SwapchainInfo.cAllocs]);
#ifdef DEBUG_misha
#endif
{
}
}
return S_OK;
}
static HRESULT vboxWddmSwapchainKmDestroy(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
{
if (pSwapchain->hSwapchainKm)
{
/* submit empty swapchain to destroy the KM one */
pSwapchain->cRTs = 0;
}
return hr;
}
static HRESULT vboxWddmSwapchainDestroyIf(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
{
if (pSwapchain->pSwapChainIf)
{
#ifndef VBOXWDDM_WITH_VISIBLE_FB
{
}
#endif
return S_OK;
}
return S_OK;
}
DECLINLINE(VOID) vboxWddmSwapchainClear(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
{
{
}
/* first do a Km destroy to ensure all km->um region submissions are completed */
}
static VOID vboxWddmSwapchainDestroy(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
{
}
{
PVBOXWDDMDISP_SWAPCHAIN pCur = RTListGetFirst(&pDevice->SwapchainList, VBOXWDDMDISP_SWAPCHAIN, ListEntry);
while (pCur)
{
{
}
}
}
{
PVBOXWDDMDISP_SWAPCHAIN pSwapchain = (PVBOXWDDMDISP_SWAPCHAIN)RTMemAllocZ(sizeof (VBOXWDDMDISP_SWAPCHAIN));
if (pSwapchain)
{
return pSwapchain;
}
return NULL;
}
DECLINLINE(VOID) vboxWddmSwapchainRtInit(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_RENDERTGT pRt, PVBOXWDDMDISP_ALLOCATION pAlloc)
{
}
DECLINLINE(VOID) vboxWddmSwapchainBbAddTail(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bAssignAsBb)
{
++pSwapchain->cRTs;
{
pSwapchain->iBB = 0;
}
else if (bAssignAsBb)
{
}
{
}
}
{
}
{
return pSwapchain->cRTs;
}
DECLINLINE(PVBOXWDDMDISP_RENDERTGT) vboxWddmSwapchainRtForAlloc(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_ALLOCATION pAlloc)
{
return NULL;
{
return &pSwapchain->aRTs[i];
}
/* should never happen */
Assert(0);
return NULL;
}
DECLINLINE(UINT) vboxWddmSwapchainRtIndex(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_RENDERTGT pRT)
{
return iRt;
}
DECLINLINE(VOID) vboxWddmSwapchainRtRemove(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_RENDERTGT pRT)
{
{
}
--pSwapchain->cRTs;
if (pSwapchain->cRTs)
{
{
--pSwapchain->iBB;
}
{
pSwapchain->iBB = 0;
}
}
else
{
}
}
DECLINLINE(VOID) vboxWddmSwapchainSetBb(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_RENDERTGT pRT)
{
}
static PVBOXWDDMDISP_SWAPCHAIN vboxWddmSwapchainFindCreate(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pBbAlloc, BOOL *pbNeedPresent)
{
if (pSwapchain)
{
/* check if this is what we expect */
{
{
/* the current front-buffer present is requested, don't do anything */
*pbNeedPresent = FALSE;
return pSwapchain;
}
/* bad, @todo: correct the swapchain by either removing the Rt and adding it to another swapchain
* or by removing the pBbAlloc out of it */
//@todo: Assert(0);
}
}
*pbNeedPresent = TRUE;
if (!pSwapchain)
{
/* first search for the swapchain the alloc might be added to */
PVBOXWDDMDISP_SWAPCHAIN pCur = RTListGetFirst(&pDevice->SwapchainList, VBOXWDDMDISP_SWAPCHAIN, ListEntry);
while (pCur)
{
&& vboxWddmSwapchainRtIndex(pCur, pRt) == 0) /* <- in case we add a rt to the swapchain on present this would mean
* that the last RT in the swapchain array is now a frontbuffer and
* thus the aRTs[0] is a backbuffer */
{
#if 0
// && pBbRc->RcDesc.fFlags.Value == pRtRc->RcDesc.fFlags.Value
)
)
#endif
)
{
pSwapchain = pCur;
break;
}
}
break;
}
// if (!pSwapchain) need to create a new one (see below)
}
if (!pSwapchain)
{
if (pSwapchain)
{
}
}
return pSwapchain;
}
static PVBOXWDDMDISP_SWAPCHAIN vboxWddmSwapchainCreateForRc(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_RESOURCE pRc)
{
if (pSwapchain)
{
{
}
return pSwapchain;
}
return NULL;
}
{
return iBb != (~0) ? (iBb + pSwapchain->iBB) % pSwapchain->cRTs : vboxWddmSwapchainIdxFb(pSwapchain);
}
static HRESULT vboxWddmSwapchainRtSynch(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain, uint32_t iBb)
{
return S_OK;
{
iBb = 0;
}
#endif
{
return hr;
}
{
{
{
/* since this can be texture, need to do the vboxWddmSurfGet magic */
{
return hr;
}
}
{
/* get the old surface's swapchain */
{
}
else
{
}
{
/* the swapchain has changed, copy data to the new surface */
#ifdef DEBUG_misha
/* @todo: we can not generally update the render target directly, implement */
#endif
VBOXVDBG_CHECK_SWAPCHAIN_SYNC(hr = pDevice->pDevice9If->StretchRect(pD3D9OldSurf, NULL, pD3D9Surf, NULL, D3DTEXF_NONE); Assert(hr == S_OK),
}
}
if (pD3D9OldSurf)
{
pD3D9OldSurf->Release();
}
}
else
{
}
}
{
{
{
}
}
}
{
/* only use direct bb if wine is able to handle quick blits bewteen surfaces in one swapchain,
* this is FALSE by now :( */
/* here we sync the front-buffer with a backbuffer data*/
/* we use backbuffer as a rt frontbuffer copy, so release the old one and assign the current bb */
{
}
# else
# endif
{
VBOXVDBG_CHECK_SWAPCHAIN_SYNC(tmpHr = pDevice->pDevice9If->StretchRect(pD3D9Bb, NULL, (IDirect3DSurface9*)vboxWddmSwapchainGetBb(pSwapchain)->pAlloc->pD3DIf, NULL, D3DTEXF_NONE); Assert(tmpHr == S_OK),
pAlloc, pD3D9Bb, NULL, pAlloc, (IDirect3DSurface9*)vboxWddmSwapchainGetBb(pSwapchain)->pAlloc->pD3DIf, NULL);
{
}
# endif
}
else
{
}
}
#endif
return hr;
}
static HRESULT vboxWddmSwapchainSynch(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
{
{
}
{
{
}
}
return hr;
}
static VOID vboxWddmSwapchainFillParams(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, D3DPRESENT_PARAMETERS *pParams)
{
#ifdef DEBUG_misha
/* not supported by wine properly, need to use offscreen render targets and blit their data to swapchain RTs*/
#endif
#if 0 //def VBOXDISP_WITH_WINE_BB_WORKAROUND /* this does not work so far any way :( */
else
#endif
}
/* copy current rt data to offscreen render targets */
static HRESULT vboxWddmSwapchainSwtichOffscreenRt(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain, BOOL fForceCreate)
{
if (pOldIf)
{
{
return hr;
}
/* just need a pointer to match */
pD3D9OldFb->Release();
}
{
continue;
:
if (!fForceCreate && !fHasSurf)
continue;
if (fHasSurf)
{
/* since this can be texture, need to do the vboxWddmSurfGet magic */
{
}
else
{
}
if (!pvSwapchain) /* no swapchain, it is already offscreen */
{
pD3D9OldSurf->Release();
continue;
}
}
TRUE, /*bLockable*/
);
{
if (pD3D9OldSurf)
pD3D9OldSurf->Release();
break;
}
if (pD3D9OldSurf)
{
if (pD3D9OldSurf != pD3D9OldFb)
{
VBOXVDBG_CHECK_SWAPCHAIN_SYNC(hr = pDevice9If->StretchRect(pD3D9OldSurf, NULL, pD3D9NewSurf, NULL, D3DTEXF_NONE); Assert(hr == S_OK),
}
else
{
}
}
{
if (pD3D9OldSurf)
pD3D9OldSurf->Release();
break;
}
if (pD3D9OldSurf)
pD3D9OldSurf->Release();
}
return hr;
}
/**
* @return old RtReportingPresent state
*/
static HRESULT vboxWddmSwapchainSwtichRtPresent(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
{
return S_OK;
{
}
TRUE /* force offscreen surface creation right away. This way we ensure the swapchain data
* is always uptodate which allows making the vboxWddmSwapchainRtSynch behave as a nop */
);
return hr;
/* ensure we update device RTs to offscreen ones we just created */
{
{
{
}
}
}
return hr;
}
static HRESULT vboxWddmSwapchainChkCreateIf(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
{
return S_OK;
/* preserve the old one */
{
/* indicae switch to Render Target Reporting Present mode is needed */
// vboxWddmSwapchainSwtichRtPresent(pDevice, pSwapchain);
}
else
{
{
{
break;
}
}
}
/* check if we need to re-create the swapchain */
if (pOldIf)
{
if (fNeedRtPresentSwitch)
{
/* the number of swapchain backbuffers does not matter */
}
else
{
{
{
}
}
}
}
/* first create the new one */
///
if (!bReuseSwapchain)
{
{
/* @todo: it seems there should be a way to detect this correctly since
* our vboxWddmDDevSetDisplayMode will be called in case we are using full-screen */
// params.EnableAutoDepthStencil = FALSE;
// params.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
// params.Flags;
// params.FullScreen_RefreshRateInHz;
// params.FullScreen_PresentationInterval;
if (!pDevice->pDevice9If)
{
hr = pAdapter->D3D.pD3D9If->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL, fFlags, &Params.Base, &pDevice9If);
{
{
}
else
{
pDevice9If->Release();
}
}
}
else
{
if (pOldIf)
{
/* need to copy data to offscreen rt to ensure the data is preserved
* since the swapchain data may become invalid once we create a new swapchain
* and pass the current swapchain's window to it
* thus vboxWddmSwapchainSynch will not be able to do synchronization */
}
/* re-use swapchain window
* this will invalidate the previusly used swapchain */
{
}
}
}
}
else
{
/* to ensure the swapchain is not deleted once we release the pOldIf */
}
return hr;
if (fNeedRtPresentSwitch)
{
}
else
{
#ifndef VBOXWDDM_WITH_VISIBLE_FB
{
# if defined(VBOXDISP_WITH_WINE_BB_WORKAROUND) && defined(VBOX_WINE_WITH_FAST_INTERSWAPCHAIN_BLT)
/* if wine is able to do fast fb->bb blits, we will use backbuffer directly,
* this is NOT possible currently */
{
/* we will assign it to wine backbuffer on a swapchain synch */
{
}
}
else
# endif
if (!pSwapchain->pRenderTargetFbCopy)
{
TRUE, /*bLockable*/
NULL /* HANDLE* pSharedHandle */
);
{
}
}
}
#endif
}
/* ignore any subsequen failures */
#ifdef DEBUG
{
}
#endif
if (pOldIf)
{
}
else
{
}
return S_OK;
}
static HRESULT vboxWddmSwapchainCreateIfForRc(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_RESOURCE pRc, PVBOXWDDMDISP_SWAPCHAIN *ppSwapchain)
{
*ppSwapchain = NULL;
if (pSwapchain)
{
{
}
return hr;
}
return E_OUTOFMEMORY;
}
static HRESULT vboxWddmSwapchainPresentPerform(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain);
static HRESULT vboxWddmSwapchainBbUpdate(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_ALLOCATION pBbAlloc)
{
{
return S_OK;
{
return hr;
}
}
AssertMsgFailed(("the given allocation not par of the swapchain\n"));
return E_FAIL;
}
/* get the surface for the specified allocation in the swapchain */
static HRESULT vboxWddmSwapchainSurfGet(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_ALLOCATION pAlloc, IDirect3DSurface9 **ppSurf)
{
#ifndef VBOXWDDM_WITH_VISIBLE_FB
# ifdef VBOXDISP_WITH_WINE_BB_WORKAROUND
&& vboxWddmSwapchainNumRTs(pSwapchain) != 1 /* for swapchains w/o a backbuffer the alloc will contain the back-buffer actually */
)
{
/* this is a front-buffer */
if (!pSwapchain->bRTFbCopyUpToDate)
{
{
return hr;
}
}
return S_OK;
}
# endif
#endif
/* if this is not a front-buffer - just return the surface associated with the allocation */
}
static HRESULT vboxWddmSwapchainRtSurfGet(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain, UINT iRt, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bOnSwapchainSynch, IDirect3DSurface9 **ppSurf)
{
/* do the necessary swapchain synchronization first,
* not needed on swapchain synch since it is done already and we're called here just to set RTs */
if (!bOnSwapchainSynch)
{
{
/* iRt != 0 is untested here !! */
if (iRt == 0)
{
{
return hr;
}
}
}
//@todo: Assert(!pSwapchain->fFlags.bChanged);
{
return hr;
}
}
//@todo: Assert(vboxWddmSwapchainGetBb(pSwapchain)->pAlloc == pAlloc || iRt != 0);
{
return hr;
}
return S_OK;
}
static HRESULT vboxWddmSwapchainPresentPerform(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
{
{
return hr;
}
else
{
return hr;
return hr;
}
return hr;
}
static HRESULT vboxWddmSwapchainPresent(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pBbAlloc)
{
/* we currently *assume* that presenting shared resource is only possible when 3d app is rendering with composited desktop on,
* no need to do anything else since dwm will present everything for us */
if (pBbAlloc->hSharedHandle)
{
HRESULT hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9Flush((IDirect3DDevice9Ex*)pDevice->pDevice9If);
return S_OK;
}
if (!bNeedPresent)
return S_OK;
if (pSwapchain)
{
{
}
return hr;
}
return E_OUTOFMEMORY;
}
#if 0 //def DEBUG
static void vboxWddmDbgRenderTargetUpdateCheckSurface(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc, uint32_t iBBuf)
{
{
}
}
static void vboxWddmDbgRenderTargetCheck(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_RESOURCE pRc, uint32_t iNewRTFB)
{
{
}
#ifdef VBOXWDDM_WITH_VISIBLE_FB
#else
#endif
{
if (iNewRTFB == i)
{
}
{
}
}
}
# define VBOXVDBG_RTGT_STATECHECK(_pDev) (vboxWddmDbgRenderTargetCheck((_pDev), (_pDev)->aScreens[(_pDev)->iPrimaryScreen].pRenderTargetRc, (_pDev)->aScreens[(_pDev)->iPrimaryScreen].iRenderTargetFrontBuf))
#else
# define VBOXVDBG_RTGT_STATECHECK(_pDev) do{}while(0)
#endif
{
if (pRc)
{
{
}
}
else
{
hr = E_OUTOFMEMORY;
}
return hr;
}
{
if (pDevice->pDevice9If)
return pDevice->pDevice9If;
#ifdef VBOXWDDMDISP_DEBUG
#endif
return pDevice->pDevice9If;
}
/******/
static HRESULT vboxWddmRenderTargetSet(PVBOXWDDMDISP_DEVICE pDevice, UINT iRt, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bOnSwapchainSynch)
{
if (pSwapchain)
{
{
return hr;
}
}
else
{
{
return hr;
}
}
{
}
return hr;
}
/**
* DLL entry point.
*/
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{
vboxVDbgPrint(("VBoxDispD3D: DLL loaded.\n"));
#ifdef VBOXWDDMDISP_DEBUG_VEHANDLER
#endif
int rc = RTR3InitDll(0);
if (RT_SUCCESS(rc))
{
// rc = VbglR3Init();
// AssertRC(rc);
// if (RT_SUCCESS(rc))
{
{
hr = vboxDispMpInternalInit();
{
vboxVDbgPrint(("VBoxDispD3D: DLL loaded OK\n"));
return TRUE;
}
}
// VbglR3Term();
}
}
#ifdef VBOXWDDMDISP_DEBUG_VEHANDLER
#endif
break;
}
case DLL_PROCESS_DETACH:
{
#ifdef VBOXWDDMDISP_DEBUG_VEHANDLER
#endif
{
hr = vboxDispCmTerm();
{
// VbglR3Term();
/// @todo RTR3Term();
return TRUE;
}
}
break;
}
default:
return TRUE;
}
return FALSE;
}
{
{
case D3DDDICAPS_DDRAW:
{
{
#ifdef VBOX_WITH_VIDEOHWACCEL
if (!VBOXDISPMODE_IS_3D(pAdapter))
{
if (vboxVhwaHasCKeying(pAdapter))
{
// pCaps->Caps2 |= DDRAW_CAPS2_FLIPNOVSYNC;
}
}
else
{
WARN(("D3DDDICAPS_DDRAW query for D3D mode!"));
}
#endif
}
else
hr = E_INVALIDARG;
break;
}
{
{
zero starting with the one following "Head", i.e. Caps */,
#ifdef VBOX_WITH_VIDEOHWACCEL
if (!VBOXDISPMODE_IS_3D(pAdapter))
{
{
{
| MODE_CKEYCAPS_DESTOVERLAYYUV /* ?? */
;
}
{
| MODE_CKEYCAPS_SRCOVERLAYCLRSPACE /* ?? */
| MODE_CKEYCAPS_SRCOVERLAYCLRSPACEYUV /* ?? */
| MODE_CKEYCAPS_SRCOVERLAYYUV /* ?? */
;
}
}
}
else
{
WARN(("D3DDDICAPS_DDRAW_MODE_SPECIFIC query for D3D mode!"));
}
#endif
}
else
hr = E_INVALIDARG;
break;
}
break;
case D3DDDICAPS_GETFORMATDATA:
memcpy(pData->pData, pAdapter->Formats.paFormstOps, pAdapter->Formats.cFormstOps * sizeof (FORMATOP));
break;
#if 1
#else
#endif
break;
#if 1
#else
Assert(0);
#endif
break;
case D3DDDICAPS_GETD3D3CAPS:
{
// | D3DDEVCAPS_DRAWPRIMTLVERTEX
// | D3DDEVCAPS_FLOATTLVERTEX
// | D3DDEVCAPS_HWTRANSFORMANDLIGHT
// | D3DDEVCAPS_TLVERTEXSYSTEMMEMORY
// | D3DDEVCAPS_TEXTUREVIDEOMEMORY
;
pCaps->dwNumVertices = 0;
pCaps->dwNumClipVertices = 0;
}
else
hr = E_INVALIDARG;
break;
case D3DDDICAPS_GETD3D7CAPS:
{
}
else
hr = E_INVALIDARG;
break;
case D3DDDICAPS_GETD3D9CAPS:
{
{
if (VBOXDISPMODE_IS_3D(pAdapter))
{
break;
}
}
else
hr = E_INVALIDARG;
break;
}
case D3DDDICAPS_GETD3D8CAPS:
{
{
if (VBOXDISPMODE_IS_3D(pAdapter))
{
break;
}
}
else
hr = E_INVALIDARG;
break;
}
break;
break;
case D3DDDICAPS_GETD3D5CAPS:
case D3DDDICAPS_GETD3D6CAPS:
Assert(0);
break;
default:
Assert(0);
}
return S_OK;
}
static HRESULT APIENTRY vboxWddmDDevSetRenderState(HANDLE hDevice, CONST D3DDDIARG_RENDERSTATE* pData)
{
return hr;
}
{
// PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice;
// VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
return S_OK;
}
static HRESULT APIENTRY vboxWddmDDevValidateDevice(HANDLE hDevice, D3DDDIARG_VALIDATETEXTURESTAGESTATE* pData)
{
// PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice;
// VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
#ifdef DEBUG_misha
/* @todo: check if it's ok to always return success */
Assert(0);
#endif
return S_OK;
}
static HRESULT APIENTRY vboxWddmDDevSetTextureStageState(HANDLE hDevice, CONST D3DDDIARG_TEXTURESTAGESTATE* pData)
{
if (!lookup.bSamplerState)
{
hr = pDevice9If->SetTextureStageState(pData->Stage, D3DTEXTURESTAGESTATETYPE(lookup.dType), pData->Value);
}
else
{
}
return hr;
}
{
// Assert(pRc);
if (pRc)
{
{
}
{
}
else
{
Assert(0);
}
if (idx >= 0)
{
#ifdef DEBUG_misha
{
WARN(("non-zero special sampler index not tested!\n"));
}
#endif
{
}
}
else
{
}
}
else
{
if (idx >= 0)
{
{
}
}
else
{
}
}
return hr;
}
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetPixelShaderConst(HANDLE hDevice, CONST D3DDDIARG_SETPIXELSHADERCONST* pData, CONST FLOAT* pRegisters)
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetStreamSourceUm(HANDLE hDevice, CONST D3DDDIARG_SETSTREAMSOURCEUM* pData, CONST VOID* pUMBuffer )
{
{
}
return hr;
}
{
if (pRc)
{
}
{
}
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetIndicesUm(HANDLE hDevice, UINT IndexSize, CONST VOID* pUMBuffer)
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevDrawPrimitive(HANDLE hDevice, CONST D3DDDIARG_DRAWPRIMITIVE* pData, CONST UINT* pFlagBuffer)
{
if (!pDevice->cStreamSources)
{
{
#ifdef DEBUG
{
}
#endif
((uint8_t*)pDevice->aStreamSourceUm[0].pvBuffer) + pData->VStart * pDevice->aStreamSourceUm[0].cbStride,
// vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
}
else
{
/* todo: impl */
Assert(0);
}
}
else
{
#ifdef DEBUG
{
}
{
if (pDevice->aStreamSource[i])
{
++cStreams;
}
}
#endif
// vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitive\n"));
}
return hr;
}
static HRESULT APIENTRY vboxWddmDDevDrawIndexedPrimitive(HANDLE hDevice, CONST D3DDDIARG_DRAWINDEXEDPRIMITIVE* pData)
{
#ifdef DEBUG
{
}
{
if (pDevice->aStreamSource[i])
{
++cStreams;
}
}
#endif
return hr;
}
static HRESULT APIENTRY vboxWddmDDevDrawRectPatch(HANDLE hDevice, CONST D3DDDIARG_DRAWRECTPATCH* pData, CONST D3DDDIRECTPATCH_INFO* pInfo, CONST FLOAT* pPatch)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevDrawTriPatch(HANDLE hDevice, CONST D3DDDIARG_DRAWTRIPATCH* pData, CONST D3DDDITRIPATCH_INFO* pInfo, CONST FLOAT* pPatch)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevDrawPrimitive2(HANDLE hDevice, CONST D3DDDIARG_DRAWPRIMITIVE2* pData)
{
#if 0
int stream;
{
{
{
IDirect3DVertexBuffer9 *pD3D9VBuf = (IDirect3DVertexBuffer9*)pDevice->aStreamSource[stream]->pD3DIf;
RECT r;
r.top = 0;
r.bottom = 1;
vboxWddmLockUnlockMemSynch(pDevice->aStreamSource[stream], &pLock->LockedRect, &r, true /*bool bToLockInfo*/);
}
}
}
hr = pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset, pData->PrimitiveCount);
#else
#ifdef DEBUG
#endif
int stream;
{
{
#ifdef DEBUG
++cStreams;
#endif
{
// vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitiveUP\n"));
(void*)((uintptr_t)pDevice->aStreamSource[stream]->pvMem+pDevice->StreamSourceInfo[stream].uiOffset+pData->FirstVertexOffset),
hr = pDevice9If->SetStreamSource(stream, (IDirect3DVertexBuffer9*)pDevice->aStreamSource[stream]->pD3DIf, pDevice->StreamSourceInfo[stream].uiOffset, pDevice->StreamSourceInfo[stream].uiStride);
}
else
{
// vboxVDbgMpPrintF((pDevice, __FUNCTION__": DrawPrimitive\n"));
hr = pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset/pDevice->StreamSourceInfo[stream].uiStride, pData->PrimitiveCount);
}
}
}
#ifdef DEBUG
#endif
#endif
return hr;
}
static HRESULT APIENTRY vboxWddmDDevDrawIndexedPrimitive2(HANDLE hDevice, CONST D3DDDIARG_DRAWINDEXEDPRIMITIVE2* pData, UINT dwIndicesSize, CONST VOID* pIndexBuffer, CONST UINT* pFlagBuffer)
{
Assert(0);
return E_FAIL;
}
{
Assert(0);
// @todo: vboxWddmDalCheckAdd(pDevice);
return E_FAIL;
}
{
Assert(0);
// @todo: vboxWddmDalCheckAdd(pDevice);
return E_FAIL;
}
{
/* requirements for D3DDevice9::UpdateTexture */
{
}
else
{
{
{
#ifdef DEBUG
RECT tstRect = {0,0, pDstRc->aAllocations[0].SurfDesc.width, pDstRc->aAllocations[0].SurfDesc.height};
#endif
hr = pDevice9If->StretchRect(pSrcSurfIf, &pData->SrcRect, pDstSurfIf, &DstRect, D3DTEXF_NONE); Assert(hr == S_OK),
pSrcSurfIf->Release();
}
pDstSurfIf->Release();
}
}
return hr;
}
{
Assert(0);
return E_FAIL;
}
{
// PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice;
// Assert(pDevice);
// VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
return S_OK;
}
static HRESULT APIENTRY vboxWddmDDevClear(HANDLE hDevice, CONST D3DDDIARG_CLEAR* pData, UINT NumRect, CONST RECT* pRect)
{
pData->FillStencil);
return hr;
}
static HRESULT APIENTRY vboxWddmDDevUpdatePalette(HANDLE hDevice, CONST D3DDDIARG_UPDATEPALETTE* pData, CONST PALETTEENTRY* pPaletteData)
{
Assert(0);
return E_FAIL;
}
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetVertexShaderConst(HANDLE hDevice, CONST D3DDDIARG_SETVERTEXSHADERCONST* pData , CONST VOID* pRegisters)
{
(CONST float*)pRegisters,
return hr;
}
static HRESULT APIENTRY vboxWddmDDevMultiplyTransform(HANDLE hDevice, CONST D3DDDIARG_MULTIPLYTRANSFORM* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetTransform(HANDLE hDevice, CONST D3DDDIARG_SETTRANSFORM* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetViewport(HANDLE hDevice, CONST D3DDDIARG_VIEWPORTINFO* pData)
{
return hr;
}
{
return hr;
}
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetLight(HANDLE hDevice, CONST D3DDDIARG_SETLIGHT* pData, CONST D3DDDI_LIGHT* pLightProperties)
{
Assert(0);
return E_FAIL;
}
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevDestroyLight(HANDLE hDevice, CONST D3DDDIARG_DESTROYLIGHT* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetClipPlane(HANDLE hDevice, CONST D3DDDIARG_SETCLIPPLANE* pData)
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevGetInfo(HANDLE hDevice, UINT DevInfoID, VOID* pDevInfoStruct, UINT DevInfoSize)
{
// PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)hDevice;
// Assert(pDevice);
// VBOXDISPCRHGSMI_SCOPE_SET_DEV(pDevice);
switch (DevInfoID)
{
case D3DDDIDEVINFOID_VCACHE:
{
if (DevInfoSize == sizeof (D3DDDIDEVINFO_VCACHE))
{
pVCache->MagicNumber = 0;
}
else
hr = E_INVALIDARG;
break;
}
default:
Assert(0);
}
return hr;
}
{
return E_INVALIDARG;
{
// Assert(pRc != pScreen->pRenderTargetRc || pScreen->iRenderTargetFrontBuf != pData->SubResourceIndex);
{
bool bNeedResynch = false;
{
}
/* else - we lock the entire texture, pRect == NULL */
{
switch (pTexAlloc->enmD3DIfType)
{
break;
break;
break;
default:
Assert(0);
break;
}
{
if (pRect)
{
}
else
{
}
}
}
else
{
{
}
{
switch (pTexAlloc->enmD3DIfType)
{
break;
break;
break;
default:
Assert(0);
break;
}
{
switch (pTexAlloc->enmD3DIfType)
{
break;
break;
break;
default:
Assert(0);
break;
}
}
}
}
{
{
pData->SlicePitch = 0;
}
else
{
}
}
}
{
{
}
/* else - we lock the entire vertex buffer, pRect == NULL */
{
{
bLocked = true;
}
{
// Assert(pLockAlloc->LockInfo.fFlags.Value == 0);
if (pRange)
{
// pAlloc->LockInfo.fFlags.RangeValid = 1;
}
else
{
// pAlloc->LockInfo.fFlags.RangeValid = 0;
}
}
}
else
{
{
}
}
{
{
pData->SlicePitch = 0;
}
else
{
{
if (pRange)
{
r.top = 0;
r.bottom = 1;
pr = &r;
}
else
}
}
}
}
{
{
}
/* else - we lock the entire vertex buffer, pRect == NULL */
{
{
bLocked = true;
}
{
// Assert(pLockAlloc->LockInfo.fFlags.Value == 0);
if (pRange)
{
// pAlloc->LockInfo.fFlags.RangeValid = 1;
}
else
{
// pAlloc->LockInfo.fFlags.RangeValid = 0;
}
}
}
else
{
{
}
}
{
{
pData->SlicePitch = 0;
}
else
{
{
if (pRange)
{
r.top = 0;
r.bottom = 1;
pr = &r;
}
else
}
}
}
}
else
{
Assert(0);
}
}
else /* if !VBOXDISPMODE_IS_3D(pDevice->pAdapter) */
{
if (pAlloc->hAllocation)
{
{
{
offset = vboxWddmCalcOffXYrd(pData->Area.left, pData->Area.top, pAlloc->SurfDesc.pitch, pAlloc->SurfDesc.format);
}
{
}
{
Assert(0);
}
else
{
offset = 0;
}
{
{
/* check if the surface was renamed */
if (LockData.hAllocation)
}
}
}
/* else - d3d may create sysmem render targets and call our Present callbacks for those
* to make it work properly we need to create a VRAM surface corresponding to sysmem one
*
* so we don't do any locking here, but still track the lock info here
* and do lock-memcopy-unlock to VRAM surface on sysmem surface unlock
* */
{
{
else
{
}
}
}
}
}
return hr;
}
{
return E_INVALIDARG;
{
{
{
{
{
break;
}
{
break;
}
{
break;
}
default:
Assert(0);
break;
}
}
else
{
}
}
{
{
// Assert(!pAlloc->LockInfo.cLocks);
/* this is a sysmem texture, update */
{
{
r.top = 0;
r.bottom = 1;
pr = &r;
}
else
pr,
true /*bool bToLockInfo*/);
}
}
else
{
}
}
{
{
// Assert(!pAlloc->LockInfo.cLocks);
/* this is a sysmem texture, update */
{
{
r.top = 0;
r.bottom = 1;
pr = &r;
}
else
pr,
true /*bool bToLockInfo*/);
}
}
else
{
}
}
else
{
Assert(0);
}
}
else
{
if (pAlloc->hAllocation)
{
{
}
else
{
{
{
}
else
{
}
}
}
if (fDoUnlock)
{
struct
{
} UnlockData;
{
}
}
{
WARN(("unlock failure!"));
}
}
}
return hr;
}
{
Assert(0);
return E_FAIL;
}
{
Assert(0);
return E_FAIL;
}
{
Assert(0);
return E_FAIL;
}
{
}
{
/* allocate buffer for D3DDDICB_ALLOCATE + D3DDDI_ALLOCATIONINFO * numAllocs + PVBOXWDDM_RCINFO with aAllocInfos[numAllocs] */
if (pvBuf)
{
{
}
return pAlloc;
}
return NULL;
}
static HRESULT APIENTRY vboxWddmDDevCreateResource(HANDLE hDevice, D3DDDIARG_CREATERESOURCE* pResource)
{
if (!pRc)
{
WARN(("vboxResourceAlloc failed"));
return E_OUTOFMEMORY;
}
bool bIssueCreateResource = false;
bool bCreateSwapchain = false;
bool bCreateKMResource = false;
{
pAllocation->iAlloc = i;
else
if (pSurf->SysMemPitch)
else
pAllocation->SurfDesc.cbSize = vboxWddmCalcSize(pAllocation->SurfDesc.pitch, pAllocation->SurfDesc.height, pAllocation->SurfDesc.format);
}
if (VBOXDISPMODE_IS_3D(pAdapter))
{
{
bIssueCreateResource = true;
bCreateKMResource = true;
}
{
{
TRUE /* @todo: BOOL Discard */,
NULL /*HANDLE* pSharedHandle*/);
{
}
else
{
for (UINT j = 0; j < i; ++j)
{
}
break;
}
}
{
{
}
}
}
{
{
NULL /*HANDLE* pSharedHandle*/);
{
}
else
{
for (UINT j = 0; j < i; ++j)
{
}
break;
}
}
{
{
}
}
}
{
{
NULL /*HANDLE* pSharedHandle*/
);
{
}
else
{
for (UINT j = 0; j < i; ++j)
{
}
break;
}
}
{
{
}
}
}
{
{
bIssueCreateResource = true;
}
{
#ifdef DEBUG
{
{
tstW /= 2;
tstH /= 2;
}
}
#endif
void **pavClientMem = NULL;
{
if (minPitch)
{
pAllocation->D3DWidth = vboxWddmCalcWidthForPitch(pSurf->SysMemPitch, pAllocation->SurfDesc.format);
}
else
{
}
}
{
if (pavClientMem)
{
{
}
}
else
}
{
#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
NULL,
#else
#endif
{
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
#endif
if (!pavClientMem)
{
/* zero-init texture memory */
}
}
if (pavClientMem)
}
}
else /*pResource->Flags.CubeMap*/
{
void **pavClientMem = NULL;
{
Assert(0);
hr = E_INVALIDARG;
}
else
{
{
if (pavClientMem)
{
{
}
}
else
}
{
hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If,
#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
NULL,
#else
#endif
{
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
#endif
}
if (pavClientMem)
}
}
}
}
{
bIssueCreateResource = true;
#ifdef VBOXWDDMDISP_DEBUG
{
}
#endif
{
bCreateSwapchain = true;
{
}
}
else
{
{
#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
#else
#endif
);
{
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
#endif
continue;
/* fail branch */
}
for (UINT j = 0; j < i; ++j)
{
}
break;
}
{
{
Assert(0);
}
}
}
}
else
{
Assert(0);
}
}
else
{
}
{
if (pDdiAllocate)
{
{
{
}
}
// Assert(!pRc->fFlags.KmResource);
if (bCreateKMResource)
{
* are created with zero km resource handle on Win7+ */
);
}
else
{
{
{
}
else
{
for (UINT j = 0; i < j; ++j)
{
}
break;
}
}
}
{
{
{
vboxVDbgPrint(("\n\n********\n(0x%x:0n%d)Shared CREATED pAlloc(0x%p), hRc(0x%p), hAl(0x%p), "
"Handle(0x%x), (0n%d) \n***********\n\n",
));
#endif
}
}
if(bCreateSwapchain)
{
}
else
{
}
}
}
else
{
hr = E_OUTOFMEMORY;
}
}
else
return hr;
}
{
if (VBOXDISPMODE_IS_3D(pAdapter))
{
{
if (pAlloc->hSharedHandle)
{
vboxVDbgPrint(("\n\n********\n(0x%x:0n%d)Shared DESTROYED pAlloc(0x%p), hRc(0x%p), hAl(0x%p), "
"Handle(0x%x), (0n%d) \n***********\n\n",
));
#endif
}
if (pSwapchain)
{
}
}
}
{
/* according to the docs the below two are ignored in case we set the hResource */
Dealloc.NumAllocations = 0;
}
else
{
{
{
}
}
}
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetDisplayMode(HANDLE hDevice, CONST D3DDDIARG_SETDISPLAYMODE* pData)
{
D3DDDICB_SETDISPLAYMODE DdiDm = {0};
{
}
return hr;
}
#ifdef VBOXWDDM_TEST_UHGSMI
#endif
{
// VBOXDISPPROFILE_DDI_CHKDUMPRESET(pDevice);
{
#ifdef VBOXWDDM_TEST_UHGSMI
{
}
#endif
}
{
D3DDDICB_PRESENT DdiPresent = {0};
if (pData->hSrcResource)
{
}
if (pData->hDstResource)
{
}
#if 0 //def VBOX_WDDMDISP_WITH_PROFILE
VBoxDispProfileScopeLogger<VBoxDispProfileEntry> profilePresentCbLogger(pDevice->ProfileDdiPresentCb.alloc("pfnPresentCb"));
#endif
#ifdef VBOXWDDMDISP_DEBUG_TIMER
#endif
#ifdef VBOXWDDMDISP_DEBUG_TIMER
#endif
#if 0 //def VBOX_WDDMDISP_WITH_PROFILE
{
}
#endif
}
return hr;
}
{
{
hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9Flush((IDirect3DDevice9Ex*)pDevice->pDevice9If);
}
return hr;
}
AssertCompile(RT_SIZEOFMEMB(D3DDDIVERTEXELEMENT, Stream) == RT_SIZEOFMEMB(D3DVERTEXELEMENT9, Stream));
AssertCompile(RT_SIZEOFMEMB(D3DDDIVERTEXELEMENT, Offset) == RT_SIZEOFMEMB(D3DVERTEXELEMENT9, Offset));
AssertCompile(RT_SIZEOFMEMB(D3DDDIVERTEXELEMENT, Method) == RT_SIZEOFMEMB(D3DVERTEXELEMENT9, Method));
AssertCompile(RT_SIZEOFMEMB(D3DDDIVERTEXELEMENT, Usage) == RT_SIZEOFMEMB(D3DVERTEXELEMENT9, Usage));
AssertCompile(RT_SIZEOFMEMB(D3DDDIVERTEXELEMENT, UsageIndex) == RT_SIZEOFMEMB(D3DVERTEXELEMENT9, UsageIndex));
AssertCompile(RT_OFFSETOF(D3DDDIVERTEXELEMENT, UsageIndex) == RT_OFFSETOF(D3DVERTEXELEMENT9, UsageIndex));
static HRESULT APIENTRY vboxWddmDDevCreateVertexShaderDecl(HANDLE hDevice, D3DDDIARG_CREATEVERTEXSHADERDECL* pData, CONST D3DDDIVERTEXELEMENT* pVertexElements)
{
bool bFreeVe = false;
{
if (pVe)
{
bFreeVe = true;
}
else
hr = E_OUTOFMEMORY;
}
else
{
pVe,
);
{
}
}
if (bFreeVe)
return hr;
}
{
return hr;
}
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevCreateVertexShaderFunc(HANDLE hDevice, D3DDDIARG_CREATEVERTEXSHADERFUNC* pData, CONST UINT* pCode)
{
{
}
return hr;
}
{
return hr;
}
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetVertexShaderConstI(HANDLE hDevice, CONST D3DDDIARG_SETVERTEXSHADERCONSTI* pData, CONST INT* pRegisters)
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetVertexShaderConstB(HANDLE hDevice, CONST D3DDDIARG_SETVERTEXSHADERCONSTB* pData, CONST BOOL* pRegisters)
{
return hr;
}
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetStreamSource(HANDLE hDevice, CONST D3DDDIARG_SETSTREAMSOURCE* pData)
{
if (pRc)
{
}
{
{
}
{
}
}
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetStreamSourceFreq(HANDLE hDevice, CONST D3DDDIARG_SETSTREAMSOURCEFREQ* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetConvolutionKernelMono(HANDLE hDevice, CONST D3DDDIARG_SETCONVOLUTIONKERNELMONO* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevComposeRects(HANDLE hDevice, CONST D3DDDIARG_COMPOSERECTS* pData)
{
Assert(0);
return E_FAIL;
}
{
// PVBOXWDDMDISP_SCREEN pScreen = &pDevice->aScreens[pDevice->iPrimaryScreen];
/* try StretchRect */
Assert(!pDstSwapchain || vboxWddmSwapchainGetFb(pDstSwapchain)->pAlloc != pDstAlloc || vboxWddmSwapchainNumRTs(pDstSwapchain) == 1);
{
do
{
if (pSrcSwapchain)
{
}
else
{
}
{
/* we support only Point & Linear, we ignore [Begin|Continue|End]PresentToDwm */
Assert((pData->Flags.Value & (~(0x00000100 | 0x00000200 | 0x00000400 | 0x00000001 | 0x00000002))) == 0);
VBOXVDBG_CHECK_BLT(hr = pDevice9If->StretchRect(pSrcSurfIf, &pData->SrcRect, pDstSurfIf, &pData->DstRect, vboxDDI2D3DBltFlags(pData->Flags)); Assert(hr == S_OK),
pSrcSurfIf->Release();
}
} while (0);
pDstSurfIf->Release();
}
{
/* todo: fallback to memcpy or whatever ? */
Assert(0);
}
return hr;
}
{
{
/* @todo: check what need to do when PresentToDwm flag is set */
}
return hr;
}
{
Assert(0);
//@todo: vboxWddmDalCheckAdd(pDevice, pDAlloc, TRUE);
return E_FAIL;
}
{
if (!pQuery)
{
WARN(("RTMemAllocZ failed"));
return E_OUTOFMEMORY;
}
{
return hr;
}
return hr;
}
{
return hr;
}
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevGetQueryData(HANDLE hDevice, CONST D3DDDIARG_GETQUERYDATA* pData)
{
#ifdef DEBUG
{
case D3DDDIQUERYTYPE_EVENT:
break;
default:
Assert(0);
break;
}
#endif
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetRenderTarget(HANDLE hDevice, CONST D3DDDIARG_SETRENDERTARGET* pData)
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetDepthStencil(HANDLE hDevice, CONST D3DDDIARG_SETDEPTHSTENCIL* pData)
{
if (pRc)
{
}
return hr;
}
static HRESULT APIENTRY vboxWddmDDevGenerateMipSubLevels(HANDLE hDevice, CONST D3DDDIARG_GENERATEMIPSUBLEVELS* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetPixelShaderConstI(HANDLE hDevice, CONST D3DDDIARG_SETPIXELSHADERCONSTI* pData, CONST INT* pRegisters)
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevSetPixelShaderConstB(HANDLE hDevice, CONST D3DDDIARG_SETPIXELSHADERCONSTB* pData, CONST BOOL* pRegisters)
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevCreatePixelShader(HANDLE hDevice, D3DDDIARG_CREATEPIXELSHADER* pData, CONST UINT* pCode)
{
{
}
return hr;
}
{
return hr;
}
static HRESULT APIENTRY vboxWddmDDevCreateDecodeDevice(HANDLE hDevice, D3DDDIARG_CREATEDECODEDEVICE* pData)
{
Assert(0);
return E_FAIL;
}
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetDecodeRenderTarget(HANDLE hDevice, CONST D3DDDIARG_SETDECODERENDERTARGET* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevDecodeBeginFrame(HANDLE hDevice, D3DDDIARG_DECODEBEGINFRAME* pData)
{
Assert(0);
return E_FAIL;
}
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevDecodeExecute(HANDLE hDevice, CONST D3DDDIARG_DECODEEXECUTE* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevDecodeExtensionExecute(HANDLE hDevice, CONST D3DDDIARG_DECODEEXTENSIONEXECUTE* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevCreateVideoProcessDevice(HANDLE hDevice, D3DDDIARG_CREATEVIDEOPROCESSDEVICE* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevDestroyVideoProcessDevice(HANDLE hDevice, HANDLE hVideoProcessor)
{
Assert(0);
return E_FAIL;
}
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevVideoProcessEndFrame(HANDLE hDevice, D3DDDIARG_VIDEOPROCESSENDFRAME* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetVideoProcessRenderTarget(HANDLE hDevice, CONST D3DDDIARG_SETVIDEOPROCESSRENDERTARGET* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevVideoProcessBlt(HANDLE hDevice, CONST D3DDDIARG_VIDEOPROCESSBLT* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevCreateExtensionDevice(HANDLE hDevice, D3DDDIARG_CREATEEXTENSIONDEVICE* pData)
{
Assert(0);
return E_FAIL;
}
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevExtensionExecute(HANDLE hDevice, CONST D3DDDIARG_EXTENSIONEXECUTE* pData)
{
Assert(0);
return E_FAIL;
}
{
#ifdef VBOXWDDMDISP_DEBUG_TIMER
#endif
if (VBOXDISPMODE_IS_3D(pAdapter))
{
/* ensure the device is destroyed in any way.
* Release may not work in case of some leaking, which will leave the crOgl context refering the destroyed VBOXUHGSMI */
if (pDevice->pDevice9If)
}
return hr;
}
{
if (pOverlay)
{
#ifndef VBOXWDDMOVERLAY_TEST
{
{
/* we have reported the dirty rect, may clear it if no locks are pending currently */
}
}
else
{
}
#else
#endif
}
else
hr = E_OUTOFMEMORY;
return hr;
}
static HRESULT APIENTRY vboxWddmDDevUpdateOverlay(HANDLE hDevice, CONST D3DDDIARG_UPDATEOVERLAY* pData)
{
#ifndef VBOXWDDMOVERLAY_TEST
#endif
{
{
/* we have reported the dirty rect, may clear it if no locks are pending currently */
}
}
return hr;
}
{
#ifndef VBOXWDDMOVERLAY_TEST
#endif
{
{
/* we have reported the dirty rect, may clear it if no locks are pending currently */
}
}
return hr;
}
static HRESULT APIENTRY vboxWddmDDevGetOverlayColorControls(HANDLE hDevice, D3DDDIARG_GETOVERLAYCOLORCONTROLS* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevSetOverlayColorControls(HANDLE hDevice, CONST D3DDDIARG_SETOVERLAYCOLORCONTROLS* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevDestroyOverlay(HANDLE hDevice, CONST D3DDDIARG_DESTROYOVERLAY* pData)
{
#ifndef VBOXWDDMOVERLAY_TEST
#else
#endif
{
}
return hr;
}
static HRESULT APIENTRY vboxWddmDDevQueryResourceResidency(HANDLE hDevice, CONST D3DDDIARG_QUERYRESOURCERESIDENCY* pData)
{
/* @todo check residency for the "real" allocations */
#if 0
{
if (pRc->hKMResource)
{
}
}
#endif
return hr;
}
static HRESULT vboxAllocationInit(PVBOXWDDMDISP_ALLOCATION pAlloc, D3DDDI_OPENALLOCATIONINFO *pInfo)
{
{
}
else
{
vboxVDbgPrintR((__FUNCTION__": ERROR: PrivateDriverDataSize(%d) < (%d)\n", pInfo->PrivateDriverDataSize, sizeof (VBOXWDDM_ALLOCINFO)));
hr = E_INVALIDARG;
}
return hr;
}
{
if (pRc)
{
{
/* this is a "standard" allocation resource */
/* both should be actually zero */
if (pDdiAllocInfo->pPrivateDriverData && pDdiAllocInfo->PrivateDriverDataSize >= sizeof (VBOXWDDM_ALLOCINFO))
{
switch(pAllocInfo->enmType)
{
break;
default:
Assert(0);
hr = E_INVALIDARG;
}
}
else
hr = E_INVALIDARG;
}
else
{
/* this is a "generic" resource whose creation is initiated by the UMD */
{
{
{
hr = E_INVALIDARG;
break;
}
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
#endif
vboxVDbgPrint(("\n\n********\n(0x%x:0n%d)Shared OPENNED pAlloc(0x%p), hRc(0x%p), hAl(0x%p), "
"Handle(0x%x), (0n%d) \n***********\n\n",
));
#endif
}
{
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
#endif
{
#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
NULL,
#else
#endif
NULL);
{
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
#endif
}
}
else
{
{
Assert(0);
hr = E_INVALIDARG;
}
hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9CreateCubeTexture((IDirect3DDevice9Ex *)pDevice9If,
#ifdef VBOXWDDMDISP_DEBUG_NOSHARED
NULL,
#else
#endif
NULL);
{
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
#endif
}
}
}
else
{
/* impl */
Assert(0);
}
}
else
hr = E_INVALIDARG;
}
{
{
break;
}
}
else
}
else
{
vboxVDbgPrintR((__FUNCTION__": vboxResourceAlloc failed for hDevice(0x%p), NumAllocations(%d)\n", hDevice, pData->NumAllocations));
hr = E_OUTOFMEMORY;
}
return hr;
}
static HRESULT APIENTRY vboxWddmDDevGetCaptureAllocationHandle(HANDLE hDevice, D3DDDIARG_GETCAPTUREALLOCATIONHANDLE* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDDevCaptureToSysMem(HANDLE hDevice, CONST D3DDDIARG_CAPTURETOSYSMEM* pData)
{
Assert(0);
return E_FAIL;
}
static HRESULT APIENTRY vboxWddmDispCreateDevice (IN HANDLE hAdapter, IN D3DDDIARG_CREATEDEVICE* pCreateData)
{
vboxVDbgPrint(("==> "__FUNCTION__", hAdapter(0x%p), Interface(%d), Version(%d)\n", hAdapter, pCreateData->Interface, pCreateData->Version));
// Assert(0);
PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)RTMemAllocZ(RT_OFFSETOF(VBOXWDDMDISP_DEVICE, apRTs[pAdapter->D3D.cMaxSimRTs]));
if (pDevice)
{
/* Set Viewport to some default values */
pCreateData->pDeviceFuncs->pfnSetVideoProcessRenderTarget = vboxWddmDDevSetVideoProcessRenderTarget;
#ifdef VBOX_WDDMDISP_WITH_PROFILE
#endif
#ifdef VBOXWDDMDISP_DEBUG_TIMER
#endif
do
{
&& !pCreateData->PatchLocationListSize);
{
{
{
#ifdef VBOXDISP_EARLYCREATEDEVICE
if (pRc)
{
// params.BackBufferWidth = 640;
// params.BackBufferHeight = 480;
// params.BackBufferCount = 0;
// params.hDeviceWindow = hWnd;
/* @todo: it seems there should be a way to detect this correctly since
* our vboxWddmDDevSetDisplayMode will be called in case we are using full-screen */
// params.EnableAutoDepthStencil = FALSE;
// params.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
// params.Flags;
// params.FullScreen_RefreshRateInHz;
// params.FullScreen_PresentationInterval;
break;
}
else
{
hr = E_OUTOFMEMORY;
}
#else
//# define VBOXDISP_TEST_SWAPCHAIN
# ifdef VBOXDISP_TEST_SWAPCHAIN
# endif
break;
#endif
}
}
}
else
{
vboxVDbgPrintR((__FUNCTION__": Not implemented: PatchLocationListSize(%d), AllocationListSize(%d)\n",
//pCreateData->pAllocationList = ??
}
} while (0);
}
else
{
hr = E_OUTOFMEMORY;
}
return hr;
}
{
if (VBOXDISPMODE_IS_3D(pAdapter))
{
}
#ifdef VBOX_WITH_VIDEOHWACCEL
else
{
}
#endif
return S_OK;
}
)
{
/*if we are loaded by ddraw module, the Interface version should be 7
* and pAdapterCallbacks should be ddraw-supplied, i.e. reside in ddraw module */
return FALSE;
if (!hDDraw)
return FALSE;
MODULEINFO ModuleInfo = {0};
{
return FALSE;
}
if (VBOXDISP_IS_MODULE_FUNC(ModuleInfo.lpBaseOfDll, ModuleInfo.SizeOfImage, pOpenData->pAdapterCallbacks->pfnQueryAdapterInfoCb))
return TRUE;
if (VBOXDISP_IS_MODULE_FUNC(ModuleInfo.lpBaseOfDll, ModuleInfo.SizeOfImage, pOpenData->pAdapterCallbacks->pfnGetMultisampleMethodListCb))
return TRUE;
return FALSE;
}
{
#if 0 //def DEBUG_misha
DWORD dwMajorVersion = 0;
DWORD dwMinorVersion = 0;
dwVersion = GetVersion();
{
exit(0);
return E_FAIL;
}
#endif
// vboxDispLock();
do
{
{
break;
}
/* check the miniport version match display version */
{
Query.u32Version));
break;
}
#ifdef VBOX_WITH_VIDEOHWACCEL
PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)RTMemAllocZ(RT_OFFSETOF(VBOXWDDMDISP_ADAPTER, aHeads[Query.cInfos]));
#else
#endif
if (pAdapter)
{
if (!vboxDispIsDDraw(pOpenData))
{
do
{
{
/* try enable the 3D */
{
break;
}
else
}
} while (0);
}
#ifdef VBOX_WITH_VIDEOHWACCEL
if (!VBOXDISPMODE_IS_3D(pAdapter))
{
{
}
{
}
}
#endif
{
break;
}
else
{
}
}
else
{
hr = E_OUTOFMEMORY;
}
} while (0);
// vboxDispUnlock();
return hr;
}