Revision: 15366
          http://sourceforge.net/p/edk2/code/15366
Author:   jljusten
Date:     2014-03-22 07:13:09 +0000 (Sat, 22 Mar 2014)
Log Message:
-----------
OvmfPkg: PlatformDxe: set preferred video resolution from platform config

The GraphicsConsoleDxe driver (in MdeModulePkg/Universal/Console)
determines the preferred video resolution from the dynamic PCDs
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution

Setting the graphics resolution during boot is useful when the guest OS
(for lack of a dedicated display driver) continues to work with the
original GOP resolution and framebuffer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>

Modified Paths:
--------------
    trunk/edk2/OvmfPkg/PlatformDxe/Platform.c
    trunk/edk2/OvmfPkg/PlatformDxe/Platform.inf

Modified: trunk/edk2/OvmfPkg/PlatformDxe/Platform.c
===================================================================
--- trunk/edk2/OvmfPkg/PlatformDxe/Platform.c   2014-03-22 07:13:02 UTC (rev 
15365)
+++ trunk/edk2/OvmfPkg/PlatformDxe/Platform.c   2014-03-22 07:13:09 UTC (rev 
15366)
@@ -17,7 +17,47 @@
 #include <Library/DebugLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 
+#include "PlatformConfig.h"
+
 /**
+  Load and execute the platform configuration.
+
+  @retval EFI_SUCCESS            Configuration loaded and executed.
+  @return                        Status codes from PlatformConfigLoad().
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ExecutePlatformConfig (
+  VOID
+  )
+{
+  EFI_STATUS      Status;
+  PLATFORM_CONFIG PlatformConfig;
+  UINT64          OptionalElements;
+
+  Status = PlatformConfigLoad (&PlatformConfig, &OptionalElements);
+  if (EFI_ERROR (Status)) {
+    DEBUG (((Status == EFI_NOT_FOUND) ? EFI_D_VERBOSE : EFI_D_ERROR,
+      "%a: failed to load platform config: %r\n", __FUNCTION__, Status));
+    return Status;
+  }
+
+  if (OptionalElements & PLATFORM_CONFIG_F_GRAPHICS_RESOLUTION) {
+    //
+    // Pass the preferred resolution to GraphicsConsoleDxe via dynamic PCDs.
+    //
+    PcdSet32 (PcdVideoHorizontalResolution,
+      PlatformConfig.HorizontalResolution);
+    PcdSet32 (PcdVideoVerticalResolution,
+      PlatformConfig.VerticalResolution);
+  }
+
+  return EFI_SUCCESS;
+}
+
+
+/**
   Entry point for this driver.
 
   @param[in] ImageHandle  Image handle of this driver.
@@ -33,6 +73,7 @@
   IN  EFI_SYSTEM_TABLE  *SystemTable
   )
 {
+  ExecutePlatformConfig ();
   return EFI_SUCCESS;
 }
 

Modified: trunk/edk2/OvmfPkg/PlatformDxe/Platform.inf
===================================================================
--- trunk/edk2/OvmfPkg/PlatformDxe/Platform.inf 2014-03-22 07:13:02 UTC (rev 
15365)
+++ trunk/edk2/OvmfPkg/PlatformDxe/Platform.inf 2014-03-22 07:13:09 UTC (rev 
15366)
@@ -42,6 +42,10 @@
   UefiRuntimeServicesTableLib
   UefiDriverEntryPoint
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution
+
 [Guids]
   gOvmfPlatformConfigGuid
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to