VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h@ 33282

Last change on this file since 33282 was 33116, checked in by vboxsync, 14 years ago

wddm/3d: chromium hgsmi transport (guest part, disabled)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.6 KB
Line 
1/*
2 * Copyright (C) 2010 Oracle Corporation
3 *
4 * This file is part of VirtualBox Open Source Edition (OSE), as
5 * available from http://www.virtualbox.org. This file is free software;
6 * you can redistribute it and/or modify it under the terms of the GNU
7 * General Public License (GPL) as published by the Free Software
8 * Foundation, in version 2 as it comes in the "COPYING" file of the
9 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
10 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
11 */
12#ifndef ___VBoxVideoWddm_h___
13#define ___VBoxVideoWddm_h___
14
15#include "../VBoxVideo.h"
16
17/* one page size */
18#define VBOXWDDM_C_DMA_BUFFER_SIZE 0x1000
19#define VBOXWDDM_C_DMA_PRIVATEDATA_SIZE 0x4000
20#define VBOXWDDM_C_ALLOC_LIST_SIZE 0xc00
21#define VBOXWDDM_C_PATH_LOCATION_LIST_SIZE 0xc00
22
23#define VBOXWDDM_C_POINTER_MAX_WIDTH 64
24#define VBOXWDDM_C_POINTER_MAX_HEIGHT 64
25
26#ifdef VBOX_WITH_VDMA
27#define VBOXWDDM_C_VDMA_BUFFER_SIZE (64*_1K)
28#endif
29
30#ifndef VBOXWDDM_RENDER_FROM_SHADOW
31# ifndef VBOX_WITH_VDMA
32# error "VBOX_WITH_VDMA must be defined!!!"
33# endif
34#endif
35
36#ifndef DEBUG_misha
37# ifdef Assert
38# undef Assert
39# define Assert(_a) do{}while(0)
40# endif
41# ifdef AssertBreakpoint
42# undef AssertBreakpoint
43# define AssertBreakpoint() do{}while(0)
44# endif
45# ifdef AssertFailed
46# undef AssertFailed
47# define AssertFailed() do{}while(0)
48# endif
49#endif
50
51PVOID vboxWddmMemAlloc(IN SIZE_T cbSize);
52PVOID vboxWddmMemAllocZero(IN SIZE_T cbSize);
53VOID vboxWddmMemFree(PVOID pvMem);
54
55NTSTATUS vboxWddmCallIsr(PDEVICE_EXTENSION pDevExt);
56
57/* allocation */
58//#define VBOXWDDM_ALLOCATIONINDEX_VOID (~0U)
59typedef struct VBOXWDDM_ALLOCATION
60{
61 LIST_ENTRY SwapchainEntry;
62 struct VBOXWDDM_SWAPCHAIN *pSwapchain;
63 VBOXWDDM_ALLOC_TYPE enmType;
64// VBOXWDDM_ALLOCUSAGE_TYPE enmCurrentUsage;
65 D3DDDI_RESOURCEFLAGS fRcFlags;
66 UINT SegmentId;
67 VBOXVIDEOOFFSET offVram;
68#ifdef VBOX_WITH_VIDEOHWACCEL
69 VBOXVHWA_SURFHANDLE hHostHandle;
70#endif
71 BOOLEAN bVisible;
72 BOOLEAN bAssigned;
73 VBOXWDDM_SURFACE_DESC SurfDesc;
74 struct VBOXWDDM_RESOURCE *pResource;
75 /* to return to the Runtime on DxgkDdiCreateAllocation */
76 DXGK_ALLOCATIONUSAGEHINT UsageHint;
77 uint32_t iIndex;
78 VBOXUHGSMI_SYNCHOBJECT_TYPE enmSynchType;
79 union
80 {
81 PKEVENT pSynchEvent;
82 PRKSEMAPHORE pSynchSemaphore;
83 };
84} VBOXWDDM_ALLOCATION, *PVBOXWDDM_ALLOCATION;
85
86typedef struct VBOXWDDM_RESOURCE
87{
88 uint32_t fFlags;
89 VBOXWDDM_RC_DESC RcDesc;
90 uint32_t cAllocations;
91 VBOXWDDM_ALLOCATION aAllocations[1];
92} VBOXWDDM_RESOURCE, *PVBOXWDDM_RESOURCE;
93
94DECLINLINE(PVBOXWDDM_RESOURCE) vboxWddmResourceForAlloc(PVBOXWDDM_ALLOCATION pAlloc)
95{
96#if 0
97 if(pAlloc->iIndex == VBOXWDDM_ALLOCATIONINDEX_VOID)
98 return NULL;
99 PVBOXWDDM_RESOURCE pRc = (PVBOXWDDM_RESOURCE)(((uint8_t*)pAlloc) - RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pAlloc->iIndex]));
100 return pRc;
101#else
102 return pAlloc->pResource;
103#endif
104}
105
106typedef struct VBOXWDDM_OVERLAY
107{
108 LIST_ENTRY ListEntry;
109 PDEVICE_EXTENSION pDevExt;
110 PVBOXWDDM_RESOURCE pResource;
111 PVBOXWDDM_ALLOCATION pCurentAlloc;
112 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
113 RECT DstRect;
114} VBOXWDDM_OVERLAY, *PVBOXWDDM_OVERLAY;
115
116typedef enum
117{
118 VBOXWDDM_DEVICE_TYPE_UNDEFINED = 0,
119 VBOXWDDM_DEVICE_TYPE_SYSTEM
120} VBOXWDDM_DEVICE_TYPE;
121
122typedef struct VBOXWDDM_DEVICE
123{
124 struct _DEVICE_EXTENSION * pAdapter; /* Adapder info */
125 HANDLE hDevice; /* handle passed to CreateDevice */
126 VBOXWDDM_DEVICE_TYPE enmType; /* device creation flags passed to DxgkDdiCreateDevice, not sure we need it */
127} VBOXWDDM_DEVICE, *PVBOXWDDM_DEVICE;
128
129typedef enum
130{
131 VBOXWDDM_OBJSTATE_TYPE_UNKNOWN = 0,
132 VBOXWDDM_OBJSTATE_TYPE_INITIALIZED,
133 VBOXWDDM_OBJSTATE_TYPE_TERMINATED
134} VBOXWDDM_OBJSTATE_TYPE;
135typedef struct VBOXWDDM_SWAPCHAIN
136{
137 LIST_ENTRY DevExtListEntry;
138 LIST_ENTRY AllocList;
139 struct VBOXWDDM_CONTEXT *pContext;
140 RECT ViewRect;
141 VBOXWDDM_OBJSTATE_TYPE enmState;
142 volatile uint32_t cRefs;
143 VBOXDISP_UMHANDLE hSwapchainUm;
144 VBOXDISP_KMHANDLE hSwapchainKm;
145 PVBOXVIDEOCM_CMD_RECTS_INTERNAL pLastReportedRects;
146}VBOXWDDM_SWAPCHAIN, *PVBOXWDDM_SWAPCHAIN;
147
148typedef struct VBOXWDDM_CONTEXT
149{
150// LIST_ENTRY ListEntry;
151 struct VBOXWDDM_DEVICE * pDevice;
152 HANDLE hContext;
153 VBOXWDDM_CONTEXT_TYPE enmType;
154 UINT NodeOrdinal;
155 UINT EngineAffinity;
156 UINT uLastCompletedCmdFenceId;
157 FAST_MUTEX SwapchainMutex;
158 VBOXWDDM_HTABLE Swapchains;
159 VBOXVIDEOCM_CTX CmContext;
160} VBOXWDDM_CONTEXT, *PVBOXWDDM_CONTEXT;
161
162#define VBOXWDDMENTRY_2_SWAPCHAIN(_pE) ((PVBOXWDDM_SWAPCHAIN)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_SWAPCHAIN, DevExtListEntry)))
163
164typedef struct VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR
165{
166 VBOXWDDM_DMA_PRIVATEDATA_BASEHDR BaseHdr;
167}VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR, *PVBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR;
168
169#ifdef VBOXWDDM_RENDER_FROM_SHADOW
170
171typedef struct VBOXWDDM_DMA_PRIVATEDATA_SHADOW2PRIMARY
172{
173 VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR Hdr;
174 VBOXVDMA_SHADOW2PRIMARY Shadow2Primary;
175} VBOXWDDM_DMA_PRIVATEDATA_SHADOW2PRIMARY, *PVBOXWDDM_DMA_PRIVATEDATA_SHADOW2PRIMARY;
176
177#endif
178
179typedef struct VBOXWDDM_DMA_PRIVATEDATA_BLT
180{
181 VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR Hdr;
182 VBOXVDMA_BLT Blt;
183} VBOXWDDM_DMA_PRIVATEDATA_BLT, *PVBOXWDDM_DMA_PRIVATEDATA_BLT;
184
185typedef struct VBOXWDDM_DMA_PRIVATEDATA_FLIP
186{
187 VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR Hdr;
188 VBOXVDMA_FLIP Flip;
189} VBOXWDDM_DMA_PRIVATEDATA_FLIP, *PVBOXWDDM_DMA_PRIVATEDATA_FLIP;
190
191typedef struct VBOXWDDM_DMA_PRIVATEDATA_CLRFILL
192{
193 VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR Hdr;
194 VBOXVDMA_CLRFILL ClrFill;
195} VBOXWDDM_DMA_PRIVATEDATA_CLRFILL, *PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL;
196
197typedef struct VBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO
198{
199 VBOXWDDM_DMA_ALLOCINFO Alloc;
200 uint32_t cbData;
201 uint32_t bDoNotSignalCompletion;
202} VBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO, *PVBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO;
203
204typedef struct VBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD
205{
206 VBOXWDDM_DMA_PRIVATEDATA_BASEHDR Base;
207 VBOXWDDM_UHGSMI_BUFFER_SUBMIT_INFO aBufInfos[1];
208} VBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD, *PVBOXWDDM_DMA_PRIVATEDATA_CHROMIUM_CMD;
209
210typedef struct VBOXWDDM_OPENALLOCATION
211{
212 D3DKMT_HANDLE hAllocation;
213} VBOXWDDM_OPENALLOCATION, *PVBOXWDDM_OPENALLOCATION;
214
215#ifdef VBOXWDDM_RENDER_FROM_SHADOW
216# define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pShadowAllocation)
217#else
218# define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pPrimaryAllocation)
219#endif
220
221//DECLINLINE(VBOXVIDEOOFFSET) vboxWddmOffsetFromPhAddress(PHYSICAL_ADDRESS phAddr)
222//{
223// return (VBOXVIDEOOFFSET)(phAddr.QuadPart ? phAddr.QuadPart - VBE_DISPI_LFB_PHYSICAL_ADDRESS : VBOXVIDEOOFFSET_VOID);
224//}
225
226#endif /* #ifndef ___VBoxVideoWddm_h___ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette