1 | /* $Id: VBoxMPVidModes.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Miniport video modes related functions
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #include "VBoxMPCommon.h"
|
---|
29 |
|
---|
30 | #include <VBoxVideoVBE.h>
|
---|
31 | #include <iprt/utf16.h>
|
---|
32 |
|
---|
33 | #ifdef VBOX_WITH_WDDM
|
---|
34 | # define VBOX_WITHOUT_24BPP_MODES
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | /* Custom video modes which are being read from registry at driver startup. */
|
---|
38 | static VIDEO_MODE_INFORMATION g_CustomVideoModes[VBOX_VIDEO_MAX_SCREENS] = { {0} };
|
---|
39 |
|
---|
40 | static BOOLEAN
|
---|
41 | VBoxMPValidateVideoModeParamsGuest(PVBOXMP_DEVEXT pExt, uint32_t iDisplay, uint32_t xres, uint32_t yres, uint32_t bpp)
|
---|
42 | {
|
---|
43 | RT_NOREF(iDisplay, xres, yres);
|
---|
44 |
|
---|
45 | switch (bpp)
|
---|
46 | {
|
---|
47 | case 32:
|
---|
48 | break;
|
---|
49 | case 24:
|
---|
50 | #ifdef VBOX_WITHOUT_24BPP_MODES
|
---|
51 | return FALSE;
|
---|
52 | #else
|
---|
53 | break;
|
---|
54 | #endif
|
---|
55 | case 16:
|
---|
56 | break;
|
---|
57 | case 8:
|
---|
58 | #ifndef VBOX_WITH_8BPP_MODES
|
---|
59 | return FALSE;
|
---|
60 | #else
|
---|
61 | #ifdef VBOX_XPDM_MINIPORT
|
---|
62 | if (pExt->iDevice != 0) /* Secondary monitors do not support 8 bit */
|
---|
63 | return FALSE;
|
---|
64 | #endif
|
---|
65 | break;
|
---|
66 | #endif
|
---|
67 | default:
|
---|
68 | WARN(("Unexpected bpp (%d)", bpp));
|
---|
69 | return FALSE;
|
---|
70 | }
|
---|
71 | return TRUE;
|
---|
72 | }
|
---|
73 |
|
---|
74 | /* Fills given video mode BPP related fields */
|
---|
75 | static void
|
---|
76 | VBoxFillVidModeBPP(VIDEO_MODE_INFORMATION *pMode, ULONG bitsR, ULONG bitsG, ULONG bitsB,
|
---|
77 | ULONG maskR, ULONG maskG, ULONG maskB)
|
---|
78 | {
|
---|
79 | pMode->NumberRedBits = bitsR;
|
---|
80 | pMode->NumberGreenBits = bitsG;
|
---|
81 | pMode->NumberBlueBits = bitsB;
|
---|
82 | pMode->RedMask = maskR;
|
---|
83 | pMode->GreenMask = maskG;
|
---|
84 | pMode->BlueMask = maskB;
|
---|
85 | }
|
---|
86 |
|
---|
87 | /* Fills given video mode structure */
|
---|
88 | static void
|
---|
89 | VBoxFillVidModeInfo(VIDEO_MODE_INFORMATION *pMode, ULONG xres, ULONG yres, ULONG bpp, ULONG index, ULONG yoffset)
|
---|
90 | {
|
---|
91 | LOGF(("%dx%d:%d (idx=%d, yoffset=%d)", xres, yres, bpp, index, yoffset));
|
---|
92 |
|
---|
93 | memset(pMode, 0, sizeof(VIDEO_MODE_INFORMATION));
|
---|
94 |
|
---|
95 | /*Common entries*/
|
---|
96 | pMode->Length = sizeof(VIDEO_MODE_INFORMATION);
|
---|
97 | pMode->ModeIndex = index;
|
---|
98 | pMode->VisScreenWidth = xres;
|
---|
99 | pMode->VisScreenHeight = yres - yoffset;
|
---|
100 | pMode->ScreenStride = xres * ((bpp + 7) / 8);
|
---|
101 | pMode->NumberOfPlanes = 1;
|
---|
102 | pMode->BitsPerPlane = bpp;
|
---|
103 | pMode->Frequency = 60;
|
---|
104 | pMode->XMillimeter = 320;
|
---|
105 | pMode->YMillimeter = 240;
|
---|
106 | pMode->VideoMemoryBitmapWidth = xres;
|
---|
107 | pMode->VideoMemoryBitmapHeight = yres - yoffset;
|
---|
108 | pMode->DriverSpecificAttributeFlags = 0;
|
---|
109 | pMode->AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN;
|
---|
110 |
|
---|
111 | /*BPP related entries*/
|
---|
112 | switch (bpp)
|
---|
113 | {
|
---|
114 | #ifdef VBOX_WITH_8BPP_MODES
|
---|
115 | case 8:
|
---|
116 | VBoxFillVidModeBPP(pMode, 6, 6, 6, 0, 0, 0);
|
---|
117 |
|
---|
118 | pMode->AttributeFlags |= VIDEO_MODE_PALETTE_DRIVEN | VIDEO_MODE_MANAGED_PALETTE;
|
---|
119 | break;
|
---|
120 | #endif
|
---|
121 | case 16:
|
---|
122 | VBoxFillVidModeBPP(pMode, 5, 6, 5, 0xF800, 0x7E0, 0x1F);
|
---|
123 | break;
|
---|
124 | case 24:
|
---|
125 | case 32:
|
---|
126 | VBoxFillVidModeBPP(pMode, 8, 8, 8, 0xFF0000, 0xFF00, 0xFF);
|
---|
127 | break;
|
---|
128 | default:
|
---|
129 | Assert(0);
|
---|
130 | break;
|
---|
131 | }
|
---|
132 | }
|
---|
133 |
|
---|
134 | void VBoxMPCmnInitCustomVideoModes(PVBOXMP_DEVEXT pExt)
|
---|
135 | {
|
---|
136 | VBOXMPCMNREGISTRY Registry;
|
---|
137 | VP_STATUS rc;
|
---|
138 | int iMode;
|
---|
139 |
|
---|
140 | LOGF_ENTER();
|
---|
141 |
|
---|
142 | rc = VBoxMPCmnRegInit(pExt, &Registry);
|
---|
143 | VBOXMP_WARN_VPS(rc);
|
---|
144 |
|
---|
145 | /* Initialize all custom modes to the 800x600x32 */
|
---|
146 | VBoxFillVidModeInfo(&g_CustomVideoModes[0], 800, 600, 32, 0, 0);
|
---|
147 | for (iMode=1; iMode<RT_ELEMENTS(g_CustomVideoModes); ++iMode)
|
---|
148 | {
|
---|
149 | g_CustomVideoModes[iMode] = g_CustomVideoModes[0];
|
---|
150 | }
|
---|
151 |
|
---|
152 | /* Read stored custom resolution info from registry */
|
---|
153 | for (iMode=0; iMode<VBoxCommonFromDeviceExt(pExt)->cDisplays; ++iMode)
|
---|
154 | {
|
---|
155 | uint32_t CustomXRes = 0, CustomYRes = 0, CustomBPP = 0;
|
---|
156 |
|
---|
157 | if (iMode==0)
|
---|
158 | {
|
---|
159 | /*First name without a suffix*/
|
---|
160 | rc = VBoxMPCmnRegQueryDword(Registry, L"CustomXRes", &CustomXRes);
|
---|
161 | VBOXMP_WARN_VPS_NOBP(rc);
|
---|
162 | rc = VBoxMPCmnRegQueryDword(Registry, L"CustomYRes", &CustomYRes);
|
---|
163 | VBOXMP_WARN_VPS_NOBP(rc);
|
---|
164 | rc = VBoxMPCmnRegQueryDword(Registry, L"CustomBPP", &CustomBPP);
|
---|
165 | VBOXMP_WARN_VPS_NOBP(rc);
|
---|
166 | }
|
---|
167 | else
|
---|
168 | {
|
---|
169 | wchar_t wszKeyName[32];
|
---|
170 | RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomXRes%d", iMode);
|
---|
171 | rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomXRes);
|
---|
172 | VBOXMP_WARN_VPS_NOBP(rc);
|
---|
173 | RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomYRes%d", iMode);
|
---|
174 | rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomYRes);
|
---|
175 | VBOXMP_WARN_VPS_NOBP(rc);
|
---|
176 | RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomBPP%d", iMode);
|
---|
177 | rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &CustomBPP);
|
---|
178 | VBOXMP_WARN_VPS_NOBP(rc);
|
---|
179 | }
|
---|
180 |
|
---|
181 | LOG(("got stored custom resolution[%d] %dx%dx%d", iMode, CustomXRes, CustomYRes, CustomBPP));
|
---|
182 |
|
---|
183 | if (CustomXRes || CustomYRes || CustomBPP)
|
---|
184 | {
|
---|
185 | if (CustomXRes == 0)
|
---|
186 | {
|
---|
187 | CustomXRes = g_CustomVideoModes[iMode].VisScreenWidth;
|
---|
188 | }
|
---|
189 | if (CustomYRes == 0)
|
---|
190 | {
|
---|
191 | CustomYRes = g_CustomVideoModes[iMode].VisScreenHeight;
|
---|
192 | }
|
---|
193 | if (CustomBPP == 0)
|
---|
194 | {
|
---|
195 | CustomBPP = g_CustomVideoModes[iMode].BitsPerPlane;
|
---|
196 | }
|
---|
197 |
|
---|
198 | if (VBoxMPValidateVideoModeParamsGuest(pExt, iMode, CustomXRes, CustomYRes, CustomBPP))
|
---|
199 | {
|
---|
200 | VBoxFillVidModeInfo(&g_CustomVideoModes[iMode], CustomXRes, CustomYRes, CustomBPP, 0, 0);
|
---|
201 | }
|
---|
202 | }
|
---|
203 | }
|
---|
204 |
|
---|
205 | rc = VBoxMPCmnRegFini(Registry);
|
---|
206 | VBOXMP_WARN_VPS(rc);
|
---|
207 | LOGF_LEAVE();
|
---|
208 | }
|
---|
209 |
|
---|
210 | VIDEO_MODE_INFORMATION *VBoxMPCmnGetCustomVideoModeInfo(ULONG ulIndex)
|
---|
211 | {
|
---|
212 | return (ulIndex<RT_ELEMENTS(g_CustomVideoModes)) ? &g_CustomVideoModes[ulIndex] : NULL;
|
---|
213 | }
|
---|
214 |
|
---|
215 | #ifdef VBOX_XPDM_MINIPORT
|
---|
216 | VIDEO_MODE_INFORMATION* VBoxMPCmnGetVideoModeInfo(PVBOXMP_DEVEXT pExt, ULONG ulIndex)
|
---|
217 | {
|
---|
218 | return (ulIndex<RT_ELEMENTS(pExt->aVideoModes)) ? &pExt->aVideoModes[ulIndex] : NULL;
|
---|
219 | }
|
---|
220 | #endif
|
---|
221 |
|
---|
222 | static bool VBoxMPVideoModesMatch(const PVIDEO_MODE_INFORMATION pMode1, const PVIDEO_MODE_INFORMATION pMode2)
|
---|
223 | {
|
---|
224 | return pMode1->VisScreenHeight == pMode2->VisScreenHeight
|
---|
225 | && pMode1->VisScreenWidth == pMode2->VisScreenWidth
|
---|
226 | && pMode1->BitsPerPlane == pMode2->BitsPerPlane;
|
---|
227 | }
|
---|
228 |
|
---|
229 | static int
|
---|
230 | VBoxMPFindVideoMode(const PVIDEO_MODE_INFORMATION pModesTable, int cModes, const PVIDEO_MODE_INFORMATION pMode)
|
---|
231 | {
|
---|
232 | for (int i = 0; i < cModes; ++i)
|
---|
233 | {
|
---|
234 | if (VBoxMPVideoModesMatch(pMode, &pModesTable[i]))
|
---|
235 | {
|
---|
236 | return i;
|
---|
237 | }
|
---|
238 | }
|
---|
239 | return -1;
|
---|
240 | }
|
---|
241 |
|
---|
242 | /* Helper function to dynamically build our table of standard video
|
---|
243 | * modes. We take the amount of VRAM and create modes with standard
|
---|
244 | * geometries until we've either reached the maximum number of modes
|
---|
245 | * or the available VRAM does not allow for additional modes.
|
---|
246 | * We also check registry for manually added video modes.
|
---|
247 | * Returns number of modes added to the table.
|
---|
248 | */
|
---|
249 | static uint32_t
|
---|
250 | VBoxMPFillModesTable(PVBOXMP_DEVEXT pExt, int iDisplay, PVIDEO_MODE_INFORMATION pModesTable, size_t tableSize,
|
---|
251 | int32_t *pPrefModeIdx)
|
---|
252 | {
|
---|
253 | /* the resolution matrix */
|
---|
254 | struct
|
---|
255 | {
|
---|
256 | uint16_t xRes;
|
---|
257 | uint16_t yRes;
|
---|
258 | } resolutionMatrix[] =
|
---|
259 | {
|
---|
260 | /* standard modes */
|
---|
261 | { 640, 480 },
|
---|
262 | { 800, 600 },
|
---|
263 | { 1024, 768 },
|
---|
264 | { 1152, 864 },
|
---|
265 | { 1280, 960 },
|
---|
266 | { 1280, 1024 },
|
---|
267 | { 1400, 1050 },
|
---|
268 | { 1600, 1200 },
|
---|
269 | { 1920, 1440 },
|
---|
270 | #ifndef VBOX_WITH_WDDM
|
---|
271 | /* multi screen modes with 1280x1024 */
|
---|
272 | { 2560, 1024 },
|
---|
273 | { 3840, 1024 },
|
---|
274 | { 5120, 1024 },
|
---|
275 | /* multi screen modes with 1600x1200 */
|
---|
276 | { 3200, 1200 },
|
---|
277 | { 4800, 1200 },
|
---|
278 | { 6400, 1200 },
|
---|
279 | #endif
|
---|
280 | };
|
---|
281 |
|
---|
282 | #ifdef VBOX_XPDM_MINIPORT
|
---|
283 | ULONG vramSize = pExt->pPrimary->u.primary.ulMaxFrameBufferSize;
|
---|
284 | #else
|
---|
285 | ULONG vramSize = vboxWddmVramCpuVisibleSegmentSize(pExt);
|
---|
286 | vramSize /= pExt->u.primary.commonInfo.cDisplays;
|
---|
287 | if (!g_VBoxDisplayOnly)
|
---|
288 | {
|
---|
289 | /* at least two surfaces will be needed: primary & shadow */
|
---|
290 | vramSize /= 2;
|
---|
291 | }
|
---|
292 | vramSize &= ~PAGE_OFFSET_MASK;
|
---|
293 | #endif
|
---|
294 |
|
---|
295 | uint32_t iMode=0, iPrefIdx=0;
|
---|
296 | /* there are 4 color depths: 8, 16, 24 and 32bpp and we reserve 50% of the modes for other sources */
|
---|
297 | size_t maxModesPerColorDepth = VBOXMP_MAX_VIDEO_MODES / 2 / 4;
|
---|
298 |
|
---|
299 | /* Always add 800x600 video modes. Windows XP+ needs at least 800x600 resolution
|
---|
300 | * and fallbacks to 800x600x4bpp VGA mode if the driver did not report suitable modes.
|
---|
301 | * This resolution could be rejected by a low resolution host (netbooks, etc).
|
---|
302 | */
|
---|
303 | #ifdef VBOX_WITH_8BPP_MODES
|
---|
304 | int bytesPerPixel=1;
|
---|
305 | #else
|
---|
306 | int bytesPerPixel=2;
|
---|
307 | #endif
|
---|
308 | for (; bytesPerPixel<=4; bytesPerPixel++)
|
---|
309 | {
|
---|
310 | int bitsPerPixel = 8*bytesPerPixel;
|
---|
311 |
|
---|
312 | if (800*600*bytesPerPixel > (LONG)vramSize)
|
---|
313 | {
|
---|
314 | /* we don't have enough VRAM for this mode */
|
---|
315 | continue;
|
---|
316 | }
|
---|
317 |
|
---|
318 | if (!VBoxMPValidateVideoModeParamsGuest(pExt, iMode, 800, 600, bitsPerPixel))
|
---|
319 | continue;
|
---|
320 |
|
---|
321 | VBoxFillVidModeInfo(&pModesTable[iMode], 800, 600, bitsPerPixel, iMode+1, 0);
|
---|
322 |
|
---|
323 | if (32==bitsPerPixel)
|
---|
324 | {
|
---|
325 | iPrefIdx = iMode;
|
---|
326 | }
|
---|
327 | ++iMode;
|
---|
328 | }
|
---|
329 |
|
---|
330 | /* Query yoffset from the host */
|
---|
331 | ULONG yOffset = VBoxGetHeightReduction();
|
---|
332 |
|
---|
333 | /* Iterate through our static resolution table and add supported video modes for different bpp's */
|
---|
334 | #ifdef VBOX_WITH_8BPP_MODES
|
---|
335 | bytesPerPixel=1;
|
---|
336 | #else
|
---|
337 | bytesPerPixel=2;
|
---|
338 | #endif
|
---|
339 | for (; bytesPerPixel<=4; bytesPerPixel++)
|
---|
340 | {
|
---|
341 | int bitsPerPixel = 8*bytesPerPixel;
|
---|
342 | size_t cAdded, resIndex;
|
---|
343 |
|
---|
344 | for (cAdded=0, resIndex=0; resIndex<RT_ELEMENTS(resolutionMatrix) && cAdded<maxModesPerColorDepth; resIndex++)
|
---|
345 | {
|
---|
346 | if (resolutionMatrix[resIndex].xRes * resolutionMatrix[resIndex].yRes * bytesPerPixel > (LONG)vramSize)
|
---|
347 | {
|
---|
348 | /* we don't have enough VRAM for this mode */
|
---|
349 | continue;
|
---|
350 | }
|
---|
351 |
|
---|
352 | if (yOffset == 0 && resolutionMatrix[resIndex].xRes == 800 && resolutionMatrix[resIndex].yRes == 600)
|
---|
353 | {
|
---|
354 | /* this mode was already added */
|
---|
355 | continue;
|
---|
356 | }
|
---|
357 |
|
---|
358 | if (
|
---|
359 | #ifdef VBOX_WDDM_MINIPORT
|
---|
360 | /* 1024x768 resolution is a minimal resolutions for win8 to make most metro apps run.
|
---|
361 | * For small host display resolutions, host will dislike the mode 1024x768 and above
|
---|
362 | * if the framebuffer window requires scrolling to fit the guest resolution.
|
---|
363 | * So add 1024x768 resolution for win8 guest to allow user switch to it */
|
---|
364 | ( (VBoxQueryWinVersion(NULL) != WIN8 && VBoxQueryWinVersion(NULL) != WIN81)
|
---|
365 | || resolutionMatrix[resIndex].xRes != 1024
|
---|
366 | || resolutionMatrix[resIndex].yRes != 768)
|
---|
367 | &&
|
---|
368 | #endif
|
---|
369 | !VBoxLikesVideoMode(iDisplay, resolutionMatrix[resIndex].xRes,
|
---|
370 | resolutionMatrix[resIndex].yRes - yOffset, bitsPerPixel))
|
---|
371 | {
|
---|
372 | /* host doesn't like this mode */
|
---|
373 | continue;
|
---|
374 | }
|
---|
375 |
|
---|
376 | if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, resolutionMatrix[resIndex].xRes, resolutionMatrix[resIndex].yRes, bitsPerPixel))
|
---|
377 | {
|
---|
378 | /* guest does not like this mode */
|
---|
379 | continue;
|
---|
380 | }
|
---|
381 |
|
---|
382 | /* Sanity check, we shouldn't ever get here */
|
---|
383 | if (iMode >= tableSize)
|
---|
384 | {
|
---|
385 | WARN(("video modes table overflow!"));
|
---|
386 | break;
|
---|
387 | }
|
---|
388 |
|
---|
389 | VBoxFillVidModeInfo(&pModesTable[iMode], resolutionMatrix[resIndex].xRes, resolutionMatrix[resIndex].yRes, bitsPerPixel, iMode+1, yOffset);
|
---|
390 | ++iMode;
|
---|
391 | ++cAdded;
|
---|
392 | }
|
---|
393 | }
|
---|
394 |
|
---|
395 | /* Check registry for manually added modes, up to 128 entries is supported
|
---|
396 | * Give up on the first error encountered.
|
---|
397 | */
|
---|
398 | VBOXMPCMNREGISTRY Registry;
|
---|
399 | int fPrefSet=0;
|
---|
400 | VP_STATUS rc;
|
---|
401 |
|
---|
402 | rc = VBoxMPCmnRegInit(pExt, &Registry);
|
---|
403 | VBOXMP_WARN_VPS(rc);
|
---|
404 |
|
---|
405 | for (int curKey=0; curKey<128; curKey++)
|
---|
406 | {
|
---|
407 | if (iMode>=tableSize)
|
---|
408 | {
|
---|
409 | WARN(("ignoring possible custom mode(s), table is full!"));
|
---|
410 | break;
|
---|
411 | }
|
---|
412 |
|
---|
413 | wchar_t wszKeyName[24];
|
---|
414 | uint32_t xres, yres, bpp = 0;
|
---|
415 |
|
---|
416 | RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomMode%dWidth", curKey);
|
---|
417 | rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &xres);
|
---|
418 | VBOXMP_CHECK_VPS_BREAK(rc);
|
---|
419 |
|
---|
420 | RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomMode%dHeight", curKey);
|
---|
421 | rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &yres);
|
---|
422 | VBOXMP_CHECK_VPS_BREAK(rc);
|
---|
423 |
|
---|
424 | RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomMode%dBPP", curKey);
|
---|
425 | rc = VBoxMPCmnRegQueryDword(Registry, wszKeyName, &bpp);
|
---|
426 | VBOXMP_CHECK_VPS_BREAK(rc);
|
---|
427 |
|
---|
428 | LOG(("got custom mode[%u]=%ux%u:%u", curKey, xres, yres, bpp));
|
---|
429 |
|
---|
430 | /* round down width to be a multiple of 8 if necessary */
|
---|
431 | if (!VBoxCommonFromDeviceExt(pExt)->fAnyX)
|
---|
432 | {
|
---|
433 | xres &= 0xFFF8;
|
---|
434 | }
|
---|
435 |
|
---|
436 | if ( (xres > (1 << 16))
|
---|
437 | || (yres > (1 << 16))
|
---|
438 | || ( (bpp != 16)
|
---|
439 | && (bpp != 24)
|
---|
440 | && (bpp != 32)))
|
---|
441 | {
|
---|
442 | /* incorrect values */
|
---|
443 | break;
|
---|
444 | }
|
---|
445 |
|
---|
446 | /* does it fit within our VRAM? */
|
---|
447 | if (xres * yres * (bpp / 8) > vramSize)
|
---|
448 | {
|
---|
449 | /* we don't have enough VRAM for this mode */
|
---|
450 | break;
|
---|
451 | }
|
---|
452 |
|
---|
453 | if (!VBoxLikesVideoMode(iDisplay, xres, yres, bpp))
|
---|
454 | {
|
---|
455 | /* host doesn't like this mode */
|
---|
456 | break;
|
---|
457 | }
|
---|
458 |
|
---|
459 | if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, xres, yres, bpp))
|
---|
460 | {
|
---|
461 | /* guest does not like this mode */
|
---|
462 | continue;
|
---|
463 | }
|
---|
464 |
|
---|
465 | LOG(("adding video mode from registry."));
|
---|
466 |
|
---|
467 | VBoxFillVidModeInfo(&pModesTable[iMode], xres, yres, bpp, iMode+1, yOffset);
|
---|
468 |
|
---|
469 | if (!fPrefSet)
|
---|
470 | {
|
---|
471 | fPrefSet = 1;
|
---|
472 | iPrefIdx = iMode;
|
---|
473 | }
|
---|
474 | #ifdef VBOX_WDDM_MINIPORT
|
---|
475 | /*check if the same mode has been added to the table already*/
|
---|
476 | int foundIdx = VBoxMPFindVideoMode(pModesTable, iMode, &pModesTable[iMode]);
|
---|
477 |
|
---|
478 | if (foundIdx>=0)
|
---|
479 | {
|
---|
480 | if (iPrefIdx==iMode)
|
---|
481 | {
|
---|
482 | iPrefIdx=foundIdx;
|
---|
483 | }
|
---|
484 | }
|
---|
485 | else
|
---|
486 | #endif
|
---|
487 | {
|
---|
488 | ++iMode;
|
---|
489 | }
|
---|
490 | }
|
---|
491 |
|
---|
492 | rc = VBoxMPCmnRegFini(Registry);
|
---|
493 | VBOXMP_WARN_VPS(rc);
|
---|
494 |
|
---|
495 | if (pPrefModeIdx)
|
---|
496 | {
|
---|
497 | *pPrefModeIdx = iPrefIdx;
|
---|
498 | }
|
---|
499 |
|
---|
500 | return iMode;
|
---|
501 | }
|
---|
502 |
|
---|
503 | /* Returns if we're in the first mode change, ie doesn't have valid video mode set yet */
|
---|
504 | static BOOLEAN VBoxMPIsStartingUp(PVBOXMP_DEVEXT pExt, uint32_t iDisplay)
|
---|
505 | {
|
---|
506 | #ifdef VBOX_XPDM_MINIPORT
|
---|
507 | RT_NOREF(iDisplay);
|
---|
508 | return (pExt->CurrentMode == 0);
|
---|
509 | #else
|
---|
510 | VBOXWDDM_SOURCE *pSource = &pExt->aSources[iDisplay];
|
---|
511 | return !pSource->AllocData.SurfDesc.width || !pSource->AllocData.SurfDesc.height;
|
---|
512 | #endif
|
---|
513 | }
|
---|
514 |
|
---|
515 | #ifdef VBOX_WDDM_MINIPORT
|
---|
516 | static const uint32_t g_aVBoxVidModesSupportedBpps[] = {
|
---|
517 | 32
|
---|
518 | #ifndef VBOX_WITHOUT_24BPP_MODES
|
---|
519 | , 24
|
---|
520 | #endif
|
---|
521 | , 16
|
---|
522 | #ifdef VBOX_WITH_8BPP_MODES
|
---|
523 | , 8
|
---|
524 | #endif
|
---|
525 | };
|
---|
526 | DECLINLINE(BOOLEAN) VBoxMPIsSupportedBpp(uint32_t bpp)
|
---|
527 | {
|
---|
528 | for (int i = 0; i < RT_ELEMENTS(g_aVBoxVidModesSupportedBpps); ++i)
|
---|
529 | {
|
---|
530 | if (bpp == g_aVBoxVidModesSupportedBpps[i])
|
---|
531 | return TRUE;
|
---|
532 | }
|
---|
533 | return FALSE;
|
---|
534 | }
|
---|
535 |
|
---|
536 | DECLINLINE(uint32_t) VBoxMPAdjustBpp(uint32_t bpp)
|
---|
537 | {
|
---|
538 | if (VBoxMPIsSupportedBpp(bpp))
|
---|
539 | return bpp;
|
---|
540 | Assert(g_aVBoxVidModesSupportedBpps[0] == 32);
|
---|
541 | return g_aVBoxVidModesSupportedBpps[0];
|
---|
542 | }
|
---|
543 | #endif
|
---|
544 | /* Updates missing video mode params with current values,
|
---|
545 | * Checks if resulting mode is liked by the host and fits into VRAM.
|
---|
546 | * Returns TRUE if resulting mode could be used.
|
---|
547 | */
|
---|
548 | static BOOLEAN
|
---|
549 | VBoxMPValidateVideoModeParams(PVBOXMP_DEVEXT pExt, uint32_t iDisplay, uint32_t &xres, uint32_t &yres, uint32_t &bpp)
|
---|
550 | {
|
---|
551 | /* Make sure all important video mode values are set */
|
---|
552 | if (VBoxMPIsStartingUp(pExt, iDisplay))
|
---|
553 | {
|
---|
554 | /* Use stored custom values only if nothing was read from host. */
|
---|
555 | xres = xres ? xres:g_CustomVideoModes[iDisplay].VisScreenWidth;
|
---|
556 | yres = yres ? yres:g_CustomVideoModes[iDisplay].VisScreenHeight;
|
---|
557 | bpp = bpp ? bpp :g_CustomVideoModes[iDisplay].BitsPerPlane;
|
---|
558 | }
|
---|
559 | else
|
---|
560 | {
|
---|
561 | /* Use current values for field which weren't read from host. */
|
---|
562 | #ifdef VBOX_XPDM_MINIPORT
|
---|
563 | xres = xres ? xres:pExt->CurrentModeWidth;
|
---|
564 | yres = yres ? yres:pExt->CurrentModeHeight;
|
---|
565 | bpp = bpp ? bpp :pExt->CurrentModeBPP;
|
---|
566 | #else
|
---|
567 | PVBOXWDDM_ALLOC_DATA pAllocData = pExt->aSources[iDisplay].pPrimaryAllocation ?
|
---|
568 | &pExt->aSources[iDisplay].pPrimaryAllocation->AllocData
|
---|
569 | : &pExt->aSources[iDisplay].AllocData;
|
---|
570 | xres = xres ? xres:pAllocData->SurfDesc.width;
|
---|
571 | yres = yres ? yres:pAllocData->SurfDesc.height;
|
---|
572 | /* VBox WDDM driver does not allow 24 modes since OS could choose the 24bit mode as default in that case,
|
---|
573 | * the pExt->aSources[iDisplay].AllocData.SurfDesc.bpp could be initially 24 though,
|
---|
574 | * i.e. when driver occurs the current mode on driver load via DxgkCbAcquirePostDisplayOwnership
|
---|
575 | * and until driver reports the supported modes
|
---|
576 | * This is true for Win8 Display-Only driver currently since DxgkCbAcquirePostDisplayOwnership is only used by it
|
---|
577 | *
|
---|
578 | * This is why we need to adjust the current mode bpp to the value we actually report as supported */
|
---|
579 | bpp = bpp ? bpp : VBoxMPAdjustBpp(pAllocData->SurfDesc.bpp);
|
---|
580 | #endif
|
---|
581 | }
|
---|
582 |
|
---|
583 | /* Round down width to be a multiple of 8 if necessary */
|
---|
584 | if (!VBoxCommonFromDeviceExt(pExt)->fAnyX)
|
---|
585 | {
|
---|
586 | xres &= 0xFFF8;
|
---|
587 | }
|
---|
588 |
|
---|
589 | /* We always need bpp to be set */
|
---|
590 | if (!bpp)
|
---|
591 | {
|
---|
592 | bpp=32;
|
---|
593 | }
|
---|
594 |
|
---|
595 | if (!VBoxMPValidateVideoModeParamsGuest(pExt, iDisplay, xres, yres, bpp))
|
---|
596 | {
|
---|
597 | WARN(("GUEST does not like special mode %dx%d:%d for display %d", xres, yres, bpp, iDisplay));
|
---|
598 | return FALSE;
|
---|
599 | }
|
---|
600 |
|
---|
601 | /* Check if host likes this mode */
|
---|
602 | if (!VBoxLikesVideoMode(iDisplay, xres, yres, bpp))
|
---|
603 | {
|
---|
604 | WARN_NOBP(("HOST does not like special mode %dx%d:%d for display %d", xres, yres, bpp, iDisplay));
|
---|
605 | return FALSE;
|
---|
606 | }
|
---|
607 |
|
---|
608 | #ifdef VBOX_XPDM_MINIPORT
|
---|
609 | ULONG vramSize = pExt->pPrimary->u.primary.ulMaxFrameBufferSize;
|
---|
610 | #else
|
---|
611 | ULONG vramSize = vboxWddmVramCpuVisibleSegmentSize(pExt);
|
---|
612 | vramSize /= pExt->u.primary.commonInfo.cDisplays;
|
---|
613 | if (!g_VBoxDisplayOnly)
|
---|
614 | {
|
---|
615 | /* at least two surfaces will be needed: primary & shadow */
|
---|
616 | vramSize /= 2;
|
---|
617 | }
|
---|
618 | vramSize &= ~PAGE_OFFSET_MASK;
|
---|
619 | #endif
|
---|
620 |
|
---|
621 | /* Check that values are valid and mode fits into VRAM */
|
---|
622 | if (!xres || !yres
|
---|
623 | || !((bpp == 16)
|
---|
624 | #ifdef VBOX_WITH_8BPP_MODES
|
---|
625 | || (bpp == 8)
|
---|
626 | #endif
|
---|
627 | || (bpp == 24)
|
---|
628 | || (bpp == 32)))
|
---|
629 | {
|
---|
630 | LOG(("invalid params for special mode %dx%d:%d", xres, yres, bpp));
|
---|
631 | return FALSE;
|
---|
632 | }
|
---|
633 |
|
---|
634 |
|
---|
635 |
|
---|
636 | if ((xres * yres * (bpp / 8) >= vramSize))
|
---|
637 | {
|
---|
638 | /* Store values of last reported release log message to avoid log flooding. */
|
---|
639 | static uint32_t s_xresNoVRAM=0, s_yresNoVRAM=0, s_bppNoVRAM=0;
|
---|
640 |
|
---|
641 | LOG(("not enough VRAM for video mode %dx%dx%dbpp. Available: %d bytes. Required: more than %d bytes.",
|
---|
642 | xres, yres, bpp, vramSize, xres * yres * (bpp / 8)));
|
---|
643 |
|
---|
644 | s_xresNoVRAM = xres;
|
---|
645 | s_yresNoVRAM = yres;
|
---|
646 | s_bppNoVRAM = bpp;
|
---|
647 |
|
---|
648 | return FALSE;
|
---|
649 | }
|
---|
650 |
|
---|
651 | return TRUE;
|
---|
652 | }
|
---|
653 |
|
---|
654 | /* Checks if there's a pending video mode change hint,
|
---|
655 | * and fills pPendingMode with associated info.
|
---|
656 | * returns TRUE if there's a pending change. Otherwise returns FALSE.
|
---|
657 | */
|
---|
658 | static BOOLEAN
|
---|
659 | VBoxMPCheckPendingVideoMode(PVBOXMP_DEVEXT pExt, PVIDEO_MODE_INFORMATION pPendingMode)
|
---|
660 | {
|
---|
661 | uint32_t xres=0, yres=0, bpp=0, display=0;
|
---|
662 |
|
---|
663 | /* Check if there's a pending display change request for this display */
|
---|
664 | if (VBoxQueryDisplayRequest(&xres, &yres, &bpp, &display) && (xres || yres || bpp))
|
---|
665 | {
|
---|
666 | if (display >= RT_ELEMENTS(g_CustomVideoModes))
|
---|
667 | {
|
---|
668 | /*display = RT_ELEMENTS(g_CustomVideoModes) - 1;*/
|
---|
669 | WARN(("VBoxQueryDisplayRequest returned invalid display number %d", display));
|
---|
670 | return FALSE;
|
---|
671 | }
|
---|
672 | }
|
---|
673 | else
|
---|
674 | {
|
---|
675 | LOG(("no pending request"));
|
---|
676 | return FALSE;
|
---|
677 | }
|
---|
678 |
|
---|
679 | /* Correct video mode params and check if host likes it */
|
---|
680 | if (VBoxMPValidateVideoModeParams(pExt, display, xres, yres, bpp))
|
---|
681 | {
|
---|
682 | VBoxFillVidModeInfo(pPendingMode, xres, yres, bpp, display, 0);
|
---|
683 | return TRUE;
|
---|
684 | }
|
---|
685 |
|
---|
686 | return FALSE;
|
---|
687 | }
|
---|
688 |
|
---|
689 | /* Save custom mode info to registry */
|
---|
690 | static void VBoxMPRegSaveModeInfo(PVBOXMP_DEVEXT pExt, uint32_t iDisplay, PVIDEO_MODE_INFORMATION pMode)
|
---|
691 | {
|
---|
692 | VBOXMPCMNREGISTRY Registry;
|
---|
693 | VP_STATUS rc;
|
---|
694 |
|
---|
695 | rc = VBoxMPCmnRegInit(pExt, &Registry);
|
---|
696 | VBOXMP_WARN_VPS(rc);
|
---|
697 |
|
---|
698 | if (iDisplay==0)
|
---|
699 | {
|
---|
700 | /*First name without a suffix*/
|
---|
701 | rc = VBoxMPCmnRegSetDword(Registry, L"CustomXRes", pMode->VisScreenWidth);
|
---|
702 | VBOXMP_WARN_VPS(rc);
|
---|
703 | rc = VBoxMPCmnRegSetDword(Registry, L"CustomYRes", pMode->VisScreenHeight);
|
---|
704 | VBOXMP_WARN_VPS(rc);
|
---|
705 | rc = VBoxMPCmnRegSetDword(Registry, L"CustomBPP", pMode->BitsPerPlane);
|
---|
706 | VBOXMP_WARN_VPS(rc);
|
---|
707 | }
|
---|
708 | else
|
---|
709 | {
|
---|
710 | wchar_t wszKeyName[32];
|
---|
711 | RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomXRes%d", iDisplay);
|
---|
712 | rc = VBoxMPCmnRegSetDword(Registry, wszKeyName, pMode->VisScreenWidth);
|
---|
713 | VBOXMP_WARN_VPS(rc);
|
---|
714 | RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomYRes%d", iDisplay);
|
---|
715 | rc = VBoxMPCmnRegSetDword(Registry, wszKeyName, pMode->VisScreenHeight);
|
---|
716 | VBOXMP_WARN_VPS(rc);
|
---|
717 | RTUtf16Printf(wszKeyName, RT_ELEMENTS(wszKeyName), "CustomBPP%d", iDisplay);
|
---|
718 | rc = VBoxMPCmnRegSetDword(Registry, wszKeyName, pMode->BitsPerPlane);
|
---|
719 | VBOXMP_WARN_VPS(rc);
|
---|
720 | }
|
---|
721 |
|
---|
722 | rc = VBoxMPCmnRegFini(Registry);
|
---|
723 | VBOXMP_WARN_VPS(rc);
|
---|
724 | }
|
---|
725 |
|
---|
726 | #ifdef VBOX_XPDM_MINIPORT
|
---|
727 | VIDEO_MODE_INFORMATION* VBoxMPXpdmCurrentVideoMode(PVBOXMP_DEVEXT pExt)
|
---|
728 | {
|
---|
729 | return VBoxMPCmnGetVideoModeInfo(pExt, pExt->CurrentMode - 1);
|
---|
730 | }
|
---|
731 |
|
---|
732 | ULONG VBoxMPXpdmGetVideoModesCount(PVBOXMP_DEVEXT pExt)
|
---|
733 | {
|
---|
734 | return pExt->cVideoModes;
|
---|
735 | }
|
---|
736 |
|
---|
737 | /* Makes a table of video modes consisting of:
|
---|
738 | * Default modes
|
---|
739 | * Custom modes manually added to registry
|
---|
740 | * Custom modes for all displays (either from a display change hint or stored in registry)
|
---|
741 | * 2 special modes, for a pending display change for this adapter. See comments below.
|
---|
742 | */
|
---|
743 | void VBoxMPXpdmBuildVideoModesTable(PVBOXMP_DEVEXT pExt)
|
---|
744 | {
|
---|
745 | uint32_t cStandartModes;
|
---|
746 | BOOLEAN bPending, bHaveSpecial;
|
---|
747 | VIDEO_MODE_INFORMATION specialMode;
|
---|
748 |
|
---|
749 | /* Fill table with standart modes and ones manually added to registry.
|
---|
750 | * Up to VBOXMP_MAX_VIDEO_MODES elements can be used, the rest is reserved
|
---|
751 | * for custom mode alternating indexes.
|
---|
752 | */
|
---|
753 | cStandartModes = VBoxMPFillModesTable(pExt, pExt->iDevice, pExt->aVideoModes, VBOXMP_MAX_VIDEO_MODES, NULL);
|
---|
754 |
|
---|
755 | /* Add custom mode for this display to the table */
|
---|
756 | /* Make 2 entries in the video mode table. */
|
---|
757 | uint32_t iModeBase = cStandartModes;
|
---|
758 |
|
---|
759 | /* Take the alternating index into account. */
|
---|
760 | BOOLEAN bAlternativeIndex = (pExt->iInvocationCounter % 2)? TRUE: FALSE;
|
---|
761 |
|
---|
762 | uint32_t iSpecialMode = iModeBase + (bAlternativeIndex? 1: 0);
|
---|
763 | uint32_t iStandardMode = iModeBase + (bAlternativeIndex? 0: 1);
|
---|
764 |
|
---|
765 | /* Fill the special mode. */
|
---|
766 | memcpy(&pExt->aVideoModes[iSpecialMode], &g_CustomVideoModes[pExt->iDevice], sizeof(VIDEO_MODE_INFORMATION));
|
---|
767 | pExt->aVideoModes[iSpecialMode].ModeIndex = iSpecialMode + 1;
|
---|
768 |
|
---|
769 | /* Wipe the other entry so it is not selected. */
|
---|
770 | memcpy(&pExt->aVideoModes[iStandardMode], &pExt->aVideoModes[3], sizeof(VIDEO_MODE_INFORMATION));
|
---|
771 | pExt->aVideoModes[iStandardMode].ModeIndex = iStandardMode + 1;
|
---|
772 |
|
---|
773 | LOG(("added special mode[%d] %dx%d:%d for display %d\n",
|
---|
774 | iSpecialMode,
|
---|
775 | pExt->aVideoModes[iSpecialMode].VisScreenWidth,
|
---|
776 | pExt->aVideoModes[iSpecialMode].VisScreenHeight,
|
---|
777 | pExt->aVideoModes[iSpecialMode].BitsPerPlane,
|
---|
778 | pExt->iDevice));
|
---|
779 |
|
---|
780 | /* Check if host wants us to switch video mode and it's for this adapter */
|
---|
781 | bPending = VBoxMPCheckPendingVideoMode(pExt, &specialMode);
|
---|
782 | bHaveSpecial = bPending && (pExt->iDevice == specialMode.ModeIndex);
|
---|
783 | LOG(("bPending %d, pExt->iDevice %d, specialMode.ModeIndex %d",
|
---|
784 | bPending, pExt->iDevice, specialMode.ModeIndex));
|
---|
785 |
|
---|
786 | /* Check the startup case */
|
---|
787 | if (!bHaveSpecial && VBoxMPIsStartingUp(pExt, pExt->iDevice))
|
---|
788 | {
|
---|
789 | uint32_t xres=0, yres=0, bpp=0;
|
---|
790 | LOG(("Startup for screen %d", pExt->iDevice));
|
---|
791 | /* Check if we could make valid mode from values stored to registry */
|
---|
792 | if (VBoxMPValidateVideoModeParams(pExt, pExt->iDevice, xres, yres, bpp))
|
---|
793 | {
|
---|
794 | LOG(("Startup for screen %d validated %dx%d %d", pExt->iDevice, xres, yres, bpp));
|
---|
795 | VBoxFillVidModeInfo(&specialMode, xres, yres, bpp, 0, 0);
|
---|
796 | bHaveSpecial = TRUE;
|
---|
797 | }
|
---|
798 | }
|
---|
799 |
|
---|
800 | /* Update number of modes. Each display has 2 entries for alternating custom mode index. */
|
---|
801 | pExt->cVideoModes = cStandartModes + 2;
|
---|
802 |
|
---|
803 | if (bHaveSpecial)
|
---|
804 | {
|
---|
805 | /* We need to alternate mode index entry for a pending mode change,
|
---|
806 | * else windows will ignore actual mode change call.
|
---|
807 | * Only alternate index if one of mode parameters changed and
|
---|
808 | * regardless of conditions always add 2 entries to the table.
|
---|
809 | */
|
---|
810 | bAlternativeIndex = FALSE;
|
---|
811 |
|
---|
812 | BOOLEAN bChanged = (pExt->Prev_xres!=specialMode.VisScreenWidth
|
---|
813 | || pExt->Prev_yres!=specialMode.VisScreenHeight
|
---|
814 | || pExt->Prev_bpp!=specialMode.BitsPerPlane);
|
---|
815 |
|
---|
816 | LOG(("prev %dx%dx%d, special %dx%dx%d",
|
---|
817 | pExt->Prev_xres, pExt->Prev_yres, pExt->Prev_bpp,
|
---|
818 | specialMode.VisScreenWidth, specialMode.VisScreenHeight, specialMode.BitsPerPlane));
|
---|
819 |
|
---|
820 | if (bChanged)
|
---|
821 | {
|
---|
822 | pExt->Prev_xres = specialMode.VisScreenWidth;
|
---|
823 | pExt->Prev_yres = specialMode.VisScreenHeight;
|
---|
824 | pExt->Prev_bpp = specialMode.BitsPerPlane;
|
---|
825 | }
|
---|
826 |
|
---|
827 | /* Check if we need to alternate the index */
|
---|
828 | if (!VBoxMPIsStartingUp(pExt, pExt->iDevice))
|
---|
829 | {
|
---|
830 | if (bChanged)
|
---|
831 | {
|
---|
832 | pExt->iInvocationCounter++;
|
---|
833 | }
|
---|
834 |
|
---|
835 | if (pExt->iInvocationCounter % 2)
|
---|
836 | {
|
---|
837 | bAlternativeIndex = TRUE;
|
---|
838 | }
|
---|
839 | }
|
---|
840 |
|
---|
841 | uint32_t iSpecialModeElement = cStandartModes + (bAlternativeIndex? 1: 0);
|
---|
842 | uint32_t iSpecialModeElementOld = cStandartModes + (bAlternativeIndex? 0: 1);
|
---|
843 |
|
---|
844 | LOG(("add special mode[%d] %dx%d:%d for display %d (bChanged=%d, bAlternativeIndex=%d)",
|
---|
845 | iSpecialModeElement, specialMode.VisScreenWidth, specialMode.VisScreenHeight, specialMode.BitsPerPlane,
|
---|
846 | pExt->iDevice, bChanged, bAlternativeIndex));
|
---|
847 |
|
---|
848 | /* Add special mode to the table
|
---|
849 | * Note: Y offset isn't used for a host-supplied modes
|
---|
850 | */
|
---|
851 | specialMode.ModeIndex = iSpecialModeElement + 1;
|
---|
852 | memcpy(&pExt->aVideoModes[iSpecialModeElement], &specialMode, sizeof(VIDEO_MODE_INFORMATION));
|
---|
853 |
|
---|
854 | /* Save special mode in the custom modes table */
|
---|
855 | memcpy(&g_CustomVideoModes[pExt->iDevice], &specialMode, sizeof(VIDEO_MODE_INFORMATION));
|
---|
856 |
|
---|
857 | /* Wipe the old entry so the special mode will be found in the new positions. */
|
---|
858 | memcpy(&pExt->aVideoModes[iSpecialModeElementOld], &pExt->aVideoModes[3], sizeof(VIDEO_MODE_INFORMATION));
|
---|
859 | pExt->aVideoModes[iSpecialModeElementOld].ModeIndex = iSpecialModeElementOld + 1;
|
---|
860 |
|
---|
861 | /* Save special mode info to registry */
|
---|
862 | VBoxMPRegSaveModeInfo(pExt, pExt->iDevice, &specialMode);
|
---|
863 | }
|
---|
864 |
|
---|
865 | #if defined(LOG_ENABLED)
|
---|
866 | do
|
---|
867 | {
|
---|
868 | LOG(("Filled %d modes for display %d", pExt->cVideoModes, pExt->iDevice));
|
---|
869 |
|
---|
870 | for (uint32_t i=0; i < pExt->cVideoModes; ++i)
|
---|
871 | {
|
---|
872 | LOG(("Mode[%2d]: %4dx%4d:%2d (idx=%d)",
|
---|
873 | i, pExt->aVideoModes[i].VisScreenWidth, pExt->aVideoModes[i].VisScreenHeight,
|
---|
874 | pExt->aVideoModes[i].BitsPerPlane, pExt->aVideoModes[i].ModeIndex));
|
---|
875 | }
|
---|
876 | } while (0);
|
---|
877 | #endif
|
---|
878 | }
|
---|
879 | #endif /*VBOX_XPDM_MINIPORT*/
|
---|