summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/PlatformDxe
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2022-01-29 17:26:14 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-01-29 17:04:21 +0000
commit929804b1721b73452a977f31af2d7de83193301b (patch)
tree1a355da75e09af253138b2a3fb1effc1209889f3 /OvmfPkg/PlatformDxe
parente95b44c90eede07c832cada9ce8e6d4035f5e8b7 (diff)
downloadedk2-929804b1721b73452a977f31af2d7de83193301b.tar.gz
edk2-929804b1721b73452a977f31af2d7de83193301b.tar.bz2
edk2-929804b1721b73452a977f31af2d7de83193301b.zip
OvmfPkg: add PcdVideoResolutionSource
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>
Diffstat (limited to 'OvmfPkg/PlatformDxe')
-rw-r--r--OvmfPkg/PlatformDxe/Platform.c3
-rw-r--r--OvmfPkg/PlatformDxe/Platform.inf1
2 files changed, 4 insertions, 0 deletions
diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c
index 69a7ecb83d..4bf22712c7 100644
--- a/OvmfPkg/PlatformDxe/Platform.c
+++ b/OvmfPkg/PlatformDxe/Platform.c
@@ -742,6 +742,9 @@ ExecutePlatformConfig (
PlatformConfig.VerticalResolution
);
ASSERT_RETURN_ERROR (PcdStatus);
+
+ PcdStatus = PcdSet8S (PcdVideoResolutionSource, 1);
+ ASSERT_RETURN_ERROR (PcdStatus);
}
return EFI_SUCCESS;
diff --git a/OvmfPkg/PlatformDxe/Platform.inf b/OvmfPkg/PlatformDxe/Platform.inf
index 14727c1220..d2f75d78b6 100644
--- a/OvmfPkg/PlatformDxe/Platform.inf
+++ b/OvmfPkg/PlatformDxe/Platform.inf
@@ -47,6 +47,7 @@
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution
+ gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource
[Protocols]
gEfiDevicePathProtocolGuid ## PRODUCES