VirtualBox

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

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

wddm,vboxtray: forward-port autoresize, multimon, and seamless fixes from 4.2 r87071, r87353, r87356, r87528, r87568, r87581, r87584, r87608, r87673, r87678, r87708, r87629, r87529; additional fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.2 KB
Line 
1/* $Id: VBoxMPDevExt.h 48070 2013-08-26 18:13:22Z 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
39typedef struct VBOXMP_COMMON
40{
41 int cDisplays; /* Number of displays. */
42
43 uint32_t cbVRAM; /* The VRAM size. */
44
45 PHYSICAL_ADDRESS phVRAM; /* Physical VRAM base. */
46
47 ULONG ulApertureSize; /* Size of the LFB aperture (>= VRAM size). */
48
49 uint32_t cbMiniportHeap; /* The size of reserved VRAM for miniport driver heap.
50 * It is at offset:
51 * cbAdapterMemorySize - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE - cbMiniportHeap
52 */
53 void *pvMiniportHeap; /* The pointer to the miniport heap VRAM.
54 * This is mapped by miniport separately.
55 */
56 void *pvAdapterInformation; /* The pointer to the last 4K of VRAM.
57 * This is mapped by miniport separately.
58 */
59
60 /** Whether HGSMI is enabled. */
61 bool bHGSMI;
62 /** Context information needed to receive commands from the host. */
63 HGSMIHOSTCOMMANDCONTEXT hostCtx;
64 /** Context information needed to submit commands to the host. */
65 HGSMIGUESTCOMMANDCONTEXT guestCtx;
66
67 BOOLEAN fAnyX; /* Unrestricted horizontal resolution flag. */
68} VBOXMP_COMMON, *PVBOXMP_COMMON;
69
70typedef struct _VBOXMP_DEVEXT
71{
72 struct _VBOXMP_DEVEXT *pNext; /* Next extension in the DualView extension list.
73 * The primary extension is the first one.
74 */
75#ifdef VBOX_XPDM_MINIPORT
76 struct _VBOXMP_DEVEXT *pPrimary; /* Pointer to the primary device extension. */
77
78 ULONG iDevice; /* Device index: 0 for primary, otherwise a secondary device. */
79
80 ULONG CurrentMode; /* Saved information about video modes */
81 ULONG CurrentModeWidth;
82 ULONG CurrentModeHeight;
83 ULONG CurrentModeBPP;
84
85 ULONG ulFrameBufferOffset; /* The framebuffer position in the VRAM. */
86 ULONG ulFrameBufferSize; /* The size of the current framebuffer. */
87
88 uint8_t iInvocationCounter;
89 uint32_t Prev_xres;
90 uint32_t Prev_yres;
91 uint32_t Prev_bpp;
92#endif /*VBOX_XPDM_MINIPORT*/
93
94#ifdef VBOX_WDDM_MINIPORT
95 PDEVICE_OBJECT pPDO;
96 UNICODE_STRING RegKeyName;
97 UNICODE_STRING VideoGuid;
98
99 uint8_t * pvVisibleVram;
100
101 VBOXVIDEOCM_MGR CmMgr;
102 VBOXVIDEOCM_MGR SeamlessCtxMgr;
103 /* hgsmi allocation manager */
104 VBOXVIDEOCM_ALLOC_MGR AllocMgr;
105 VBOXVDMADDI_NODE aNodes[VBOXWDDM_NUM_NODES];
106 LIST_ENTRY DpcCmdQueue;
107 LIST_ENTRY SwapchainList3D;
108 /* mutex for context list operations */
109 KSPIN_LOCK ContextLock;
110 KSPIN_LOCK SynchLock;
111 volatile uint32_t cContexts3D;
112 volatile uint32_t cContexts2D;
113 volatile uint32_t cContextsDispIfResize;
114 volatile uint32_t cRenderFromShadowDisabledContexts;
115 volatile uint32_t cUnlockedVBVADisabled;
116
117 DWORD dwDrvCfgFlags;
118 /* this is examined and swicthed by DxgkDdiSubmitCommand only! */
119 volatile BOOLEAN fRenderToShadowDisabled;
120
121 BOOLEAN f3DEnabled;
122 BOOLEAN fTexPresentEnabled;
123
124 uint32_t u32CrConDefaultClientID;
125
126 VBOXMP_CRCTLCON CrCtlCon;
127 VBOXMP_CRSHGSMITRANSPORT CrHgsmiTransport;
128
129 VBOXWDDM_GLOBAL_POINTER_INFO PointerInfo;
130
131 VBOXVTLIST CtlList;
132 VBOXVTLIST DmaCmdList;
133#ifdef VBOX_WITH_VIDEOHWACCEL
134 VBOXVTLIST VhwaCmdList;
135#endif
136 BOOL bNotifyDxDpc;
137
138#ifdef VBOX_VDMA_WITH_WATCHDOG
139 PKTHREAD pWdThread;
140 KEVENT WdEvent;
141#endif
142
143 KTIMER VSyncTimer;
144 KDPC VSyncDpc;
145
146#if 0
147 FAST_MUTEX ShRcTreeMutex;
148 AVLPVTREE ShRcTree;
149#endif
150
151 VBOXWDDM_SOURCE aSources[VBOX_VIDEO_MAX_SCREENS];
152 VBOXWDDM_TARGET aTargets[VBOX_VIDEO_MAX_SCREENS];
153#endif /*VBOX_WDDM_MINIPORT*/
154
155 union {
156 /* Information that is only relevant to the primary device or is the same for all devices. */
157 struct {
158
159 void *pvReqFlush; /* Pointer to preallocated generic request structure for
160 * VMMDevReq_VideoAccelFlush. Allocated when VBVA status
161 * is changed. Deallocated on HwReset.
162 */
163 ULONG ulVbvaEnabled; /* Indicates that VBVA mode is enabled. */
164 ULONG ulMaxFrameBufferSize; /* The size of the VRAM allocated for the a single framebuffer. */
165 BOOLEAN fMouseHidden; /* Has the mouse cursor been hidden by the guest? */
166 VBOXMP_COMMON commonInfo;
167#ifdef VBOX_XPDM_MINIPORT
168 /* Video Port API dynamically picked up at runtime for binary backwards compatibility with older NT versions */
169 VBOXVIDEOPORTPROCS VideoPortProcs;
170#endif
171
172#ifdef VBOX_WDDM_MINIPORT
173 VBOXVDMAINFO Vdma;
174# ifdef VBOXVDMA_WITH_VBVA
175 VBOXVBVAINFO Vbva;
176# endif
177 D3DKMDT_HVIDPN hCommittedVidPn; /* committed VidPn handle */
178 DXGKRNL_INTERFACE DxgkInterface; /* Display Port handle and callbacks */
179#endif
180 } primary;
181
182 /* Secondary device information. */
183 struct {
184 BOOLEAN bEnabled; /* Device enabled flag */
185 } secondary;
186 } u;
187
188 HGSMIAREA areaDisplay; /* Entire VRAM chunk for this display device. */
189} VBOXMP_DEVEXT, *PVBOXMP_DEVEXT;
190
191DECLINLINE(PVBOXMP_DEVEXT) VBoxCommonToPrimaryExt(PVBOXMP_COMMON pCommon)
192{
193 return RT_FROM_MEMBER(pCommon, VBOXMP_DEVEXT, u.primary.commonInfo);
194}
195
196DECLINLINE(PVBOXMP_COMMON) VBoxCommonFromDeviceExt(PVBOXMP_DEVEXT pExt)
197{
198#ifdef VBOX_XPDM_MINIPORT
199 return &pExt->pPrimary->u.primary.commonInfo;
200#else
201 return &pExt->u.primary.commonInfo;
202#endif
203}
204
205#ifdef VBOX_WDDM_MINIPORT
206DECLINLINE(ULONG) vboxWddmVramCpuVisibleSize(PVBOXMP_DEVEXT pDevExt)
207{
208#ifdef VBOXWDDM_RENDER_FROM_SHADOW
209 /* all memory layout info should be initialized */
210 Assert(pDevExt->aSources[0].Vbva.offVBVA);
211 /* page aligned */
212 Assert(!(pDevExt->aSources[0].Vbva.offVBVA & 0xfff));
213
214 return (ULONG)(pDevExt->aSources[0].Vbva.offVBVA & ~0xfffULL);
215#else
216 /* all memory layout info should be initialized */
217 Assert(pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase);
218 /* page aligned */
219 Assert(!(pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase & 0xfff));
220
221 return pDevExt->u.primary.Vdma.CmdHeap.Heap.area.offBase & ~0xfffUL;
222#endif
223}
224
225DECLINLINE(ULONG) vboxWddmVramCpuVisibleSegmentSize(PVBOXMP_DEVEXT pDevExt)
226{
227 return vboxWddmVramCpuVisibleSize(pDevExt);
228}
229
230#ifdef VBOXWDDM_RENDER_FROM_SHADOW
231DECLINLINE(ULONG) vboxWddmVramCpuInvisibleSegmentSize(PVBOXMP_DEVEXT pDevExt)
232{
233 return vboxWddmVramCpuVisibleSegmentSize(pDevExt);
234}
235
236DECLINLINE(bool) vboxWddmCmpSurfDescsBase(VBOXWDDM_SURFACE_DESC *pDesc1, VBOXWDDM_SURFACE_DESC *pDesc2)
237{
238 if (pDesc1->width != pDesc2->width)
239 return false;
240 if (pDesc1->height != pDesc2->height)
241 return false;
242 if (pDesc1->format != pDesc2->format)
243 return false;
244 if (pDesc1->bpp != pDesc2->bpp)
245 return false;
246 if (pDesc1->pitch != pDesc2->pitch)
247 return false;
248 return true;
249}
250
251#endif
252#endif /*VBOX_WDDM_MINIPORT*/
253
254#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