From nobody Mon Feb 9 20:35:37 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+86361+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+86361+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643873179; cv=none; d=zohomail.com; s=zohoarc; b=Tz3kB9UI26vU1bon0FodoaqZhfxahTBIH5zbfOLWni0Ww89sPlnOZtsTbnPbfCG6EFyy9+XzJK9nlAzQhK/I2kWUPm9xTJK7+B/t7zRA0TTl/igkBTSahkijJC62A//RKF6wOkeWkrR97oSFUPmuEU6Vqi4Fj5cpVlygc5m/daU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643873179; 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=jLyL3A0jlS1axOiab/hYMBzMNrD/ZRsOgSAonkN85C8=; b=LbkFONP5EzZ5oGyAlNpzExhGP/5H61DYbB3AJ1NF4hA9FT8vu9961PbjeAXx/fi+oY9mlAl3IM8OGoz9tnbEWdV2sU9XpkSEobE11nvBGTevuSK4Y+wv3K/2FJlA1b+DQZlWCQeyB+pFLXt5nWtORvmROYIA3Xo6J4jWxsAdP7E= 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+86361+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 164387317942163.113842856876886; Wed, 2 Feb 2022 23:26:19 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id iyD0YY1788612xULj6AuM5pF; Wed, 02 Feb 2022 23:26:18 -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.web11.6288.1643873178213288523 for ; Wed, 02 Feb 2022 23:26:18 -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-644-So8iDY88MxyloYzRjrWKqw-1; Thu, 03 Feb 2022 02:26:15 -0500 X-MC-Unique: So8iDY88MxyloYzRjrWKqw-1 X-Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91988814607 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 3E7D35DBAC; Thu, 3 Feb 2022 07:26:14 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B0B99180060D; 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 5/6] OvmfPkg/VirtioGpuDxe: move code to GopInitialize Date: Thu, 3 Feb 2022 08:25:59 +0100 Message-Id: <20220203072600.1646396-6-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.11 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: WCONTAK3p9u6hx3FR2cZnMvEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643873178; bh=AR1uyXBM135UN+C1JMMc4WQcyiwszL57qZGwtJTez4k=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=ETVmENfFrviHpZPrr1XhJlVweicDkN/Yw3e5mO3H6+yllFM8OG8H1rX0LubXKBpb46v KvqZjLcXwFjwl+vfy6JvDCCORRm/t6vIYRpxPDmksLOc6jAmAAssUK801buvxklfhxyB7 nGzhqUm6gVgQYG7snOqgApz35IzntDbOBsI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643873180708100001 Content-Type: text/plain; charset="utf-8" Add new function to initialize the GOP, move over setup code. Handle initialization first, specifically before calling GopQueryMode(), so GopQueryMode is never called before GopInitialize() did complete. Signed-off-by: Gerd Hoffmann --- OvmfPkg/VirtioGpuDxe/Gop.c | 47 ++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c index 337a7e19bffa..05daefcbfbc8 100644 --- a/OvmfPkg/VirtioGpuDxe/Gop.c +++ b/OvmfPkg/VirtioGpuDxe/Gop.c @@ -192,6 +192,32 @@ STATIC CONST GOP_RESOLUTION mGopResolutions[] =3D { #define VGPU_GOP_FROM_GOP(GopPointer) \ CR (GopPointer, VGPU_GOP, Gop, VGPU_GOP_SIG) =20 +STATIC +VOID +EFIAPI +GopInitialize ( + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This + ) +{ + VGPU_GOP *VgpuGop; + + VgpuGop =3D VGPU_GOP_FROM_GOP (This); + + // + // Set up the Gop -> GopMode -> GopModeInfo pointer chain, and the other + // (nonzero) constant fields. + // + // No direct framebuffer access is supported, only Blt() is. + // + VgpuGop->Gop.Mode =3D &VgpuGop->GopMode; + + VgpuGop->GopMode.MaxMode =3D (UINT32)(ARRAY_SIZE (mGopResolutions)); + VgpuGop->GopMode.Info =3D &VgpuGop->GopModeInfo; + VgpuGop->GopMode.SizeOfInfo =3D sizeof VgpuGop->GopModeInfo; + + VgpuGop->GopModeInfo.PixelFormat =3D PixelBltOnly; +} + // // EFI_GRAPHICS_OUTPUT_PROTOCOL member functions. // @@ -207,7 +233,7 @@ GopQueryMode ( { EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GopModeInfo; =20 - if (ModeNumber >=3D ARRAY_SIZE (mGopResolutions)) { + if (ModeNumber >=3D This->Mode->MaxMode) { return EFI_INVALID_PARAMETER; } =20 @@ -247,6 +273,11 @@ GopSetMode ( EFI_STATUS Status; EFI_STATUS Status2; =20 + if (!This->Mode) { + // SetMode() call in InitVgpuGop() triggers this. + GopInitialize (This); + } + Status =3D GopQueryMode (This, ModeNumber, &SizeOfInfo, &GopModeInfo); if (Status !=3D EFI_SUCCESS) { return Status; @@ -259,20 +290,6 @@ GopSetMode ( // calls. // if (VgpuGop->ResourceId =3D=3D 0) { - // - // Set up the Gop -> GopMode -> GopModeInfo pointer chain, and the oth= er - // (nonzero) constant fields. - // - // No direct framebuffer access is supported, only Blt() is. - // - VgpuGop->Gop.Mode =3D &VgpuGop->GopMode; - - VgpuGop->GopMode.MaxMode =3D (UINT32)(ARRAY_SIZE (mGopResolutions)); - VgpuGop->GopMode.Info =3D &VgpuGop->GopModeInfo; - VgpuGop->GopMode.SizeOfInfo =3D sizeof VgpuGop->GopModeInfo; - - VgpuGop->GopModeInfo.PixelFormat =3D PixelBltOnly; - // // This is the first time we create a host side resource. // --=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 (#86361): https://edk2.groups.io/g/devel/message/86361 Mute This Topic: https://groups.io/mt/88878649/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-