From nobody Mon Feb 9 18:19:43 2026 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+86363+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+86363+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643873187; cv=none; d=zohomail.com; s=zohoarc; b=eD6KMcqpc8STsTViWZigYeJ52qkXVIe4vS4ff9Cf8dHlzCLG96m1hk7I0buhcjCkzT42QUkifvDeB2Bqv8M2ZzOTbsl0A/7UnPBEhVfOFvgG68sZddQD3yWWqvk6kJO76ER0AN+iYLsQV+bCuRb6pQ25dQRT+bvLpRiJgsLrAcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643873187; 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=oD6ZSPA8BMJTJoC3MZvai/7X/RXhO8M57TntdJnr9Co=; b=e8tb44iUNSNKZGYGU6iTW9tDCBLIUbrE6XKFpGuBYgEsK2yl2MOnjeMLFBc6qsEC9+3qVZ3IcG27WbHTWkbg6h4CKWMeauUV3I5EVVFEiOwp8/MrsvYafi14/b51oQ0Ag3BNWRXtawDiexAIAt76C/QYLtOYR0b42FPkUzPnEmQ= 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+86363+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 1643873187857553.1773557362989; Wed, 2 Feb 2022 23:26:27 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id wXBoYY1788612xcWwG1mjwlh; Wed, 02 Feb 2022 23:26:27 -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.web08.6255.1643873186661033064 for ; Wed, 02 Feb 2022 23:26:26 -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-190-6QYBb-ejNLyguAv9Rhh7Ew-1; Thu, 03 Feb 2022 02:26:16 -0500 X-MC-Unique: 6QYBb-ejNLyguAv9Rhh7Ew-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 C1BBF10144E3 for ; Thu, 3 Feb 2022 07:26:14 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3EC1E5F91C; Thu, 3 Feb 2022 07:26:14 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AD9A31800609; Thu, 3 Feb 2022 08:26:00 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Pawel Polawski , Gerd Hoffmann Subject: [edk2-devel] [PATCH 4/6] OvmfPkg/VirtioGpuDxe: use GopQueryMode in GopSetMode Date: Thu, 3 Feb 2022 08:25:58 +0100 Message-Id: <20220203072600.1646396-5-kraxel@redhat.com> In-Reply-To: <20220203072600.1646396-1-kraxel@redhat.com> References: <20220203072600.1646396-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: ftdNUw0Zkgfm75WougQarJ5xx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643873187; bh=mwhBXNZLf/+lRH3UnL8zYGWzAG0HGiSpMOQj1um075w=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=ZDB/k2ttjRSHlAYTC1JsFYxGv+0prt0Nb6ggJbp1KVmnoEtyzLdCJU42TO7laDidpL8 jhcdFoEEMG4ncizgmdmvPA3erRlUYXilcx7rulXqLo+kZGXmI27ZQg8JHZAJCpk7Wh8Av P1O3IT/+c5Uif+h9VP73+V6dfd2u5OQeGr0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643873189909100002 Content-Type: text/plain; charset="utf-8" Call GopQueryMode() in GopSetMode(), use the ModeInfo returned when setting the mode. This is needed to properly handle modes which are not on the static mGopResolutions list. Signed-off-by: Gerd Hoffmann --- OvmfPkg/VirtioGpuDxe/Gop.c | 60 ++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c index 2c15d542e3b1..337a7e19bffa 100644 --- a/OvmfPkg/VirtioGpuDxe/Gop.c +++ b/OvmfPkg/VirtioGpuDxe/Gop.c @@ -234,19 +234,22 @@ GopSetMode ( IN UINT32 ModeNumber ) { - VGPU_GOP *VgpuGop; - UINT32 NewResourceId; - UINTN NewNumberOfBytes; - UINTN NewNumberOfPages; - VOID *NewBackingStore; - EFI_PHYSICAL_ADDRESS NewBackingStoreDeviceAddress; - VOID *NewBackingStoreMap; + VGPU_GOP *VgpuGop; + UINT32 NewResourceId; + UINTN NewNumberOfBytes; + UINTN NewNumberOfPages; + VOID *NewBackingStore; + EFI_PHYSICAL_ADDRESS NewBackingStoreDeviceAddress; + VOID *NewBackingStoreMap; + UINTN SizeOfInfo; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GopModeInfo; =20 EFI_STATUS Status; EFI_STATUS Status2; =20 - if (ModeNumber >=3D ARRAY_SIZE (mGopResolutions)) { - return EFI_UNSUPPORTED; + Status =3D GopQueryMode (This, ModeNumber, &SizeOfInfo, &GopModeInfo); + if (Status !=3D EFI_SUCCESS) { + return Status; } =20 VgpuGop =3D VGPU_GOP_FROM_GOP (This); @@ -292,8 +295,8 @@ GopSetMode ( VgpuGop->ParentBus, // VgpuDev NewResourceId, // ResourceId VirtioGpuFormatB8G8R8X8Unorm, // Format - mGopResolutions[ModeNumber].Width, // Width - mGopResolutions[ModeNumber].Height // Height + GopModeInfo->HorizontalResolution, // Width + GopModeInfo->VerticalResolution // Height ); if (EFI_ERROR (Status)) { return Status; @@ -303,8 +306,8 @@ GopSetMode ( // Allocate, zero and map guest backing store, for bus master common buf= fer // operation. // - NewNumberOfBytes =3D mGopResolutions[ModeNumber].Width * - mGopResolutions[ModeNumber].Height * sizeof (UINT32); + NewNumberOfBytes =3D GopModeInfo->HorizontalResolution * + GopModeInfo->VerticalResolution * sizeof (UINT32); NewNumberOfPages =3D EFI_SIZE_TO_PAGES (NewNumberOfBytes); Status =3D VirtioGpuAllocateZeroAndMapBackingStore ( VgpuGop->ParentBus, // VgpuDev @@ -337,8 +340,8 @@ GopSetMode ( VgpuGop->ParentBus, // VgpuDev 0, // X 0, // Y - mGopResolutions[ModeNumber].Width, // Width - mGopResolutions[ModeNumber].Height, // Height + GopModeInfo->HorizontalResolution, // Width + GopModeInfo->VerticalResolution, // Height 0, // ScanoutId NewResourceId // ResourceId ); @@ -356,8 +359,8 @@ GopSetMode ( VgpuGop->ParentBus, // VgpuDev 0, // X 0, // Y - mGopResolutions[ModeNumber].Width, // Width - mGopResolutions[ModeNumber].Height, // Height + GopModeInfo->HorizontalResolution, // Width + GopModeInfo->VerticalResolution, // Height NewResourceId // ResourceId ); if (EFI_ERROR (Status)) { @@ -367,13 +370,13 @@ GopSetMode ( // therefore non-recoverable. // Status2 =3D VirtioGpuSetScanout ( - VgpuGop->ParentBus, // VgpuDev - 0, // X - 0, // Y - mGopResolutions[This->Mode->Mode].Width, // Width - mGopResolutions[This->Mode->Mode].Height, // Height - 0, // ScanoutId - VgpuGop->ResourceId // ResourceId + VgpuGop->ParentBus, // VgpuDev + 0, // X + 0, // Y + VgpuGop->GopModeInfo.HorizontalResolution, // Width + VgpuGop->GopModeInfo.VerticalResolution, // Height + 0, // ScanoutId + VgpuGop->ResourceId // ResourceId ); ASSERT_EFI_ERROR (Status2); if (EFI_ERROR (Status2)) { @@ -406,11 +409,9 @@ GopSetMode ( // // Populate Mode and ModeInfo (mutable fields only). // - VgpuGop->GopMode.Mode =3D ModeNumber; - VgpuGop->GopModeInfo.HorizontalResolution =3D - mGopResolutions[ModeNumber].Width; - VgpuGop->GopModeInfo.VerticalResolution =3D mGopResolutions[ModeNumber].= Height; - VgpuGop->GopModeInfo.PixelsPerScanLine =3D mGopResolutions[ModeNumber].= Width; + VgpuGop->GopMode.Mode =3D ModeNumber; + VgpuGop->GopModeInfo =3D *GopModeInfo; + FreePool (GopModeInfo); return EFI_SUCCESS; =20 DetachBackingStore: @@ -435,6 +436,7 @@ GopSetMode ( CpuDeadLoop (); } =20 + FreePool (GopModeInfo); return Status; } =20 --=20 2.34.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 (#86363): https://edk2.groups.io/g/devel/message/86363 Mute This Topic: https://groups.io/mt/88878651/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-