VirtualBox

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

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

WINNT/VBoxVideo: separate mode table for each guest monitor.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.7 KB
Line 
1/* $Id: VBoxMPDevExt.h 49458 2013-11-13 10:32:13Z 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 cRenderFromShadowDisabledContexts;
122 volatile uint32_t cUnlockedVBVADisabled;
123
124 DWORD dwDrvCfgFlags;
125 /* this is examined and swicthed by DxgkDdiSubmitCommand only! */
126 volatile BOOLEAN fRenderToShadowDisabled;
127
128 BOOLEAN f3DEnabled;
129 BOOLEAN fTexPresentEnabled;
130
131 uint32_t u32CrConDefaultClientID;
132
133 VBOXMP_CRCTLCON CrCtlCon;
134 VBOXMP_CRSHGSMITRANSPORT CrHgsmiTransport;
135
136 VBOXWDDM_GLOBAL_POINTER_INFO PointerInfo;
137
138 VBOXVTLIST CtlList;
139 VBOXVTLIST DmaCmdList;
140#ifdef VBOX_WITH_VIDEOHWACCEL
141 VBOXVTLIST VhwaCmdList;
142#endif
143 BOOL bNotifyDxDpc;
144
145#ifdef VBOX_VDMA_WITH_WATCHDOG
146 PKTHREAD pWdThread;
147 KEVENT WdEvent;
148#endif
149
150 KTIMER VSyncTimer;
151 KDPC VSyncDpc;
152
153#if 0
154 FAST_MUTEX ShRcTreeMutex;
155 AVLPVTREE ShRcTree;
156#endif
157
158 VBOXWDDM_SOURCE aSources[VBOX_VIDEO_MAX_SCREENS];
159 VBOXWDDM_TARGET aTargets[VBOX_VIDEO_MAX_SCREENS];
160#endif /*VBOX_WDDM_MINIPORT*/
161
162 union {
163 /* Information that is only relevant to the primary device or is the same for all devices. */
164 struct {
165
166 void *pvReqFlush; /* Pointer to preallocated generic request structure for
167 * VMMDevReq_VideoAccelFlush. Allocated when VBVA status
168 * is changed. Deallocated on HwReset.
169 */
170 ULONG ulVbvaEnabled; /* Indicates that VBVA mode is enabled. */
171 ULONG ulMaxFrameBufferSize; /* The size of the VRAM allocated for the a single framebuffer. */
172 BOOLEAN fMouseHidden; /* Has the mouse cursor been hidden by the guest? */
173 VBOXMP_COMMON commonInfo;
174#ifdef VBOX_XPDM_MINIPORT
175 /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */
176 VBOXVIDEOPORTPROCS VideoPortProcs;
177#endif
178
179#ifdef VBOX_WDDM_MINIPORT
180 VBOXVDMAINFO Vdma;
181# ifdef VBOXVDMA_WITH_VBVA
182 VBOXVBVAINFO Vbva;
183# endif
184 D3DKMDT_HVIDPN hCommittedVidPn; /* committed VidPn handle */
185 DXGKRNL_INTERFACE DxgkInterface; /* Display Port handle and callbacks */
186#endif
187 } primary;
188
189 /* Secondary device information. */
190 struct {
191 BOOLEAN bEnabled; /* Device enabled flag */
192 } secondary;
193 } u;
194
195 HGSMIAREA areaDisplay; /* Entire VRAM chunk for this display device. */
196} VBOXMP_DEVEXT, *PVBOXMP_DEVEXT;
197
198DECLINLINE(PVBOXMP_DEVEXT) VBoxCommonToPrimaryExt(PVBOXMP_COMMON pCommon)
199{
200 return RT_FROM_MEMBER(pCommon, VBOXMP_DEVEXT, u.primary.commonInfo);
201}
202
203DECLINLINE(PVBOXMP_COMMON) VBoxCommonFromDeviceExt(PVBOXMP_DEVEXT pExt)
204{
205#ifdef VBOX_XPDM_MINIPORT
206 return &pExt->pPrimary->u.primary.commonInfo;
207#else
208 return &pExt->u.primary.commonInfo;
209#endif
210}
211
212#ifdef VBOX_WDDM_MINIPORT
213DECLINLINE(ULONG) vboxWddmVramCpuVisibleSize(PVBOXMP_DEVEXT pDevExt)
214{
215#ifdef VBOXWDDM_RENDER_FROM_SHADOW
216 /* all memory layout info should be initialized */
217 Assert(pDevExt->aSources[0].Vbva.Vbva.offVRAMBuffer);
218 /* page aligned */
219 Assert(!(pDevExt->aSources[0].Vbva.Vbva.offVRAMBuffer & 0xfff));
220
221 return (ULONG)(pDevExt->aSources[0].Vbva.Vbva.offVRAMBuffer & ~0xfffULL);
222#else
223 /* all memory layout info should be initialized */
224 Assert(pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase);
225 /* page aligned */
226 Assert(!(pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase & 0xfff));
227
228 return pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase & ~0xfffUL;
229#endif
230}
231
232DECLINLINE(ULONG) vboxWddmVramCpuVisibleSegmentSize(PVBOXMP_DEVEXT pDevExt)
233{
234 return vboxWddmVramCpuVisibleSize(pDevExt);
235}
236
237#ifdef VBOXWDDM_RENDER_FROM_SHADOW
238DECLINLINE(ULONG) vboxWddmVramCpuInvisibleSegmentSize(PVBOXMP_DEVEXT pDevExt)
239{
240 return vboxWddmVramCpuVisibleSegmentSize(pDevExt);
241}
242
243DECLINLINE(bool) vboxWddmCmpSurfDescsBase(VBOXWDDM_SURFACE_DESC *pDesc1, VBOXWDDM_SURFACE_DESC *pDesc2)
244{
245 if (pDesc1->width != pDesc2->width)
246 return false;
247 if (pDesc1->height != pDesc2->height)
248 return false;
249 if (pDesc1->format != pDesc2->format)
250 return false;
251 if (pDesc1->bpp != pDesc2->bpp)
252 return false;
253 if (pDesc1->pitch != pDesc2->pitch)
254 return false;
255 return true;
256}
257
258#endif
259#endif /*VBOX_WDDM_MINIPORT*/
260
261#endif /*VBOXMPDEVEXT_H*/
Note: See TracBrowser for help on using the repository browser.

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