From nobody Thu Dec 16 17:00:04 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 30D3F18EAD6B; Thu, 16 Dec 2021 17:00:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JFJJN6Yhnz3rkr; Thu, 16 Dec 2021 17:00:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0FFD3DB5; Thu, 16 Dec 2021 17:00:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BGH04Q2079201; Thu, 16 Dec 2021 17:00:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BGH04K6079198; Thu, 16 Dec 2021 17:00:04 GMT (envelope-from git) Date: Thu, 16 Dec 2021 17:00:04 GMT Message-Id: <202112161700.1BGH04K6079198@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 02732f945ed2 - main - loader.efi: Do not use as frame buffer BLT-only GOPs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02732f945ed2ec2b4fd03421923720608b28a615 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639674004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eWHX2V+XYrcGN8uBapZLl1X8onMWKdcUH+GrNwn/en0=; b=cz5tAloaqNYZS+GMyC2UQOJF1EbVAk6dGk44cpZWKyrPnPCpKUjRubjm7olhmXucHwD11L STiGMkvoOrX/PIzib6HIge7yULJygMbBN/Ld6bUA5Z76KZeR9PgpBtSTWTcUWt9qlmc6MT w4rb7DNoVu2Tq96HJBOPKNtu0IFgWVk1Z75RBlTfZ3lZUr5S0IjRVOmuGMPjpU28fJ51KR za+Fd0A/2t/n+dOtcanaM4WppouNlaW3WFOXVg/j63AiE7oSHGqSPpFat4t+hTFWPDKgy0 HCWIbTfAsQcxkEq7zwTESQ2RfHTv6Iekpjczyv0Q2U8HIAPZF5GtBv3zn0cceA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639674004; a=rsa-sha256; cv=none; b=MIZlTgT9P0kQTDDyT7EVl3al5L9z9wN6/qwBFPEaLQ0dXzzAWfqiWBAENwP9hoTKilSYMi 1roliWK/WeaxU9bOHgmK3NFduoGcJWjC49IDBD13TE7kZHA9Y7bznoKaKgH4UZmYx+stbk pE6rlu5q3KQP/GBREyLfl8NQBhlSNXZkTY6p0n6KokxGlYdsXnGqZnj03cmrFSvi+FYUeA CuK4PirSTrZAgYNzm8chR1FXO59zmEVizrC/O7GVCQuS4BUYUzfcYwlTVXw2M6ZSN37OpG KKNPxSQfPDHaBHMt4/d+q8fb5DodN53R7uBEpvDOilLCM3qSDPtn3mhRd1r82g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=02732f945ed2ec2b4fd03421923720608b28a615 commit 02732f945ed2ec2b4fd03421923720608b28a615 Author: Alexander Motin AuthorDate: 2021-12-16 16:44:34 +0000 Commit: Alexander Motin CommitDate: 2021-12-16 16:44:34 +0000 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 --- stand/efi/loader/framebuffer.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/stand/efi/loader/framebuffer.c b/stand/efi/loader/framebuffer.c index 03752b77a24e..0a00b3645b36 100644 --- a/stand/efi/loader/framebuffer.c +++ b/stand/efi/loader/framebuffer.c @@ -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)