VirtualBox

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

Last change on this file since 45037 was 45037, checked in by vboxsync, 12 years ago

VBoxVideo: multimonitor resize fixes.

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