]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: add PcdVideoResolutionSource
authorGerd Hoffmann <kraxel@redhat.com>
Sat, 29 Jan 2022 16:26:14 +0000 (17:26 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sat, 29 Jan 2022 17:04:21 +0000 (17:04 +0000)
It's a UINT8 (enum) PCD telling where the PcdVideoHorizontalResolution
and PcdVideoVerticalResolution values are coming from.  It can be:

 0 (unset aka default from dsc file), or
 1 (from PlatformConfig), or
 2 (set by Video Driver).

It will be used by video drivers to avoid overriding PlatformConfig
values, or override each others values in case multiple display devices
are present.

The underlying problem this tries to solve is that the GOP protocol has
no way to indicate the preferred video mode.  On physical hardware this
isn't much of a problem because using the highest resolution available
works just fine as that is typically the native display resolution

But in a virtual machine you don't want come up with a huge 4k window by
default just because the virtual vga is able to handle that.  Cutting
down the video mode list isn't a great solution either as that would
also remove the modes from the platform configuration so the user
wouldn't be able to pick a resolution higher than the default any more.

So with patch drivers can use use PcdVideoHorizontalResolution and
PcdVideoVerticalResolution to indicate what the preferred display
resolution is, without overwriting the user preferences from
PlatformConfig if present.

A possible alternative approach would be to extend the GOP protocol, but
I'm not sure this is a good plan given this is mostly a problem for
virtual machines and using PCDs allows to keep this local to OvmfPkg.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
OvmfPkg/AmdSev/AmdSevX64.dsc
OvmfPkg/Microvm/MicrovmX64.dsc
OvmfPkg/OvmfPkg.dec
OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc
OvmfPkg/OvmfXen.dsc
OvmfPkg/PlatformDxe/Platform.c
OvmfPkg/PlatformDxe/Platform.inf

index 4c8498df1ca3a484bee48130d456d998dd0c081a..fd56176796d5f478941bc88a449cb4468386b41a 100644 (file)
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1280\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|800\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0\r
index d566fe83aaadde70aa8adf42222d5047b643f437..1ea43443ae9762cb45442963ac0f491a5aacfed5 100644 (file)
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1280\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|800\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0\r
index 769bef0ffa12d04afebdd095a95c11888932e6e2..7aa94ca02863f3f0d35ffb808580ad767e7b8aba 100644 (file)
   #  instance in PiSmmCpuDxeSmm, and CpuHotplugSmm.\r
   gUefiOvmfPkgTokenSpaceGuid.PcdCpuHotEjectDataAddress|0|UINT64|0x46\r
 \r
+  ## This PCD tracks where PcdVideo{Horizontal,Vertical}Resolution\r
+  #  values are coming from.\r
+  #    0 - unset (defaults from platform dsc)\r
+  #    1 - set from PlatformConfig\r
+  #    2 - set by GOP Driver.\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0|UINT8|0x64\r
+\r
 [PcdsFeatureFlag]\r
   gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE|BOOLEAN|0x1c\r
   gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|FALSE|BOOLEAN|0x1d\r
index 2baced98330a36d541b37f54e3c5ea779beacbaf..29eea82571c578278fd85adc1615f9e03f4b470d 100644 (file)
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1280\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|800\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0\r
index 6cb8c22f64eac0948499dd0693f0208aaf9b848f..56d3c49ab21a94942009dc882768db2a9d248058 100644 (file)
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1280\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|800\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0\r
index bf60c6df3a5db61c53980a1fbc956d6d1ecddc33..f0924c0f9d0a607b277795b514ee506a63cafe2e 100644 (file)
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1280\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|800\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0\r
index 2316c39ad2f61bced87df27cb1ac4031743b7326..efa97f09f32b73821ed69c7288af36c651e24228 100644 (file)
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1280\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|800\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0\r
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0\r
index 69a7ecb83d03fc474175210ed2e7b224b7749283..4bf22712c78f5e6b42b5fb74653e6d98a6639eeb 100644 (file)
@@ -742,6 +742,9 @@ ExecutePlatformConfig (
                   PlatformConfig.VerticalResolution\r
                   );\r
     ASSERT_RETURN_ERROR (PcdStatus);\r
+\r
+    PcdStatus = PcdSet8S (PcdVideoResolutionSource, 1);\r
+    ASSERT_RETURN_ERROR (PcdStatus);\r
   }\r
 \r
   return EFI_SUCCESS;\r
index 14727c1220e86b66701f67976cda195240170f3c..d2f75d78b601919b6bb05ba22f3afe872001cb93 100644 (file)
@@ -47,6 +47,7 @@
 [Pcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource\r
 \r
 [Protocols]\r
   gEfiDevicePathProtocolGuid      ## PRODUCES\r