Changeset 35656 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jan 20, 2011 2:48:13 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Makefile.kmk
r34848 r35656 35 35 VBoxVideo_DEFS += VBOX_WITH_VIDEOHWACCEL 36 36 endif 37 VBoxVideo_DEFS += VBOX_WITH_MULTIMONITOR_FIX38 37 #VBoxVideo_DEFS += LOG_ENABLED 39 38 VBoxVideo_INCS = ../../include … … 93 92 VBoxVideoWddm_DEFS += LOG_ENABLED 94 93 endif 95 #VBoxVideoWddm_DEFS += VBOX_WITH_MULTIMONITOR_FIX96 94 VBoxVideoWddm_DEFS += LOG_TO_BACKDOOR 97 95 VBoxVideoWddm_INCS += ../../include -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r34686 r35656 48 48 { 0x000A0000, 0x00000000, 0x00020000, 0, 0, 1, 0 }, /* 0xA0000-0xBFFFF */ 49 49 }; 50 /*51 * Globals for the last custom resolution set. This is important52 * for system startup so that we report the last currently set53 * custom resolution and Windows can use it again.54 */55 #ifndef VBOX_WITH_MULTIMONITOR_FIX56 uint32_t gCustomXRes = 0;57 uint32_t gCustomYRes = 0;58 uint32_t gCustomBPP = 0;59 #endif /* !VBOX_WITH_MULTIMONITOR_FIX */60 50 61 51 /******************************************************************************* … … 332 322 } 333 323 #endif 324 325 static void initVideoModeInformation(VIDEO_MODE_INFORMATION *pVideoMode, ULONG xres, ULONG yres, ULONG bpp, ULONG index, ULONG yoffset) 326 { 327 /* 328 * Build mode entry. 329 */ 330 memset(pVideoMode, 0, sizeof(VIDEO_MODE_INFORMATION)); 331 332 pVideoMode->Length = sizeof(VIDEO_MODE_INFORMATION); 333 pVideoMode->ModeIndex = index; 334 pVideoMode->VisScreenWidth = xres; 335 pVideoMode->VisScreenHeight = yres - yoffset; 336 pVideoMode->ScreenStride = xres * ((bpp + 7) / 8); 337 pVideoMode->NumberOfPlanes = 1; 338 pVideoMode->BitsPerPlane = bpp; 339 pVideoMode->Frequency = 60; 340 pVideoMode->XMillimeter = 320; 341 pVideoMode->YMillimeter = 240; 342 switch (bpp) 343 { 344 #ifdef VBOX_WITH_8BPP_MODES 345 case 8: 346 pVideoMode->NumberRedBits = 6; 347 pVideoMode->NumberGreenBits = 6; 348 pVideoMode->NumberBlueBits = 6; 349 pVideoMode->RedMask = 0; 350 pVideoMode->GreenMask = 0; 351 pVideoMode->BlueMask = 0; 352 break; 353 #endif 354 case 16: 355 pVideoMode->NumberRedBits = 5; 356 pVideoMode->NumberGreenBits = 6; 357 pVideoMode->NumberBlueBits = 5; 358 pVideoMode->RedMask = 0xF800; 359 pVideoMode->GreenMask = 0x7E0; 360 pVideoMode->BlueMask = 0x1F; 361 break; 362 case 24: 363 pVideoMode->NumberRedBits = 8; 364 pVideoMode->NumberGreenBits = 8; 365 pVideoMode->NumberBlueBits = 8; 366 pVideoMode->RedMask = 0xFF0000; 367 pVideoMode->GreenMask = 0xFF00; 368 pVideoMode->BlueMask = 0xFF; 369 break; 370 case 32: 371 pVideoMode->NumberRedBits = 8; 372 pVideoMode->NumberGreenBits = 8; 373 pVideoMode->NumberBlueBits = 8; 374 pVideoMode->RedMask = 0xFF0000; 375 pVideoMode->GreenMask = 0xFF00; 376 pVideoMode->BlueMask = 0xFF; 377 break; 378 } 379 pVideoMode->AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN; 380 #ifdef VBOX_WITH_8BPP_MODES 381 if (bpp == 8) 382 pVideoMode->AttributeFlags |= VIDEO_MODE_PALETTE_DRIVEN | VIDEO_MODE_MANAGED_PALETTE; 383 #endif 384 pVideoMode->VideoMemoryBitmapWidth = xres; 385 pVideoMode->VideoMemoryBitmapHeight = yres - yoffset; 386 pVideoMode->DriverSpecificAttributeFlags = 0; 387 } 334 388 335 389 #ifdef VBOX_WITH_GENERIC_MULTIMONITOR … … 1388 1442 */ 1389 1443 #define MAX_VIDEO_MODES 128 1390 #ifndef VBOX_WITH_MULTIMONITOR_FIX1391 static VIDEO_MODE_INFORMATION VideoModes[MAX_VIDEO_MODES + 2] = { 0 };1392 #else1393 1444 /* 1394 1445 * Additional space is reserved for custom video modes for 64 guest monitors. … … 1396 1447 */ 1397 1448 static VIDEO_MODE_INFORMATION VideoModes[MAX_VIDEO_MODES + 64 + 2] = { 0 }; 1398 /* On the driver startup this is initialized from registry (replaces gCustom*). */ 1449 1450 /* 1451 * The last custom resolution set for each display. This is important 1452 * for system startup so that we report the last currently set 1453 * custom resolution and Windows can use it again. 1454 * On the driver startup this is initialized from registry. 1455 */ 1399 1456 static VIDEO_MODE_INFORMATION CustomVideoModes[64] = { 0 }; 1400 #endif /* VBOX_WITH_MULTIMONITOR_FIX */ 1457 1401 1458 /* number of available video modes, set by VBoxBuildModesTable */ 1402 1459 static uint32_t gNumVideoModes = 0; 1403 1460 1404 #ifdef VBOX_WITH_MULTIMONITOR_FIX 1405 static void initVideoModeInformation(VIDEO_MODE_INFORMATION *pVideoMode, ULONG xres, ULONG yres, ULONG bpp, ULONG index, ULONG yoffset) 1406 { 1407 /* 1408 * Build mode entry. 1409 */ 1410 memset(pVideoMode, 0, sizeof(VIDEO_MODE_INFORMATION)); 1411 1412 pVideoMode->Length = sizeof(VIDEO_MODE_INFORMATION); 1413 pVideoMode->ModeIndex = index; 1414 pVideoMode->VisScreenWidth = xres; 1415 pVideoMode->VisScreenHeight = yres - yoffset; 1416 pVideoMode->ScreenStride = xres * ((bpp + 7) / 8); 1417 pVideoMode->NumberOfPlanes = 1; 1418 pVideoMode->BitsPerPlane = bpp; 1419 pVideoMode->Frequency = 60; 1420 pVideoMode->XMillimeter = 320; 1421 pVideoMode->YMillimeter = 240; 1422 switch (bpp) 1423 { 1424 #ifdef VBOX_WITH_8BPP_MODES 1425 case 8: 1426 pVideoMode->NumberRedBits = 6; 1427 pVideoMode->NumberGreenBits = 6; 1428 pVideoMode->NumberBlueBits = 6; 1429 pVideoMode->RedMask = 0; 1430 pVideoMode->GreenMask = 0; 1431 pVideoMode->BlueMask = 0; 1432 break; 1433 #endif 1434 case 16: 1435 pVideoMode->NumberRedBits = 5; 1436 pVideoMode->NumberGreenBits = 6; 1437 pVideoMode->NumberBlueBits = 5; 1438 pVideoMode->RedMask = 0xF800; 1439 pVideoMode->GreenMask = 0x7E0; 1440 pVideoMode->BlueMask = 0x1F; 1441 break; 1442 case 24: 1443 pVideoMode->NumberRedBits = 8; 1444 pVideoMode->NumberGreenBits = 8; 1445 pVideoMode->NumberBlueBits = 8; 1446 pVideoMode->RedMask = 0xFF0000; 1447 pVideoMode->GreenMask = 0xFF00; 1448 pVideoMode->BlueMask = 0xFF; 1449 break; 1450 case 32: 1451 pVideoMode->NumberRedBits = 8; 1452 pVideoMode->NumberGreenBits = 8; 1453 pVideoMode->NumberBlueBits = 8; 1454 pVideoMode->RedMask = 0xFF0000; 1455 pVideoMode->GreenMask = 0xFF00; 1456 pVideoMode->BlueMask = 0xFF; 1457 break; 1458 } 1459 pVideoMode->AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN; 1460 #ifdef VBOX_WITH_8BPP_MODES 1461 if (bpp == 8) 1462 pVideoMode->AttributeFlags |= VIDEO_MODE_PALETTE_DRIVEN | VIDEO_MODE_MANAGED_PALETTE; 1463 #endif 1464 pVideoMode->VideoMemoryBitmapWidth = xres; 1465 pVideoMode->VideoMemoryBitmapHeight = yres - yoffset; 1466 pVideoMode->DriverSpecificAttributeFlags = 0; 1467 } 1468 #endif /* VBOX_WITH_MULTIMONITOR_FIX */ 1469 1470 1461 /* Remember which video mode was not set because there was no enough VRAM. 1462 * So repeated entries will be not written to the guest log. 1463 */ 1471 1464 static uint32_t g_xresNoVRAM = 0, g_yresNoVRAM = 0, g_bppNoVRAM = 0; 1472 1465 … … 2032 2025 */ 2033 2026 2034 #ifdef VBOX_WITH_MULTIMONITOR_FIX2035 2027 /* Add custom resolutions for each display and then for the display change request, if exists. 2036 2028 */ … … 2105 2097 } 2106 2098 } 2107 #endif /* VBOX_WITH_MULTIMONITOR_FIX */ 2108 2109 #ifndef VBOX_WITH_MULTIMONITOR_FIX 2110 uint32_t xres = 0, yres = 0, bpp = 0, display = 0; 2111 if ( ( vboxQueryDisplayRequest(&xres, &yres, &bpp, &display) 2112 && (xres || yres || bpp)) 2113 || (gCustomXRes || gCustomYRes || gCustomBPP)) 2114 #else 2099 2115 2100 if (fDisplayChangeRequest || DeviceExtension->CurrentMode == 0) 2116 #endif /* VBOX_WITH_MULTIMONITOR_FIX */2117 2101 { 2118 2102 #ifndef VBOX_WITH_WDDM … … 2127 2111 * The custom mode might be not valid anymore and would block any hints from host. 2128 2112 */ 2129 #ifndef VBOX_WITH_MULTIMONITOR_FIX2130 if (!xres)2131 xres = gCustomXRes;2132 if (!yres)2133 yres = gCustomYRes;2134 if (!bpp)2135 bpp = gCustomBPP;2136 dprintf(("VBoxVideo: using stored custom resolution %dx%dx%d\n", xres, yres, bpp));2137 #else2138 2113 if (!xres) 2139 2114 xres = CustomVideoModes[DeviceExtension->iDevice].VisScreenWidth; … … 2143 2118 bpp = CustomVideoModes[DeviceExtension->iDevice].BitsPerPlane; 2144 2119 dprintf(("VBoxVideo: using stored custom resolution %dx%dx%d for %d\n", xres, yres, bpp, DeviceExtension->iDevice)); 2145 #endif /* VBOX_WITH_MULTIMONITOR_FIX */2146 2120 } 2147 2121 /* round down to multiple of 8 if necessary */ … … 2197 2171 2198 2172 { 2199 /* we need an alternating index */ 2200 #ifdef VBOX_WITH_MULTIMONITOR_FIX 2201 /* Only alternate index if the new custom mode differs from the last one 2173 /* We need an alternating index so the guest will recognoize the mode as a new one. 2174 * However only alternate index if the new custom mode differs from the last one 2202 2175 * (only resolution and bpp changes are important, a display change does not matter). 2203 2176 * Always add 2 last entries to the mode array, so number of video modes … … 2218 2191 } 2219 2192 BOOLEAN fAlternatedIndex = FALSE; 2220 #endif /* VBOX_WITH_MULTIMONITOR_FIX */2221 2193 #ifndef VBOX_WITH_WDDM 2222 2194 if (DeviceExtension->CurrentMode != 0) … … 2224 2196 if (commonFromDeviceExt(DeviceExtension)->cDisplays && DeviceExtension->aSources[0].pPrimaryAllocation) 2225 2197 #endif 2226 #ifndef VBOX_WITH_MULTIMONITOR_FIX2227 {2228 if (gInvocationCounter % 2)2229 gNumVideoModes++;2230 gInvocationCounter++;2231 }2232 #else2233 2198 { 2234 2199 if (fNewInvocation) … … 2247 2212 fNewInvocation = FALSE; 2248 2213 } 2249 #endif /* VBOX_WITH_MULTIMONITOR_FIX */2250 2214 2251 2215 dprintf(("VBoxVideo: setting special mode to xres = %d, yres = %d, bpp = %d, display = %d\n", xres, yres, bpp, display)); 2252 #ifdef VBOX_WITH_MULTIMONITOR_FIX2253 2216 dprintf(("VBoxVideo: fNewInvocation = %d, fAlternatedIndex = %d\n", fNewInvocation, fAlternatedIndex)); 2254 #endif /* VBOX_WITH_MULTIMONITOR_FIX */2255 2217 #ifdef VBOX_WITH_WDDM 2256 2218 /* assign host-supplied as the most preferable */ … … 2318 2280 VideoModes[gNumVideoModes].VideoMemoryBitmapHeight = yres; 2319 2281 VideoModes[gNumVideoModes].DriverSpecificAttributeFlags = 0; 2320 #ifdef VBOX_WITH_MULTIMONITOR_FIX 2282 2321 2283 /* Save the mode in the list of custom modes for this display. */ 2322 2284 CustomVideoModes[DeviceExtension->iDevice] = VideoModes[gNumVideoModes]; 2323 #endif /* VBOX_WITH_MULTIMONITOR_FIX */2324 2285 ++gNumVideoModes; 2325 2286 … … 2336 2297 gNumVideoModes++; 2337 2298 } 2338 #ifdef VBOX_WITH_MULTIMONITOR_FIX2339 2299 else if (!fAlternatedIndex) 2340 2300 { … … 2344 2304 gNumVideoModes++; 2345 2305 } 2346 #endif /* VBOX_WITH_MULTIMONITOR_FIX */ 2347 2348 #ifndef VBOX_WITH_MULTIMONITOR_FIX 2349 /* store this video mode as the last custom video mode */ 2350 status = VBoxVideoCmnRegSetDword(Reg, L"CustomXRes", xres); 2351 if (status != NO_ERROR) 2352 dprintf(("VBoxVideo: error %d writing CustomXRes\n", status)); 2353 status = VBoxVideoCmnRegSetDword(Reg, L"CustomYRes", yres); 2354 if (status != NO_ERROR) 2355 dprintf(("VBoxVideo: error %d writing CustomYRes\n", status)); 2356 status = VBoxVideoCmnRegSetDword(Reg, L"CustomBPP", bpp); 2357 if (status != NO_ERROR) 2358 dprintf(("VBoxVideo: error %d writing CustomBPP\n", status)); 2359 #else 2306 2360 2307 /* Save the custom mode for this display. */ 2361 2308 if (DeviceExtension->iDevice == 0) … … 2388 2335 dprintf(("VBoxVideo: error %d writing CustomBPP%d\n", status, DeviceExtension->iDevice)); 2389 2336 } 2390 #endif /* VBOX_WITH_MULTIMONITOR_FIX */2391 2337 } 2392 2338 else … … 2937 2883 dprintf(("VBoxVideo::vboxVideoInitCustomVideoModes\n")); 2938 2884 2939 #ifndef VBOX_WITH_MULTIMONITOR_FIX2940 /*2941 * Get the last custom resolution2942 */2943 status = VBoxVideoCmnRegQueryDword(Reg, L"CustomXRes", &gCustomXRes);2944 if (status != NO_ERROR)2945 gCustomXRes = 0;2946 2947 status = VBoxVideoCmnRegQueryDword(Reg, L"CustomYRes", &gCustomYRes);2948 if (status != NO_ERROR)2949 gCustomYRes = 0;2950 status = VBoxVideoCmnRegQueryDword(Reg, L"CustomBPP", &gCustomBPP);2951 if (status != NO_ERROR)2952 gCustomBPP = 0;2953 2954 dprintf(("VBoxVideo: got stored custom resolution %dx%dx%d\n", gCustomXRes, gCustomYRes, gCustomBPP));2955 #else2956 2885 /* Initialize all custom modes to the 800x600x32. */ 2957 2886 initVideoModeInformation(&CustomVideoModes[0], 800, 600, 32, 0, 0); … … 3027 2956 } 3028 2957 } 3029 #endif /* VBOX_WITH_MULTIMONITOR_FIX */3030 2958 3031 2959 VBoxVideoCmnRegFini(Reg);
Note:
See TracChangeset
for help on using the changeset viewer.