VBoxDispD3D.cpp revision ca6db47466081ed9ecacc53249d192ed7a740e97
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * VBoxVideo Display D3D User mode dll
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * Copyright (C) 2011-2012 Oracle Corporation
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * available from http://www.virtualbox.org. This file is free software;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * you can redistribute it and/or modify it under the terms of the GNU
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * General Public License (GPL) as published by the Free Software
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c2a7eba496481419a88aba56bbed51f7c8194926vboxsyncvolatile uint32_t g_u32VBoxDispProfileFunctionLoggerIndex = 0;
615105a2b89b7dd89a76504e6a9b8e099704c0d9vboxsync/* the number of frames to collect data before doing dump/reset */
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsync/* uncomment to enable particular logging */
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsync/* allows dumping fps + how much time is spent in ddi functions in comparison with the rest time */
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync//# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_ENABLE
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync/* allows dumping time spent in each function and the number of calls made for any given function */
49207a1552ff3752904e36b9269f08fe643ba871vboxsync VBoxDispProfileDevicePostProcess(PVBOXWDDMDISP_DEVICE pDevice) :
49207a1552ff3752904e36b9269f08fe643ba871vboxsync m_pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9Finish((IDirect3DDevice9Ex *)m_pDevice->pDevice9If);
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync//static VBoxDispProfileSet g_VBoxDispProfileDDI("D3D_DDI");
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_DEV(_pObj) VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE((_pObj)->ProfileDdiFunc, VBoxDispProfileDevicePostProcess, VBoxDispProfileDevicePostProcess(_pObj))
83c86878d483df62ca8db465c671995984838338vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_BASE(_pObj) VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE((_pObj)->ProfileDdiFunc, VBoxDispProfileDummyPostProcess, VBoxDispProfileDummyPostProcess())
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DUMP(_pObj) do {\
83c86878d483df62ca8db465c671995984838338vboxsync } while (0)
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_RESET(_pObj) do {\
83c86878d483df62ca8db465c671995984838338vboxsync } while (0)
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DISABLE_CURRENT() do {\
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync VBOXDISPPROFILE_FUNCTION_LOGGER_DISABLE_CURRENT();\
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync } while (0)
cb893baebb2af3f4fc9cd613a24d5a25e6687a6cvboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_LOG_AND_DISABLE_CURRENT() VBOXDISPPROFILE_FUNCTION_LOGGER_LOG_AND_DISABLE_CURRENT()
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_REPORT_FRAME(_pObj) do { \
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync if (!((_pObj)->ProfileDdiFunc.reportIteration() % VBOXDISPPROFILE_DDI_DUMP_FRAME_COUNT) /*&& !VBOXVDBG_IS_DWM()*/) {\
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_RESET(_pObj); \
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync } while (0)
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_DEV(_pObj) do {} while(0)
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_BASE(_pObj) do {} while(0)
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DUMP(_pObj) do {} while(0)
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_RESET(_pObj) do {} while(0)
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_DISABLE_CURRENT() do {} while (0)
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_LOG_AND_DISABLE_CURRENT() do {} while (0)
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync# define VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_REPORT_FRAME(_pDev) do {} while (0)
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync//static VBoxDispProfileFpsCounter g_VBoxDispFpsDDI(64);
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj) VBOXDISPPROFILE_STATISTIC_LOGGER_DEFINE(&(_pObj)->ProfileDdiFps, VBoxDispProfileDummyPostProcess, VBoxDispProfileDummyPostProcess())
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DISABLE_CURRENT() do {\
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync VBOXDISPPROFILE_STATISTIC_LOGGER_DISABLE_CURRENT();\
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync } while (0)
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DUMP(_pObj) do { \
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync double tup = (_pObj)->ProfileDdiFps.GetTimeProcPercent(); \
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync VBOXDISPPROFILE_DUMP(("[0x%p]: fps: %f, cps: %.1f, host %.1f%%", (_pObj), fps, cps, tup)); \
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync } while (0)
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_REPORT_FRAME(_pObj) do { \
e120ca0501a41ca43369b7ba984f4db2f720bdc8vboxsync if(!((_pObj)->ProfileDdiFps.GetNumFrames() % VBOXDISPPROFILE_DDI_DUMP_FRAME_COUNT)) \
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DUMP(_pObj); \
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync } while (0)
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_LOG_AND_DISABLE_CURRENT() VBOXDISPPROFILE_STATISTIC_LOGGER_LOG_AND_DISABLE_CURRENT()
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj) do {} while(0)
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DISABLE_CURRENT() do {} while (0)
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_LOG_AND_DISABLE_CURRENT() do {} while (0)
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_REPORT_FRAME(_pDev) do {} while (0)
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync# define VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_DUMP(_pObj) do {} while (0)
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_DEV(_pObj) \
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_DEV(_pObj); \
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj);
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_BASE(_pObj) \
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_PROLOGUE_BASE(_pObj); \
054466641bb642a73b66938a9fb851bad1147749vboxsync VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_PROLOGUE(_pObj);
2f3e13b744091a6c1d3bc4b9dc6ef4e7f25bf1cdvboxsync# define VBOXDISPPROFILE_DDI_LOG_AND_DISABLE_CURRENT() \
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_LOG_AND_DISABLE_CURRENT(); \
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_LOG_AND_DISABLE_CURRENT();
4dee4a4f4ff664b16f478e200e0d231407a2b097vboxsync# define VBOXDISPPROFILE_DDI_REPORT_FRAME(_pDev) do {\
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_REPORT_FRAME(_pDev); \
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_REPORT_FRAME(_pDev); \
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync } while (0)
7a3d722456f70226ebc994df685bd736e4324d04vboxsync# define VBOXDISPPROFILE_DDI_REPORT_FLUSH(_pDev) do {\
7a3d722456f70226ebc994df685bd736e4324d04vboxsync VBOXDISPPROFILE_DDI_STATISTIC_LOGGER_REPORT_FRAME(_pDev); \
7a3d722456f70226ebc994df685bd736e4324d04vboxsync VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_REPORT_FRAME(_pDev); \
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync } while (0)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_DDI_REPORT_FLUSH(_pDev) do {} while (0)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_DDI_INIT_CMN(_pObj, _name, _cEntries) do { \
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync (_pObj)->ProfileDdiFps = VBoxDispProfileFpsCounter(); \
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync (_pObj)->ProfileDdiFunc = VBoxDispProfileSet(_name); \
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync } while (0)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync } while (0)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync VBOXDISPPROFILE_DDI_FUNCTION_LOGGER_RESET(_pObj); \
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync } while (0)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_DDI_PRINT(_m) VBOXDISPPROFILE_DUMP(_m)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_DDI_INIT_GLBL() VBOXDISPPROFILE_DDI_INIT_CMN(&g_VBoxDispProfile, "DDI_Adp", 64)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_DDI_INIT_ADP(_pAdp) VBOXDISPPROFILE_DDI_INIT_CMN(_pAdp, "DDI_Adp", 64)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_DDI_INIT_DEV(_pDev) VBOXDISPPROFILE_DDI_INIT_CMN(_pDev, "DDI_Dev", 64)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_DEV(_pObj) do {} while (0)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_BASE(_pObj) do {} while (0)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_DDI_REPORT_FRAME(_pDev) do {} while (0)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_DDI_REPORT_FLUSH(_pDev) do {} while (0)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync# define VBOXDISPPROFILE_DDI_INIT_GLBL() do {} while (0)
561574402775590253d11504354bfe21d80e4858vboxsync# define VBOXDISPPROFILE_DDI_INIT_ADP(_pAdp) do {} while (0)
561574402775590253d11504354bfe21d80e4858vboxsync# define VBOXDISPPROFILE_DDI_INIT_DEV(_pDev) do {} while (0)
561574402775590253d11504354bfe21d80e4858vboxsync# define VBOXDISPPROFILE_DDI_TERM(_pObj) do {} while (0)
561574402775590253d11504354bfe21d80e4858vboxsync# define VBOXDISPPROFILE_DDI_PRINT(_m) do {} while (0)
561574402775590253d11504354bfe21d80e4858vboxsync/* debugging/profiling stuff could go here.
561574402775590253d11504354bfe21d80e4858vboxsync * NOP in release */
561574402775590253d11504354bfe21d80e4858vboxsync VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_DEV((PVBOXWDDMDISP_DEVICE)(_hDevice));
561574402775590253d11504354bfe21d80e4858vboxsync VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_BASE((PVBOXWDDMDISP_ADAPTER)(_hAdapter));
561574402775590253d11504354bfe21d80e4858vboxsync VBOXDISPPROFILE_FUNCTION_DDI_PROLOGUE_BASE(&g_VBoxDispProfile);
561574402775590253d11504354bfe21d80e4858vboxsync//#define VBOXWDDMOVERLAY_TEST
561574402775590253d11504354bfe21d80e4858vboxsync// D3DDDIQUERYTYPE_OCCLUSION
561574402775590253d11504354bfe21d80e4858vboxsync#define VBOX_QUERYTYPE_COUNT() RT_ELEMENTS(gVBoxQueryTypes)
561574402775590253d11504354bfe21d80e4858vboxsync#define VBOXDISPCRHGSMI_SCOPE_SET_DEV(_pDev) do {} while(0)
561574402775590253d11504354bfe21d80e4858vboxsync#define VBOXDISPCRHGSMI_SCOPE_SET_GLOBAL() do {} while(0)
561574402775590253d11504354bfe21d80e4858vboxsyncstatic HRESULT vboxWddmNSCAddAlloc(PVBOXWDDMDISP_NSCADD pData, PVBOXWDDMDISP_ALLOCATION pAlloc)
561574402775590253d11504354bfe21d80e4858vboxsync Assert(pAlloc->fEverWritten || pAlloc->pRc->RcDesc.fFlags.SharedResource);
7a3d722456f70226ebc994df685bd736e4324d04vboxsync if (pData->cAllocationList && pData->cPatchLocationList && pData->cbCommandBuffer >= 4)
7a3d722456f70226ebc994df685bd736e4324d04vboxsync memset(pData->pAllocationList, 0, sizeof (D3DDDI_ALLOCATIONLIST));
7a3d722456f70226ebc994df685bd736e4324d04vboxsync pData->pAllocationList[0].hAllocation = pAlloc->hAllocation;
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync memset(pData->pPatchLocationList, 0, sizeof (D3DDDI_PATCHLOCATIONLIST));
561574402775590253d11504354bfe21d80e4858vboxsync pData->pPatchLocationList[0].PatchOffset = pData->cAllocations*4;
561574402775590253d11504354bfe21d80e4858vboxsync pData->pPatchLocationList[0].AllocationIndex = pData->cAllocations;
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync pData->pvCommandBuffer = (VOID*)(((uint8_t*)pData->pvCommandBuffer) + 4);
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsyncstatic VOID vboxWddmDalRemove(PVBOXWDDMDISP_ALLOCATION pAlloc)
7a3d722456f70226ebc994df685bd736e4324d04vboxsyncstatic HRESULT vboxWddmDalNotifyChange(PVBOXWDDMDISP_DEVICE pDevice)
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync NscAdd.pvCommandBuffer = pDevice->DefaultContext.ContextInfo.pCommandBuffer;
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync NscAdd.cbCommandBuffer = pDevice->DefaultContext.ContextInfo.CommandBufferSize;
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync NscAdd.pAllocationList = pDevice->DefaultContext.ContextInfo.pAllocationList;
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync NscAdd.cAllocationList = pDevice->DefaultContext.ContextInfo.AllocationListSize;
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync NscAdd.pPatchLocationList = pDevice->DefaultContext.ContextInfo.pPatchLocationList;
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync NscAdd.cPatchLocationList = pDevice->DefaultContext.ContextInfo.PatchLocationListSize;
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync Assert(NscAdd.cbCommandBuffer >= sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR));
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync if (NscAdd.cbCommandBuffer < sizeof (VBOXWDDM_DMA_PRIVATEDATA_BASEHDR))
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR pHdr = (PVBOXWDDM_DMA_PRIVATEDATA_BASEHDR)NscAdd.pvCommandBuffer;
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync NscAdd.pvCommandBuffer = (VOID*)(((uint8_t*)NscAdd.pvCommandBuffer) + sizeof (*pHdr));
561574402775590253d11504354bfe21d80e4858vboxsync RTListForEach(&pDevice->DirtyAllocList, pAlloc, VBOXWDDMDISP_ALLOCATION, DirtyAllocListEntry)
561574402775590253d11504354bfe21d80e4858vboxsync Assert(pAlloc->fEverWritten || pAlloc->pRc->RcDesc.fFlags.SharedResource);
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync PVBOXWDDMDISP_ALLOCATION pAlloc = RTListGetFirst(&pDevice->DirtyAllocList, VBOXWDDMDISP_ALLOCATION, DirtyAllocListEntry);
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync HRESULT tmpHr = vboxWddmNSCAddAlloc(&NscAdd, pAlloc);
e35d51bc86d234abdf08fe247ea901501faa022fvboxsync RenderData.CommandLength = pDevice->DefaultContext.ContextInfo.CommandBufferSize - NscAdd.cbCommandBuffer;
79e36c53917758fe8e3623fe9de2e21336431147vboxsync RenderData.NumAllocations = pDevice->DefaultContext.ContextInfo.AllocationListSize - NscAdd.cAllocationList;
040c9969cc5574339d5f1fa2c95c73da095c151bvboxsync Assert(RenderData.NumAllocations == NscAdd.cAllocations);
6f4550210b018b6a25af5bd11fddabb14b69ff60vboxsync RenderData.NumPatchLocations = pDevice->DefaultContext.ContextInfo.PatchLocationListSize - NscAdd.cPatchLocationList;
6f4550210b018b6a25af5bd11fddabb14b69ff60vboxsync Assert(RenderData.NumPatchLocations == NscAdd.cAllocations);
6f4550210b018b6a25af5bd11fddabb14b69ff60vboxsync// RenderData.NewCommandBufferSize = sizeof (VBOXVDMACMD) + 4 * (100);
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync// RenderData.NewAllocationListSize = 100;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync// RenderData.NewPatchLocationListSize = 100;
1f277e5b999f572b1ef1fe4ef593c603ea463be3vboxsync RenderData.hContext = pDevice->DefaultContext.ContextInfo.hContext;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync HRESULT hr = pDevice->RtCallbacks.pfnRenderCb(pDevice->hDevice, &RenderData);
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsync pDevice->DefaultContext.ContextInfo.CommandBufferSize = RenderData.NewCommandBufferSize;
a05b4948186b031cbd8c3b7c6cfe973d69039016vboxsync pDevice->DefaultContext.ContextInfo.pCommandBuffer = RenderData.pNewCommandBuffer;
a05b4948186b031cbd8c3b7c6cfe973d69039016vboxsync pDevice->DefaultContext.ContextInfo.AllocationListSize = RenderData.NewAllocationListSize;
088a45b35631115e7729fdc57a56f49faf0c2a43vboxsync pDevice->DefaultContext.ContextInfo.pAllocationList = RenderData.pNewAllocationList;
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync pDevice->DefaultContext.ContextInfo.PatchLocationListSize = RenderData.NewPatchLocationListSize;
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync pDevice->DefaultContext.ContextInfo.pPatchLocationList = RenderData.pNewPatchLocationList;
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync } while (1);
561574402775590253d11504354bfe21d80e4858vboxsyncstatic HRESULT vboxWddmDalCheckUnlock(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc)
6c5e2fff0e3fdfc7c3f3fb2e7b7ec8ebb2223cecvboxsync if (!pAlloc->fAllocLocked || pAlloc->LockInfo.cLocks)
cbf5a4260109bea05e1492f0b375b11a738cfb1dvboxsync HRESULT hr = pDevice->RtCallbacks.pfnUnlockCb(pDevice->hDevice, &Unlock);
615105a2b89b7dd89a76504e6a9b8e099704c0d9vboxsyncstatic HRESULT vboxWddmDalCheckLock(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc, D3DDDI_LOCKFLAGS Flags)
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync WARN(("vboxWddmDalNotifyChange failed %#x, ignoring", hr));
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync hr = pDevice->RtCallbacks.pfnLockCb(pDevice->hDevice, &LockData);
040c9969cc5574339d5f1fa2c95c73da095c151bvboxsync WARN(("pfnLockCb failed %#x, Flags %#x", hr, Flags.Value));
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsyncstatic BOOLEAN vboxWddmDalCheckNotifyRemove(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc)
8374dfdfc4d7fdfcfbaeec4c65fbf856212d4c32vboxsyncstatic BOOLEAN vboxWddmDalCheckAdd(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOLEAN fWrite)
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync if (!pAlloc->hAllocation /* only shared resources matter */
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync Assert(!pAlloc->DirtyAllocListEntry.pNext || pAlloc->hSharedHandle /*|| pAlloc->fDirtyWrite*/);
8374dfdfc4d7fdfcfbaeec4c65fbf856212d4c32vboxsync Assert(fWrite || pAlloc->fEverWritten || pAlloc->pRc->RcDesc.fFlags.SharedResource);
4b4bf806fd0a1f544ae7c3866d4c056bbb306ca3vboxsync RTListAppend(&pDevice->DirtyAllocList, &pAlloc->DirtyAllocListEntry);
4b4bf806fd0a1f544ae7c3866d4c056bbb306ca3vboxsyncstatic DECLINLINE(BOOLEAN) vboxWddmDalCheckAddRc(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_RESOURCE pRc, BOOLEAN fWrite)
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsync PVBOXWDDMDISP_ALLOCATION pDAlloc = &pRc->aAllocations[i];
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsync fChanged |= vboxWddmDalCheckAdd(pDevice, pDAlloc, fWrite);
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsyncstatic VOID vboxWddmDalCheckAddDepthStencil(PVBOXWDDMDISP_DEVICE pDevice)
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsync vboxWddmDalCheckAddRc(pDevice, pDevice->pDepthStencilRc, TRUE);
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsyncstatic VOID vboxWddmDalCheckAddRTs(PVBOXWDDMDISP_DEVICE pDevice)
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsync vboxWddmDalCheckAdd(pDevice, pDevice->apRTs[i], TRUE);
e67d45467855114df09f2bf4c07505beecba573fvboxsyncstatic VOID vboxWddmDalCheckAddSamplers(PVBOXWDDMDISP_DEVICE pDevice)
52b9ffdb596974faf66a826097386ba74a9c7cd0vboxsync for (UINT i = 0, iSampler = 0; iSampler < pDevice->cSamplerTextures; ++i)
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsync Assert(i < RT_ELEMENTS(pDevice->aSamplerTextures));
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsync vboxWddmDalCheckAddRc(pDevice, pDevice->aSamplerTextures[i], FALSE);
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsyncstatic VOID vboxWddmDalCheckAddOnDraw(PVBOXWDDMDISP_DEVICE pDevice)
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsyncstatic BOOLEAN vboxWddmDalIsEmpty(PVBOXWDDMDISP_DEVICE pDevice)
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsyncstatic bool vboxVhwaIsEnabled(PVBOXWDDMDISP_ADAPTER pAdapter)
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsync if (pAdapter->aHeads[i].Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED)
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsync return true;
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsync return false;
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsyncstatic bool vboxVhwaHasCKeying(PVBOXWDDMDISP_ADAPTER pAdapter)
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsync VBOXVHWA_INFO* pSettings = &pAdapter->aHeads[i].Vhwa.Settings;
8b1975ddd07b69272802f37efbcf9a358c32a15avboxsync return true;
561574402775590253d11504354bfe21d80e4858vboxsync return false;
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsyncstatic void vboxResourceFree(PVBOXWDDMDISP_RESOURCE pRc)
8374dfdfc4d7fdfcfbaeec4c65fbf856212d4c32vboxsyncvoid vboxWddmResourceInit(PVBOXWDDMDISP_RESOURCE pRc, UINT cAllocs)
8374dfdfc4d7fdfcfbaeec4c65fbf856212d4c32vboxsync memset(pRc, 0, RT_OFFSETOF(VBOXWDDMDISP_RESOURCE, aAllocations[cAllocs]));
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsyncstatic PVBOXWDDMDISP_RESOURCE vboxResourceAlloc(UINT cAllocs)
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync PVBOXWDDMDISP_RESOURCE pRc = (PVBOXWDDMDISP_RESOURCE)RTMemAlloc(RT_OFFSETOF(VBOXWDDMDISP_RESOURCE, aAllocations[cAllocs]));
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsyncstatic void vboxWddmDbgSynchMemCheck(PVBOXWDDMDISP_ALLOCATION pAlloc, D3DLOCKED_RECT *pLockInfo)
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync iRc = memcmp(pLockInfo->pBits, pAlloc->pvMem, pAlloc->SurfDesc.cbSize);
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync Assert(pAlloc->SurfDesc.pitch <= (UINT)pLockInfo->Pitch);
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync uint32_t cRows = vboxWddmCalcNumRows(0, pAlloc->SurfDesc.height, pAlloc->SurfDesc.format);
49207a1552ff3752904e36b9269f08fe643ba871vboxsyncstatic VOID vboxWddmDbgRcSynchMemCheck(PVBOXWDDMDISP_RESOURCE pRc)
7b10aacc7acbc3a9b05b06bdebf9e8209bdbf1a6vboxsync HRESULT hr = VBoxD3DIfLockRect(pRc, i, &Rect, NULL, D3DLOCK_READONLY);
7b10aacc7acbc3a9b05b06bdebf9e8209bdbf1a6vboxsync PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i];
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsyncstatic HRESULT vboxWddmRenderTargetSet(PVBOXWDDMDISP_DEVICE pDevice, UINT iRt, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bOnSwapchainSynch);
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsyncDECLINLINE(VOID) vboxWddmSwapchainInit(PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync memset(pSwapchain, 0, sizeof (VBOXWDDMDISP_SWAPCHAIN));
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsyncstatic HRESULT vboxWddmSwapchainKmSynch(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync D3DKMT_HANDLE ahAllocs[VBOXWDDMDISP_MAX_SWAPCHAIN_SIZE];
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync memset(&Buf.SwapchainInfo, 0, sizeof (Buf.SwapchainInfo));
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync Buf.SwapchainInfo.EscapeHdr.escapeCode = VBOXESC_SWAPCHAININFO;
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync Buf.SwapchainInfo.SwapchainInfo.hSwapchainKm = pSwapchain->hSwapchainKm;
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync Buf.SwapchainInfo.SwapchainInfo.hSwapchainUm = (VBOXDISP_UMHANDLE)pSwapchain;
e08dd625e50b1975366f9e95b1135ec14763c7b0vboxsync HRESULT hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DSwapchain9GetHostWinID(pSwapchain->pSwapChainIf, &Buf.SwapchainInfo.SwapchainInfo.winHostID);
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync WARN(("pfnVBoxWineExD3DSwapchain9GetHostWinID failed, hr 0x%x", hr));
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync// Buf.SwapchainInfo.SwapchainInfo.Rect;
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync// Buf.SwapchainInfo.SwapchainInfo.u32Reserved;
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync Buf.SwapchainInfo.SwapchainInfo.cAllocs = pSwapchain->cRTs;
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync for (UINT i = 0; i < Buf.SwapchainInfo.SwapchainInfo.cAllocs; ++i)
561574402775590253d11504354bfe21d80e4858vboxsync// Assert(pSwapchain->aRTs[i].pAlloc->hAllocation);
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync Buf.SwapchainInfo.SwapchainInfo.ahAllocs[i] = pSwapchain->aRTs[i].pAlloc->hAllocation;
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync Assert(cAllocsKm == Buf.SwapchainInfo.SwapchainInfo.cAllocs || !cAllocsKm);
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync if (cAllocsKm == Buf.SwapchainInfo.SwapchainInfo.cAllocs)
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync DdiEscape.hContext = pDevice->DefaultContext.ContextInfo.hContext;
1439977563a6d2143201766a0d7c61e50a5acf75vboxsync // DdiEscape.Flags.Value = 0;
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync DdiEscape.PrivateDriverDataSize = RT_OFFSETOF(VBOXDISPIFESCAPE_SWAPCHAININFO, SwapchainInfo.ahAllocs[Buf.SwapchainInfo.SwapchainInfo.cAllocs]);
0b6e534f55fcb5870df42b58ae354ad5fdbda66avboxsync hr = pDevice->RtCallbacks.pfnEscapeCb(pDevice->pAdapter->hAdapter, &DdiEscape);
561574402775590253d11504354bfe21d80e4858vboxsync pSwapchain->hSwapchainKm = Buf.SwapchainInfo.SwapchainInfo.hSwapchainKm;
cc04399629ac806e92deeb3006dc1d507a608901vboxsyncstatic HRESULT vboxWddmSwapchainKmDestroy(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync /* submit empty swapchain to destroy the KM one */
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync hr = vboxWddmSwapchainKmSynch(pDevice, pSwapchain);
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsyncstatic HRESULT vboxWddmSwapchainDestroyIf(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsyncDECLINLINE(VOID) vboxWddmSwapchainClear(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync /* first do a Km destroy to ensure all km->um region submissions are completed */
6c5e2fff0e3fdfc7c3f3fb2e7b7ec8ebb2223cecvboxsyncVOID vboxWddmSwapchainDestroy(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsyncstatic VOID vboxWddmSwapchainDestroyAll(PVBOXWDDMDISP_DEVICE pDevice)
5413a6a2dab50ebebc702aa2ae7d8059dcd09c9cvboxsync PVBOXWDDMDISP_SWAPCHAIN pCur = RTListGetFirst(&pDevice->SwapchainList, VBOXWDDMDISP_SWAPCHAIN, ListEntry);
49207a1552ff3752904e36b9269f08fe643ba871vboxsync if (!RTListNodeIsLast(&pDevice->SwapchainList, &pCur->ListEntry))
05c28d9d4557bed6e320dfee1acca69408bc3c15vboxsync pNext = RTListNodeGetNext(&pCur->ListEntry, VBOXWDDMDISP_SWAPCHAIN, ListEntry);
f2fedb6cbb946e9dd6d418b1472373395e2ac34fvboxsyncstatic PVBOXWDDMDISP_SWAPCHAIN vboxWddmSwapchainAlloc(PVBOXWDDMDISP_DEVICE pDevice)
f2fedb6cbb946e9dd6d418b1472373395e2ac34fvboxsync PVBOXWDDMDISP_SWAPCHAIN pSwapchain = (PVBOXWDDMDISP_SWAPCHAIN)RTMemAllocZ(sizeof (VBOXWDDMDISP_SWAPCHAIN));
e8e40640deaea2e9002e1bf9cf4944e2590c6e7avboxsync RTListAppend(&pDevice->SwapchainList, &pSwapchain->ListEntry);
6c6531128b39093daeac902a8705c0bdf15b31ccvboxsyncDECLINLINE(VOID) vboxWddmSwapchainRtInit(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_RENDERTGT pRt, PVBOXWDDMDISP_ALLOCATION pAlloc)
f6adf1a86574758258baa232172c965aed0d848dvboxsyncDECLINLINE(VOID) vboxWddmSwapchainBbAddTail(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bAssignAsBb)
else if (bAssignAsBb)
DECLINLINE(PVBOXWDDMDISP_RENDERTGT) vboxWddmSwapchainRtForAlloc(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_ALLOCATION pAlloc)
return NULL;
Assert(0);
return NULL;
DECLINLINE(UINT) vboxWddmSwapchainRtIndex(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_RENDERTGT pRT)
return iRt;
DECLINLINE(VOID) vboxWddmSwapchainRtRemove(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_RENDERTGT pRT)
DECLINLINE(VOID) vboxWddmSwapchainSetBb(PVBOXWDDMDISP_SWAPCHAIN pSwapchain, PVBOXWDDMDISP_RENDERTGT pRT)
PVBOXWDDMDISP_SWAPCHAIN vboxWddmSwapchainFindCreate(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_ALLOCATION pBbAlloc, BOOL *pbNeedPresent)
if (pSwapchain)
return pSwapchain;
if (!pSwapchain)
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
&& vboxWddmFmtNoAlphaFormat(pBbAlloc->SurfDesc.format) == vboxWddmFmtNoAlphaFormat(pRt->pAlloc->SurfDesc.format)
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;
return hr;
return hr;
#ifdef DEBUG_misha
VBOXVDBG_CHECK_SWAPCHAIN_SYNC(hr = pDevice->pDevice9If->StretchRect(pD3D9OldSurf, NULL, pD3D9Surf, NULL, D3DTEXF_NONE); Assert(hr == S_OK),
if (pD3D9OldSurf)
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);
return hr;
static HRESULT vboxWddmSwapchainSynch(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
return hr;
static VOID vboxWddmSwapchainFillPresentParams(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*/
static HRESULT vboxWddmSwapchainSwtichOffscreenRt(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain, BOOL fForceCreate)
if (pOldIf)
return hr;
if (fHasSurf)
if (pD3D9OldSurf)
if (pD3D9OldSurf)
VBOXVDBG_CHECK_SWAPCHAIN_SYNC(hr = pDevice9If->StretchRect(pD3D9OldSurf, NULL, pD3D9NewSurf, NULL, D3DTEXF_NONE); Assert(hr == S_OK),
if (pD3D9OldSurf)
if (pD3D9OldSurf)
return hr;
static HRESULT vboxWddmSwapchainSwtichRtPresent(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
return S_OK;
return hr;
return hr;
HRESULT vboxWddmSwapchainChkCreateIf(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
return S_OK;
if (pOldIf)
if (fNeedRtPresentSwitch)
if (!bReuseSwapchain)
#ifdef VBOX_WITH_CRHGSMI
hr = pAdapter->D3D.pD3D9If->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL, fFlags, &Params.Base, &pDevice9If);
if (pOldIf)
return hr;
if (fNeedRtPresentSwitch)
#ifndef VBOXWDDM_WITH_VISIBLE_FB
#ifdef DEBUG
if (pOldIf)
return S_OK;
static HRESULT vboxWddmSwapchainCreateIfForRc(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_RESOURCE pRc, PVBOXWDDMDISP_SWAPCHAIN *ppSwapchain)
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;
return E_FAIL;
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 */
return hr;
return S_OK;
static HRESULT vboxWddmSwapchainRtSurfGet(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain, UINT iRt, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bOnSwapchainSynch, IDirect3DSurface9 **ppSurf)
if (!bOnSwapchainSynch)
if (iRt == 0)
return hr;
return hr;
return hr;
return S_OK;
static HRESULT vboxWddmSwapchainPresentPerform(PVBOXWDDMDISP_DEVICE pDevice, PVBOXWDDMDISP_SWAPCHAIN pSwapchain)
return hr;
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,
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;
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
if (iNewRTFB == i)
# define VBOXVDBG_RTGT_STATECHECK(_pDev) (vboxWddmDbgRenderTargetCheck((_pDev), (_pDev)->aScreens[(_pDev)->iPrimaryScreen].pRenderTargetRc, (_pDev)->aScreens[(_pDev)->iPrimaryScreen].iRenderTargetFrontBuf))
static HRESULT vboxWddmRenderTargetSet(PVBOXWDDMDISP_DEVICE pDevice, UINT iRt, PVBOXWDDMDISP_ALLOCATION pAlloc, BOOL bOnSwapchainSynch)
if (pSwapchain)
return hr;
return hr;
return hr;
switch (dwReason)
case DLL_PROCESS_ATTACH:
#ifdef VBOXWDDMDISP_DEBUG_VEHANDLER
return TRUE;
#ifdef VBOXWDDMDISP_DEBUG_VEHANDLER
case DLL_PROCESS_DETACH:
#ifdef VBOXWDDMDISP_DEBUG_VEHANDLER
return TRUE;
return TRUE;
return FALSE;
case D3DDDICAPS_DDRAW:
#ifdef VBOX_WITH_VIDEOHWACCEL
#ifdef VBOX_WITH_VIDEOHWACCEL
case D3DDDICAPS_GETFORMATDATA:
memcpy(pData->pData, pAdapter->Formats.paFormstOps, pAdapter->Formats.cFormstOps * sizeof (FORMATOP));
Assert(0);
case D3DDDICAPS_GETD3D3CAPS:
case D3DDDICAPS_GETD3D7CAPS:
case D3DDDICAPS_GETD3D9CAPS:
case D3DDDICAPS_GETD3D8CAPS:
case D3DDDICAPS_GETD3D5CAPS:
case D3DDDICAPS_GETD3D6CAPS:
Assert(0);
Assert(0);
return S_OK;
static HRESULT APIENTRY vboxWddmDDevSetRenderState(HANDLE hDevice, CONST D3DDDIARG_RENDERSTATE* pData)
return hr;
return S_OK;
static HRESULT APIENTRY vboxWddmDDevValidateDevice(HANDLE hDevice, D3DDDIARG_VALIDATETEXTURESTAGESTATE* pData)
#ifdef DEBUG_misha
Assert(0);
return S_OK;
static HRESULT APIENTRY vboxWddmDDevSetTextureStageState(HANDLE hDevice, CONST D3DDDIARG_TEXTURESTAGESTATE* pData)
hr = pDevice9If->SetTextureStageState(pData->Stage, D3DTEXTURESTAGESTATETYPE(lookup.dType), pData->Value);
return hr;
if (pRc)
Assert(0);
if (idx >= 0)
#ifdef DEBUG_misha
if (idx >= 0)
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)
#ifdef DEBUG
++cStreams;
((uint8_t*)pDevice->aStreamSourceUm[i].pvBuffer) + pData->VStart * pDevice->aStreamSourceUm[i].cbStride,
#ifdef DEBUG
++cStreams;
return hr;
static HRESULT APIENTRY vboxWddmDDevDrawIndexedPrimitive(HANDLE hDevice, CONST D3DDDIARG_DRAWINDEXEDPRIMITIVE* pData)
#ifdef DEBUG
++cStreams;
cStreams = 0;
++cStreams;
if (!pvIndexBuffer)
HRESULT tmpHr = pDevice9If->SetIndices((IDirect3DIndexBuffer9*)pDevice->IndiciesInfo.pIndicesAlloc->pD3DIf);
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)
int stream;
IDirect3DVertexBuffer9 *pD3D9VBuf = (IDirect3DVertexBuffer9*)pDevice->aStreamSource[stream]->pD3DIf;
RECT r;
r.top = 0;
VBoxD3DIfLockUnlockMemSynch(pDevice->aStreamSource[stream], &pLock->LockedRect, &r, true /*bool bToLockInfo*/);
hr = pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset, pData->PrimitiveCount);
#ifdef DEBUG
int stream;
#ifdef DEBUG
++cStreams;
(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);
hr = pDevice9If->DrawPrimitive(pData->PrimitiveType, pData->FirstVertexOffset/pDevice->StreamSourceInfo[stream].uiStride, pData->PrimitiveCount);
#ifdef DEBUG
return hr;
static HRESULT APIENTRY vboxWddmDDevDrawIndexedPrimitive2(HANDLE hDevice, CONST D3DDDIARG_DRAWINDEXEDPRIMITIVE2* pData, UINT dwIndicesSize, CONST VOID* pIndexBuffer, CONST UINT* pFlagBuffer)
HRESULT tmpHr = pDevice9If->SetStreamSource(0, (IDirect3DVertexBuffer9*)pDevice->aStreamSource[0]->pD3DIf, pDevice->StreamSourceInfo[0].uiOffset, pDevice->StreamSourceInfo[0].uiStride);
HRESULT tmpHr = pDevice9If->SetIndices((IDirect3DIndexBuffer9*)pDevice->IndiciesInfo.pIndicesAlloc->pD3DIf);
return hr;
HRESULT hr = pDevice->pAdapter->D3D.D3D.pfnVBoxWineExD3DDev9VolTexBlt((IDirect3DDevice9Ex*)pDevice9If, pSrcTex, pDstTex,
return hr;;
Assert(0);
return E_FAIL;
#ifdef DEBUG
RECT tstRect = {0,0, pDstRc->aAllocations[0].SurfDesc.width, pDstRc->aAllocations[0].SurfDesc.height};
hr = pDevice9If->StretchRect(pSrcSurfIf, &pData->SrcRect, pDstSurfIf, &DstRect, D3DTEXF_NONE); Assert(hr == S_OK),
return hr;
Assert(0);
return E_FAIL;
return S_OK;
static HRESULT APIENTRY vboxWddmDDevClear(HANDLE hDevice, CONST D3DDDIARG_CLEAR* pData, UINT NumRect, CONST RECT* pRect)
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)
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)
switch (DevInfoID)
case D3DDDIDEVINFOID_VCACHE:
Assert(0);
return hr;
return E_INVALIDARG;
// Assert(pRc != pScreen->pRenderTargetRc || pScreen->iRenderTargetFrontBuf != pData->SubResourceIndex);
#ifdef VBOXWDDMDISP_DAL_CHECK_LOCK
return hr;
Assert((pAlloc->LockInfo.fFlags.Value & ~1) == (pData->Flags.Value & ~1)); /* <- 1 is "ReadOnly" flag */
Assert(0);
if (pRect)
Assert(0);
Assert((pAlloc->LockInfo.fFlags.Value & ~1) == (pData->Flags.Value & ~1)); /* <- 1 is "ReadOnly" flag */
if (pBox)
bLocked = true;
if (pRange)
if (pRange)
r.top = 0;
pr = &r;
bLocked = true;
if (pRange)
if (pRange)
r.top = 0;
pr = &r;
#ifdef VBOXWDDMDISP_DAL_CHECK_LOCK
offset = vboxWddmCalcOffXYrd(pData->Area.left, pData->Area.top, pAlloc->SurfDesc.pitch, pAlloc->SurfDesc.format);
Assert(0);
offset = 0;
return hr;
return E_INVALIDARG;
Assert(0);
// Assert(!pAlloc->LockInfo.cLocks);
r.top = 0;
pr = &r;
pr,
// Assert(!pAlloc->LockInfo.cLocks);
r.top = 0;
pr = &r;
pr,
#ifdef VBOXWDDMDISP_DAL_CHECK_LOCK
if (fDoUnlock)
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)
return E_OUTOFMEMORY;
bool bIssueCreateResource = false;
bool bCreateKMResource = false;
bool bSetHostID = false;
pAllocation->SurfDesc.cbSize = vboxWddmCalcSize(pAllocation->SurfDesc.pitch, pAllocation->SurfDesc.height, pAllocation->SurfDesc.format);
if (minPitch)
pAllocation->SurfDesc.d3dWidth = vboxWddmCalcWidthForPitch(pAllocation->SurfDesc.pitch, pAllocation->SurfDesc.format);
Assert(VBOXWDDMDISP_IS_TEXTURE(pRc->RcDesc.fFlags) && !pRc->RcDesc.fFlags.CubeMap); /* <- tested for textures only! */
bIssueCreateResource = true;
bCreateKMResource = true;
bIssueCreateResource = true;
bSetHostID = true;
if (pDdiAllocate)
if (bSetHostID)
if (bCreateKMResource)
for (UINT j = 0; j < i; ++j)
return hr;
if (pSwapchain)
return hr;
static HRESULT APIENTRY vboxWddmDDevSetDisplayMode(HANDLE hDevice, CONST D3DDDIARG_SETDISPLAYMODE* pData)
return hr;
#ifdef VBOXWDDM_TEST_UHGSMI
#ifdef VBOXWDDM_TEST_UHGSMI
#ifdef VBOX_WITH_CROGL
return hr;
if (pSrcAlloc)
if (pDstAlloc)
VBoxDispProfileScopeLogger<VBoxDispProfileEntry> profilePresentCbLogger(pDevice->ProfileDdiPresentCb.alloc("pfnPresentCb"));
#ifdef VBOXWDDMDISP_DEBUG_TIMER
#ifdef VBOXWDDMDISP_DEBUG_TIMER
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;
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)
#ifdef DEBUG_misha
Assert(0);
return hr;
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;
Assert(!pDstSwapchain || vboxWddmSwapchainGetFb(pDstSwapchain)->pAlloc != pDstAlloc || vboxWddmSwapchainNumRTs(pDstSwapchain) == 1);
if (pSrcSwapchain)
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),
Assert(0);
return hr;
return hr;
Assert(0);
return E_FAIL;
if (!pQuery)
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:
Assert(0);
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)
if (pD3D9Surf)
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
* Release may not work in case of some leaking, which will leave the crOgl context refering the destroyed VBOXUHGSMI */
return hr;
if (pOverlay)
#ifndef VBOXWDDMOVERLAY_TEST
return hr;
static HRESULT APIENTRY vboxWddmDDevUpdateOverlay(HANDLE hDevice, CONST D3DDDIARG_UPDATEOVERLAY* pData)
#ifndef VBOXWDDMOVERLAY_TEST
return hr;
#ifndef VBOXWDDMOVERLAY_TEST
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
return hr;
static HRESULT APIENTRY vboxWddmDDevQueryResourceResidency(HANDLE hDevice, CONST D3DDDIARG_QUERYRESOURCERESIDENCY* pData)
return hr;
if (pRc)
#ifndef VBOXWDDMDISP_DEBUG_NOSHARED
Assert(!pAllocation->hSharedHandle == (pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE));
if (pDdiAllocInfo->pPrivateDriverData && pDdiAllocInfo->PrivateDriverDataSize >= sizeof (VBOXWDDM_ALLOCINFO))
Assert(0);
vboxVDbgPrintR((__FUNCTION__": vboxResourceAlloc failed for hDevice(0x%p), NumAllocations(%d)\n", hDevice, pData->NumAllocations));
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));
PVBOXWDDMDISP_DEVICE pDevice = (PVBOXWDDMDISP_DEVICE)RTMemAllocZ(RT_OFFSETOF(VBOXWDDMDISP_DEVICE, apRTs[pAdapter->D3D.cMaxSimRTs]));
if (pDevice)
pCreateData->pDeviceFuncs->pfnSetVideoProcessRenderTarget = vboxWddmDDevSetVideoProcessRenderTarget;
#ifdef VBOX_WDDMDISP_WITH_PROFILE
#ifdef VBOXWDDMDISP_DEBUG_TIMER
#ifdef VBOXDISP_EARLYCREATEDEVICE
if (pRc)
// params.hDeviceWindow = hWnd;
# ifdef VBOXDISP_TEST_SWAPCHAIN
vboxVDbgPrintR((__FUNCTION__": Not implemented: PatchLocationListSize(%d), AllocationListSize(%d)\n",
return hr;
#ifdef VBOX_WITH_VIDEOHWACCEL
return S_OK;
return FALSE;
if (!hDDraw)
return FALSE;
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;
exit(0);
return E_FAIL;
#ifdef VBOX_WITH_VIDEOHWACCEL
PVBOXWDDMDISP_ADAPTER pAdapter = (PVBOXWDDMDISP_ADAPTER)RTMemAllocZ(RT_OFFSETOF(VBOXWDDMDISP_ADAPTER, aHeads[Query.cInfos]));
if (pAdapter)
#ifdef VBOX_WITH_VIDEOHWACCEL
return hr;