From patchwork Mon Sep 26 14:24:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Caggiano X-Patchwork-Id: 12988797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5CE01C07E9D for ; Mon, 26 Sep 2022 14:47:59 +0000 (UTC) Received: from localhost ([::1]:60468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ocpOo-0006ni-7W for qemu-devel@archiver.kernel.org; Mon, 26 Sep 2022 10:47:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocp2G-0003qv-8g for qemu-devel@nongnu.org; Mon, 26 Sep 2022 10:24:40 -0400 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]:33176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocp2D-00044N-FT for qemu-devel@nongnu.org; Mon, 26 Sep 2022 10:24:38 -0400 Received: from dellino.fritz.box (host-79-27-165-192.retail.telecomitalia.it [79.27.165.192]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: fahien) by madras.collabora.co.uk (Postfix) with ESMTPSA id A779D660225F; Mon, 26 Sep 2022 15:24:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1664202275; bh=OPQZG7ytG7XOmX1N+cx0sIGXDh4qy3kHaMuKu0ArY9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYhH39S5QE+7hgL75V6B0d4WGVFcaZWpMNsWI6WkzEonwtrqIIr75ZNqoU51/ZS3t jViu+SQX2NvWI1jtaQ0A3woZ4KoplOkuuX0k9dVErU1EuTyWFCL7jFg0VxajaDFg2f nKFz6mLn4nH/gcyOy7B7hib5LKh2k9p/tFbNhNBxE65ZVMHO0a8cSkqt6HX7LyQz8r oO6ZlrzDl8ZuTrmPuwn9FQ4Aw5V+obYW4H5U73HfzGu6iNVlYr05hMHTi+nPL1R4tk jUBBxMoL/r8peQEbrMCsOfR1U0M3Qksa/zR7Leo9vcA9tXklxHA8swUtDWxyLRJnx8 j6A1hzWPYSkYA== From: Antonio Caggiano To: qemu-devel@nongnu.org Cc: gert.wollny@collabora.com, dmitry.osipenko@collabora.com, Gerd Hoffmann , "Michael S. Tsirkin" Subject: [PATCH v3 7/9] virtio-gpu: Support Venus capset Date: Mon, 26 Sep 2022 16:24:20 +0200 Message-Id: <20220926142422.22325-8-antonio.caggiano@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220926142422.22325-1-antonio.caggiano@collabora.com> References: <20220926142422.22325-1-antonio.caggiano@collabora.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1098:0:82:1000:25:2eeb:e5ab; envelope-from=antonio.caggiano@collabora.com; helo=madras.collabora.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add support for the Venus capset, which enables Vulkan support through the Venus Vulkan driver for virtio-gpu. Signed-off-by: Antonio Caggiano --- v3: Improve commit message hw/display/virtio-gpu-virgl.c | 21 +++++++++++++++++---- include/standard-headers/linux/virtio_gpu.h | 2 ++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index f9d8ccfdf8..16f600adbb 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -388,6 +388,11 @@ static void virgl_cmd_get_capset_info(VirtIOGPU *g, virgl_renderer_get_cap_set(resp.capset_id, &resp.capset_max_version, &resp.capset_max_size); + } else if (info.capset_index == 2) { + resp.capset_id = VIRTIO_GPU_CAPSET_VENUS; + virgl_renderer_get_cap_set(resp.capset_id, + &resp.capset_max_version, + &resp.capset_max_size); } else { resp.capset_max_version = 0; resp.capset_max_size = 0; @@ -820,10 +825,18 @@ int virtio_gpu_virgl_init(VirtIOGPU *g) int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g) { - uint32_t capset2_max_ver, capset2_max_size; + uint32_t capset2_max_ver, capset2_max_size, num_capsets; + num_capsets = 1; + virgl_renderer_get_cap_set(VIRTIO_GPU_CAPSET_VIRGL2, - &capset2_max_ver, - &capset2_max_size); + &capset2_max_ver, + &capset2_max_size); + num_capsets += capset2_max_ver ? 1 : 0; + + virgl_renderer_get_cap_set(VIRTIO_GPU_CAPSET_VENUS, + &capset2_max_ver, + &capset2_max_size); + num_capsets += capset2_max_size ? 1 : 0; - return capset2_max_ver ? 2 : 1; + return num_capsets; } diff --git a/include/standard-headers/linux/virtio_gpu.h b/include/standard-headers/linux/virtio_gpu.h index 2da48d3d4c..2db643ed8f 100644 --- a/include/standard-headers/linux/virtio_gpu.h +++ b/include/standard-headers/linux/virtio_gpu.h @@ -309,6 +309,8 @@ struct virtio_gpu_cmd_submit { #define VIRTIO_GPU_CAPSET_VIRGL 1 #define VIRTIO_GPU_CAPSET_VIRGL2 2 +/* 3 is reserved for gfxstream */ +#define VIRTIO_GPU_CAPSET_VENUS 4 /* VIRTIO_GPU_CMD_GET_CAPSET_INFO */ struct virtio_gpu_get_capset_info {