loader.efi: Do not use as frame buffer BLT-only GOPs.

Kernel needs physical frame buffer address and size, which Block
Transfer-only Graphics Output Protocol instances do not have.

Some recent ASUS boards like PRIME Z690M-PLUS D4 and PRIME H570-Plus
report two GOPs, out of which the second one support ConOut protocol,
that made it preferable, but is BLT-only, that made console unusable.

Discussed with:	tsoome (previous version)
MFC after:	1 week
This commit is contained in:
Alexander Motin 2021-12-16 11:44:34 -05:00
parent c610426c4d
commit 02732f945e

View File

@ -567,21 +567,33 @@ efi_find_framebuffer(teken_gfx_t *gfx_state)
/*
* Search for ConOut protocol, if not found, use first handle.
*/
gop_handle = *hlist;
gop_handle = NULL;
for (i = 0; i < nhandles; i++) {
void *dummy = NULL;
EFI_GRAPHICS_OUTPUT *tgop;
void *dummy;
status = OpenProtocolByHandle(hlist[i], &gop_guid, (void **)&tgop);
if (status != EFI_SUCCESS)
continue;
if (tgop->Mode->Info->PixelFormat == PixelBltOnly ||
tgop->Mode->Info->PixelFormat >= PixelFormatMax)
continue;
status = OpenProtocolByHandle(hlist[i], &conout_guid, &dummy);
if (status == EFI_SUCCESS) {
gop_handle = hlist[i];
gop = tgop;
break;
} else if (gop_handle == NULL) {
gop_handle = hlist[i];
gop = tgop;
}
}
status = OpenProtocolByHandle(gop_handle, &gop_guid, (void **)&gop);
free(hlist);
if (status == EFI_SUCCESS) {
if (gop_handle != NULL) {
gfx_state->tg_fb_type = FB_GOP;
gfx_state->tg_private = gop;
if (edid_info == NULL)