From nobody Fri May 17 06:54:04 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+86360+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+86360+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643873176; cv=none; d=zohomail.com; s=zohoarc; b=VAQsNacVRz3mE6mbzkKRKujKtJVypkiTioSQ8ZH3xaIYU2vveVX6rXRG3eFvvgeExroms+EhEAWP6yNv8fnBR0MvohFaSCeOyzxfROzNkhYNQjkOYIP90x2dbrbjMv5BaSVcW6BP29nGx3UBBDduOCr4RxUS/+4q0J9lMyw0bw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643873176; 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=0nXPCPvqlBwTb95lhDW05TSnDx8ylBYg5mypsna+SGQ=; b=TwIdH2iiuL3rthfh4kltCpKuRKleTXFJpLiSqcJc7uf3RVmLfN7hecKzft3kHrYOCapGX8T3Ngsj/RY7IWqCEFPm9I9L956gonplRnAWyfXWWSSrsw/cyTmXb8VuWLgUaUon/qSuc0sdJgVPtjkPhBOAgB/iTjaOWoFvdhcGvGc= 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+86360+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 1643873176382719.3467591817725; Wed, 2 Feb 2022 23:26:16 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id CSMbYY1788612xhH4dXUxcXa; Wed, 02 Feb 2022 23:26:15 -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.6400.1643873174921330262 for ; Wed, 02 Feb 2022 23:26:15 -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-351-1EQvxlFfMYizqydwpYv1Qw-1; Thu, 03 Feb 2022 02:26:08 -0500 X-MC-Unique: 1EQvxlFfMYizqydwpYv1Qw-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 24A111060D71 for ; Thu, 3 Feb 2022 07:26:03 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B08775DBB3; Thu, 3 Feb 2022 07:26:02 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A153118003A1; 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 1/6] OvmfPkg/VirtioGpuDxe: add VirtioGpuSendCommandWithReply Date: Thu, 3 Feb 2022 08:25:55 +0100 Message-Id: <20220203072600.1646396-2-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: URdmNWXcX2od3aYXNepfDcBtx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643873175; bh=jSxFFtKfynI5oD4N5hiRBEH3hni6ZFq59Yy6i/L8PEk=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=stOoAsixRImeEa0b12KYuQvQ9oxi3czFEwd/hXzLrjrFhfjKnTB3hZ2JC59k33K7u65 Jl++7xbMtnvQPKWHWFx+7Tbg8lQHEd5Zf6IQrFFVveNSOhXCjQYjA6m3a2TzfDF9GuOnI O5IZdmdpYOa7/PDLqMPGa6c9WRa0lRqyOu8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643873178513100015 Content-Type: text/plain; charset="utf-8" Extend VirtioGpuSendCommand() to support commands which return data, rename the function to VirtioGpuSendCommandWithReply() to indicate that. Add a new VirtioGpuSendCommand() function which is just a thin wrapper around VirtioGpuSendCommandWithReply() so existing code continues to work without changes. Signed-off-by: Gerd Hoffmann --- OvmfPkg/VirtioGpuDxe/Commands.c | 75 +++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Command= s.c index 873a71656700..b9a3ea923021 100644 --- a/OvmfPkg/VirtioGpuDxe/Commands.c +++ b/OvmfPkg/VirtioGpuDxe/Commands.c @@ -393,6 +393,14 @@ VirtioGpuExitBoot ( @param[in] RequestSize Size of the entire caller-allocated request obje= ct, including the leading VIRTIO_GPU_CONTROL_HEADER. =20 + @param[in] ResponseType The type of the response (VirtioGpuResp*). + + @param[in,out] Response Pointer to the caller-allocated response object.= The + request must start with VIRTIO_GPU_CONTROL_HEADE= R. + + @param[in] ResponseSize Size of the entire caller-allocated response obj= ect, + including the leading VIRTIO_GPU_CONTROL_HEADER. + @retval EFI_SUCCESS Operation successful. =20 @retval EFI_DEVICE_ERROR The host rejected the request. The host e= rror @@ -404,22 +412,24 @@ VirtioGpuExitBoot ( **/ STATIC EFI_STATUS -VirtioGpuSendCommand ( +VirtioGpuSendCommandWithReply ( IN OUT VGPU_DEV *VgpuDev, IN VIRTIO_GPU_CONTROL_TYPE RequestType, IN BOOLEAN Fence, IN OUT volatile VIRTIO_GPU_CONTROL_HEADER *Header, - IN UINTN RequestSize + IN UINTN RequestSize, + IN VIRTIO_GPU_CONTROL_TYPE ResponseType, + IN OUT volatile VIRTIO_GPU_CONTROL_HEADER *Response, + IN UINTN ResponseSize ) { - DESC_INDICES Indices; - volatile VIRTIO_GPU_CONTROL_HEADER Response; - EFI_STATUS Status; - UINT32 ResponseSize; - EFI_PHYSICAL_ADDRESS RequestDeviceAddress; - VOID *RequestMap; - EFI_PHYSICAL_ADDRESS ResponseDeviceAddress; - VOID *ResponseMap; + DESC_INDICES Indices; + EFI_STATUS Status; + UINT32 ResponseSizeRet; + EFI_PHYSICAL_ADDRESS RequestDeviceAddress; + VOID *RequestMap; + EFI_PHYSICAL_ADDRESS ResponseDeviceAddress; + VOID *ResponseMap; =20 // // Initialize Header. @@ -457,8 +467,8 @@ VirtioGpuSendCommand ( Status =3D VirtioMapAllBytesInSharedBuffer ( VgpuDev->VirtIo, VirtioOperationBusMasterWrite, - (VOID *)&Response, - sizeof Response, + (VOID *)Response, + ResponseSize, &ResponseDeviceAddress, &ResponseMap ); @@ -480,7 +490,7 @@ VirtioGpuSendCommand ( VirtioAppendDesc ( &VgpuDev->Ring, ResponseDeviceAddress, - (UINT32)sizeof Response, + (UINT32)ResponseSize, VRING_DESC_F_WRITE, &Indices ); @@ -493,7 +503,7 @@ VirtioGpuSendCommand ( VIRTIO_GPU_CONTROL_QUEUE, &VgpuDev->Ring, &Indices, - &ResponseSize + &ResponseSizeRet ); if (EFI_ERROR (Status)) { goto UnmapResponse; @@ -502,7 +512,7 @@ VirtioGpuSendCommand ( // // Verify response size. // - if (ResponseSize !=3D sizeof Response) { + if (ResponseSize !=3D ResponseSizeRet) { DEBUG (( DEBUG_ERROR, "%a: malformed response to Request=3D0x%x\n", @@ -531,16 +541,17 @@ VirtioGpuSendCommand ( // // Parse the response. // - if (Response.Type =3D=3D VirtioGpuRespOkNodata) { + if (Response->Type =3D=3D (UINT32)ResponseType) { return EFI_SUCCESS; } =20 DEBUG (( DEBUG_ERROR, - "%a: Request=3D0x%x Response=3D0x%x\n", + "%a: Request=3D0x%x Response=3D0x%x (expected 0x%x)\n", __FUNCTION__, (UINT32)RequestType, - Response.Type + Response->Type, + ResponseType )); return EFI_DEVICE_ERROR; =20 @@ -553,6 +564,34 @@ VirtioGpuSendCommand ( return Status; } =20 +/** + Simplified version of VirtioGpuSendCommandWithReply() for commands + which do not send back any data. +**/ +STATIC +EFI_STATUS +VirtioGpuSendCommand ( + IN OUT VGPU_DEV *VgpuDev, + IN VIRTIO_GPU_CONTROL_TYPE RequestType, + IN BOOLEAN Fence, + IN OUT volatile VIRTIO_GPU_CONTROL_HEADER *Header, + IN UINTN RequestSize + ) +{ + volatile VIRTIO_GPU_CONTROL_HEADER Response; + + return VirtioGpuSendCommandWithReply ( + VgpuDev, + RequestType, + Fence, + Header, + RequestSize, + VirtioGpuRespOkNodata, + &Response, + sizeof (Response) + ); +} + /** The following functions send requests to the VirtIo GPU device model, aw= ait the answer from the host, and return a status. They share the following --=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 (#86360): https://edk2.groups.io/g/devel/message/86360 Mute This Topic: https://groups.io/mt/88878648/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 Fri May 17 06:54:04 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+86359+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+86359+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643873174; cv=none; d=zohomail.com; s=zohoarc; b=M+/8T710TkEuCn7zB/rI5v3DH0bUT6fy5BRf8I5GPcDEVofICYCYvvIRIqb0IsMF0PX9QFr0SxhAHbhuu2XHH4cq009MonVTbRn3VsOI8IEyHx/cjorcqwXnFMA09HqM9GF/iA34LI+zzytuxdHDNzVM8+Gl7+jivdIzUqyHVqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643873174; 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=panmAR6HsFqKH6DtLSmr9DAoa98zG2GmP7adwQ0j1a4=; b=JGBe2ToCicoAJIP/x9J+HeMMcAEV/3A6fU1ccpukKiPZvJ1PVQc4kpe4/Kg0YN+vak+QkrgnLG3dcGFPR6PHwmjHgYJrNCgG0A3L20lvOpvaIkt3832su+BviKrtQCUTkaFkq3t6ASjpanfpPJltFOb32BXkUgmZVuGQ5pWRrDw= 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+86359+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 1643873174343705.9478143607062; Wed, 2 Feb 2022 23:26:14 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id NzvDYY1788612xPq1ab4EWbt; Wed, 02 Feb 2022 23:26: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.web11.6286.1643873172999253228 for ; Wed, 02 Feb 2022 23:26:13 -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-391-qIXgKJx0NfCRAi_iwPH8AQ-1; Thu, 03 Feb 2022 02:26:09 -0500 X-MC-Unique: qIXgKJx0NfCRAi_iwPH8AQ-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 D0870871800 for ; Thu, 3 Feb 2022 07:26:05 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 833A760BD8; Thu, 3 Feb 2022 07:26:05 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A6D2B18003A7; 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 2/6] OvmfPkg/VirtioGpuDxe: add GetDisplayInfo to virtio-gpu spec header. Date: Thu, 3 Feb 2022 08:25:56 +0100 Message-Id: <20220203072600.1646396-3-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: LryEtM9u3uqC4b9JcZLxpGtlx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643873173; bh=npiidM/ldNkXEMq79+VyLibLrPrcpIsWKakq/AmMrO8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=bnZFacRrp6SW4nMXsJZyRdBugOdiQaVfw+VIoSgPqd3IALjs5/kw5Pgqk8sANITaEzP ZQs5YBRzClASKVIJasm7sQ9Jhqf0e4nZuDy7lBTuqL72lvpesPMe1l6y0ToGmSRoxrNKD E9SgcMFgLZkCufz2ESXMndt7QjaNOTBPdEU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643873176132100007 Content-Type: text/plain; charset="utf-8" Add GetDisplayInfo command, reply and data struct to the virtio-gpu specification header file. Signed-off-by: Gerd Hoffmann --- OvmfPkg/Include/IndustryStandard/VirtioGpu.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Include/IndustryStandard/VirtioGpu.h b/OvmfPkg/Include= /IndustryStandard/VirtioGpu.h index 12559ccef5b1..13f719d4c0f2 100644 --- a/OvmfPkg/Include/IndustryStandard/VirtioGpu.h +++ b/OvmfPkg/Include/IndustryStandard/VirtioGpu.h @@ -37,6 +37,7 @@ typedef enum { // // - create/release a host-side 2D resource, // + VirtioGpuCmdGetDisplayInfo =3D 0x0100, VirtioGpuCmdResourceCreate2d =3D 0x0101, VirtioGpuCmdResourceUnref =3D 0x0102, // @@ -64,7 +65,8 @@ typedef enum { // // Success code for all of the above commands. // - VirtioGpuRespOkNodata =3D 0x1100, + VirtioGpuRespOkNodata =3D 0x1100, + VirtioGpuRespOkDisplayInfo =3D 0x1101, } VIRTIO_GPU_CONTROL_TYPE; =20 // @@ -207,4 +209,19 @@ typedef struct { } VIRTIO_GPU_RESOURCE_FLUSH; #pragma pack () =20 +// +// Response structure for VirtioGpuCmdGetDisplayInfo +// +#define VIRTIO_GPU_MAX_SCANOUTS 16 +#pragma pack (1) +typedef struct { + VIRTIO_GPU_CONTROL_HEADER Header; + struct { + VIRTIO_GPU_RECTANGLE Rectangle; + UINT32 Enabled; + UINT32 Flags; + } Pmodes[VIRTIO_GPU_MAX_SCANOUTS]; +} VIRTIO_GPU_RESP_DISPLAY_INFO; +#pragma pack () + #endif // _VIRTIO_GPU_H_ --=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 (#86359): https://edk2.groups.io/g/devel/message/86359 Mute This Topic: https://groups.io/mt/88878647/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 Fri May 17 06:54:04 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+86358+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+86358+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643873175; cv=none; d=zohomail.com; s=zohoarc; b=GGPTrGOSTAYRteyw2PurN9SLKR+ShMTuA+8JraiANJ18zAgGS8XG+AV1JEThsbtJmaxfPSaucIiyhNExNp4lOtmo18Q4OpQ4KQDgnpgqhy3D5kJStHLi0vlAYtd/ElKxKqvftkRQl1oI4iG7I1sr9WYCZONDKIq/C5N146sqUpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643873175; 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=LJ0Lb4c1G+bKD60txUHpyR9ehBqB50A6TMlL09IA/LA=; b=Y2jS+SWwMP2Fdeu8qEl0pHhZK5Wc8ksjLIjR+Eaaq5PUdwhsMUykkb5L4lGRKXAOgY1ndrZOopFaMFMHSFGRJ3zAiV9O1J+/jkp3mU6ANTOdE//lYfKSQV3iDSTNBwA0MzyxaoWIKH0FOCabWyu1XcoIU0zHSyjspZ/tyf+pTy0= 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+86358+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 1643873175023869.2092477267373; Wed, 2 Feb 2022 23:26:15 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id TnXdYY1788612xOWwLJB9xE0; Wed, 02 Feb 2022 23:26:14 -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.6285.1643873172908839936 for ; Wed, 02 Feb 2022 23:26:13 -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-512-ohH96hp_O724Qe_X0EnMtw-1; Thu, 03 Feb 2022 02:26:10 -0500 X-MC-Unique: ohH96hp_O724Qe_X0EnMtw-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 EDF641091DB3 for ; Thu, 3 Feb 2022 07:26:06 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D5215F917; Thu, 3 Feb 2022 07:26:06 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AA2771800605; 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 3/6] OvmfPkg/VirtioGpuDxe: add VirtioGpuGetDisplayInfo Date: Thu, 3 Feb 2022 08:25:57 +0100 Message-Id: <20220203072600.1646396-4-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: DJ6nUpLfuGXoCVJXQs7KleYDx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643873174; bh=sUkF4Cw3OFq1+Beo7e1VulkD7ii/J5ysIL9mLrAn7yk=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=qjjS30NvBvw4pozU+TZp72yjcErfaBDi94Zs7oBAQxv3c/rg3hbEyCQ6aqXGJ4iwhfN W7oqbmUCcoNphAxE5oZqfOlsku2u/LSDR/vkEgVtiM8tYkgARvS3Oeyc6rfXE9qgzyxlg k+CBeTDubYvO4wdtndvkTikArGlpFXNbYxg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643873176360100011 Content-Type: text/plain; charset="utf-8" Add support for sending a GetDisplayInfo command. Signed-off-by: Gerd Hoffmann --- OvmfPkg/VirtioGpuDxe/VirtioGpu.h | 6 ++++++ OvmfPkg/VirtioGpuDxe/Commands.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h b/OvmfPkg/VirtioGpuDxe/Virtio= Gpu.h index 2155b261d43e..1d781088bb3f 100644 --- a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h +++ b/OvmfPkg/VirtioGpuDxe/VirtioGpu.h @@ -366,6 +366,12 @@ VirtioGpuResourceFlush ( IN UINT32 ResourceId ); =20 +EFI_STATUS +VirtioGpuGetDisplayInfo ( + IN OUT VGPU_DEV *VgpuDev, + volatile VIRTIO_GPU_RESP_DISPLAY_INFO *Response + ); + /** Release guest-side and host-side resources that are related to an initia= lized VGPU_GOP.Gop. diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Command= s.c index b9a3ea923021..4318d3d771c5 100644 --- a/OvmfPkg/VirtioGpuDxe/Commands.c +++ b/OvmfPkg/VirtioGpuDxe/Commands.c @@ -828,3 +828,23 @@ VirtioGpuResourceFlush ( sizeof Request ); } + +EFI_STATUS +VirtioGpuGetDisplayInfo ( + IN OUT VGPU_DEV *VgpuDev, + volatile VIRTIO_GPU_RESP_DISPLAY_INFO *Response + ) +{ + volatile VIRTIO_GPU_CONTROL_HEADER Request; + + return VirtioGpuSendCommandWithReply ( + VgpuDev, + VirtioGpuCmdGetDisplayInfo, + FALSE, // Fence + &Request, + sizeof Request, + VirtioGpuRespOkDisplayInfo, + &Response->Header, + sizeof *Response + ); +} --=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 (#86358): https://edk2.groups.io/g/devel/message/86358 Mute This Topic: https://groups.io/mt/88878646/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 Fri May 17 06:54:04 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+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- From nobody Fri May 17 06:54:04 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+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- From nobody Fri May 17 06:54:04 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+86362+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+86362+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1643873185; cv=none; d=zohomail.com; s=zohoarc; b=PXIGmYpaVVEYBgl/RSDIqFlNzBeauyiwADRFmfi7c0fpG56ix+j/5Xc0KC6uC4dejhmp0RtvVX9wvqPXjAMYbAMkiU1btVlvXTB94vQZPOSlX/Qzk6Hk8Hs0rPob3fxrzAusJ68cFAWmJ9Ayps9u21vfA0Zq0egMUZrLZjSjJrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643873185; 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=2qn/UAtOYDKtbdxeTaBKYOp2LI3yja2vggCmABxVQXQ=; b=Z0A/rnAS7xV/bbNFRzlsIx26TFwyiblRXKbjgu/NiFjdj91v9oiFpPo+4Q2e+yEGqBkRaCUGPk5pzze6FscdN8IWeLqtNsM1rEut60VSAlIEBg5bwvgX+hBn42C7KEE/R6zcVnop5OY7xSzPW25AMweR8bTAbjh4aNmUNnjll3c= 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+86362+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 1643873185155381.9399149006998; Wed, 2 Feb 2022 23:26:25 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id MOKtYY1788612xmyBzk5Ya4t; Wed, 02 Feb 2022 23:26:24 -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.6254.1643873183463297612 for ; Wed, 02 Feb 2022 23:26:24 -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-336-XdKmv7FXOEirwqr5qfmwIw-1; Thu, 03 Feb 2022 02:26:21 -0500 X-MC-Unique: XdKmv7FXOEirwqr5qfmwIw-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 4356551086 for ; Thu, 3 Feb 2022 07:26:19 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1F5A5F917; Thu, 3 Feb 2022 07:26:18 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B3BE91800614; 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 6/6] OvmfPkg/VirtioGpuDxe: query native display resolution from host Date: Thu, 3 Feb 2022 08:26:00 +0100 Message-Id: <20220203072600.1646396-7-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: Ooy35bMBv7VXeKmGAwtkq8cvx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643873184; bh=12DM0LsoZIkTz5IUBIgiyFkMey+ckhuTf9JD5W7mG1Q=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=b3+8KG1opjnM0VB+PL+3YE87FidJhUk+7p4LpCbHARCQGgO9fALAPR/Twky0XpyGGwj sf4y0AqBJGxBHG3nWLUcYchlb2RR7R1iSK0ALycsbQ9b5kRV9yWDis/wxjR30trf5Fepm Fr2bhzE1yo8fv+WY/33+zRMvCclwKxRAZg4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643873187627100002 Content-Type: text/plain; charset="utf-8" Try query native display resolution from the host. When successfull setup PcdVideoHorizontalResolution and PcdVideoVerticalResolution accordingly and add the video mode to the GOP mode list if needed. Signed-off-by: Gerd Hoffmann --- OvmfPkg/VirtioGpuDxe/VirtioGpu.inf | 6 ++ OvmfPkg/VirtioGpuDxe/VirtioGpu.h | 6 ++ OvmfPkg/VirtioGpuDxe/Gop.c | 92 ++++++++++++++++++++++++++++-- 3 files changed, 99 insertions(+), 5 deletions(-) diff --git a/OvmfPkg/VirtioGpuDxe/VirtioGpu.inf b/OvmfPkg/VirtioGpuDxe/Virt= ioGpu.inf index 9e66bcd4b97f..d88c87e129f0 100644 --- a/OvmfPkg/VirtioGpuDxe/VirtioGpu.inf +++ b/OvmfPkg/VirtioGpuDxe/VirtioGpu.inf @@ -25,6 +25,7 @@ [Sources] =20 [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec OvmfPkg/OvmfPkg.dec =20 [LibraryClasses] @@ -43,3 +44,8 @@ [Protocols] gEfiGraphicsOutputProtocolGuid ## BY_START gEfiPciIoProtocolGuid ## TO_START gVirtioDeviceProtocolGuid ## TO_START + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdVideoResolutionSource + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution diff --git a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h b/OvmfPkg/VirtioGpuDxe/Virtio= Gpu.h index 1d781088bb3f..45da56415297 100644 --- a/OvmfPkg/VirtioGpuDxe/VirtioGpu.h +++ b/OvmfPkg/VirtioGpuDxe/VirtioGpu.h @@ -151,6 +151,12 @@ struct VGPU_GOP_STRUCT { // BackingStore is non-NULL. // VOID *BackingStoreMap; + + // + // native display resolution + // + UINT32 NativeXRes; + UINT32 NativeYRes; }; =20 // diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c index 05daefcbfbc8..70a81c10c8b5 100644 --- a/OvmfPkg/VirtioGpuDxe/Gop.c +++ b/OvmfPkg/VirtioGpuDxe/Gop.c @@ -9,6 +9,7 @@ **/ =20 #include +#include =20 #include "VirtioGpu.h" =20 @@ -192,6 +193,47 @@ STATIC CONST GOP_RESOLUTION mGopResolutions[] =3D { #define VGPU_GOP_FROM_GOP(GopPointer) \ CR (GopPointer, VGPU_GOP, Gop, VGPU_GOP_SIG) =20 +STATIC +VOID +EFIAPI +GopNativeResolution ( + IN VGPU_GOP *VgpuGop, + OUT UINT32 *XRes, + OUT UINT32 *YRes + ) +{ + volatile VIRTIO_GPU_RESP_DISPLAY_INFO DisplayInfo; + EFI_STATUS Status; + UINTN Index; + + Status =3D VirtioGpuGetDisplayInfo (VgpuGop->ParentBus, &DisplayInfo); + if (Status !=3D EFI_SUCCESS) { + return; + } + + for (Index =3D 0; Index < VIRTIO_GPU_MAX_SCANOUTS; Index++) { + if (!DisplayInfo.Pmodes[Index].Enabled || + !DisplayInfo.Pmodes[Index].Rectangle.Width || + !DisplayInfo.Pmodes[Index].Rectangle.Height) + { + continue; + } + + DEBUG (( + DEBUG_INFO, + "%a: #%d: %dx%d\n", + __FUNCTION__, + Index, + DisplayInfo.Pmodes[Index].Rectangle.Width, + DisplayInfo.Pmodes[Index].Rectangle.Height + )); + if ((*XRes =3D=3D 0) || (*YRes =3D=3D 0)) { + *XRes =3D DisplayInfo.Pmodes[Index].Rectangle.Width; + *YRes =3D DisplayInfo.Pmodes[Index].Rectangle.Height; + } + } +} + STATIC VOID EFIAPI @@ -199,7 +241,9 @@ GopInitialize ( IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This ) { - VGPU_GOP *VgpuGop; + VGPU_GOP *VgpuGop; + EFI_STATUS Status; + UINT32 XRes =3D 0, YRes =3D 0, Index; =20 VgpuGop =3D VGPU_GOP_FROM_GOP (This); =20 @@ -216,6 +260,37 @@ GopInitialize ( VgpuGop->GopMode.SizeOfInfo =3D sizeof VgpuGop->GopModeInfo; =20 VgpuGop->GopModeInfo.PixelFormat =3D PixelBltOnly; + + // + // query host for display resolution + // + GopNativeResolution (VgpuGop, &XRes, &YRes); + if ((XRes =3D=3D 0) || (YRes =3D=3D 0)) { + return; + } + + 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); + } + + VgpuGop->NativeXRes =3D XRes; + VgpuGop->NativeYRes =3D YRes; + for (Index =3D 0; Index < ARRAY_SIZE (mGopResolutions); Index++) { + if ((mGopResolutions[Index].Width =3D=3D XRes) && + (mGopResolutions[Index].Height =3D=3D YRes)) + { + // native resolution already is in mode list + return; + } + } + + // add to mode list + VgpuGop->GopMode.MaxMode++; } =20 // @@ -242,10 +317,17 @@ GopQueryMode ( return EFI_OUT_OF_RESOURCES; } =20 - GopModeInfo->HorizontalResolution =3D mGopResolutions[ModeNumber].Width; - GopModeInfo->VerticalResolution =3D mGopResolutions[ModeNumber].Height; - GopModeInfo->PixelFormat =3D PixelBltOnly; - GopModeInfo->PixelsPerScanLine =3D mGopResolutions[ModeNumber].Width; + if (ModeNumber < ARRAY_SIZE (mGopResolutions)) { + GopModeInfo->HorizontalResolution =3D mGopResolutions[ModeNumber].Widt= h; + GopModeInfo->VerticalResolution =3D mGopResolutions[ModeNumber].Heig= ht; + } else { + VGPU_GOP *VgpuGop =3D VGPU_GOP_FROM_GOP (This); + GopModeInfo->HorizontalResolution =3D VgpuGop->NativeXRes; + GopModeInfo->VerticalResolution =3D VgpuGop->NativeYRes; + } + + GopModeInfo->PixelFormat =3D PixelBltOnly; + GopModeInfo->PixelsPerScanLine =3D GopModeInfo->HorizontalResolution; =20 *SizeOfInfo =3D sizeof *GopModeInfo; *Info =3D GopModeInfo; --=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 (#86362): https://edk2.groups.io/g/devel/message/86362 Mute This Topic: https://groups.io/mt/88878650/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-