From 807dbf2b9440a2519190663e711ec8cd95221c3a Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 19 Apr 2018 03:31:41 +0000 Subject: [PATCH] efi loader: Address two nits with recent graphics changes - We should be setting a known graphics mode on conout, but we aren't. - We shouldn't be setting gop mode if we didn't find a good resolution to set, but we were. This made efi_max_resolution=1x1 effectively worthless, since it would always set gop mode 0 if nothing else. --- stand/efi/boot1/boot1.c | 2 ++ stand/efi/loader/framebuffer.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/stand/efi/boot1/boot1.c b/stand/efi/boot1/boot1.c index 61087dc08954..32ca635562dd 100644 --- a/stand/efi/boot1/boot1.c +++ b/stand/efi/boot1/boot1.c @@ -415,6 +415,8 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) */ conout = ST->ConOut; conout->Reset(conout, TRUE); + /* Explicitly set conout to mode 0, 80x25 */ + conout->SetMode(conout, 0); conout->EnableCursor(conout, TRUE); conout->ClearScreen(conout); diff --git a/stand/efi/loader/framebuffer.c b/stand/efi/loader/framebuffer.c index c6b187d04596..fa65ddde24b9 100644 --- a/stand/efi/loader/framebuffer.c +++ b/stand/efi/loader/framebuffer.c @@ -577,12 +577,14 @@ gop_autoresize(EFI_GRAPHICS_OUTPUT *gop) } } - status = gop->SetMode(gop, best_mode); - if (EFI_ERROR(status)) { - snprintf(command_errbuf, sizeof(command_errbuf), - "gop_autoresize: Unable to set mode to %u (error=%lu)", - mode, EFI_ERROR_CODE(status)); - return (CMD_ERROR); + if (maxdim != 0) { + status = gop->SetMode(gop, best_mode); + if (EFI_ERROR(status)) { + snprintf(command_errbuf, sizeof(command_errbuf), + "gop_autoresize: Unable to set mode to %u (error=%lu)", + mode, EFI_ERROR_CODE(status)); + return (CMD_ERROR); + } } return (CMD_OK); }