From nobody Mon Nov 25 04:46:57 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=1718499931; cv=none; d=zohomail.com; s=zohoarc; b=EwnxphWMmPFnwq/5ZZPwt7CS8Uzuqtf+esBObOdfYMUbKXgLeh3o+/42fbkJf75wrWwmXEQb1bzm274ejW18qB2HBfl/zgV9/S3VPw4eMhy8I6N2kl2RGL1JEldQPEqD8BciVu/WVD3z+5g+y4/JpfsckNM/ouJiC6xkfOrgn7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718499931; 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=yiQcSizzgwigBR1M0OK+pm5AWsGyog0MdV72S4fM1T8=; b=mgjCzA/PKimg+hoELapRF7gYuxlx+eg5H21Rd/+iMUbL93GMldIqCJYY37DIOQvO31DLY5lVi0X/KcKAFOEuPWh87r2+GCPSq1JEaZALTfN0K0WSaSQgrBFj67lVnaUkI4PbwqUF5AZch/J7tZCMD48NLILwRRR1CiIb6zLnsBU= 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 1718499931295250.17905441467906; Sat, 15 Jun 2024 18:05:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sIeK6-0005If-CC; Sat, 15 Jun 2024 21:04:46 -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 1sIeK4-0005IR-RC for qemu-devel@nongnu.org; Sat, 15 Jun 2024 21:04:44 -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 1sIeK2-00030p-Ts for qemu-devel@nongnu.org; Sat, 15 Jun 2024 21:04:44 -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 7F27437820A7; Sun, 16 Jun 2024 01:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1718499881; bh=DA3b++JVeYc99/yDGr/5cJZo0xHPEZc2IdiCUSpYCSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GWLliiOIy4OUpTMLLuvow3dePnkXodZLhqmIog3K8I/4nkLIQR7NHhgeV7YKl/S1C Zs7bjkNNQcT5uDicwx4DRxF2d2kxubAdOFRbDhklmSZwibHVlcJ0/Bve/lvchpRD22 w/aee7+JTlN5VQ+hg6fAT+9yuCftnRaCMxuk/cOWUf8Nx+o8YQkw9UObxq+0gEDqel PO7/a/DQC0tI/Y3+9xHLly7Ykjac2RrpNWNCLb6epEj/N2DCN98/uVwktb54H3fpAx e8DoHmJa5+im0Vpbdswn1h5wDZhATP+3XfLBcfW9B6gPXSb6TW6tYgzPVurFVwM2a0 g+b8yKFdCmeCg== 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 v14 07/14] virtio-gpu: Support context-init feature with virglrenderer Date: Sun, 16 Jun 2024 04:03:50 +0300 Message-ID: <20240616010357.2874662-8-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240616010357.2874662-1-dmitry.osipenko@collabora.com> References: <20240616010357.2874662-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: 1718499931893100005 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 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 0109244276fc..4fe9e6a0c21c 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -141,6 +141,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 +#if VIRGL_VERSION_MAJOR >=3D 1 + 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 ca6f4d6cbb58..b3aa444bcfa5 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; + } + +#if VIRGL_VERSION_MAJOR >=3D 1 + 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, --=20 2.44.0