From nobody Mon Nov 25 09:40:14 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=collabora.com ARC-Seal: i=1; a=rsa-sha256; t=1716779119; cv=none; d=zohomail.com; s=zohoarc; b=L5qFQrzrtSmGWR37nMxCARLpu8ZLgqOC6zOAje3oEjH34AqgC1AMJl6MzNekIEpYVpaCawYCaLwD+rPD4R6XLHw7dm4L/hbhQ69xrsgN8Fy0baAcC390pzJ21V9KTSWcvGekY22w4o4mzsk1cCDE47akY58QpP8kl6sI3vc4zCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716779119; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nFBnFQsKOp2pBLeVJzT1ux5urKpJKctgPJQ0Cp1N+e4=; b=BKmqvy1n4QYmUpeD4/gXD77gS10ZNq2bDG231hgCJFInaJc3iJXlQhRummedHGkw2D20ethVHBb1ajc7a8M4KtpeIy4gUG5ByU4Wu0rWqoC4L7aas0WWThaAEw8kNNCUucyNJ4DVASEfrTJ4r/fbywLete4wpullms3jRNs997o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716779119163713.9247575457853; Sun, 26 May 2024 20:05:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBQdo-0005Dh-GG; Sun, 26 May 2024 23:03:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sBQdn-0005DX-FP for qemu-devel@nongnu.org; Sun, 26 May 2024 23:03:15 -0400 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sBQdl-0002Ip-S6 for qemu-devel@nongnu.org; Sun, 26 May 2024 23:03:15 -0400 Received: from workpc.. (cola.collaboradmins.com [195.201.22.229]) (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: dmitry.osipenko) by madrid.collaboradmins.com (Postfix) with ESMTPSA id D5BBB37820A7; Mon, 27 May 2024 03:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1716778991; bh=u3lPt4dfSywaRiWn1iJk8KCTSQnwKkF0pZSAepAV4MA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGu2nTsIi9NY3PFL7Onp8HE2j/sYMjzMmm9QWtbPUXGpG/8XKETlFQpWiWTpjn1Rh 2+Q9lc2KFEzfIm86/UCdYehAkx3MwfV/dmjHnuD2+kCEQXAb3jgHaeG2xqDRSUwPlU LBwkWesFe+jEaEG0pdAKk1VbCQxYU0zsTwyEzJPjd0yuXhdpa46vg1o1cUQQKAGsEI 61ehwlR5VP1nLmvl3PNi6sYgsLmDgOVh3EmHSC6mvKjvILZZFbQXzgA20AeWbTwIAx GgaMmXlMGbH4SfHEuikQzSbCI6j4YtynCj7iQ1Z2tUanvaMjfSKGgU1vOA5pY/jgs5 tI1UlJCvP+lbQ== From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , "Michael S . Tsirkin" , Stefano Stabellini , Antonio Caggiano , "Dr . David Alan Gilbert" , Robert Beckett , Gert Wollny , =?UTF-8?q?Alex=20Benn=C3=A9e?= Cc: qemu-devel@nongnu.org, Gurchetan Singh , ernunes@redhat.com, Alyssa Ross , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , Stefano Stabellini , =?UTF-8?q?Christian=20K=C3=B6nig?= , Xenia Ragiadakou , Pierre-Eric Pelloux-Prayer , Honglei Huang , Julia Zhang , Chen Jiqian , Yiwei Zhang Subject: [PATCH v13 06/13] virtio-gpu: Support context-init feature with virglrenderer Date: Mon, 27 May 2024 06:02:26 +0300 Message-ID: <20240527030233.3775514-7-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240527030233.3775514-1-dmitry.osipenko@collabora.com> References: <20240527030233.3775514-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1098:ed:100::25; envelope-from=dmitry.osipenko@collabora.com; helo=madrid.collaboradmins.com 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, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @collabora.com) X-ZM-MESSAGEID: 1716779121452100003 Content-Type: text/plain; charset="utf-8" From: Huang Rui Patch "virtio-gpu: CONTEXT_INIT feature" has added the context_init feature flags. Expose this feature and support creating virglrenderer context with flags using context_id if libvirglrenderer is new enough. Originally-by: Antonio Caggiano Signed-off-by: Huang Rui Reviewed-by: Antonio Caggiano Signed-off-by: Dmitry Osipenko --- hw/display/virtio-gpu-gl.c | 4 ++++ hw/display/virtio-gpu-virgl.c | 20 ++++++++++++++++++-- meson.build | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 7978b2985e17..9822d79c5e81 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -140,6 +140,10 @@ static void virtio_gpu_gl_device_realize(DeviceState *= qdev, Error **errp) VIRTIO_GPU_BASE(g)->virtio_config.num_capsets =3D virtio_gpu_virgl_get_num_capsets(g); =20 +#ifdef HAVE_VIRGL_CONTEXT_CREATE_WITH_FLAGS + g->parent_obj.conf.flags |=3D 1 << VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLE= D; +#endif + virtio_gpu_device_realize(qdev, errp); } =20 diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index 66c4aab9b283..4b2d4a643e30 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -106,8 +106,24 @@ static void virgl_cmd_context_create(VirtIOGPU *g, trace_virtio_gpu_cmd_ctx_create(cc.hdr.ctx_id, cc.debug_name); =20 - virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen, - cc.debug_name); + if (cc.context_init) { + if (!virtio_gpu_context_init_enabled(g->parent_obj.conf)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: context_init disabled", + __func__); + cmd->error =3D VIRTIO_GPU_RESP_ERR_UNSPEC; + return; + } + +#ifdef HAVE_VIRGL_CONTEXT_CREATE_WITH_FLAGS + virgl_renderer_context_create_with_flags(cc.hdr.ctx_id, + cc.context_init, + cc.nlen, + cc.debug_name); + return; +#endif + } + + virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen, cc.debug_name); } =20 static void virgl_cmd_context_destroy(VirtIOGPU *g, diff --git a/meson.build b/meson.build index de97d2426bde..65fddfbbc3a7 100644 --- a/meson.build +++ b/meson.build @@ -2310,6 +2310,7 @@ config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) config_host_data.set('CONFIG_VNC_SASL', sasl.found()) if virgl.version().version_compare('>=3D1.0.0') config_host_data.set('HAVE_VIRGL_D3D_INFO_EXT', 1) + config_host_data.set('HAVE_VIRGL_CONTEXT_CREATE_WITH_FLAGS', 1) endif config_host_data.set('CONFIG_VIRTFS', have_virtfs) config_host_data.set('CONFIG_VTE', vte.found()) --=20 2.44.0