From nobody Sat Nov 23 19:56:34 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1730203873; cv=none; d=zohomail.com; s=zohoarc; b=DWcq2LISGgtGqp2M/WmByqJ/q9y/WdAHTZCN6pa5JXFM2uJab/YqGTLkpqEqguIahrjxKqGKA9jtnFCT0aRFp+56eKc0YB4g1SBurK9pw/n8yChtE6jl1rJrGwkTbdHT4U4leZqEzixBp9T+IVH8DFrvCkHgqx0tJxBzXUYPCHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730203873; h=Content-Type: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=Lowm4YyV2GElWtVAlyi9nUtaFHXu7/ajO637WhpLQKM=; b=ZMljJdd7W/gveDpD/5jcFqaKQA7xhvXnbCopAFuLa3PAP0QRHWSUiKSR+2YrwM4wZZ20DQJ7ppddcTuICwkDc7i0/Izvh/sb2NDAdXFzKSs0algR1kz5tE/f2QPhkHXsKgTw4MrevsA7Z/f03hVgpSXRuy8LEm9myM0zpavNrIk= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173020387361442.35601742620031; Tue, 29 Oct 2024 05:11:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5l3k-0004dp-VZ; Tue, 29 Oct 2024 08:10:53 -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 1t5l3Z-0004at-HY for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:10:41 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5l3X-0007Sz-Ai for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:10:41 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-539f1292a9bso6285352e87.2 for ; Tue, 29 Oct 2024 05:10:38 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058bb1bc3sm12200227f8f.110.2024.10.29.05.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 05:10:34 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2676B5FACF; Tue, 29 Oct 2024 12:10:31 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730203837; x=1730808637; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Lowm4YyV2GElWtVAlyi9nUtaFHXu7/ajO637WhpLQKM=; b=xYVnIbC1ac2tJEgnUEHNJ5uDPzfWmZOspdwbWTOJZeSK7W1KaszhF8Tv1JuSlWW12Y xoqvrHwtSn3F7RO5dEr+WN2VgBW3mALQRrjUtkukKk389p6gg/ajflX3Ers02zwzYyk1 Yxhk/yQkET3vSy2exjA99tc+rWOC9fSgQ8Zdc1Ojl0BEgGi27bLqeCF/E3PRfO175GZt NBnfoNDiveSzVzhytri2CpDCVlY6ig6yCXZo+/NyLSplIpw3L+sAl1tes0qnKIig+tzM PG4Ax5qkC2a/efXz/0Dvn0vW3LsqJJvNCJsCSbbHntVYDxlKeTJ/+tnZaTT6R6meRvzs R2Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730203837; x=1730808637; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lowm4YyV2GElWtVAlyi9nUtaFHXu7/ajO637WhpLQKM=; b=nl+IMkaj4CEBtM/KzVerhAz1J7DuRvGIwoQOePe5tRNC5Av+LMeEVlVAYzIKnqzj37 GIxGi2SYMvAovPMMmYN3XOw7KG2ezOwZYvhcdSvjUBoZ+mITUAxBPr6qmtCFfLvxVdh/ s0k9lBCVfQH8s9u/pI3QP5wNi77Fko9hGek0bNqtjvTyloot2LZ0e4PmZaqKpXPN+GFR p0gXpC7cEFsAVGO29Wzl6ZMSQBlYoiQ/U6xJFlqiRDa6LQUn11GV0wL7dGuhbqKJlMRf 8yO5XFu6Up8vkHw+JQekudQvd6GDGREUG01xUtV/H4mFfDYTzx09f9rQoSoYea2WNKYb uuGQ== X-Gm-Message-State: AOJu0YyDC46IDAyu18SjKEtcRig/XD+Jh5itfexF9WgI5BR+XNjimpaq zKM/YyYXRO6TDLdrJXnvG+EcBTr0wL9rNWAYux5KdYfx6rF2nQM6dEsT3yUYJio= X-Google-Smtp-Source: AGHT+IGjTGDiRCVJEGBE/cC71k3FucS4hi/JgbbTrHBY1hEvAen5h8YiyW29FV5Mr80LPRlpKVmEcQ== X-Received: by 2002:a05:6512:32c7:b0:539:a353:279c with SMTP id 2adb3069b0e04-53b348d8f6cmr6306914e87.28.1730203837419; Tue, 29 Oct 2024 05:10:37 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Huang Rui , Antonio Caggiano , Antonio Caggiano , Dmitry Osipenko , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Michael S. Tsirkin" Subject: [PULL 07/13] virtio-gpu: Support context-init feature with virglrenderer Date: Tue, 29 Oct 2024 12:10:24 +0000 Message-Id: <20241029121030.4007014-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241029121030.4007014-1-alex.bennee@linaro.org> References: <20241029121030.4007014-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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:1450:4864:20::133; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x133.google.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, RCVD_IN_DNSWL_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1730203875137116600 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 Message-Id: <20241024210311.118220-8-dmitry.osipenko@collabora.com> Signed-off-by: Alex Benn=C3=A9e diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 753b35ed69..bf87ba4232 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -147,6 +147,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 ca6f4d6cbb..b3aa444bcf 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.39.5