VirtualBox

Ignore:
Timestamp:
Nov 23, 2015 6:46:58 PM (9 years ago)
Author:
vboxsync
Message:

EFI/Firmware: Move some VBox specific modifications for changing the video resolution to VBoxVgaDxe. Avoids flickering as the previous code was changing the resolution back and forth multiple times

Location:
trunk/src/VBox/Devices/EFI/Firmware
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c

    r58460 r58836  
    1717#ifdef VBOX
    1818#include "VBoxPkg.h"
    19 #include "DevEFI.h"
    20 #include "iprt/asm.h"
    2119#include "Library/PrintLib.h"
    22 /* Hmmm Uga Draw wasn't pointed in BDS, so perhaps it's totally dead */
    23 #include <Protocol/UgaDraw.h>
    2420#include <Guid/EventGroup.h> /* gEfiEventReadyToBootGuid */
    2521#endif
     
    3531EFI_EVENT     mEmuVariableEvent;
    3632BOOLEAN       mDetectVgaOnly;
    37 
    38 #ifdef VBOX
    39 static EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOutputProtocol;
    40 static EFI_GRAPHICS_OUTPUT_PROTOCOL    *Gop;
    41 static EFI_UGA_DRAW_PROTOCOL           *Uga;
    42 
    43 /*
    44  *   @todo move this function to the library.
    45  */
    46 static UINT32
    47 GetVmVariable(UINT32 Variable, CHAR8* Buffer, UINT32 Size )
    48 {
    49     UINT32 VarLen, i;
    50 
    51 
    52     ASMOutU32(EFI_INFO_PORT, Variable);
    53     VarLen = ASMInU32(EFI_INFO_PORT);
    54 
    55     for (i=0; i < VarLen && i < Size; i++)
    56     {
    57         Buffer[i] = ASMInU8(EFI_INFO_PORT);
    58     }
    59 
    60     return VarLen;
    61 }
    62 
    63 static VOID
    64 EFIAPI
    65 VBoxConsoleSwitchMode (
    66   IN EFI_EVENT                Event,
    67   IN VOID                     *Context
    68   )
    69 {
    70     EFI_STATUS r = EFI_NOT_FOUND; /* Neither GOP nor UGA is found*/
    71     EFI_TPL               OldTpl;
    72     OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
    73 
    74     gBS->LocateProtocol(&gEfiSimpleTextOutProtocolGuid, NULL, (VOID **)&TextOutputProtocol);
    75     gBS->LocateProtocol(&gEfiUgaDrawProtocolGuid, NULL, (VOID **)&Uga);
    76     gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Gop);
    77 
    78     if (Gop)
    79     {
    80         UINT32 mode = 2;
    81         GetVmVariable(EFI_INFO_INDEX_GOP_MODE, (CHAR8 *)&mode, sizeof(UINT32));
    82         r = Gop->SetMode(Gop, mode);
    83     }
    84     else if (Uga)
    85     {
    86         UINT32 H = 1027;
    87         UINT32 V = 768;
    88         GetVmVariable(EFI_INFO_INDEX_UGA_HORIZONTAL_RESOLUTION, (CHAR8 *)&H, sizeof(UINT32));
    89         GetVmVariable(EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION, (CHAR8 *)&V, sizeof(UINT32));
    90         r = Uga->SetMode(Uga, H, V, 32, 60);
    91     }
    92 
    93     if(EFI_ERROR(r))
    94         goto done;
    95 
    96     r = TextOutputProtocol->SetMode(TextOutputProtocol, TextOutputProtocol->Mode->MaxMode);
    97     if(EFI_ERROR(r))
    98         goto done;
    99     done:
    100     gBS->RestoreTPL (OldTpl);
    101     return;
    102 }
    103 
    104 EFI_STATUS
    105 EFIAPI
    106 VBoxConsoleInit()
    107 {
    108     EFI_EVENT event;
    109 
    110     gBS->CreateEventEx(EVT_NOTIFY_SIGNAL, TPL_NOTIFY, VBoxConsoleSwitchMode, NULL, &gEfiEventReadyToBootGuid, &event);
    111     return EFI_SUCCESS;
    112 }
    113 #endif /* VBOX */
    114 
    11533
    11634//
     
    13861304    }
    13871305  }
    1388 #ifdef VBOX
    1389   VBoxConsoleInit();
    1390 #endif
    13911306
    13921307  //
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgIa32.dsc

    r58786 r58836  
    545545 MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
    546546 VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.inf
    547  VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf
     547 VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf {
     548    <LibraryClasses>
     549      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     550 }
    548551 VBoxPkg/VBoxFsDxe/VBoxIso9660.inf
    549552 VBoxPkg/VBoxFsDxe/VBoxHfs.inf
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgX64.dsc

    r58786 r58836  
    549549 MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
    550550 VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.inf
    551  VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf
     551 VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf {
     552    <LibraryClasses>
     553      PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
     554 }
    552555 VBoxPkg/VBoxFsDxe/VBoxIso9660.inf
    553556 VBoxPkg/VBoxFsDxe/VBoxHfs.inf
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.c

    r56292 r58836  
    230230    NULL
    231231};
     232
     233
     234/*
     235 *   @todo move this function to the library.
     236 */
     237UINT32 VBoxVgaGetVmVariable(UINT32 Variable, CHAR8* Buffer, UINT32 Size)
     238{
     239    UINT32 VarLen, i;
     240
     241    ASMOutU32(EFI_INFO_PORT, Variable);
     242    VarLen = ASMInU32(EFI_INFO_PORT);
     243
     244    for (i = 0; i < VarLen && i < Size; i++)
     245        Buffer[i] = ASMInU8(EFI_INFO_PORT);
     246
     247    return VarLen;
     248}
     249
    232250
    233251/**
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.h

    r56292 r58836  
    7272
    7373#include "VBoxPkg.h"
     74#include "DevEFI.h"
     75#include "iprt/asm.h"
     76
    7477//
    7578// Cirrus Logic 5430 PCI Configuration Header values
     
    447450  );
    448451
     452UINT32 VBoxVgaGetVmVariable(UINT32 Variable, CHAR8* Buffer, UINT32 Size);
     453
    449454#endif
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf

    r56292 r58836  
    9090[Packages]
    9191  MdePkg/MdePkg.dec
     92  MdeModulePkg/MdeModulePkg.dec
    9293  VBoxPkg/VBoxPkg.dec
    9394
     
    119120[Pcd]
    120121  gVBoxVgaPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion
     122  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution  ## PRODUCES
     123  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution    ## PRODUCES
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c

    r56292 r58836  
    444444  EFI_STATUS                   Status;
    445445  EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
    446 
     446  UINT32                        GopMode = 2;
    447447
    448448  GraphicsOutput            = &Private->GraphicsOutput;
     
    478478  // Initialize the hardware
    479479  //
    480   GraphicsOutput->SetMode (GraphicsOutput, 2);
     480  VBoxVgaGetVmVariable(EFI_INFO_INDEX_GOP_MODE, (CHAR8 *)&GopMode, sizeof(GopMode));
     481  GraphicsOutput->SetMode (GraphicsOutput, GopMode);
    481482  DrawLogo (
    482483    Private,
     
    484485    Private->ModeData[Private->GraphicsOutput.Mode->Mode].VerticalResolution
    485486    );
     487  PcdSet32(PcdVideoHorizontalResolution, Private->ModeData[Private->GraphicsOutput.Mode->Mode].HorizontalResolution);
     488  PcdSet32(PcdVideoVerticalResolution, Private->ModeData[Private->GraphicsOutput.Mode->Mode].VerticalResolution);
    486489
    487490  return EFI_SUCCESS;
  • trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaUgaDraw.c

    r56292 r58836  
    333333{
    334334  EFI_UGA_DRAW_PROTOCOL *UgaDraw;
     335  UINT32                HorizontalResolution = 1027;
     336  UINT32                VerticalResolution = 768;
    335337
    336338  //
     
    353355  // Initialize the hardware
    354356  //
     357  VBoxVgaGetVmVariable(EFI_INFO_INDEX_UGA_HORIZONTAL_RESOLUTION, (CHAR8 *)&HorizontalResolution,
     358                       sizeof(HorizontalResolution));
     359  VBoxVgaGetVmVariable(EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION, (CHAR8 *)&VerticalResolution,
     360                       sizeof(VerticalResolution));
     361
    355362  UgaDraw->SetMode (
    356363            UgaDraw,
     
    365372    Private->ModeData[Private->CurrentMode].VerticalResolution
    366373    );
     374  PcdSet32(PcdVideoHorizontalResolution, HorizontalResolution);
     375  PcdSet32(PcdVideoVerticalResolution, VerticalResolution);
    367376
    368377  return EFI_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette