VirtualBox

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

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

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