Changeset 67918 in vbox for trunk/src/VBox/Devices/EFI/Firmware
- Timestamp:
- Jul 12, 2017 9:30:24 AM (8 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c
r67356 r67918 426 426 ) 427 427 { 428 EFI_STATUS Status; 429 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; 430 UINT32 GopMode = 2; 428 EFI_STATUS Status; 429 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; 430 UINT32 Index; 431 UINT32 HorizontalResolution = 1024; 432 UINT32 VerticalResolution = 768; 433 UINT32 ColorDepth = 32; 434 435 DEBUG((DEBUG_INFO, "%a:%d construct\n", __FILE__, __LINE__)); 431 436 432 437 GraphicsOutput = &Private->GraphicsOutput; … … 461 466 // Initialize the hardware 462 467 // 463 VBoxVgaGetVmVariable(EFI_INFO_INDEX_GOP_MODE, (CHAR8 *)&GopMode, sizeof(GopMode)); 464 465 GraphicsOutput->SetMode (GraphicsOutput, GopMode); 468 VBoxVgaGetVmVariable(EFI_INFO_INDEX_HORIZONTAL_RESOLUTION, (CHAR8 *)&HorizontalResolution, 469 sizeof(HorizontalResolution)); 470 VBoxVgaGetVmVariable(EFI_INFO_INDEX_VERTICAL_RESOLUTION, (CHAR8 *)&VerticalResolution, 471 sizeof(VerticalResolution)); 472 for (Index = 0; Index < Private->MaxMode; Index++) 473 { 474 if ( HorizontalResolution == Private->ModeData[Index].HorizontalResolution 475 && VerticalResolution == Private->ModeData[Index].VerticalResolution 476 && ColorDepth == Private->ModeData[Index].ColorDepth) 477 break; 478 } 479 // not found? try mode number 480 if (Index >= Private->MaxMode) 481 { 482 VBoxVgaGetVmVariable(EFI_INFO_INDEX_GRAPHICS_MODE, (CHAR8 *)&Index, sizeof(Index)); 483 // try with mode 2 (usually 1024x768) as a fallback 484 if (Index >= Private->MaxMode) 485 Index = 2; 486 // try with mode 0 (usually 640x480) as a fallback 487 if (Index >= Private->MaxMode) 488 Index = 0; 489 } 490 491 // skip mode setting completely if there is no valid mode 492 if (Index >= Private->MaxMode) 493 return EFI_UNSUPPORTED; 494 495 GraphicsOutput->SetMode (GraphicsOutput, Index); 466 496 467 497 DrawLogo ( -
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaUgaDraw.c
r67356 r67918 90 90 ) 91 91 { 92 VBOX_VGA_PRIVATE_DATA 93 UINTN 92 VBOX_VGA_PRIVATE_DATA *Private; 93 UINTN Index; 94 94 95 95 DEBUG((DEBUG_INFO, "%a:%d VIDEO: %dx%d %d bpp\n", __FILE__, __LINE__, HorizontalResolution, VerticalResolution, ColorDepth)); … … 328 328 { 329 329 EFI_UGA_DRAW_PROTOCOL *UgaDraw; 330 UINT32 Index; 330 331 UINT32 HorizontalResolution = 1024; 331 332 UINT32 VerticalResolution = 768; 333 UINT32 ColorDepth = 32; 332 334 333 335 // … … 349 351 // Initialize the hardware 350 352 // 351 VBoxVgaGetVmVariable(EFI_INFO_INDEX_ UGA_HORIZONTAL_RESOLUTION, (CHAR8 *)&HorizontalResolution,353 VBoxVgaGetVmVariable(EFI_INFO_INDEX_HORIZONTAL_RESOLUTION, (CHAR8 *)&HorizontalResolution, 352 354 sizeof(HorizontalResolution)); 353 VBoxVgaGetVmVariable(EFI_INFO_INDEX_ UGA_VERTICAL_RESOLUTION, (CHAR8 *)&VerticalResolution,355 VBoxVgaGetVmVariable(EFI_INFO_INDEX_VERTICAL_RESOLUTION, (CHAR8 *)&VerticalResolution, 354 356 sizeof(VerticalResolution)); 357 for (Index = 0; Index < Private->MaxMode; Index++) 358 { 359 if ( HorizontalResolution == Private->ModeData[Index].HorizontalResolution 360 && VerticalResolution == Private->ModeData[Index].VerticalResolution 361 && ColorDepth == Private->ModeData[Index].ColorDepth) 362 break; 363 } 364 // not found? try mode number 365 if (Index >= Private->MaxMode) 366 { 367 VBoxVgaGetVmVariable(EFI_INFO_INDEX_GRAPHICS_MODE, (CHAR8 *)&Index, sizeof(Index)); 368 // try with mode 2 (usually 1024x768) as a fallback 369 if (Index >= Private->MaxMode) 370 Index = 2; 371 // try with mode 0 (usually 640x480) as a fallback 372 if (Index >= Private->MaxMode) 373 Index = 0; 374 375 // get the resolution from the mode if valid 376 if (Index < Private->MaxMode) 377 { 378 HorizontalResolution = Private->ModeData[Index].HorizontalResolution; 379 VerticalResolution = Private->ModeData[Index].VerticalResolution; 380 ColorDepth = Private->ModeData[Index].ColorDepth; 381 } 382 } 383 384 // skip mode setting completely if there is no valid mode 385 if (Index >= Private->MaxMode) 386 return EFI_UNSUPPORTED; 355 387 356 388 UgaDraw->SetMode ( … … 358 390 HorizontalResolution, 359 391 VerticalResolution, 360 32,392 ColorDepth, 361 393 60 362 394 );
Note:
See TracChangeset
for help on using the changeset viewer.