From nobody Sun May 19 00:42:46 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+87445+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+87445+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646977403; cv=none; d=zohomail.com; s=zohoarc; b=dzlVMju8tfGHvelP5CIETKqzz0xHNioS4hPog4JxOVFsgIzP2h5fJuIDhAIhDrA0qUfpjWG62YeTZbtXE7uxGbNCZogzAnRy8015p+XcfZ724/LGW2l7fSbZaJcRlz6lQpc7cpHc4d25Welkt4Bp2aNVaHdmcOXSKWBQLAnJMZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646977403; 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=U/bmVh/apG5kpOLt8z23NG/iW+yWTgEFsM8jdf3k3hg=; b=N8iqby2l7uuwXUqlCav7Uzq5AmX5PP85feQ2lKgey4s/M7IffoeOaWDj6YoEIwAXk/v6KRJ1vi3q/vf/hcjV4Sj8rs8K9u9l4FGypgVApNsXoMqya9skqHgeGMQN47YGGDgzdWMdgXOpCX7foJvUrFa6pnTaEYcltaZ0Ne5eV9M= 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+87445+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 1646977403719148.98399100104575; Thu, 10 Mar 2022 21:43:23 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id eAOfYY1788612xIyoDZHm6T0; Thu, 10 Mar 2022 21:43:23 -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.2685.1646977401676776093 for ; Thu, 10 Mar 2022 21:43:22 -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-17-W4uvEYg4Opm5nwpNpgYQng-1; Fri, 11 Mar 2022 00:43:19 -0500 X-MC-Unique: W4uvEYg4Opm5nwpNpgYQng-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 66F921006AA8 for ; Fri, 11 Mar 2022 05:43:18 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.196.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF73E1006915; Fri, 11 Mar 2022 05:43:17 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A4D9A18000B4; Fri, 11 Mar 2022 06:43:15 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Pawel Polawski , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 1/6] OvmfPkg/VirtioGpuDxe: add VirtioGpuSendCommandWithReply Date: Fri, 11 Mar 2022 06:43:10 +0100 Message-Id: <20220311054315.876774-2-kraxel@redhat.com> In-Reply-To: <20220311054315.876774-1-kraxel@redhat.com> References: <20220311054315.876774-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: fyVqpSQdILHJVSRmeOh22y8Ex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646977403; bh=ywqZaoTpXBwgHg2B9kUYG4oqO2ZGG9xb33KywGOhsTw=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=vINhBMLnRMJhiBuJsxQfQSnTnCmN1RkbPwyA4pw6Ol0HP4dWI7UUdmwQDDKYoP51TO+ FYtNeM9Nzgu/oNkw/YKeQNkx49C0frZwqUDRoAVBUoDjVMewtplV+NCS+iR8VlxfefTs6 8bOpkZIY3xi5Wa28nRuPjCWJNXAzDCyqdbE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646977404809100003 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.35.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 (#87445): https://edk2.groups.io/g/devel/message/87445 Mute This Topic: https://groups.io/mt/89705197/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 Sun May 19 00:42:46 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+87446+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+87446+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646977404; cv=none; d=zohomail.com; s=zohoarc; b=dbJwg1aYnPzUf/pim7N+Jn5FqnUnISMdBXBxyNDZ/3csHKTzNfKNxg/GYZKt04W+/X1+W7m/e/IopvYlA6wdMbL+CYl1yXHmytbJgDKo/egeTuZ+1BfZGc/6GTTJ65w5IFDRyL47VYu6oAk7ofxtH96b1v7OCxRiSmv6u/w7mXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646977404; 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=vWjUsd6tEmt24qwXqgsIvOUdmfCXIG55TQl6+Y3Xy04=; b=Kr0Z+cNl8KyWZb44InBJ9o8R0zhYm7iyrAS0rpC/hLk27YtSQnyIGk/3jGFqiTE4T5T5inlUn+z5ikLTLYsTDWNlYghkcYc9jznVBmRzp0ANEgLPmjCO8tbiwyvLZP11tFW62989ccymMvPCx0HYobXGWJ6QL6a511JuHuQFUr8= 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+87446+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 1646977404007789.6433015487299; Thu, 10 Mar 2022 21:43:24 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Cs06YY1788612xPG4CjJnyi7; Thu, 10 Mar 2022 21:43: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.web11.2676.1646977403404310924 for ; Thu, 10 Mar 2022 21:43: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-484-R2wfLcT5OliXhuFEYMz94A-1; Fri, 11 Mar 2022 00:43:21 -0500 X-MC-Unique: R2wfLcT5OliXhuFEYMz94A-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 850CF801AFC for ; Fri, 11 Mar 2022 05:43:20 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.196.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 400F55DBA2; Fri, 11 Mar 2022 05:43:20 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AA8491800608; Fri, 11 Mar 2022 06:43:15 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Pawel Polawski , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 2/6] OvmfPkg/VirtioGpuDxe: add GetDisplayInfo to virtio-gpu spec header. Date: Fri, 11 Mar 2022 06:43:11 +0100 Message-Id: <20220311054315.876774-3-kraxel@redhat.com> In-Reply-To: <20220311054315.876774-1-kraxel@redhat.com> References: <20220311054315.876774-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: Q1KbS0EQWe9Npd5QVVpdbyDvx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646977404; bh=PQGjewHbHtKdyUVVIiIdoolW9bRVtyUkvM6CtCyJnm8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=O7FeVbeJYqvM0TzmZ1QVfkC+SO79Yy+gzrAYVrAeWu/WDVMYLOKTuJq4MBzmTUIrgEG /piu1kC9Hy5xfzFtPGe1IpvcTGv7+BWCxbT+ZaL1ky1B6AmvNA3E6j4NdDQ5GBnCUyTwD rumzm/p4HUpk/fyKNZdxNh9msmHortkDFa4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646977423277100003 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.35.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 (#87446): https://edk2.groups.io/g/devel/message/87446 Mute This Topic: https://groups.io/mt/89705198/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 Sun May 19 00:42:46 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+87447+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+87447+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646977406; cv=none; d=zohomail.com; s=zohoarc; b=LbIXNrwIVr7rLCir5iLamm9+6VPLWmql/T9ntn+R5Ca1evVgTY7NlcbywkWdp5vzdimMqCG3E1OKodUtjMxmwMifPWyAFw+jwC03w3FnFWqY3XiUksQDcU0x6WOTDlquVK/Qzpx9gFzcDNu/vSEOlqKX6SLo6R6OhJxLLgXXvs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646977406; 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=U+8TCSQ03R5s9If4refF9wPvhxMogdCLEDkIG/jIzeE=; b=Et0MTTHJPke/Qj/vtypJsXjcPBe/RV6vTqKX39/dLMBCPf+l1DXDa+RWBxYkt6DiWM5wXrpQy59MZ8GvTZwWMbDJPrTQToSgRf8C/sm4/NnySQsHXyX7eUrrUQn2NLdn9mNqIuZwpwFcDqVwXzzBhzY2VGxwu4H6kxLXZrQziVc= 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+87447+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 1646977406148575.7805375569327; Thu, 10 Mar 2022 21:43:26 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id FxdqYY1788612xmgkjNAEV9N; Thu, 10 Mar 2022 21:43:25 -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.2688.1646977404586362066 for ; Thu, 10 Mar 2022 21:43: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-484-IJ2QhngDN6ebz0fKKMpq5w-1; Fri, 11 Mar 2022 00:43:21 -0500 X-MC-Unique: IJ2QhngDN6ebz0fKKMpq5w-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 8AA7C51DC for ; Fri, 11 Mar 2022 05:43:20 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.196.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 44D0F5DBA9; Fri, 11 Mar 2022 05:43:20 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B02B81800612; Fri, 11 Mar 2022 06:43:15 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Pawel Polawski , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 3/6] OvmfPkg/VirtioGpuDxe: add VirtioGpuGetDisplayInfo Date: Fri, 11 Mar 2022 06:43:12 +0100 Message-Id: <20220311054315.876774-4-kraxel@redhat.com> In-Reply-To: <20220311054315.876774-1-kraxel@redhat.com> References: <20220311054315.876774-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: vFthIgUeC9tUj758KQ2iblqhx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646977405; bh=JChG5cXWDrrnDjIa0kazXVMbE0oXVgsF7whBEgvZXc0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=KSlbMdDYsAfQ0d01kpYaXutEvsqG3HixRSDGhnKKRFFmjyQhS18nAUNoUkY+/BPP/OJ rHFACl7st0inOdLgvVeWz5OlIrhXwJ/3ya8umxQc1i24+1lIcXFCWjrxSyCAi8R2115gv uc//UrjiHunrfgiHBwG75uWfjnFYslGkgXM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646977406652100009 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.35.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 (#87447): https://edk2.groups.io/g/devel/message/87447 Mute This Topic: https://groups.io/mt/89705199/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 Sun May 19 00:42:46 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+87448+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+87448+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646977416; cv=none; d=zohomail.com; s=zohoarc; b=HDQRZC7WoI1EuvDjmtfDKJbVjZh0kRshZvDpVwvW6TGmx4lO5DMML6twvOS2qg4eSfT/b+Gw9JKkonf2jdYnJlOVj/85gNlqSHMSlFQCFDDdUCzSE0279rDOzxCMCfk7S3giYh41ijiSdrvnVrCPsOEzECwASttWQSJZt17vY2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646977416; 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=Imgv6vVC4KHb1VYi8Nmyp3dNjVEwXi3Ix6RIQ0hkYzs=; b=NXe2ryePDVhYT7KHYCz8Rm2hODvRa3035G5pMnARoXVhLEMpedG4gz3U567mYJpqrHsVIVfG4p6CWdnng1a2WwJY6DdL/+EnzpSqaX7btALUuEIY6pL9zJbZidv/MrzSJx+7WbCZ3ZJPyrmzeIMz+3Bk17/5saWOyZbs2hKpnUY= 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+87448+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 1646977416835505.0702166048462; Thu, 10 Mar 2022 21:43:36 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id fhijYY1788612xVqseHWLDAe; Thu, 10 Mar 2022 21:43:36 -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.2738.1646977415400845939 for ; Thu, 10 Mar 2022 21:43:35 -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-298-3e6a88LjNUCQ4zBtgr8SoA-1; Fri, 11 Mar 2022 00:43:33 -0500 X-MC-Unique: 3e6a88LjNUCQ4zBtgr8SoA-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B5FB2180FD73 for ; Fri, 11 Mar 2022 05:43:32 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.196.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8CAD646C2; Fri, 11 Mar 2022 05:43:22 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B50B31800636; Fri, 11 Mar 2022 06:43:15 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Pawel Polawski , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 4/6] OvmfPkg/VirtioGpuDxe: use GopQueryMode in GopSetMode Date: Fri, 11 Mar 2022 06:43:13 +0100 Message-Id: <20220311054315.876774-5-kraxel@redhat.com> In-Reply-To: <20220311054315.876774-1-kraxel@redhat.com> References: <20220311054315.876774-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: wHw8D7UmuvnEZNf4hdZpWKR4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646977416; bh=IAomIhlEYdmyB158OYSDo1YRr5ND/uhzAcgxbJOA7Qc=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=V4dX5S4psXyC8RcGEUO89lgMsaI/Juj+9IrQTnARDEQIQxAnXZC64QmpfSQ/TXMd9bX aP+p2VtSYPWQZVyc1sb2iXLY/dahGGr00k4dZTvMMqsRwllldxAYAXXL00dQ5XEB/AUXI WhIc+eENj4CC68HG1FHur5dug35Rp/cUb1o= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646977418869100001 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.35.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 (#87448): https://edk2.groups.io/g/devel/message/87448 Mute This Topic: https://groups.io/mt/89705200/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 Sun May 19 00:42:46 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+87450+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+87450+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646977426; cv=none; d=zohomail.com; s=zohoarc; b=N8WEm6xaHrv/cSvhRIuYZiWt2Vu3SURNVFT+fKjS0B42aTCatpt8E7QJ0QZybh4zPFyqihDNFiQps6LikmBTuY6T9ansbG5ML1lrXWNfr6/mjaK42IKFZk67FBd7Twr0UZXeJ3CTudxUlGKg+TnBdxmrbu1T31wu996okEiLhvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646977426; 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=9O+TQFsfXB1MF8LHp/U+bSHssIZ4EtTGFeLJVD7xOxU=; b=ZcJggh7LdoA5fembwm+e7Gv5eM00srKMxOAmfKWdLKEIXFsV6GsN80xw2DDTGgOaTG1newHbmNhvaK2mb0a8W9u0Su8jOwRenck29f6bFU1ED56HDSfDWkGyH6g833j2/T3zHRwNUz+hiWflSatKINMCmyw5kjZUvTTp0UtMcW4= 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+87450+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 16469774262741001.2900404972327; Thu, 10 Mar 2022 21:43:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Ji0SYY1788612xxdVFdTve71; Thu, 10 Mar 2022 21:43:45 -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.2677.1646977424777104321 for ; Thu, 10 Mar 2022 21:43:45 -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-481-grFtSdkuNuCu8PrcGV7iwA-1; Fri, 11 Mar 2022 00:43:41 -0500 X-MC-Unique: grFtSdkuNuCu8PrcGV7iwA-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 DD4A9180FD72 for ; Fri, 11 Mar 2022 05:43:40 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.196.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB47D5DF4B; Fri, 11 Mar 2022 05:43:22 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B9F8D180063C; Fri, 11 Mar 2022 06:43:15 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Pawel Polawski , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 5/6] OvmfPkg/VirtioGpuDxe: move code to GopInitialize Date: Fri, 11 Mar 2022 06:43:14 +0100 Message-Id: <20220311054315.876774-6-kraxel@redhat.com> In-Reply-To: <20220311054315.876774-1-kraxel@redhat.com> References: <20220311054315.876774-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: quB3pLCa0e96Zbdq6DeIfUApx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646977425; bh=btb8MjL3AR+2iWTm/pg3yU4tRHCZV/KigghJy4AGzNI=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=Mwbil5FmmRS6rh0KUHdjFKB6PYUxRcJOb/4/YmrxRRekYOZ/0x+D8uSK7bhzX2aUhyC IkwjiiljD3oFUM6aZXE1cWeUV5bFTNKMF6Tkrl6Sju2z588eQAl911SCjL5apydz12QAt L9wi0UBoois9lGfUenSbD6LpXIXQEGiREis= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646977426803100001 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.35.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 (#87450): https://edk2.groups.io/g/devel/message/87450 Mute This Topic: https://groups.io/mt/89705202/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 Sun May 19 00:42:46 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+87449+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+87449+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646977419; cv=none; d=zohomail.com; s=zohoarc; b=f2E7fdswKI/nYJo+ZCitRC0fGi03obsTr6JGOzjmzPRdv4wyc5s1mcI4edNbwNK6MQKD1eu9WooT067qJRUnZXzjsnxT+fqKPXPY0w4WgLJ6tqsWV0jskrMQmgiWFsuYXA6IHsc41FhItetuFz5aIcZFQcyq6ti+KSjBNekAFh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646977419; 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=tN/1Ql+zRIbyu/7HXnwgeCKJ9EnQoSwW64517udayFA=; b=LGJu03eha9P/K5tUbm0VzMPICiLoSp2aj4yft4lMKHlyMkBNOrvD6u1vNGdSnH0C1vcnLRDStyTgOEIHGSvZ7o6UjP9MUddV5cw774olyiohb73ddY3BjpxbRcCbbC3J5rz7FZ44rhz5CGfU63qom7LS6+0C52F5DpwBSmhmscU= 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+87449+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 1646977419378947.9181383987901; Thu, 10 Mar 2022 21:43:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UduJYY1788612xqpjKHIArTX; Thu, 10 Mar 2022 21:43:39 -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.2676.1646977418453074874 for ; Thu, 10 Mar 2022 21:43:38 -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-333-iCu5-ifzPNSPbwFUSEbhaA-1; Fri, 11 Mar 2022 00:43:36 -0500 X-MC-Unique: iCu5-ifzPNSPbwFUSEbhaA-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 70D221006AA7 for ; Fri, 11 Mar 2022 05:43:35 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.196.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7C0E57CA4; Fri, 11 Mar 2022 05:43:34 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BEF211800796; Fri, 11 Mar 2022 06:43:15 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Pawel Polawski , Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 6/6] OvmfPkg/VirtioGpuDxe: query native display resolution from host Date: Fri, 11 Mar 2022 06:43:15 +0100 Message-Id: <20220311054315.876774-7-kraxel@redhat.com> In-Reply-To: <20220311054315.876774-1-kraxel@redhat.com> References: <20220311054315.876774-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: YTeBCuqT7BE1ezTJy7X74czNx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646977419; bh=hFX3jpcu+xqpBvBy69bKOguX9Jg7T82RzqY8P/WhP6E=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=hYqR48OIAQ2l8/GA7F2frjYL4yEk+1Y77s5fWlVGoABuc4gO9renpjBzAO7KqGu58KV m+/1+02qrCwNf2ivjnapklK5VU2Me16VWSQoE37kqH57qlQNDTHwlx17mAfpA7ttDtJyQ 45QLgBMscBgjMSjAF84OEqNLK5bw5ZrVCDc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646977420769100006 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.35.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 (#87449): https://edk2.groups.io/g/devel/message/87449 Mute This Topic: https://groups.io/mt/89705201/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-