VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h@ 55709

Last change on this file since 55709 was 52136, checked in by vboxsync, 11 years ago

wddm: autoresize enhancements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.8 KB
Line 
1/* $Id: VBoxMPDevExt.h 52136 2014-07-22 19:36:45Z vboxsync $ */
2
3/** @file
4 * VBox Miniport device extension header
5 */
6
7/*
8 * Copyright (C) 2011-2012 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef VBOXMPDEVEXT_H
20#define VBOXMPDEVEXT_H
21
22#include "VBoxMPUtils.h"
23#include <VBox/VBoxVideoGuest.h>
24
25#ifdef VBOX_XPDM_MINIPORT
26# include <miniport.h>
27# include <ntddvdeo.h>
28# include <video.h>
29# include "common/xpdm/VBoxVideoPortAPI.h"
30#endif
31
32#ifdef VBOX_WDDM_MINIPORT
33# ifdef VBOX_WDDM_WIN8
34extern DWORD g_VBoxDisplayOnly;
35# endif
36# include "wddm/VBoxMPTypes.h"
37#endif
38
39#define VBOXMP_MAX_VIDEO_MODES 128
40typedef struct VBOXMP_COMMON
41{
42 int cDisplays; /* Number of displays. */
43
44 uint32_t cbVRAM; /* The VRAM size. */
45
46 PHYSICAL_ADDRESS phVRAM; /* Physical VRAM base. */
47
48 ULONG ulApertureSize; /* Size of the LFB aperture (>= VRAM size). */
49
50 uint32_t cbMiniportHeap; /* The size of reserved VRAM for miniport driver heap.
51 * It is at offset:
52 * cbAdapterMemorySize - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE - cbMiniportHeap
53 */
54 void *pvMiniportHeap; /* The pointer to the miniport heap VRAM.
55 * This is mapped by miniport separately.
56 */
57 void *pvAdapterInformation; /* The pointer to the last 4K of VRAM.
58 * This is mapped by miniport separately.
59 */
60
61 /** Whether HGSMI is enabled. */
62 bool bHGSMI;
63 /** Context information needed to receive commands from the host. */
64 HGSMIHOSTCOMMANDCONTEXT hostCtx;
65 /** Context information needed to submit commands to the host. */
66 HGSMIGUESTCOMMANDCONTEXT guestCtx;
67
68 BOOLEAN fAnyX; /* Unrestricted horizontal resolution flag. */
69} VBOXMP_COMMON, *PVBOXMP_COMMON;
70
71typedef struct _VBOXMP_DEVEXT
72{
73 struct _VBOXMP_DEVEXT *pNext; /* Next extension in the DualView extension list.
74 * The primary extension is the first one.
75 */
76#ifdef VBOX_XPDM_MINIPORT
77 struct _VBOXMP_DEVEXT *pPrimary; /* Pointer to the primary device extension. */
78
79 ULONG iDevice; /* Device index: 0 for primary, otherwise a secondary device. */
80 /* Standart video modes list.
81 * Additional space is reserved for a custom video mode for this guest monitor.
82 * The custom video mode index is alternating for each mode set and 2 indexes are needed for the custom mode.
83 */
84 VIDEO_MODE_INFORMATION aVideoModes[VBOXMP_MAX_VIDEO_MODES + 2];
85 /* Number of available video modes, set by VBoxMPCmnBuildVideoModesTable. */
86 uint32_t cVideoModes;
87 ULONG CurrentMode; /* Saved information about video modes */
88 ULONG CurrentModeWidth;
89 ULONG CurrentModeHeight;
90 ULONG CurrentModeBPP;
91
92 ULONG ulFrameBufferOffset; /* The framebuffer position in the VRAM. */
93 ULONG ulFrameBufferSize; /* The size of the current framebuffer. */
94
95 uint8_t iInvocationCounter;
96 uint32_t Prev_xres;
97 uint32_t Prev_yres;
98 uint32_t Prev_bpp;
99#endif /*VBOX_XPDM_MINIPORT*/
100
101#ifdef VBOX_WDDM_MINIPORT
102 PDEVICE_OBJECT pPDO;
103 UNICODE_STRING RegKeyName;
104 UNICODE_STRING VideoGuid;
105
106 uint8_t * pvVisibleVram;
107
108 VBOXVIDEOCM_MGR CmMgr;
109 VBOXVIDEOCM_MGR SeamlessCtxMgr;
110 /* hgsmi allocation manager */
111 VBOXVIDEOCM_ALLOC_MGR AllocMgr;
112 VBOXVDMADDI_NODE aNodes[VBOXWDDM_NUM_NODES];
113 LIST_ENTRY DpcCmdQueue;
114 LIST_ENTRY SwapchainList3D;
115 /* mutex for context list operations */
116 KSPIN_LOCK ContextLock;
117 KSPIN_LOCK SynchLock;
118 volatile uint32_t cContexts3D;
119 volatile uint32_t cContexts2D;
120 volatile uint32_t cContextsDispIfResize;
121 volatile uint32_t cUnlockedVBVADisabled;
122
123 volatile uint32_t fCompletingCommands;
124
125 DWORD dwDrvCfgFlags;
126#ifdef VBOX_WITH_CROGL
127 BOOLEAN f3DEnabled;
128 BOOLEAN fTexPresentEnabled;
129 BOOLEAN fCmdVbvaEnabled;
130 BOOLEAN fComplexTopologiesEnabled;
131
132 uint32_t u32CrConDefaultClientID;
133
134 VBOXCMDVBVA CmdVbva;
135
136 VBOXMP_CRCTLCON CrCtlCon;
137 VBOXMP_CRSHGSMITRANSPORT CrHgsmiTransport;
138#endif
139 VBOXWDDM_GLOBAL_POINTER_INFO PointerInfo;
140
141 VBOXVTLIST CtlList;
142 VBOXVTLIST DmaCmdList;
143#ifdef VBOX_WITH_VIDEOHWACCEL
144 VBOXVTLIST VhwaCmdList;
145#endif
146 BOOLEAN bNotifyDxDpc;
147
148 BOOLEAN fDisableTargetUpdate;
149
150
151
152#ifdef VBOX_VDMA_WITH_WATCHDOG
153 PKTHREAD pWdThread;
154 KEVENT WdEvent;
155#endif
156 BOOL bVSyncTimerEnabled;
157 volatile uint32_t fVSyncInVBlank;
158 volatile LARGE_INTEGER VSyncTime;
159 KTIMER VSyncTimer;
160 KDPC VSyncDpc;
161
162#if 0
163 FAST_MUTEX ShRcTreeMutex;
164 AVLPVTREE ShRcTree;
165#endif
166
167 VBOXWDDM_SOURCE aSources[VBOX_VIDEO_MAX_SCREENS];
168 VBOXWDDM_TARGET aTargets[VBOX_VIDEO_MAX_SCREENS];
169#endif /*VBOX_WDDM_MINIPORT*/
170
171 union {
172 /* Information that is only relevant to the primary device or is the same for all devices. */
173 struct {
174
175 void *pvReqFlush; /* Pointer to preallocated generic request structure for
176 * VMMDevReq_VideoAccelFlush. Allocated when VBVA status
177 * is changed. Deallocated on HwReset.
178 */
179 ULONG ulVbvaEnabled; /* Indicates that VBVA mode is enabled. */
180 ULONG ulMaxFrameBufferSize; /* The size of the VRAM allocated for the a single framebuffer. */
181 BOOLEAN fMouseHidden; /* Has the mouse cursor been hidden by the guest? */
182 VBOXMP_COMMON commonInfo;
183#ifdef VBOX_XPDM_MINIPORT
184 /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */
185 VBOXVIDEOPORTPROCS VideoPortProcs;
186#endif
187
188#ifdef VBOX_WDDM_MINIPORT
189 VBOXVDMAINFO Vdma;
190# ifdef VBOXVDMA_WITH_VBVA
191 VBOXVBVAINFO Vbva;
192# endif
193 D3DKMDT_HVIDPN hCommittedVidPn; /* committed VidPn handle */
194 DXGKRNL_INTERFACE DxgkInterface; /* Display Port handle and callbacks */
195#endif
196 } primary;
197
198 /* Secondary device information. */
199 struct {
200 BOOLEAN bEnabled; /* Device enabled flag */
201 } secondary;
202 } u;
203
204 HGSMIAREA areaDisplay; /* Entire VRAM chunk for this display device. */
205} VBOXMP_DEVEXT, *PVBOXMP_DEVEXT;
206
207DECLINLINE(PVBOXMP_DEVEXT) VBoxCommonToPrimaryExt(PVBOXMP_COMMON pCommon)
208{
209 return RT_FROM_MEMBER(pCommon, VBOXMP_DEVEXT, u.primary.commonInfo);
210}
211
212DECLINLINE(PVBOXMP_COMMON) VBoxCommonFromDeviceExt(PVBOXMP_DEVEXT pExt)
213{
214#ifdef VBOX_XPDM_MINIPORT
215 return &pExt->pPrimary->u.primary.commonInfo;
216#else
217 return &pExt->u.primary.commonInfo;
218#endif
219}
220
221#ifdef VBOX_WDDM_MINIPORT
222DECLINLINE(ULONG) vboxWddmVramCpuVisibleSize(PVBOXMP_DEVEXT pDevExt)
223{
224#ifdef VBOX_WITH_CROGL
225 if (pDevExt->fCmdVbvaEnabled)
226 {
227 /* all memory layout info should be initialized */
228 Assert(pDevExt->CmdVbva.Vbva.offVRAMBuffer);
229 /* page aligned */
230 Assert(!(pDevExt->CmdVbva.Vbva.offVRAMBuffer & 0xfff));
231
232 return (ULONG)(pDevExt->CmdVbva.Vbva.offVRAMBuffer & ~0xfffULL);
233 }
234#endif
235 /* all memory layout info should be initialized */
236 Assert(pDevExt->aSources[0].Vbva.Vbva.offVRAMBuffer);
237 /* page aligned */
238 Assert(!(pDevExt->aSources[0].Vbva.Vbva.offVRAMBuffer & 0xfff));
239
240 return (ULONG)(pDevExt->aSources[0].Vbva.Vbva.offVRAMBuffer & ~0xfffULL);
241}
242
243DECLINLINE(ULONG) vboxWddmVramCpuVisibleSegmentSize(PVBOXMP_DEVEXT pDevExt)
244{
245 return vboxWddmVramCpuVisibleSize(pDevExt);
246}
247
248/* 128 MB */
249DECLINLINE(ULONG) vboxWddmVramCpuInvisibleSegmentSize(PVBOXMP_DEVEXT pDevExt)
250{
251 return 128 * 1024 * 1024;
252}
253
254#ifdef VBOXWDDM_RENDER_FROM_SHADOW
255
256DECLINLINE(bool) vboxWddmCmpSurfDescsBase(VBOXWDDM_SURFACE_DESC *pDesc1, VBOXWDDM_SURFACE_DESC *pDesc2)
257{
258 if (pDesc1->width != pDesc2->width)
259 return false;
260 if (pDesc1->height != pDesc2->height)
261 return false;
262 if (pDesc1->format != pDesc2->format)
263 return false;
264 if (pDesc1->bpp != pDesc2->bpp)
265 return false;
266 if (pDesc1->pitch != pDesc2->pitch)
267 return false;
268 return true;
269}
270
271#endif
272#endif /*VBOX_WDDM_MINIPORT*/
273
274#endif /*VBOXMPDEVEXT_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