Changeset 23926 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Oct 21, 2009 8:25:33 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r23793 r23926 211 211 VP_STATUS status = 0; 212 212 213 /* Always add 800x600 video modes. Windows XP+ needs at least 800x600 resolution 214 * and fallbacks to 800x600x4bpp VGA mode if the driver did not report suitable modes. 215 * This resolution could be rejected by a low resolution host (netbooks, etc). 216 */ 217 int cBytesPerPixel; 218 for (cBytesPerPixel = 1; cBytesPerPixel <= 4; cBytesPerPixel++) 219 { 220 int cBitsPerPixel = cBytesPerPixel * 8; /* 8, 16, 24, 32 */ 221 222 #ifndef VBOX_WITH_8BPP_MODES 223 if (cBitsPerPixel == 8) 224 { 225 continue; 226 } 227 #endif /* !VBOX_WITH_8BPP_MODES */ 228 229 /* does the mode fit into the VRAM? */ 230 if (800 * 600 * cBytesPerPixel > (LONG)vramSize) 231 { 232 continue; 233 } 234 235 VideoModes[gNumVideoModes].Length = sizeof(VIDEO_MODE_INFORMATION); 236 VideoModes[gNumVideoModes].ModeIndex = gNumVideoModes + 1; 237 VideoModes[gNumVideoModes].VisScreenWidth = 800; 238 VideoModes[gNumVideoModes].VisScreenHeight = 600; 239 VideoModes[gNumVideoModes].ScreenStride = 800 * cBytesPerPixel; 240 VideoModes[gNumVideoModes].NumberOfPlanes = 1; 241 VideoModes[gNumVideoModes].BitsPerPlane = cBitsPerPixel; 242 VideoModes[gNumVideoModes].Frequency = 60; 243 VideoModes[gNumVideoModes].XMillimeter = 320; 244 VideoModes[gNumVideoModes].YMillimeter = 240; 245 switch (cBytesPerPixel) 246 { 247 case 1: 248 { 249 VideoModes[gNumVideoModes].NumberRedBits = 6; 250 VideoModes[gNumVideoModes].NumberGreenBits = 6; 251 VideoModes[gNumVideoModes].NumberBlueBits = 6; 252 VideoModes[gNumVideoModes].RedMask = 0; 253 VideoModes[gNumVideoModes].GreenMask = 0; 254 VideoModes[gNumVideoModes].BlueMask = 0; 255 VideoModes[gNumVideoModes].AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN | 256 VIDEO_MODE_PALETTE_DRIVEN | VIDEO_MODE_MANAGED_PALETTE; 257 } break; 258 case 2: 259 { 260 VideoModes[gNumVideoModes].NumberRedBits = 5; 261 VideoModes[gNumVideoModes].NumberGreenBits = 6; 262 VideoModes[gNumVideoModes].NumberBlueBits = 5; 263 VideoModes[gNumVideoModes].RedMask = 0xF800; 264 VideoModes[gNumVideoModes].GreenMask = 0x7E0; 265 VideoModes[gNumVideoModes].BlueMask = 0x1F; 266 VideoModes[gNumVideoModes].AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN; 267 } break; 268 case 3: 269 { 270 VideoModes[gNumVideoModes].NumberRedBits = 8; 271 VideoModes[gNumVideoModes].NumberGreenBits = 8; 272 VideoModes[gNumVideoModes].NumberBlueBits = 8; 273 VideoModes[gNumVideoModes].RedMask = 0xFF0000; 274 VideoModes[gNumVideoModes].GreenMask = 0xFF00; 275 VideoModes[gNumVideoModes].BlueMask = 0xFF; 276 VideoModes[gNumVideoModes].AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN; 277 } break; 278 default: 279 case 4: 280 { 281 VideoModes[gNumVideoModes].NumberRedBits = 8; 282 VideoModes[gNumVideoModes].NumberGreenBits = 8; 283 VideoModes[gNumVideoModes].NumberBlueBits = 8; 284 VideoModes[gNumVideoModes].RedMask = 0xFF0000; 285 VideoModes[gNumVideoModes].GreenMask = 0xFF00; 286 VideoModes[gNumVideoModes].BlueMask = 0xFF; 287 VideoModes[gNumVideoModes].AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR | VIDEO_MODE_NO_OFF_SCREEN; 288 } break; 289 } 290 VideoModes[gNumVideoModes].VideoMemoryBitmapWidth = 800; 291 VideoModes[gNumVideoModes].VideoMemoryBitmapHeight = 600; 292 VideoModes[gNumVideoModes].DriverSpecificAttributeFlags = 0; 293 294 /* a new mode has been filled in */ 295 ++gNumVideoModes; 296 } 297 213 298 /* 214 299 * Query the y-offset from the host … … 231 316 if (resolutionMatrix[matrixIndex].xRes * resolutionMatrix[matrixIndex].yRes * 1 > (LONG)vramSize) 232 317 { 318 ++matrixIndex; 319 continue; 320 } 321 322 if (yOffset == 0 && resolutionMatrix[matrixIndex].xRes == 800 && resolutionMatrix[matrixIndex].yRes == 600) 323 { 324 /* This mode was already added. */ 233 325 ++matrixIndex; 234 326 continue; … … 290 382 } 291 383 384 if (yOffset == 0 && resolutionMatrix[matrixIndex].xRes == 800 && resolutionMatrix[matrixIndex].yRes == 600) 385 { 386 /* This mode was already added. */ 387 ++matrixIndex; 388 continue; 389 } 390 292 391 /* does the host like that mode? */ 293 392 if (!vboxLikesVideoMode(resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 16)) … … 343 442 } 344 443 444 if (yOffset == 0 && resolutionMatrix[matrixIndex].xRes == 800 && resolutionMatrix[matrixIndex].yRes == 600) 445 { 446 /* This mode was already added. */ 447 ++matrixIndex; 448 continue; 449 } 450 345 451 /* does the host like that mode? */ 346 452 if (!vboxLikesVideoMode(resolutionMatrix[matrixIndex].xRes, resolutionMatrix[matrixIndex].yRes - yOffset, 24)) … … 392 498 if (resolutionMatrix[matrixIndex].xRes * resolutionMatrix[matrixIndex].yRes * 4 > (LONG)vramSize) 393 499 { 500 ++matrixIndex; 501 continue; 502 } 503 504 if (yOffset == 0 && resolutionMatrix[matrixIndex].xRes == 800 && resolutionMatrix[matrixIndex].yRes == 600) 505 { 506 /* This mode was already added. */ 394 507 ++matrixIndex; 395 508 continue; … … 561 674 * registry key add it to the modes table. 562 675 */ 563 uint32_t xres , yres, bpp = 0;676 uint32_t xres = 0, yres = 0, bpp = 0; 564 677 if ( ( vboxQueryDisplayRequest(&xres, &yres, &bpp) 565 678 && (xres || yres || bpp)) … … 570 683 if (DeviceExtension->CurrentMode == 0) 571 684 { 572 xres = gCustomXRes; 573 yres = gCustomYRes; 574 bpp = gCustomBPP; 685 /* Use the stored custom resolution values only if nothing was read from host. 686 * The custom mode might be not valid anymore and would block any hints from host. 687 */ 688 if (!xres) 689 xres = gCustomXRes; 690 if (!yres) 691 yres = gCustomYRes; 692 if (!bpp) 693 bpp = gCustomBPP; 575 694 dprintf(("VBoxVideo: using stored custom resolution %dx%dx%d\n", xres, yres, bpp)); 576 695 } … … 589 708 bpp = DeviceExtension->CurrentModeBPP; 590 709 } 710 711 /* Use a default value. */ 712 if (!bpp) 713 bpp = 32; 591 714 592 715 /* does the host like that mode? */ … … 719 842 xres, yres, bpp)); 720 843 } 721 #ifdef DEBUG844 #ifdef LOG_ENABLED 722 845 { 723 846 int i;
Note:
See TracChangeset
for help on using the changeset viewer.