From nobody Mon Apr 29 14:14:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+85000+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+85000+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639665057; cv=none; d=zohomail.com; s=zohoarc; b=cLohPO6hj3zRNKYxFsBmtypCIydaO1wzIdRH98J7iRPZtjLNhqmKgUC8ufvRfHePRAFc66EOHd+1u/qoBEUZWOQA8dnuYP03QcajTOAulOwAm+266Y+l5fxcVH6KBfKshW/0u/C7emgmjUIeHzDPu9RJa2XMPUy09CCM5wWDmrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639665057; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=kkcoS6VT6ecdDf23wAGk0lRqO+iHRVEGygtrIz9AEPg=; b=m5zN8kdXe7VSd3InUag8mva8OleC4LIm9LLGBh2defQesnoRWdf2fs3GXgcdqqhf5byQu/yIzOuHD5KQR9gEgc1MYWrum2D8trEr39uCLUxqFE7oTMYe3sDnVDITwVRAgmCBlNjm7YfAnMtGmTEPT0+py9q6NzKLehj7e0NzGNI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+85000+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1639665057892885.037148744977; Thu, 16 Dec 2021 06:30:57 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id RzwZYY1788612x554URIy5RH; Thu, 16 Dec 2021 06:30:57 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web12.11124.1639665056834845186 for ; Thu, 16 Dec 2021 06:30:57 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-287-BCvsGV6tM3epTm4kwzP8OQ-1; Thu, 16 Dec 2021 09:30:52 -0500 X-MC-Unique: BCvsGV6tM3epTm4kwzP8OQ-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 34825760C8; Thu, 16 Dec 2021 14:30:50 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 21EEE5ED43; Thu, 16 Dec 2021 14:30:01 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3A6F118003A8; Thu, 16 Dec 2021 15:29:59 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Erdem Aktas , Julien Grall , Brijesh Singh , Pawel Polawski , Min Xu , Jiewen Yao , Tom Lendacky , Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , James Bottomley , Anthony Perard , Gerd Hoffmann Subject: [edk2-devel] [PATCH 1/5] OvmfPkg: add PcdVideoResolutionSource Date: Thu, 16 Dec 2021 15:29:55 +0100 Message-Id: <20211216142959.1998191-2-kraxel@redhat.com> In-Reply-To: <20211216142959.1998191-1-kraxel@redhat.com> References: <20211216142959.1998191-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: rqwn7iik263fZEAUr0WRTmVMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639665057; bh=9v/+JbLruOopICMvmcG2zCkoCoc+30UcmtFH6epvsac=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=YZZ61UEZ8rJVtK4bRdz6VmAfmUOUknwRn4kdXIq4St2tIlAfl0UDGz1Kq1+hTUNHPRb vRn2jzfJfihoKe1hG0GBqkvqC8+GhgLH4B42PFpzL5psN+uISk+uzM8aaXlE7+CyA1kqw pdWfMHoE3dxRZfp97O0Dr6WLpy9QZqkbmJM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639665072079100001 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Gerd Hoffmann --- OvmfPkg/OvmfPkg.dec | 7 +++++++ OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + OvmfPkg/Microvm/MicrovmX64.dsc | 1 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/OvmfXen.dsc | 1 + OvmfPkg/PlatformDxe/Platform.inf | 1 + OvmfPkg/PlatformDxe/Platform.c | 3 +++ 9 files changed, 17 insertions(+) diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 769bef0ffa12..7aa94ca02863 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -408,6 +408,13 @@ [PcdsDynamic, PcdsDynamicEx] # instance in PiSmmCpuDxeSmm, and CpuHotplugSmm. gUefiOvmfPkgTokenSpaceGuid.PcdCpuHotEjectDataAddress|0|UINT64|0x46 =20 + ## This PCD tracks where PcdVideo{Horizontal,Vertical}Resolution + # values are coming from. + # 0 - unset (defaults from platform dsc) + # 1 - set from PlatformConfig + # 2 - set by GOP Driver. + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0|UINT8|0x64 + [PcdsFeatureFlag] gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE|BOOLEAN|0= x1c gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|FALSE|BOOLEAN= |0x1d diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc index 04ae61cf69d8..343ac643f021 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -527,6 +527,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 1c2e600febee..cb28bd8bba2c 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -560,6 +560,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 085cc7ece15d..2f05d93ed4af 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -590,6 +590,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 0ce122ddb50c..bcab54aaa02a 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -596,6 +596,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 4589adff388d..ee0fdf492fd4 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -595,6 +595,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index de0d30bfb807..1f6352195b75 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -468,6 +468,7 @@ [PcdsDynamicDefault] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource|0 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0 gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0 diff --git a/OvmfPkg/PlatformDxe/Platform.inf b/OvmfPkg/PlatformDxe/Platfor= m.inf index 14727c1220e8..d2f75d78b601 100644 --- a/OvmfPkg/PlatformDxe/Platform.inf +++ b/OvmfPkg/PlatformDxe/Platform.inf @@ -47,6 +47,7 @@ [LibraryClasses] [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource =20 [Protocols] gEfiDevicePathProtocolGuid ## PRODUCES diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c index 69a7ecb83d03..4bf22712c78f 100644 --- a/OvmfPkg/PlatformDxe/Platform.c +++ b/OvmfPkg/PlatformDxe/Platform.c @@ -742,6 +742,9 @@ ExecutePlatformConfig ( PlatformConfig.VerticalResolution ); ASSERT_RETURN_ERROR (PcdStatus); + + PcdStatus =3D PcdSet8S (PcdVideoResolutionSource, 1); + ASSERT_RETURN_ERROR (PcdStatus); } =20 return EFI_SUCCESS; --=20 2.33.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#85000): https://edk2.groups.io/g/devel/message/85000 Mute This Topic: https://groups.io/mt/87767770/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Apr 29 14:14:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+84996+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84996+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639665013; cv=none; d=zohomail.com; s=zohoarc; b=P6/D5I63uXnHXb6zTrWjduQgU1JxU0w4/RYABKtwdN1xnHRBdifHNSW7GUB8pwCsnFYCQetR2jReiCEKzkkN6gG1ZXWHbKTQKLL8JY6MeIiUx/WZJ7wb8P22KQz/YCEvd4ojfZT3G+CZ4u/2RQBD6MTfdqyBvkjHc0SIz0t+558= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639665013; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=kd4B9ksfHDGKeka51bRtax3p9kmofm09RjXikan6A4s=; b=KFwSrHvUlhL7++U5RtrAXJQRrzkOowrtS4hXnIn53v8a6cJ8sfcYpnp2jttV4Ge9SudVAQvDIawv7QjexULvYgg1Desj6URVt6M2BSZ25SGlGowrhBGDOIAngAV7qLFWbJuHhncYQr34ocVezlLxZVP36bc3PoK7iApE9ktKm28= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84996+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1639665013784546.7857947302734; Thu, 16 Dec 2021 06:30:13 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id gOgSYY1788612xQXVhAbCYWr; Thu, 16 Dec 2021 06:30:13 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web09.11135.1639665012466777458 for ; Thu, 16 Dec 2021 06:30:12 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-G0SiXKKgNiKzd7HFlPTY5Q-1; Thu, 16 Dec 2021 09:30:06 -0500 X-MC-Unique: G0SiXKKgNiKzd7HFlPTY5Q-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 495A464A88; Thu, 16 Dec 2021 14:30:04 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA4E37A228; Thu, 16 Dec 2021 14:30:03 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4049D18003A9; Thu, 16 Dec 2021 15:29:59 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Erdem Aktas , Julien Grall , Brijesh Singh , Pawel Polawski , Min Xu , Jiewen Yao , Tom Lendacky , Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , James Bottomley , Anthony Perard , Gerd Hoffmann Subject: [edk2-devel] [PATCH 2/5] OvmfPkg/QemuVideoDxe: simplify InitializeBochsGraphicsMode Date: Thu, 16 Dec 2021 15:29:56 +0100 Message-Id: <20211216142959.1998191-3-kraxel@redhat.com> In-Reply-To: <20211216142959.1998191-1-kraxel@redhat.com> References: <20211216142959.1998191-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: NsjuZ7O6Qgw3hh3SlJVP97wnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639665013; bh=T8e+D6tTAVYyIeBlvihi7c0qjNcNDm3fhq4RzhqQWc0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=B4z8xkCCVv3JG7PIUKgPiBMK+ETRKVy3QBbx99aVeF5aSSnE+fJ18Q/qRO+EvEmINFY xMYY/XoESSMf83gQq2JLDTMW0teiOdurIhRsqp5SuVM7yJ6tjnDneCVjuLVs1Kl6W1rKs s3zrGtCCFh3nsAZvfiIOtYVHFqpP/4QZAoQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639665026164100001 Content-Type: text/plain; charset="utf-8" struct QEMU_VIDEO_MODE_DATA has all the data needed to set the video mode, there is no need to take the extra indirection and use struct QEMU_VIDEO_BOCHS_MODES. Signed-off-by: Gerd Hoffmann --- OvmfPkg/QemuVideoDxe/Qemu.h | 3 +-- OvmfPkg/QemuVideoDxe/Driver.c | 14 +++++++------- OvmfPkg/QemuVideoDxe/Gop.c | 2 +- OvmfPkg/QemuVideoDxe/Initialize.c | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h index 8f05898f862c..fef648c967b2 100644 --- a/OvmfPkg/QemuVideoDxe/Qemu.h +++ b/OvmfPkg/QemuVideoDxe/Qemu.h @@ -150,7 +150,6 @@ extern UINT16 Seq_800_600_256_60= []; extern UINT8 Crtc_1024_768_256_60[]; extern UINT16 Seq_1024_768_256_60[]; extern QEMU_VIDEO_CIRRUS_MODES QemuVideoCirrusModes[]; -extern QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[]; extern EFI_DRIVER_BINDING_PROTOCOL gQemuVideoDriverBinding; extern EFI_COMPONENT_NAME_PROTOCOL gQemuVideoComponentName; extern EFI_COMPONENT_NAME2_PROTOCOL gQemuVideoComponentName2; @@ -414,7 +413,7 @@ InitializeCirrusGraphicsMode ( VOID InitializeBochsGraphicsMode ( QEMU_VIDEO_PRIVATE_DATA *Private, - QEMU_VIDEO_BOCHS_MODES *ModeData + QEMU_VIDEO_MODE_DATA *ModeData ); =20 VOID diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c index d9f0a2464aa3..b91909a14e59 100644 --- a/OvmfPkg/QemuVideoDxe/Driver.c +++ b/OvmfPkg/QemuVideoDxe/Driver.c @@ -987,14 +987,14 @@ VgaOutb ( VOID InitializeBochsGraphicsMode ( QEMU_VIDEO_PRIVATE_DATA *Private, - QEMU_VIDEO_BOCHS_MODES *ModeData + QEMU_VIDEO_MODE_DATA *ModeData ) { DEBUG (( DEBUG_INFO, "InitializeBochsGraphicsMode: %dx%d @ %d\n", - ModeData->Width, - ModeData->Height, + ModeData->HorizontalResolution, + ModeData->VerticalResolution, ModeData->ColorDepth )); =20 @@ -1007,10 +1007,10 @@ InitializeBochsGraphicsMode ( BochsWrite (Private, VBE_DISPI_INDEX_Y_OFFSET, 0); =20 BochsWrite (Private, VBE_DISPI_INDEX_BPP, (UINT16)ModeData->ColorDepth); - BochsWrite (Private, VBE_DISPI_INDEX_XRES, (UINT16)ModeData->Width); - BochsWrite (Private, VBE_DISPI_INDEX_VIRT_WIDTH, (UINT16)ModeData->Width= ); - BochsWrite (Private, VBE_DISPI_INDEX_YRES, (UINT16)ModeData->Height); - BochsWrite (Private, VBE_DISPI_INDEX_VIRT_HEIGHT, (UINT16)ModeData->Heig= ht); + BochsWrite (Private, VBE_DISPI_INDEX_XRES, (UINT16)ModeData->HorizontalR= esolution); + BochsWrite (Private, VBE_DISPI_INDEX_VIRT_WIDTH, (UINT16)ModeData->Horiz= ontalResolution); + BochsWrite (Private, VBE_DISPI_INDEX_YRES, (UINT16)ModeData->VerticalRes= olution); + BochsWrite (Private, VBE_DISPI_INDEX_VIRT_HEIGHT, (UINT16)ModeData->Vert= icalResolution); =20 BochsWrite ( Private, diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c index 5ad0afe88378..0c4dea7fb6f2 100644 --- a/OvmfPkg/QemuVideoDxe/Gop.c +++ b/OvmfPkg/QemuVideoDxe/Gop.c @@ -177,7 +177,7 @@ Routine Description: break; case QEMU_VIDEO_BOCHS_MMIO: case QEMU_VIDEO_BOCHS: - InitializeBochsGraphicsMode (Private, &QemuVideoBochsModes[ModeData-= >InternalModeIndex]); + InitializeBochsGraphicsMode (Private, ModeData); break; default: ASSERT (FALSE); diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initi= alize.c index 533ec661d64f..8a70cf848483 100644 --- a/OvmfPkg/QemuVideoDxe/Initialize.c +++ b/OvmfPkg/QemuVideoDxe/Initialize.c @@ -202,7 +202,7 @@ QemuVideoCirrusModeSetup ( /// /// Table of supported video modes /// -QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[] =3D { +STATIC QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[] =3D { { 640, 480, 32 }, { 800, 480, 32 }, { 800, 600, 32 }, --=20 2.33.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#84996): https://edk2.groups.io/g/devel/message/84996 Mute This Topic: https://groups.io/mt/87767748/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Apr 29 14:14:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+84997+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84997+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639665014; cv=none; d=zohomail.com; s=zohoarc; b=RitSZsscN/CiUwBZA9gSlfVnSvKCF/cIUtvY2/CE40eraCTB8cc+6OO+Xi4wod7OzmfT+4subZtWS2OzoQtXacE8YDTm5w/isVaNV7FfbNCEj2DEG9L2gLm/zP5H6BalCY8/Ecfr/fGFKBnG6H2JjzlXeg2rljmf7ZW7JebNy0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639665014; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=hc/VR495/6qg8GKYItGEsYbUbh8AYqw8EQspS3RB0Eg=; b=SEVT0THLXlTyLjio/lw0UU+SvPNoDyKvKJYTUcJrz/kRfSjqptR7J7ck4YrXDqIcggsCLVSdUtSMGP8IULLW7+uJAcPLrq3iyyuk6oi68yrUI7LRrM6TEDheci3lHDs8P+kzlr50vOdCedZLKtiaiSL8EFF25JgfqdmO0m7qzRQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84997+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163966501433011.76368799409613; Thu, 16 Dec 2021 06:30:14 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id pJb8YY1788612xPsQtMe8PeF; Thu, 16 Dec 2021 06:30:14 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web09.11136.1639665012766125311 for ; Thu, 16 Dec 2021 06:30:12 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-607-yP102KIwPjCCLPo9SS2aDg-1; Thu, 16 Dec 2021 09:30:08 -0500 X-MC-Unique: yP102KIwPjCCLPo9SS2aDg-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A394E10247AC; Thu, 16 Dec 2021 14:30:06 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BA5F7A22A; Thu, 16 Dec 2021 14:30:06 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4397118003B6; Thu, 16 Dec 2021 15:29:59 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Erdem Aktas , Julien Grall , Brijesh Singh , Pawel Polawski , Min Xu , Jiewen Yao , Tom Lendacky , Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , James Bottomley , Anthony Perard , Gerd Hoffmann Subject: [edk2-devel] [PATCH 3/5] OvmfPkg/QemuVideoDxe: drop QEMU_VIDEO_BOCHS_MODES->ColorDepth Date: Thu, 16 Dec 2021 15:29:57 +0100 Message-Id: <20211216142959.1998191-4-kraxel@redhat.com> In-Reply-To: <20211216142959.1998191-1-kraxel@redhat.com> References: <20211216142959.1998191-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: ifr3OI9aMJQNNtevSeRTZsFMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639665014; bh=lw27NtZhRYD6a3oXGSowgMxMJ7zh8jDWEfExpCxcVe0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=OPG2z1m+4yzFR9urypqYJN8HwxEyR9F/81p8Sh8qTmlC+kKWp3MX2FwVYSW4/0YYYdX PiULPIyncXnNleLzLz9J1YYbXeAIgo4XnNb7zmnaPM6iXsAApe0+uKt7Cr+U9d5fVhoYN IMubxfESwR/TVrmKGZmx6m9UFpeSwe7YckU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639665027149100007 Content-Type: text/plain; charset="utf-8" All video modes in the list are 32-bit, so drop the useless ColorDepth field. Signed-off-by: Gerd Hoffmann --- OvmfPkg/QemuVideoDxe/Qemu.h | 1 - OvmfPkg/QemuVideoDxe/Initialize.c | 80 +++++++++++++++---------------- 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h index fef648c967b2..1e6507f44caa 100644 --- a/OvmfPkg/QemuVideoDxe/Qemu.h +++ b/OvmfPkg/QemuVideoDxe/Qemu.h @@ -132,7 +132,6 @@ typedef struct { typedef struct { UINT32 Width; UINT32 Height; - UINT32 ColorDepth; } QEMU_VIDEO_BOCHS_MODES; =20 #define QEMU_VIDEO_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS(a) \ diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initi= alize.c index 8a70cf848483..2b174d13faf2 100644 --- a/OvmfPkg/QemuVideoDxe/Initialize.c +++ b/OvmfPkg/QemuVideoDxe/Initialize.c @@ -203,43 +203,43 @@ QemuVideoCirrusModeSetup ( /// Table of supported video modes /// STATIC QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[] =3D { - { 640, 480, 32 }, - { 800, 480, 32 }, - { 800, 600, 32 }, - { 832, 624, 32 }, - { 960, 640, 32 }, - { 1024, 600, 32 }, - { 1024, 768, 32 }, - { 1152, 864, 32 }, - { 1152, 870, 32 }, - { 1280, 720, 32 }, - { 1280, 760, 32 }, - { 1280, 768, 32 }, - { 1280, 800, 32 }, - { 1280, 960, 32 }, - { 1280, 1024, 32 }, - { 1360, 768, 32 }, - { 1366, 768, 32 }, - { 1400, 1050, 32 }, - { 1440, 900, 32 }, - { 1600, 900, 32 }, - { 1600, 1200, 32 }, - { 1680, 1050, 32 }, - { 1920, 1080, 32 }, - { 1920, 1200, 32 }, - { 1920, 1440, 32 }, - { 2000, 2000, 32 }, - { 2048, 1536, 32 }, - { 2048, 2048, 32 }, - { 2560, 1440, 32 }, - { 2560, 1600, 32 }, - { 2560, 2048, 32 }, - { 2800, 2100, 32 }, - { 3200, 2400, 32 }, - { 3840, 2160, 32 }, - { 4096, 2160, 32 }, - { 7680, 4320, 32 }, - { 8192, 4320, 32 } + { 640, 480 }, + { 800, 480 }, + { 800, 600 }, + { 832, 624 }, + { 960, 640 }, + { 1024, 600 }, + { 1024, 768 }, + { 1152, 864 }, + { 1152, 870 }, + { 1280, 720 }, + { 1280, 760 }, + { 1280, 768 }, + { 1280, 800 }, + { 1280, 960 }, + { 1280, 1024 }, + { 1360, 768 }, + { 1366, 768 }, + { 1400, 1050 }, + { 1440, 900 }, + { 1600, 900 }, + { 1600, 1200 }, + { 1680, 1050 }, + { 1920, 1080 }, + { 1920, 1200 }, + { 1920, 1440 }, + { 2000, 2000 }, + { 2048, 1536 }, + { 2048, 2048 }, + { 2560, 1440 }, + { 2560, 1600 }, + { 2560, 2048 }, + { 2800, 2100 }, + { 3200, 2400 }, + { 3840, 2160 }, + { 4096, 2160 }, + { 7680, 4320 }, + { 8192, 4320 } }; =20 #define QEMU_VIDEO_BOCHS_MODE_COUNT \ @@ -348,14 +348,12 @@ QemuVideoBochsModeSetup ( for (Index =3D 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index++) { UINTN RequiredFbSize; =20 - ASSERT (VideoMode->ColorDepth % 8 =3D=3D 0); - RequiredFbSize =3D (UINTN)VideoMode->Width * VideoMode->Height * - (VideoMode->ColorDepth / 8); + RequiredFbSize =3D (UINTN)VideoMode->Width * VideoMode->Height * 4; if (RequiredFbSize <=3D AvailableFbSize) { ModeData->InternalModeIndex =3D Index; ModeData->HorizontalResolution =3D VideoMode->Width; ModeData->VerticalResolution =3D VideoMode->Height; - ModeData->ColorDepth =3D VideoMode->ColorDepth; + ModeData->ColorDepth =3D 32; DEBUG (( DEBUG_INFO, "Adding Mode %d as Bochs Internal Mode %d: %dx%d, %d-bit\n", --=20 2.33.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#84997): https://edk2.groups.io/g/devel/message/84997 Mute This Topic: https://groups.io/mt/87767749/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Apr 29 14:14:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+84998+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84998+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639665017; cv=none; d=zohomail.com; s=zohoarc; b=UNFCGh2YY4ibVp+lnlXX/zwOP3lkx6CfjmChMGYrvcIRmnx5mVm98iYTRFkA+brBN5P11DEUXZ+wx+ACnH8bihGxq/2tskxN2qkRwLEInKKQDz1L01xoPcMipp9Fty8pHEunUj7qKnFzRD+J+3WLo9OEi0jMQnkcvMheOSt85AM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639665017; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=zoAL6grsnD08u6Q8zHEn8sT9xCjuxGfEeCwYcCEU+Lg=; b=LOUbIdJJdarTMKxSPXeGkmwF1wR4qgBUHWxCdsgHn7Iny7tTOuz4pCEkmsIIVM2pzRDQ/fqu6WikCJ+gyW0UVqywTrK+haFQiwuQcEbvtX428xnDu1tbesL5aCmmXYhIO6fZ3ITfc9GX0aLlAo5A/CsQGwS+aV5QirdoRN8F8RM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84998+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1639665017650686.6442048773522; Thu, 16 Dec 2021 06:30:17 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id cPhHYY1788612xkBEMb38jxj; Thu, 16 Dec 2021 06:30:17 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.11190.1639665016190094019 for ; Thu, 16 Dec 2021 06:30:16 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-353-cKl7njl1Mr6kELSSkgM0fg-1; Thu, 16 Dec 2021 09:30:12 -0500 X-MC-Unique: cKl7njl1Mr6kELSSkgM0fg-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49166760D2; Thu, 16 Dec 2021 14:30:09 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C94D77A223; Thu, 16 Dec 2021 14:30:08 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4729318003B8; Thu, 16 Dec 2021 15:29:59 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Erdem Aktas , Julien Grall , Brijesh Singh , Pawel Polawski , Min Xu , Jiewen Yao , Tom Lendacky , Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , James Bottomley , Anthony Perard , Gerd Hoffmann Subject: [edk2-devel] [PATCH 4/5] OvmfPkg/QemuVideoDxe: factor out QemuVideoBochsAddMode Date: Thu, 16 Dec 2021 15:29:58 +0100 Message-Id: <20211216142959.1998191-5-kraxel@redhat.com> In-Reply-To: <20211216142959.1998191-1-kraxel@redhat.com> References: <20211216142959.1998191-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: ROmcQr3afjRfwaBDUkjOn4sqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639665017; bh=T/dCNhG3P9XFIoU7yvCgRg8nPI6tBJtvthkWlOciTXI=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=uQx732d7hgNKZxN6GTDTqFtnobM7qfhAeCzTWbZPBHlIja0x+nU/eSCckHQq9pWFC8g lrBDLOMce80y/X/8LSG/n5DYHDYQkxT1WolWVu1e/W7T79CkWA2lkLHEuZ4oEyWujZp/M /BG7EpXyj7ijBnhQJLjhx2eiTgeZL2TK0Yk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639665030903100001 Content-Type: text/plain; charset="utf-8" Add helper function to add a video mode to the list of modes. Move code. Minor debug logging tweaks, no other functional change. Signed-off-by: Gerd Hoffmann --- OvmfPkg/QemuVideoDxe/Initialize.c | 77 +++++++++++++++++++------------ 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initi= alize.c index 2b174d13faf2..8c5c9176ad21 100644 --- a/OvmfPkg/QemuVideoDxe/Initialize.c +++ b/OvmfPkg/QemuVideoDxe/Initialize.c @@ -245,16 +245,53 @@ STATIC QEMU_VIDEO_BOCHS_MODES QemuVideoBochsModes[] = =3D { #define QEMU_VIDEO_BOCHS_MODE_COUNT \ (ARRAY_SIZE (QemuVideoBochsModes)) =20 +STATIC +VOID +QemuVideoBochsAddMode ( + QEMU_VIDEO_PRIVATE_DATA *Private, + UINT32 AvailableFbSize, + UINT32 Width, + UINT32 Height + ) +{ + QEMU_VIDEO_MODE_DATA *ModeData =3D Private->ModeData + Private->MaxMode; + UINTN RequiredFbSize; + + RequiredFbSize =3D (UINTN)Width * Height * 4; + if (RequiredFbSize > AvailableFbSize) { + DEBUG (( + DEBUG_INFO, + "Skipping Bochs Mode %dx%d, 32-bit (not enough vram)\n", + Width, + Height + )); + return; + } + + ModeData->InternalModeIndex =3D (UINT32)Private->MaxMode; + ModeData->HorizontalResolution =3D Width; + ModeData->VerticalResolution =3D Height; + ModeData->ColorDepth =3D 32; + DEBUG (( + DEBUG_INFO, + "Adding Bochs Internal Mode %d: %dx%d, %d-bit\n", + ModeData->InternalModeIndex, + ModeData->HorizontalResolution, + ModeData->VerticalResolution, + ModeData->ColorDepth + )); + + Private->MaxMode++; +} + EFI_STATUS QemuVideoBochsModeSetup ( QEMU_VIDEO_PRIVATE_DATA *Private, BOOLEAN IsQxl ) { - UINT32 AvailableFbSize; - UINT32 Index; - QEMU_VIDEO_MODE_DATA *ModeData; - QEMU_VIDEO_BOCHS_MODES *VideoMode; + UINT32 AvailableFbSize; + UINT32 Index; =20 // // Fetch the available framebuffer size. @@ -343,34 +380,14 @@ QemuVideoBochsModeSetup ( return EFI_OUT_OF_RESOURCES; } =20 - ModeData =3D Private->ModeData; - VideoMode =3D &QemuVideoBochsModes[0]; for (Index =3D 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index++) { - UINTN RequiredFbSize; - - RequiredFbSize =3D (UINTN)VideoMode->Width * VideoMode->Height * 4; - if (RequiredFbSize <=3D AvailableFbSize) { - ModeData->InternalModeIndex =3D Index; - ModeData->HorizontalResolution =3D VideoMode->Width; - ModeData->VerticalResolution =3D VideoMode->Height; - ModeData->ColorDepth =3D 32; - DEBUG (( - DEBUG_INFO, - "Adding Mode %d as Bochs Internal Mode %d: %dx%d, %d-bit\n", - (INT32)(ModeData - Private->ModeData), - ModeData->InternalModeIndex, - ModeData->HorizontalResolution, - ModeData->VerticalResolution, - ModeData->ColorDepth - )); - - ModeData++; - } - - VideoMode++; + QemuVideoBochsAddMode ( + Private, + AvailableFbSize, + QemuVideoBochsModes[Index].Width, + QemuVideoBochsModes[Index].Height + ); } =20 - Private->MaxMode =3D ModeData - Private->ModeData; - return EFI_SUCCESS; } --=20 2.33.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#84998): https://edk2.groups.io/g/devel/message/84998 Mute This Topic: https://groups.io/mt/87767751/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Mon Apr 29 14:14:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+84999+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84999+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639665022; cv=none; d=zohomail.com; s=zohoarc; b=Ycjoyn8QGCNBxP0KNrv5tH+ScK/CcoJQE0o4XdX+ZqOQKOI8+zwRg3lp8NdvJ2CO+crGIZ666/oIjnVGIoe10G3KdTE1zLBj70P2bsy1UOuqkfjZAfPkR8aJG80ylsu7w3z/9obmtUUt4ZKPd+0/ZTb2tARDQGSnvstEZ4CRx0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639665022; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=fpQXWk/MhwV1H283jh8xrPU6Ydgbv5oaReYHcl6ghPA=; b=ch1oY/BMlZ6ubnZlk35AJQirxBzFL4vFMNPhHXyNXt/DXt8gN8C7A+O9TcsUVFVwUF6eyvmRocu1WexM2blAGhk0V24r+0i9g7u/AGxoGuDGv3JOuepp5hkY2eMmnu2Zr7WpFtLlPYMc3kQamsxLc6cpUIKCnYksiXbFEq/SHJA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84999+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163966502261858.4709521027911; Thu, 16 Dec 2021 06:30:22 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id LUXgYY1788612xEN8e0VpHmH; Thu, 16 Dec 2021 06:30:22 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web12.11112.1639665021451295719 for ; Thu, 16 Dec 2021 06:30:21 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-56-ls561-JhO7iG7P85oXJ04Q-1; Thu, 16 Dec 2021 09:30:15 -0500 X-MC-Unique: ls561-JhO7iG7P85oXJ04Q-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB98F10247AB; Thu, 16 Dec 2021 14:30:11 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 479AA4D73A; Thu, 16 Dec 2021 14:30:11 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4A28E18003BC; Thu, 16 Dec 2021 15:29:59 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Erdem Aktas , Julien Grall , Brijesh Singh , Pawel Polawski , Min Xu , Jiewen Yao , Tom Lendacky , Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , James Bottomley , Anthony Perard , Gerd Hoffmann Subject: [edk2-devel] [PATCH 5/5] OvmfPkg/QemuVideoDxe: parse edid blob, detect display resolution Date: Thu, 16 Dec 2021 15:29:59 +0100 Message-Id: <20211216142959.1998191-6-kraxel@redhat.com> In-Reply-To: <20211216142959.1998191-1-kraxel@redhat.com> References: <20211216142959.1998191-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: OZQxlohuuDiNrB1ymq7Pan5ox1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639665022; bh=GpKziTd8fyAwY8NtWCmSDQKhxXsXvWGebZZGeE+0+M0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=S1g8UGgZzo3AG/TZDJwG6RcBt7R4TPzjI9CuK4ii2OXQYkqW0Lv5XabhOQsBkIqLdOO WAB+RjQdfzFNcmTm4rQ36OjP4swfh6CtnGtaXoBWBbnDsB9MDVgPu7nbQKt8DwwP6y/XQ rGR4y/ZukMmqZIx3oVgKTxyKgZVb4VCNYNY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639665035537100003 Content-Type: text/plain; charset="utf-8" Check whenever an EDID blob is present. In case it is get the display resolution from it. Unless PcdVideoResolutionSource indicates the display resolution has been set already update PcdVideoHorizontalResolution and PcdVideoVerticalResolution accordingly. Also add the resolution to the mode list. This will make OVMF boot up with the display resolution configured by QEMU, which is 1024x768 by default. The resolution can be set using the xres and yres properties. Here is an example for FullHD: qemu-system-x86_64 -device VGA,xres=3D1920,yres=3D1080 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3778 Ref: https://bugzilla.redhat.com/show_bug.cgi?id=3D1749250 Signed-off-by: Gerd Hoffmann --- OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf | 3 + OvmfPkg/QemuVideoDxe/Qemu.h | 2 + OvmfPkg/QemuVideoDxe/Initialize.c | 102 +++++++++++++++++++++++++- 3 files changed, 105 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf b/OvmfPkg/QemuVideoDxe/Q= emuVideoDxe.inf index fe8befd51d3c..43a6e07faa88 100644 --- a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf +++ b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf @@ -63,4 +63,7 @@ [Protocols] =20 [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution diff --git a/OvmfPkg/QemuVideoDxe/Qemu.h b/OvmfPkg/QemuVideoDxe/Qemu.h index 1e6507f44caa..57341a0bbfc4 100644 --- a/OvmfPkg/QemuVideoDxe/Qemu.h +++ b/OvmfPkg/QemuVideoDxe/Qemu.h @@ -115,6 +115,8 @@ typedef struct { FRAME_BUFFER_CONFIGURE *FrameBufferBltConfigure; UINTN FrameBufferBltConfigureSize; UINT8 FrameBufferVramBarIndex; + + UINT8 Edid[128]; } QEMU_VIDEO_PRIVATE_DATA; =20 /// diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initi= alize.c index 8c5c9176ad21..2a3cbc65c32a 100644 --- a/OvmfPkg/QemuVideoDxe/Initialize.c +++ b/OvmfPkg/QemuVideoDxe/Initialize.c @@ -284,6 +284,88 @@ QemuVideoBochsAddMode ( Private->MaxMode++; } =20 +STATIC +VOID +QemuVideoBochsEdid ( + QEMU_VIDEO_PRIVATE_DATA *Private, + UINT32 *XRes, + UINT32 *YRes + ) +{ + EFI_STATUS Status; + + if (Private->Variant !=3D QEMU_VIDEO_BOCHS_MMIO) { + return; + } + + Status =3D Private->PciIo->Mem.Read ( + Private->PciIo, + EfiPciIoWidthUint8, + PCI_BAR_IDX2, + 0, + sizeof (Private->Edid), + Private->Edid + ); + if (Status !=3D EFI_SUCCESS) { + DEBUG (( + DEBUG_INFO, + "%a: mmio read failed\n", + __FUNCTION__ + )); + return; + } + + if ((Private->Edid[0] !=3D 0x00) || + (Private->Edid[1] !=3D 0xff)) + { + DEBUG (( + DEBUG_INFO, + "%a: magic check failed\n", + __FUNCTION__ + )); + return; + } + + DEBUG (( + DEBUG_INFO, + "%a: blob found (extensions: %d)\n", + __FUNCTION__, + Private->Edid[126] + )); + + if ((Private->Edid[54] =3D=3D 0x00) && + (Private->Edid[55] =3D=3D 0x00)) + { + DEBUG (( + DEBUG_INFO, + "%a: no detailed timing descriptor\n", + __FUNCTION__ + )); + return; + } + + *XRes =3D Private->Edid[56] | ((Private->Edid[58] & 0xf0) << 4); + *YRes =3D Private->Edid[59] | ((Private->Edid[61] & 0xf0) << 4); + DEBUG (( + DEBUG_INFO, + "%a: default resolution: %dx%d\n", + __FUNCTION__, + *XRes, + *YRes + )); + + if (PcdGet8 (PcdVideoResolutionSource) =3D=3D 0) { + Status =3D PcdSet32S (PcdVideoHorizontalResolution, *XRes); + ASSERT_RETURN_ERROR (Status); + Status =3D PcdSet32S (PcdVideoVerticalResolution, *YRes); + ASSERT_RETURN_ERROR (Status); + Status =3D PcdSet8S (PcdVideoResolutionSource, 2); + ASSERT_RETURN_ERROR (Status); + } + + // TODO: register edid as gEfiEdidDiscoveredProtocolGuid ? +} + EFI_STATUS QemuVideoBochsModeSetup ( QEMU_VIDEO_PRIVATE_DATA *Private, @@ -291,7 +373,7 @@ QemuVideoBochsModeSetup ( ) { UINT32 AvailableFbSize; - UINT32 Index; + UINT32 Index, XRes =3D 0, YRes =3D 0; =20 // // Fetch the available framebuffer size. @@ -374,13 +456,29 @@ QemuVideoBochsModeSetup ( // Setup Video Modes // Private->ModeData =3D AllocatePool ( - sizeof (Private->ModeData[0]) * QEMU_VIDEO_BOCHS_M= ODE_COUNT + sizeof (Private->ModeData[0]) * (QEMU_VIDEO_BOCHS_= MODE_COUNT+1) ); if (Private->ModeData =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } =20 + QemuVideoBochsEdid (Private, &XRes, &YRes); + if (XRes && YRes) { + QemuVideoBochsAddMode ( + Private, + AvailableFbSize, + XRes, + YRes + ); + } + for (Index =3D 0; Index < QEMU_VIDEO_BOCHS_MODE_COUNT; Index++) { + if ((QemuVideoBochsModes[Index].Width =3D=3D XRes) && + (QemuVideoBochsModes[Index].Height =3D=3D YRes)) + { + continue; // duplicate with edid resolution + } + QemuVideoBochsAddMode ( Private, AvailableFbSize, --=20 2.33.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#84999): https://edk2.groups.io/g/devel/message/84999 Mute This Topic: https://groups.io/mt/87767755/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-