summaryrefslogtreecommitdiffstats
path: root/OvmfPkg
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2024-08-23 14:36:16 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-08-30 05:32:12 +0000
commit391666da2c1dc5671bbb3393079d86f46e3435af (patch)
treecfaf1cd8f39fd67bffe5396a92ae94e78104cbfc /OvmfPkg
parent58035e8b5e11cfe2b9e6428d14c7817b6b1c83a2 (diff)
downloadedk2-391666da2c1dc5671bbb3393079d86f46e3435af.tar.gz
edk2-391666da2c1dc5671bbb3393079d86f46e3435af.tar.bz2
edk2-391666da2c1dc5671bbb3393079d86f46e3435af.zip
OvmfPkg/QemuVideoDxe: ignore display resolutions smaller than 640x480
GraphicsConsoleDxe will assert in case the resolution is too small. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'OvmfPkg')
-rw-r--r--OvmfPkg/QemuVideoDxe/Initialize.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c
index 050ae878ec..2d1f50637f 100644
--- a/OvmfPkg/QemuVideoDxe/Initialize.c
+++ b/OvmfPkg/QemuVideoDxe/Initialize.c
@@ -293,6 +293,8 @@ QemuVideoBochsEdid (
)
{
EFI_STATUS Status;
+ UINT32 X;
+ UINT32 Y;
if (Private->Variant != QEMU_VIDEO_BOCHS_MMIO) {
return;
@@ -344,16 +346,24 @@ QemuVideoBochsEdid (
return;
}
- *XRes = Private->Edid[56] | ((Private->Edid[58] & 0xf0) << 4);
- *YRes = Private->Edid[59] | ((Private->Edid[61] & 0xf0) << 4);
+ X = Private->Edid[56] | ((Private->Edid[58] & 0xf0) << 4);
+ Y = Private->Edid[59] | ((Private->Edid[61] & 0xf0) << 4);
DEBUG ((
DEBUG_INFO,
"%a: default resolution: %dx%d\n",
__func__,
- *XRes,
- *YRes
+ X,
+ Y
));
+ if ((X < 640) || (Y < 480)) {
+ /* ignore hint, GraphicsConsoleDxe needs 640x480 or larger */
+ return;
+ }
+
+ *XRes = X;
+ *YRes = Y;
+
if (PcdGet8 (PcdVideoResolutionSource) == 0) {
Status = PcdSet32S (PcdVideoHorizontalResolution, *XRes);
ASSERT_RETURN_ERROR (Status);