VirtualBox

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

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

wddm/3d: more impl

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 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#define VBOXWDDM_C_VDMA_BUFFER_SIZE (64*_1K)
27
28#ifdef VBOXWDDM_WITH_VBVA
29# define VBOXWDDM_RENDER_FROM_SHADOW
30#endif
31
32#ifndef DEBUG_misha
33# ifdef Assert
34# undef Assert
35# define Assert(_a) do{}while(0)
36# endif
37# ifdef AssertBreakpoint
38# undef AssertBreakpoint
39# define AssertBreakpoint() do{}while(0)
40# endif
41# ifdef AssertFailed
42# undef AssertFailed
43# define AssertFailed() do{}while(0)
44# endif
45#endif
46
47PVOID vboxWddmMemAlloc(IN SIZE_T cbSize);
48PVOID vboxWddmMemAllocZero(IN SIZE_T cbSize);
49VOID vboxWddmMemFree(PVOID pvMem);
50
51/* allocation */
52//#define VBOXWDDM_ALLOCATIONINDEX_VOID (~0U)
53typedef struct VBOXWDDM_ALLOCATION
54{
55 VBOXWDDM_ALLOC_TYPE enmType;
56// VBOXWDDM_ALLOCUSAGE_TYPE enmCurrentUsage;
57 D3DDDI_RESOURCEFLAGS fRcFlags;
58 UINT SegmentId;
59 VBOXVIDEOOFFSET offVram;
60#ifdef VBOX_WITH_VIDEOHWACCEL
61 VBOXVHWA_SURFHANDLE hHostHandle;
62#endif
63 BOOLEAN bVisible;
64 BOOLEAN bAssigned;
65 VBOXWDDM_SURFACE_DESC SurfDesc;
66 struct VBOXWDDM_RESOURCE *pResource;
67 /* to return to the Runtime on DxgkDdiCreateAllocation */
68 DXGK_ALLOCATIONUSAGEHINT UsageHint;
69 uint32_t iIndex;
70} VBOXWDDM_ALLOCATION, *PVBOXWDDM_ALLOCATION;
71
72typedef struct VBOXWDDM_RESOURCE
73{
74 uint32_t fFlags;
75 VBOXWDDM_RC_DESC RcDesc;
76 uint32_t cAllocations;
77 VBOXWDDM_ALLOCATION aAllocations[1];
78} VBOXWDDM_RESOURCE, *PVBOXWDDM_RESOURCE;
79
80DECLINLINE(PVBOXWDDM_RESOURCE) vboxWddmResourceForAlloc(PVBOXWDDM_ALLOCATION pAlloc)
81{
82#if 0
83 if(pAlloc->iIndex == VBOXWDDM_ALLOCATIONINDEX_VOID)
84 return NULL;
85 PVBOXWDDM_RESOURCE pRc = (PVBOXWDDM_RESOURCE)(((uint8_t*)pAlloc) - RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pAlloc->iIndex]));
86 return pRc;
87#else
88 return pAlloc->pResource;
89#endif
90}
91
92typedef struct VBOXWDDM_OVERLAY
93{
94 PDEVICE_EXTENSION pDevExt;
95 PVBOXWDDM_RESOURCE pResource;
96 PVBOXWDDM_ALLOCATION pCurentAlloc;
97 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
98} VBOXWDDM_OVERLAY, *PVBOXWDDM_OVERLAY;
99
100typedef enum
101{
102 VBOXWDDM_DEVICE_TYPE_UNDEFINED = 0,
103 VBOXWDDM_DEVICE_TYPE_SYSTEM
104} VBOXWDDM_DEVICE_TYPE;
105
106typedef struct VBOXWDDM_DEVICE
107{
108 struct _DEVICE_EXTENSION * pAdapter; /* Adapder info */
109 HANDLE hDevice; /* handle passed to CreateDevice */
110 VBOXWDDM_DEVICE_TYPE enmType; /* device creation flags passed to DxgkDdiCreateDevice, not sure we need it */
111} VBOXWDDM_DEVICE, *PVBOXWDDM_DEVICE;
112
113typedef enum
114{
115 VBOXWDDM_CONTEXT_TYPE_UNDEFINED = 0,
116 VBOXWDDM_CONTEXT_TYPE_SYSTEM,
117 VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D,
118 VBOXWDDM_CONTEXT_TYPE_CUSTOM_2D
119} VBOXWDDM_CONTEXT_TYPE;
120
121typedef struct VBOXWDDM_CONTEXT
122{
123 LIST_ENTRY ListEntry;
124 struct VBOXWDDM_DEVICE * pDevice;
125 HANDLE hContext;
126 VBOXWDDM_CONTEXT_TYPE enmType;
127 UINT NodeOrdinal;
128 UINT EngineAffinity;
129 UINT uLastCompletedCmdFenceId;
130 RECT ViewRect;
131 PVBOXVIDEOCM_CMD_RECTS pLastReportedRects;
132 VBOXVIDEOCM_CTX CmContext;
133} VBOXWDDM_CONTEXT, *PVBOXWDDM_CONTEXT;
134
135#define VBOXWDDMENTRY_2_CONTEXT(_pE) ((PVBOXWDDM_CONTEXT)((uint8_t*)(_pE) - RT_OFFSETOF(VBOXWDDM_CONTEXT, ListEntry)))
136
137typedef struct VBOXWDDM_DMA_ALLOCINFO
138{
139 PVBOXWDDM_ALLOCATION pAlloc;
140 VBOXVIDEOOFFSET offAlloc;
141 UINT segmentIdAlloc;
142 D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId;
143} VBOXWDDM_DMA_ALLOCINFO, *PVBOXWDDM_DMA_ALLOCINFO;
144
145typedef struct VBOXWDDM_DMA_PRIVATEDATA_FLAFS
146{
147 union
148 {
149 struct
150 {
151 UINT bCmdInDmaBuffer : 1;
152 UINT bReserved : 31;
153 };
154 uint32_t Value;
155 };
156} VBOXWDDM_DMA_PRIVATEDATA_FLAFS, *PVBOXWDDM_DMA_PRIVATEDATA_FLAFS;
157
158typedef struct VBOXWDDM_DMA_PRIVATEDATA_HDR
159{
160 PVBOXWDDM_CONTEXT pContext;
161 VBOXWDDM_DMA_PRIVATEDATA_FLAFS fFlags;
162 VBOXVDMACMD_TYPE enmCmd;
163 VBOXWDDM_DMA_ALLOCINFO SrcAllocInfo;
164 VBOXWDDM_DMA_ALLOCINFO DstAllocInfo;
165}VBOXWDDM_DMA_PRIVATEDATA_HDR, *PVBOXWDDM_DMA_PRIVATEDATA_HDR;
166
167#ifdef VBOXWDDM_RENDER_FROM_SHADOW
168
169typedef struct VBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW
170{
171 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr;
172 RECT rect;
173} VBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW, *PVBOXWDDM_DMA_PRESENT_RENDER_FROM_SHADOW;
174
175#endif
176
177typedef struct VBOXWDDM_DMA_PRESENT_BLT
178{
179 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr;
180 RECT SrcRect;
181 VBOXVDMAPIPE_RECTS DstRects;
182}VBOXWDDM_DMA_PRESENT_BLT, *PVBOXWDDM_DMA_PRESENT_BLT;
183
184typedef struct VBOXVDMACMD_DMA_PRESENT_FLIP
185{
186 VBOXWDDM_DMA_PRIVATEDATA_HDR Hdr;
187} VBOXVDMACMD_DMA_PRESENT_FLIP, *PVBOXVDMACMD_DMA_PRESENT_FLIP;
188
189
190typedef struct VBOXWDDM_OPENALLOCATION
191{
192 D3DKMT_HANDLE hAllocation;
193} VBOXWDDM_OPENALLOCATION, *PVBOXWDDM_OPENALLOCATION;
194
195#ifdef VBOXWDDM_RENDER_FROM_SHADOW
196# define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pShadowAllocation)
197#else
198# define VBOXWDDM_FB_ALLOCATION(_pSrc) ((_pSrc)->pPrimaryAllocation)
199#endif
200
201//DECLINLINE(VBOXVIDEOOFFSET) vboxWddmOffsetFromPhAddress(PHYSICAL_ADDRESS phAddr)
202//{
203// return (VBOXVIDEOOFFSET)(phAddr.QuadPart ? phAddr.QuadPart - VBE_DISPI_LFB_PHYSICAL_ADDRESS : VBOXVIDEOOFFSET_VOID);
204//}
205
206#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