From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619786566; cv=none; d=zohomail.com; s=zohoarc; b=JsZq4UxNQaa9dlTokc+9DOY22e2PDyJS0ojIih3VR5F+6GG82bPx+Njp++ByIuthRaCTsduvaxcifl4FR2lcgHDDOsJBd76GyZBFrTlZO81o9kIKQawo5g9OZnWiTULy97OHg20bj5XmfRxY3N9wYGdpv6kqZsUqkcSg1XQPTEo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619786566; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=duCwyNlglNcqemTVpMO0z8NLXL7nnvuZpAoGomh3gjc=; b=ONWFngD1u+qEvzbUfCzlFFT1GmDdHGBPst8nh3L0nV4iDLBzPsRqZAMoljlW6rKcxuRdHqMdoyeghgduAhdap41mpcprCnV6TBa8J3B4QxpkFIdXDyc5gSw/2qWYJUHSCllT+NcJlo7GUk2hAvVLU9EoPUG2mSNPxCbNLmiv5m0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619786566507507.58394132918136; Fri, 30 Apr 2021 05:42:46 -0700 (PDT) Received: from localhost ([::1]:49242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSTl-0002Mk-EV for importer@patchew.org; Fri, 30 Apr 2021 08:42:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRP-0000IZ-JJ for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39745) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRC-0001Ft-Gp for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:12 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-420-pcaXCV3GOBaIA9TxC77v_A-1; Fri, 30 Apr 2021 07:35:59 -0400 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 C36E21020C25; Fri, 30 Apr 2021 11:35:58 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C314C1007624; Fri, 30 Apr 2021 11:35:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 203E21800604; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=duCwyNlglNcqemTVpMO0z8NLXL7nnvuZpAoGomh3gjc=; b=didEGFFlRdmxvA+QsXWx56petTNxfOCKKJD575doK8j72o/Uzwcbc7TdI5b5ZQN13k9+do 1Lj9plBnjxmz8B90sw6c7b127y5XGZWuTfgyr3dIBz1FLy9yTtyNTeoiBMcCO2L3asP8w4 Mu1mNzYAoL1hdF8z0TxsKhfzZvvMBD4= X-MC-Unique: pcaXCV3GOBaIA9TxC77v_A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 01/16] virtio-gpu: rename virgl source file. Date: Fri, 30 Apr 2021 13:35:32 +0200 Message-Id: <20210430113547.1816178-2-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" "3d" -> "virgl" as 3d is a rather broad term. Hopefully a bit less confusing. Signed-off-by: Gerd Hoffmann --- hw/display/{virtio-gpu-3d.c =3D> virtio-gpu-virgl.c} | 0 hw/display/meson.build | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename hw/display/{virtio-gpu-3d.c =3D> virtio-gpu-virgl.c} (100%) diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-virgl.c similarity index 100% rename from hw/display/virtio-gpu-3d.c rename to hw/display/virtio-gpu-virgl.c diff --git a/hw/display/meson.build b/hw/display/meson.build index 9d79e3951d9e..8e465731b85b 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -58,7 +58,7 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU') virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU', if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), = pixman, virgl]) virtio_gpu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRGL'], - if_true: [files('virtio-gpu-3d.c'), pixman, virgl]) + if_true: [files('virtio-gpu-virgl.c'), pixman, virgl]) virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-u= ser-gpu.c')) hw_display_modules +=3D {'virtio-gpu': virtio_gpu_ss} endif --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619786742; cv=none; d=zohomail.com; s=zohoarc; b=WgODmQ291bKHHiMpbgG1jT8bzGqRL2DYHI9bfukz9BaSRDWpAY/4L6lTr77YXc2WHz2m0GoOaRnXwI05pTIg2iznfngzTlVdNxGDhZxclaj1/WAD6s1zM9jF6Mm/HyG3lnnrGMRRDj8VunoBKDwe8s1xE2/2xkzJdcBHyQotqm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619786742; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eRrQ9PXTe3QSzjJLsOEEW6blX494e5u6D6yK7OfmH8k=; b=evzEEg6yqpDwID4C6pUn6PJp+4eDGvGG4XP5vwCjvpRgum4SFsIMcNVxnhstpnBvj0PfSybW9COZ6oBbM85gxzterZ9iksWqQslPGmPdp7P7/SP6LCMqt4gTemnSGD1hCXawkMHuAnWOh1EQVC7tH0iErBG6yFk93igcYbuzVIU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619786742181241.95563585828074; Fri, 30 Apr 2021 05:45:42 -0700 (PDT) Received: from localhost ([::1]:57990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSWa-0005tx-U3 for importer@patchew.org; Fri, 30 Apr 2021 08:45:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRQ-0000Jd-VL for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20218) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRM-0001Hn-JL for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:16 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-423-4v1-Bgy5OmKgx_mjSb3k5g-1; Fri, 30 Apr 2021 07:36:08 -0400 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 2ADC4107ACF2; Fri, 30 Apr 2021 11:36:07 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3FDAD5D9D7; Fri, 30 Apr 2021 11:36:00 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3213F1800606; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eRrQ9PXTe3QSzjJLsOEEW6blX494e5u6D6yK7OfmH8k=; b=JP4+4kt7ToCgL/UPREiIE9x1J9MNDRONcSLeiDcnXo3Fif20JykQ1y86NIquOmSE6m+eBT 8mE8mxvibX7CKxAs4dd1YBPfHXbhEqFPB0wyIUZmAQN2hkDhCzacHQlWXaLbfLe6rd2IGv qYub4c0zzDXxbRP5SbggvzJFb7hhH8U= X-MC-Unique: 4v1-Bgy5OmKgx_mjSb3k5g-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 02/16] virtio-gpu: add virtio-gpu-gl-device Date: Fri, 30 Apr 2021 13:35:33 +0200 Message-Id: <20210430113547.1816178-3-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Just a skeleton for starters, following patches will add more code. Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-gpu.h | 7 ++++++ hw/display/virtio-gpu-gl.c | 41 ++++++++++++++++++++++++++++++++++ util/module.c | 1 + hw/display/meson.build | 2 +- 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 hw/display/virtio-gpu-gl.c diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index fae149235c58..8ee6b8fe0fb8 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -31,6 +31,9 @@ OBJECT_DECLARE_TYPE(VirtIOGPUBase, VirtIOGPUBaseClass, #define TYPE_VIRTIO_GPU "virtio-gpu-device" OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPU, VIRTIO_GPU) =20 +#define TYPE_VIRTIO_GPU_GL "virtio-gpu-gl-device" +OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPUGL, VIRTIO_GPU_GL) + #define TYPE_VHOST_USER_GPU "vhost-user-gpu" OBJECT_DECLARE_SIMPLE_TYPE(VhostUserGPU, VHOST_USER_GPU) =20 @@ -163,6 +166,10 @@ struct VirtIOGPU { } stats; }; =20 +struct VirtIOGPUGL { + struct VirtIOGPU parent_obj; +}; + struct VhostUserGPU { VirtIOGPUBase parent_obj; =20 diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c new file mode 100644 index 000000000000..a477cbe186d3 --- /dev/null +++ b/hw/display/virtio-gpu-gl.c @@ -0,0 +1,41 @@ +/* + * Virtio GPU Device + * + * Copyright Red Hat, Inc. 2013-2014 + * + * Authors: + * Dave Airlie + * Gerd Hoffmann + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu/iov.h" +#include "qemu/module.h" +#include "qemu/error-report.h" +#include "qapi/error.h" +#include "hw/virtio/virtio.h" +#include "hw/virtio/virtio-gpu.h" +#include "hw/virtio/virtio-gpu-bswap.h" +#include "hw/virtio/virtio-gpu-pixman.h" +#include "hw/qdev-properties.h" + +static void virtio_gpu_gl_class_init(ObjectClass *klass, void *data) +{ +} + +static const TypeInfo virtio_gpu_gl_info =3D { + .name =3D TYPE_VIRTIO_GPU_GL, + .parent =3D TYPE_VIRTIO_GPU, + .instance_size =3D sizeof(VirtIOGPUGL), + .class_init =3D virtio_gpu_gl_class_init, +}; + +static void virtio_register_types(void) +{ + type_register_static(&virtio_gpu_gl_info); +} + +type_init(virtio_register_types) diff --git a/util/module.c b/util/module.c index 7661d0f6234d..47bba1182841 100644 --- a/util/module.c +++ b/util/module.c @@ -301,6 +301,7 @@ static struct { { "qxl-vga", "hw-", "display-qxl" }, { "qxl", "hw-", "display-qxl" }, { "virtio-gpu-device", "hw-", "display-virtio-gpu" }, + { "virtio-gpu-gl-device", "hw-", "display-virtio-gpu" }, { "vhost-user-gpu", "hw-", "display-virtio-gpu" }, { "virtio-gpu-pci-base", "hw-", "display-virtio-gpu-pci" }, { "virtio-gpu-pci", "hw-", "display-virtio-gpu-pci" }, diff --git a/hw/display/meson.build b/hw/display/meson.build index 8e465731b85b..5161efa08a6e 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -58,7 +58,7 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU') virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU', if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), = pixman, virgl]) virtio_gpu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRGL'], - if_true: [files('virtio-gpu-virgl.c'), pixman, virgl]) + if_true: [files('virtio-gpu-gl.c', 'virtio-gpu-virgl.c= '), pixman, virgl]) virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-u= ser-gpu.c')) hw_display_modules +=3D {'virtio-gpu': virtio_gpu_ss} endif --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619786896; cv=none; d=zohomail.com; s=zohoarc; b=XH9Zuso9DMoi1PAAY1+OnGRXCNyZIuk7e2H7ayenu3hzPY85YN77XMC2UVUgiT+uf6oAX1ZmaXXaxns8yXZbAX0W839wZsVE7tFhmMsYvrCr7A30E7Hrk0B22LRtiT5EoqF4UF3BOEf7ouKrLfAdMVk7l3g3p+NyjIYiMH5dRgY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619786896; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=W5msPHfDPE8ZjYfXa0hRMK1hPCL03sJxjOy2f0Kvi2Q=; b=chOJvJi9VtngSbXHtx7XIGxRMvOhF3YBFVKKJk48XJoFOIeOtYSuAunXFrbMMtUAvQi9i84Vv2WMRKQhnDMDLAQupC6JgiUQW3kuh19AEwOxINCBhDZen46znYSNrDZWVNboHLAwsZ8wYv4FxgafqOtT45udvczDoPpac0T9NbE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619786896353310.45459731541587; Fri, 30 Apr 2021 05:48:16 -0700 (PDT) Received: from localhost ([::1]:38464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSZ5-000178-9Q for importer@patchew.org; Fri, 30 Apr 2021 08:48:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRT-0000Lr-3Z for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30852) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRM-0001Ht-Sd for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:18 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-447-Ld4iRcisOUqp78QSP8O6zQ-1; Fri, 30 Apr 2021 07:36:08 -0400 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 A371E9196A8; Fri, 30 Apr 2021 11:36:07 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47E7B2B0A0; Fri, 30 Apr 2021 11:36:00 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 41A01180060B; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W5msPHfDPE8ZjYfXa0hRMK1hPCL03sJxjOy2f0Kvi2Q=; b=AOlbeO9AjbE99pV6MH0OY5ENmz0oQEZenW9MgZoJK85P/yMJcnAw4c1Yhdte87KnGWNkIP GE+T38VlP6lrG4NBMqhmO77h5A4PEG4+Oe1LqoPd9lzcEmKsaMmDtrpcH9rfcpg7PMoNp4 RkFBHjCozcFrh46PNQMnvFXuMVmIRrE= X-MC-Unique: Ld4iRcisOUqp78QSP8O6zQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 03/16] virtio-gpu: move virgl realize + properties Date: Fri, 30 Apr 2021 13:35:34 +0200 Message-Id: <20210430113547.1816178-4-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Move device init (realize) and properties. Drop the virgl property, the virtio-gpu-gl-device has virgl enabled no matter what. Just use virtio-gpu-device instead if you don't want enable virgl and opengl. This simplifies the logic and reduces the test matrix. Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu-gl.c | 33 +++++++++++++++++++++++++++++++++ hw/display/virtio-gpu.c | 23 +---------------------- 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 8ee6b8fe0fb8..4c1a8faebec9 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -220,6 +220,7 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g, void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g, struct iovec *iov, uint32_t count); void virtio_gpu_process_cmdq(VirtIOGPU *g); +void virtio_gpu_device_realize(DeviceState *qdev, Error **errp); =20 /* virtio-gpu-3d.c */ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index a477cbe186d3..9b7b5f00d7e6 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -16,14 +16,47 @@ #include "qemu/module.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "sysemu/sysemu.h" #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-gpu-bswap.h" #include "hw/virtio/virtio-gpu-pixman.h" #include "hw/qdev-properties.h" =20 +static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp) +{ + VirtIOGPU *g =3D VIRTIO_GPU(qdev); + +#if defined(HOST_WORDS_BIGENDIAN) + error_setg(errp, "virgl is not supported on bigendian platforms"); + return; +#endif + + if (!display_opengl) { + error_setg(errp, "opengl is not available"); + return; + } + + g->parent_obj.conf.flags |=3D (1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED); + VIRTIO_GPU_BASE(g)->virtio_config.num_capsets =3D + virtio_gpu_virgl_get_num_capsets(g); + + virtio_gpu_device_realize(qdev, errp); +} + +static Property virtio_gpu_gl_properties[] =3D { + DEFINE_PROP_BIT("stats", VirtIOGPU, parent_obj.conf.flags, + VIRTIO_GPU_FLAG_STATS_ENABLED, false), + DEFINE_PROP_END_OF_LIST(), +}; + static void virtio_gpu_gl_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc =3D DEVICE_CLASS(klass); + VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + + vdc->realize =3D virtio_gpu_gl_device_realize; + device_class_set_props(dc, virtio_gpu_gl_properties); } =20 static const TypeInfo virtio_gpu_gl_info =3D { diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index c9f5e36fd076..2ee6ba756aba 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1105,25 +1105,10 @@ static int virtio_gpu_load(QEMUFile *f, void *opaqu= e, size_t size, return 0; } =20 -static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp) +void virtio_gpu_device_realize(DeviceState *qdev, Error **errp) { VirtIODevice *vdev =3D VIRTIO_DEVICE(qdev); VirtIOGPU *g =3D VIRTIO_GPU(qdev); - bool have_virgl; - -#if !defined(CONFIG_VIRGL) || defined(HOST_WORDS_BIGENDIAN) - have_virgl =3D false; -#else - have_virgl =3D display_opengl; -#endif - if (!have_virgl) { - g->parent_obj.conf.flags &=3D ~(1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED= ); - } else { -#if defined(CONFIG_VIRGL) - VIRTIO_GPU_BASE(g)->virtio_config.num_capsets =3D - virtio_gpu_virgl_get_num_capsets(g); -#endif - } =20 if (!virtio_gpu_base_device_realize(qdev, virtio_gpu_handle_ctrl_cb, @@ -1235,12 +1220,6 @@ static Property virtio_gpu_properties[] =3D { VIRTIO_GPU_BASE_PROPERTIES(VirtIOGPU, parent_obj.conf), DEFINE_PROP_SIZE("max_hostmem", VirtIOGPU, conf_max_hostmem, 256 * MiB), -#ifdef CONFIG_VIRGL - DEFINE_PROP_BIT("virgl", VirtIOGPU, parent_obj.conf.flags, - VIRTIO_GPU_FLAG_VIRGL_ENABLED, true), - DEFINE_PROP_BIT("stats", VirtIOGPU, parent_obj.conf.flags, - VIRTIO_GPU_FLAG_STATS_ENABLED, false), -#endif DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619785757; cv=none; d=zohomail.com; s=zohoarc; b=BP9WfsVw64lMw14vUPIOLPfEb9O/qu7SXXI5Qy6tE7hsjh70bHwLk6/fgd93X3Q3FNlWCbtspKwMLGs3RWvQrl+MSxnzTjkdbquooTxLGegv2Dag1qOTQ0cdv0xRkCV6MCZFQmid9i4EnCLxiZ9VOYqTWaSpab58OSS8WCY2J34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619785757; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vOvyha5542i4mdxbIN7WTp4XctpbTj5g8szd3EOgRX4=; b=ey0gFHB2zo39wP54pwEnakSpI3GmyFzY9G3TVdj63ZOdFRGlJetjITFE8EPIAw4gYJftX6b1QEGvlyIlOL5iJ5pB64jeeWCWuWgj2q4C2X6jY2xTuVq7P5c7MF2VIXOY6yExBRoJXrUpkUvJ5zBVm/Jwiq0abilNzwLLRTUm+BI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619785757457995.153573326417; Fri, 30 Apr 2021 05:29:17 -0700 (PDT) Received: from localhost ([::1]:50014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSGi-0007aq-BQ for importer@patchew.org; Fri, 30 Apr 2021 08:29:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRf-0000er-Nw for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42053) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRb-0001Pi-4l for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:31 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-543-UnmTvodYO2GTulgU2yRtWg-1; Fri, 30 Apr 2021 07:36:23 -0400 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 A43139196A5; Fri, 30 Apr 2021 11:36:22 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD4BA63BA7; Fri, 30 Apr 2021 11:36:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 51110180060D; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vOvyha5542i4mdxbIN7WTp4XctpbTj5g8szd3EOgRX4=; b=UFv+Pvc6lhFcQFa8GpY19y8lCgHxjIuUdjA0T11CT9LJer4GeCBaFIq3Tv3cE0Qh3FnebF E8bCD0rzgmC7w01RSwb82EE73RuO5nrYqFj2RPBZtAHfpkqx5ZymLFsOKd02AIZ9lTe8AZ /lLTrUghHx0d9zPje1GBIhfr14EfXik= X-MC-Unique: UnmTvodYO2GTulgU2yRtWg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 04/16] virtio-gpu: move virgl reset Date: Fri, 30 Apr 2021 13:35:35 +0200 Message-Id: <20210430113547.1816178-5-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu-gl.c | 17 +++++++++++++++++ hw/display/virtio-gpu.c | 19 +------------------ 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 4c1a8faebec9..a7b7d78310ea 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -221,6 +221,7 @@ void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g, struct iovec *iov, uint32_t count); void virtio_gpu_process_cmdq(VirtIOGPU *g); void virtio_gpu_device_realize(DeviceState *qdev, Error **errp); +void virtio_gpu_reset(VirtIODevice *vdev); =20 /* virtio-gpu-3d.c */ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 9b7b5f00d7e6..c3e562f835f7 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -23,6 +23,22 @@ #include "hw/virtio/virtio-gpu-pixman.h" #include "hw/qdev-properties.h" =20 +static void virtio_gpu_gl_reset(VirtIODevice *vdev) +{ + VirtIOGPU *g =3D VIRTIO_GPU(vdev); + + virtio_gpu_reset(vdev); + + if (g->parent_obj.use_virgl_renderer) { + if (g->parent_obj.renderer_blocked) { + g->renderer_reset =3D true; + } else { + virtio_gpu_virgl_reset(g); + } + g->parent_obj.use_virgl_renderer =3D false; + } +} + static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp) { VirtIOGPU *g =3D VIRTIO_GPU(qdev); @@ -56,6 +72,7 @@ static void virtio_gpu_gl_class_init(ObjectClass *klass, = void *data) VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); =20 vdc->realize =3D virtio_gpu_gl_device_realize; + vdc->reset =3D virtio_gpu_gl_reset; device_class_set_props(dc, virtio_gpu_gl_properties); } =20 diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 2ee6ba756aba..68286f75a01a 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1126,18 +1126,12 @@ void virtio_gpu_device_realize(DeviceState *qdev, E= rror **errp) QTAILQ_INIT(&g->fenceq); } =20 -static void virtio_gpu_reset(VirtIODevice *vdev) +void virtio_gpu_reset(VirtIODevice *vdev) { VirtIOGPU *g =3D VIRTIO_GPU(vdev); struct virtio_gpu_simple_resource *res, *tmp; struct virtio_gpu_ctrl_command *cmd; =20 -#ifdef CONFIG_VIRGL - if (g->parent_obj.use_virgl_renderer) { - virtio_gpu_virgl_reset(g); - } -#endif - QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) { virtio_gpu_resource_destroy(g, res); } @@ -1155,17 +1149,6 @@ static void virtio_gpu_reset(VirtIODevice *vdev) g_free(cmd); } =20 -#ifdef CONFIG_VIRGL - if (g->parent_obj.use_virgl_renderer) { - if (g->parent_obj.renderer_blocked) { - g->renderer_reset =3D true; - } else { - virtio_gpu_virgl_reset(g); - } - g->parent_obj.use_virgl_renderer =3D false; - } -#endif - virtio_gpu_base_reset(VIRTIO_GPU_BASE(vdev)); } =20 --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619787062; cv=none; d=zohomail.com; s=zohoarc; b=QwnrKJPIelVOyVJ2LqnfmnhOIgQk+zWXZCAJVyJWDC7Sal3vh/UFwOgX7q5/D7wPWLziVF5hPOwinkG92Ut4G8NPcqxTAEMlnDODMcEG8JL369MWkaQSt6GFSBPV2Ri7tqxHjM0sygiMOsXb4x+Bu5SY7xtGUr02uYmqxp7P95E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619787062; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VuFpGqKJ7y13aOr+sF6JhBiOaHNOzSXfGJS+bPt23so=; b=RfiY57TXBRJLlRPHyS3itVweszlJocsv7ExMRCzVpK22t42MLgLl0aZuD5o7Etdt1BY4PBMP9xjfgVTZ48AnR4ZMY1KHBdFZBJ0GpjmvcwJOMz5n1s5Ao2uv8FleV2IATZQuO6F+t8V422hRCMRsYWl0+KwEOC/j0rDemBE8Trs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619787061839989.8217725186666; Fri, 30 Apr 2021 05:51:01 -0700 (PDT) Received: from localhost ([::1]:46830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSbj-0004h5-FL for importer@patchew.org; Fri, 30 Apr 2021 08:50:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRV-0000SZ-Dp for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRT-0001L9-JO for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:21 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-502-caGbIhWYM_ebGw3HygJA_g-1; Fri, 30 Apr 2021 07:36:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 45227501F3; Fri, 30 Apr 2021 11:36:16 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 267517013C; Fri, 30 Apr 2021 11:36:09 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5E2911800612; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VuFpGqKJ7y13aOr+sF6JhBiOaHNOzSXfGJS+bPt23so=; b=LKniDc1WpMp3xJkL/UrJ/N3uvbJa/Ygdd4oJZ2jyfkWeC7/+vqJzI/R2iJOa6OVuCce6pz t+KLbcpBN3eWfWrdx9knoFZYuR34gwpkoOlBYH6D23vqwEJUiQxKWmvyNwZaheqLFelKab iZnZtW/nQ5MYqgDSGQ+3P50rllMWRno= X-MC-Unique: caGbIhWYM_ebGw3HygJA_g-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 05/16] virtio-gpu: use class function for ctrl queue handlers Date: Fri, 30 Apr 2021 13:35:36 +0200 Message-Id: <20210430113547.1816178-6-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-gpu.h | 8 +++++++- hw/display/virtio-gpu.c | 12 +++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index a7b7d78310ea..380aa7dd6322 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -29,7 +29,7 @@ OBJECT_DECLARE_TYPE(VirtIOGPUBase, VirtIOGPUBaseClass, VIRTIO_GPU_BASE) =20 #define TYPE_VIRTIO_GPU "virtio-gpu-device" -OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPU, VIRTIO_GPU) +OBJECT_DECLARE_TYPE(VirtIOGPU, VirtIOGPUClass, VIRTIO_GPU) =20 #define TYPE_VIRTIO_GPU_GL "virtio-gpu-gl-device" OBJECT_DECLARE_SIMPLE_TYPE(VirtIOGPUGL, VIRTIO_GPU_GL) @@ -166,6 +166,12 @@ struct VirtIOGPU { } stats; }; =20 +struct VirtIOGPUClass { + VirtIOGPUBaseClass parent; + + void (*handle_ctrl)(VirtIODevice *vdev, VirtQueue *vq); +}; + struct VirtIOGPUGL { struct VirtIOGPU parent_obj; }; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 68286f75a01a..39ef22b7c08d 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -893,7 +893,9 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, = VirtQueue *vq) static void virtio_gpu_ctrl_bh(void *opaque) { VirtIOGPU *g =3D opaque; - virtio_gpu_handle_ctrl(&g->parent_obj.parent_obj, g->ctrl_vq); + VirtIOGPUClass *vgc =3D VIRTIO_GPU_GET_CLASS(g); + + vgc->handle_ctrl(&g->parent_obj.parent_obj, g->ctrl_vq); } =20 static void virtio_gpu_handle_cursor(VirtIODevice *vdev, VirtQueue *vq) @@ -1210,9 +1212,12 @@ static void virtio_gpu_class_init(ObjectClass *klass= , void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); - VirtIOGPUBaseClass *vgc =3D VIRTIO_GPU_BASE_CLASS(klass); + VirtIOGPUBaseClass *vbc =3D VIRTIO_GPU_BASE_CLASS(klass); + VirtIOGPUClass *vgc =3D VIRTIO_GPU_CLASS(klass); + + vbc->gl_flushed =3D virtio_gpu_gl_flushed; + vgc->handle_ctrl =3D virtio_gpu_handle_ctrl; =20 - vgc->gl_flushed =3D virtio_gpu_gl_flushed; vdc->realize =3D virtio_gpu_device_realize; vdc->reset =3D virtio_gpu_reset; vdc->get_config =3D virtio_gpu_get_config; @@ -1226,6 +1231,7 @@ static const TypeInfo virtio_gpu_info =3D { .name =3D TYPE_VIRTIO_GPU, .parent =3D TYPE_VIRTIO_GPU_BASE, .instance_size =3D sizeof(VirtIOGPU), + .class_size =3D sizeof(VirtIOGPUClass), .class_init =3D virtio_gpu_class_init, }; =20 --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619787240; cv=none; d=zohomail.com; s=zohoarc; b=TDuOJ/wLdDw/Ft3wtjXGeqOKpKlsRfaBoA0tQCawoTVSwAWlYJVecoRTrbgOa+vWbFnC9zF2qyKOivGcqKCa+SxQVlfw2pCWs4z3XBp4IJCKjZUynW2u/Disys0F6ssDfwBvRSRcf/LLP9tvIfB3wBRZZVkZFsHvX7WMa9+on+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619787240; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zN5UnJ+pYx/PpNMhGlBA6xMrw9ZYFiFztsTIti1deVI=; b=iJlCav1WRprv4QOD2HcE0pbNURn54CpnwPBo4KdF/NA/zFOfkVffRg+x5rqiSk2VvXK542BdzkbL6URUfTecVIZOY/jQ7FJkzKstSFu0z+GKDh5FxHOTWjTyvRcArjcSojPYlbDYAtXOFpYQAZRtsvb37Wq1sQaKFapyIVt+Lbg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619787240506997.5728293296944; Fri, 30 Apr 2021 05:54:00 -0700 (PDT) Received: from localhost ([::1]:55172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSed-0008Bz-Eg for importer@patchew.org; Fri, 30 Apr 2021 08:53:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRc-0000by-TU for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41957) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRb-0001PI-28 for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-G6PucNCUNVS7nU9BD6FZgg-1; Fri, 30 Apr 2021 07:36:20 -0400 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 42F271922965; Fri, 30 Apr 2021 11:36:19 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3D576E71D; Fri, 30 Apr 2021 11:36:17 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6B97D180078D; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zN5UnJ+pYx/PpNMhGlBA6xMrw9ZYFiFztsTIti1deVI=; b=eMLSsKvWdQ+iKYgw2l5+a73tStPXZvRGYPOngm66MMY/b8US4Grrtp0yselug3uhwegUoH /tYQrPzAFjiKz1bV43NdS+CPmEBRVLdjk8xVsG2y8j6xY3KS5oerHI7v9MMsUrak+sRJ8r 0u6hXkbenvYBIwKALQ+D2fT1zL+GUjs= X-MC-Unique: G6PucNCUNVS7nU9BD6FZgg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 06/16] virtio-gpu: move virgl handle_ctrl Date: Fri, 30 Apr 2021 13:35:37 +0200 Message-Id: <20210430113547.1816178-7-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu-gl.c | 33 +++++++++++++++++++++++++++++++++ hw/display/virtio-gpu.c | 13 ------------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index c3e562f835f7..6d0ce5bcd6f1 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -23,6 +23,36 @@ #include "hw/virtio/virtio-gpu-pixman.h" #include "hw/qdev-properties.h" =20 +static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) +{ + VirtIOGPU *g =3D VIRTIO_GPU(vdev); + struct virtio_gpu_ctrl_command *cmd; + + if (!virtio_queue_ready(vq)) { + return; + } + + if (!g->renderer_inited && g->parent_obj.use_virgl_renderer) { + virtio_gpu_virgl_init(g); + g->renderer_inited =3D true; + } + + cmd =3D virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command)); + while (cmd) { + cmd->vq =3D vq; + cmd->error =3D 0; + cmd->finished =3D false; + QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next); + cmd =3D virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command)); + } + + virtio_gpu_process_cmdq(g); + + if (g->parent_obj.use_virgl_renderer) { + virtio_gpu_virgl_fence_poll(g); + } +} + static void virtio_gpu_gl_reset(VirtIODevice *vdev) { VirtIOGPU *g =3D VIRTIO_GPU(vdev); @@ -70,6 +100,9 @@ static void virtio_gpu_gl_class_init(ObjectClass *klass,= void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + VirtIOGPUClass *vgc =3D VIRTIO_GPU_CLASS(klass); + + vgc->handle_ctrl =3D virtio_gpu_gl_handle_ctrl; =20 vdc->realize =3D virtio_gpu_gl_device_realize; vdc->reset =3D virtio_gpu_gl_reset; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 39ef22b7c08d..5901e09bcd81 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -865,13 +865,6 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev,= VirtQueue *vq) return; } =20 -#ifdef CONFIG_VIRGL - if (!g->renderer_inited && g->parent_obj.use_virgl_renderer) { - virtio_gpu_virgl_init(g); - g->renderer_inited =3D true; - } -#endif - cmd =3D virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command)); while (cmd) { cmd->vq =3D vq; @@ -882,12 +875,6 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev,= VirtQueue *vq) } =20 virtio_gpu_process_cmdq(g); - -#ifdef CONFIG_VIRGL - if (g->parent_obj.use_virgl_renderer) { - virtio_gpu_virgl_fence_poll(g); - } -#endif } =20 static void virtio_gpu_ctrl_bh(void *opaque) --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619785703; cv=none; d=zohomail.com; s=zohoarc; b=aDklQDczQxWOdeVgxMsCfTZc4KWnksyekbV+usfhvNlOPC7smueGbf8GVFu3Rtiq/dQ0k0XJxEXgruTVDUJsP9aQsW0N3d1HVI3HvLAsqBPZduJOeYcDpsw/1aIBUevyzyjH0/uH7nqAnQZCSYaJYWS8TBiiYITc4y2o76jfsIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619785703; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=byEmvQrMpP/CdT9jGgCkT76amTfNmYOr0AitR0MffkY=; b=RzlyKaN98XgZxwqKLhIPyF2CXJx5ezbc1GiMEbTXg9ZGuAj+KcOkwB6XWF23sbYa2DANmgtXoW9OHJCA4BrpMvPOMg8DDWNbVah941ScBHDQ7sMc4YHEJkmXdaaa5oog9U6O8JcqOn0EqtVoWMIt9HS8i8aJrj454nc0AoEUpts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619785703218731.9461600215875; Fri, 30 Apr 2021 05:28:23 -0700 (PDT) Received: from localhost ([::1]:47176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSFq-0006R3-8c for importer@patchew.org; Fri, 30 Apr 2021 08:28:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRj-0000gO-7b for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43389) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRf-0001VB-FF for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:34 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-19-aTs2OTMFMZKolHLDTCLLkg-1; Fri, 30 Apr 2021 07:36:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 091E81922964; Fri, 30 Apr 2021 11:36:28 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0EDCB5D719; Fri, 30 Apr 2021 11:36:21 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 78D8E1800792; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782590; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=byEmvQrMpP/CdT9jGgCkT76amTfNmYOr0AitR0MffkY=; b=Ox7mOQ+q3pK0gzsk4XigvSePRjI14MJq6KnpQ/X9EY+E/te13NqHI1GRhOE76M0h6ew/+C YzyJnbqiPIHMOneLqbdQHWA8qUB3CyLlhxy6e4AcLmPLcqIN2fvSZ8ieGzumajWI88AQe3 EQEOW+rnVpAi2YFhcU2uZfgZb4KY8Js= X-MC-Unique: aTs2OTMFMZKolHLDTCLLkg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 07/16] virtio-gpu: move virgl gl_flushed Date: Fri, 30 Apr 2021 13:35:38 +0200 Message-Id: <20210430113547.1816178-8-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu-gl.c | 13 +++++++++++++ hw/display/virtio-gpu.c | 15 --------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 6d0ce5bcd6f1..e976fb8d04c4 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -23,6 +23,17 @@ #include "hw/virtio/virtio-gpu-pixman.h" #include "hw/qdev-properties.h" =20 +static void virtio_gpu_gl_flushed(VirtIOGPUBase *b) +{ + VirtIOGPU *g =3D VIRTIO_GPU(b); + + if (g->renderer_reset) { + g->renderer_reset =3D false; + virtio_gpu_virgl_reset(g); + } + virtio_gpu_process_cmdq(g); +} + static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIOGPU *g =3D VIRTIO_GPU(vdev); @@ -100,8 +111,10 @@ static void virtio_gpu_gl_class_init(ObjectClass *klas= s, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); + VirtIOGPUBaseClass *vbc =3D VIRTIO_GPU_BASE_CLASS(klass); VirtIOGPUClass *vgc =3D VIRTIO_GPU_CLASS(klass); =20 + vbc->gl_flushed =3D virtio_gpu_gl_flushed; vgc->handle_ctrl =3D virtio_gpu_gl_handle_ctrl; =20 vdc->realize =3D virtio_gpu_gl_device_realize; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 5901e09bcd81..ae80519c7356 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -843,19 +843,6 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g) g->processing_cmdq =3D false; } =20 -static void virtio_gpu_gl_flushed(VirtIOGPUBase *b) -{ - VirtIOGPU *g =3D VIRTIO_GPU(b); - -#ifdef CONFIG_VIRGL - if (g->renderer_reset) { - g->renderer_reset =3D false; - virtio_gpu_virgl_reset(g); - } -#endif - virtio_gpu_process_cmdq(g); -} - static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIOGPU *g =3D VIRTIO_GPU(vdev); @@ -1199,10 +1186,8 @@ static void virtio_gpu_class_init(ObjectClass *klass= , void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); - VirtIOGPUBaseClass *vbc =3D VIRTIO_GPU_BASE_CLASS(klass); VirtIOGPUClass *vgc =3D VIRTIO_GPU_CLASS(klass); =20 - vbc->gl_flushed =3D virtio_gpu_gl_flushed; vgc->handle_ctrl =3D virtio_gpu_handle_ctrl; =20 vdc->realize =3D virtio_gpu_device_realize; --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619787372; cv=none; d=zohomail.com; s=zohoarc; b=Sjbv5qOUy4/fpQ10z+EFnmKLwEyLDYfHLHwQqk9GOymD6DIhb8AMF5sVBFLS09WsYik7Jna7EBK1Etn6vTU3qYHApZpntuiSG6lhaimHS10oObe5aXafO/YgQwOOpmBGRPfwgoQO3XUWC3QgarZ9KLn+nfGLDfzw1+RgTreWFKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619787372; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=flG4vCcohiYPuPddxsmca0eoSsF3ZLP6wMrnLYWqORw=; b=HAIlfSKpwGxs5j2fSo7/K56RVYk+1jWUrLpiq7yYAfYBHO2h+YOdJelbMtrxQqrafMRRYCgAkBw4v3ZukWph46L5UKVg6VuRFfGM/kiyZAdNi991pn9+uw4fjQq12aGzGLPk235CW5i4l/rEb+NEtQnArTECzQN9o15g3ei8SKQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619787372973990.8258942392739; Fri, 30 Apr 2021 05:56:12 -0700 (PDT) Received: from localhost ([::1]:35394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSgl-0003Ii-Nu for importer@patchew.org; Fri, 30 Apr 2021 08:56:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRr-0000j9-0l for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37733) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRh-0001VR-Al for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:42 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-203-566G8KtmObm4Vvjsd-tdxA-1; Fri, 30 Apr 2021 07:36:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 11853501F8; Fri, 30 Apr 2021 11:36:28 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ACFDA5B684; Fri, 30 Apr 2021 11:36:24 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 87BCD1800794; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=flG4vCcohiYPuPddxsmca0eoSsF3ZLP6wMrnLYWqORw=; b=eh4jPtjqYz5N+F01Xihl7dOc//VRXIg5j7KqzouLH1mFEGxK+sZDYPlCvgDVsND705lNGB 0gXTCTDkw3N7BXPv1bJW8tdMnLmL+DSaQu5bHqG/tSf3ZSxLabT0RLmFudezvsXH5ViHMm 8TSQjxBXKpQqckCOYm7oitZY/uRbmIk= X-MC-Unique: 566G8KtmObm4Vvjsd-tdxA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 08/16] virtio-gpu: move virgl process_cmd Date: Fri, 30 Apr 2021 13:35:39 +0200 Message-Id: <20210430113547.1816178-9-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-gpu.h | 2 ++ hw/display/virtio-gpu-gl.c | 11 +++++++++++ hw/display/virtio-gpu.c | 9 +++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 380aa7dd6322..4ce39d2abb4c 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -170,6 +170,7 @@ struct VirtIOGPUClass { VirtIOGPUBaseClass parent; =20 void (*handle_ctrl)(VirtIODevice *vdev, VirtQueue *vq); + void (*process_cmd)(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd); }; =20 struct VirtIOGPUGL { @@ -228,6 +229,7 @@ void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g, void virtio_gpu_process_cmdq(VirtIOGPU *g); void virtio_gpu_device_realize(DeviceState *qdev, Error **errp); void virtio_gpu_reset(VirtIODevice *vdev); +void virtio_gpu_simple_process_cmd(VirtIOGPU *g, struct virtio_gpu_ctrl_co= mmand *cmd); =20 /* virtio-gpu-3d.c */ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index e976fb8d04c4..792cc0b41256 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -23,6 +23,16 @@ #include "hw/virtio/virtio-gpu-pixman.h" #include "hw/qdev-properties.h" =20 +static void virtio_gpu_gl_process_cmd(VirtIOGPU *g, + struct virtio_gpu_ctrl_command *cmd) +{ + if (g->parent_obj.use_virgl_renderer) { + virtio_gpu_virgl_process_cmd(g, cmd); + return; + } + virtio_gpu_simple_process_cmd(g, cmd); +} + static void virtio_gpu_gl_flushed(VirtIOGPUBase *b) { VirtIOGPU *g =3D VIRTIO_GPU(b); @@ -116,6 +126,7 @@ static void virtio_gpu_gl_class_init(ObjectClass *klass= , void *data) =20 vbc->gl_flushed =3D virtio_gpu_gl_flushed; vgc->handle_ctrl =3D virtio_gpu_gl_handle_ctrl; + vgc->process_cmd =3D virtio_gpu_gl_process_cmd; =20 vdc->realize =3D virtio_gpu_gl_device_realize; vdc->reset =3D virtio_gpu_gl_reset; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index ae80519c7356..e61bfffa8019 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -747,8 +747,8 @@ virtio_gpu_resource_detach_backing(VirtIOGPU *g, virtio_gpu_cleanup_mapping(g, res); } =20 -static void virtio_gpu_simple_process_cmd(VirtIOGPU *g, - struct virtio_gpu_ctrl_command *= cmd) +void virtio_gpu_simple_process_cmd(VirtIOGPU *g, + struct virtio_gpu_ctrl_command *cmd) { VIRTIO_GPU_FILL_CMD(cmd->cmd_hdr); virtio_gpu_ctrl_hdr_bswap(&cmd->cmd_hdr); @@ -806,6 +806,7 @@ static void virtio_gpu_handle_cursor_cb(VirtIODevice *v= dev, VirtQueue *vq) void virtio_gpu_process_cmdq(VirtIOGPU *g) { struct virtio_gpu_ctrl_command *cmd; + VirtIOGPUClass *vgc =3D VIRTIO_GPU_GET_CLASS(g); =20 if (g->processing_cmdq) { return; @@ -819,8 +820,7 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g) } =20 /* process command */ - VIRGL(g, virtio_gpu_virgl_process_cmd, virtio_gpu_simple_process_c= md, - g, cmd); + vgc->process_cmd(g, cmd); =20 QTAILQ_REMOVE(&g->cmdq, cmd, next); if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { @@ -1189,6 +1189,7 @@ static void virtio_gpu_class_init(ObjectClass *klass,= void *data) VirtIOGPUClass *vgc =3D VIRTIO_GPU_CLASS(klass); =20 vgc->handle_ctrl =3D virtio_gpu_handle_ctrl; + vgc->process_cmd =3D virtio_gpu_simple_process_cmd; =20 vdc->realize =3D virtio_gpu_device_realize; vdc->reset =3D virtio_gpu_reset; --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619786308; cv=none; d=zohomail.com; s=zohoarc; b=EI65b0zDAv8G+9oidtHFAAxVLeYHayAJrE/hjki2KqyZfwRSQSlHduK/aIueqZj1Dm8ICPZ6vECa/eVd4yjQlN/x2cv8T52Re/T3KqoraXcuXSeVzNWi9DACFMy1ktcmDdgNcaupNTo9JJHSRi9JDqGhVaOrGHk4UuS/7LptHkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619786308; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FxHTD7DL9VIpADnJyPky8JqIRzo8V34WM13UYnNOYsw=; b=DnP6Mb6/wQLu9sL+WfkQycGYiG90xranuKrKED6062mgpztoEBB0S60pPVxFQtPWIE+Z++wsIABSrujIjWdSbALh6x0UdjeAoF4uMDyGJt92HZBlIsCaU3O6seXDqnDT/1afjd35YebUDsF/z9EN32HEgWsk+XyL038p3sKzAak= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619786308680906.7426318741266; Fri, 30 Apr 2021 05:38:28 -0700 (PDT) Received: from localhost ([::1]:37038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSPb-0005gk-Es for importer@patchew.org; Fri, 30 Apr 2021 08:38:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRx-0000qZ-2w for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRq-0001Yb-5r for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-tCmcf0vcPyGajW96C4Gqcw-1; Fri, 30 Apr 2021 07:36:37 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 10CAD80ED96; Fri, 30 Apr 2021 11:36:37 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A400C7013C; Fri, 30 Apr 2021 11:36:29 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 972261800795; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FxHTD7DL9VIpADnJyPky8JqIRzo8V34WM13UYnNOYsw=; b=c7XWgQWZY63AfnPzTWKDjDQe47OVc/0cOOBIPkMpOp84FGG9qW4dwkaWHVghsBqCIhXZb7 HmGdwW3tWo+GDFpth7z3VsCgh/tz5hLZkItUfLkgMLP62y1QlcrS3XxFAms/hhEdG8xYig 40mmrXQmQ2Pnk1oJaHWKF8zowsgBnO0= X-MC-Unique: tCmcf0vcPyGajW96C4Gqcw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 09/16] virtio-gpu: move update_cursor_data Date: Fri, 30 Apr 2021 13:35:40 +0200 Message-Id: <20210430113547.1816178-10-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-gpu.h | 6 ++++++ hw/display/virtio-gpu-gl.c | 30 +++++++++++++++++++++++++++ hw/display/virtio-gpu.c | 38 ++++++---------------------------- 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 4ce39d2abb4c..cd55c2d07090 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -171,6 +171,9 @@ struct VirtIOGPUClass { =20 void (*handle_ctrl)(VirtIODevice *vdev, VirtQueue *vq); void (*process_cmd)(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd); + void (*update_cursor_data)(VirtIOGPU *g, + struct virtio_gpu_scanout *s, + uint32_t resource_id); }; =20 struct VirtIOGPUGL { @@ -230,6 +233,9 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g); void virtio_gpu_device_realize(DeviceState *qdev, Error **errp); void virtio_gpu_reset(VirtIODevice *vdev); void virtio_gpu_simple_process_cmd(VirtIOGPU *g, struct virtio_gpu_ctrl_co= mmand *cmd); +void virtio_gpu_update_cursor_data(VirtIOGPU *g, + struct virtio_gpu_scanout *s, + uint32_t resource_id); =20 /* virtio-gpu-3d.c */ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 792cc0b41256..b4303cc5bb41 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -23,6 +23,35 @@ #include "hw/virtio/virtio-gpu-pixman.h" #include "hw/qdev-properties.h" =20 +#include + +static void virtio_gpu_gl_update_cursor_data(VirtIOGPU *g, + struct virtio_gpu_scanout *s, + uint32_t resource_id) +{ + uint32_t width, height; + uint32_t pixels, *data; + + if (g->parent_obj.use_virgl_renderer) { + data =3D virgl_renderer_get_cursor_data(resource_id, &width, &heig= ht); + if (!data) { + return; + } + + if (width !=3D s->current_cursor->width || + height !=3D s->current_cursor->height) { + free(data); + return; + } + + pixels =3D s->current_cursor->width * s->current_cursor->height; + memcpy(s->current_cursor->data, data, pixels * sizeof(uint32_t)); + free(data); + return; + } + virtio_gpu_update_cursor_data(g, s, resource_id); +} + static void virtio_gpu_gl_process_cmd(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { @@ -127,6 +156,7 @@ static void virtio_gpu_gl_class_init(ObjectClass *klass= , void *data) vbc->gl_flushed =3D virtio_gpu_gl_flushed; vgc->handle_ctrl =3D virtio_gpu_gl_handle_ctrl; vgc->process_cmd =3D virtio_gpu_gl_process_cmd; + vgc->update_cursor_data =3D virtio_gpu_gl_update_cursor_data; =20 vdc->realize =3D virtio_gpu_gl_device_realize; vdc->reset =3D virtio_gpu_gl_reset; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index e61bfffa8019..2c0065277ffd 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -56,9 +56,9 @@ static void virtio_gpu_cleanup_mapping(VirtIOGPU *g, } while (0) #endif =20 -static void update_cursor_data_simple(VirtIOGPU *g, - struct virtio_gpu_scanout *s, - uint32_t resource_id) +void virtio_gpu_update_cursor_data(VirtIOGPU *g, + struct virtio_gpu_scanout *s, + uint32_t resource_id) { struct virtio_gpu_simple_resource *res; uint32_t pixels; @@ -79,36 +79,10 @@ static void update_cursor_data_simple(VirtIOGPU *g, pixels * sizeof(uint32_t)); } =20 -#ifdef CONFIG_VIRGL - -static void update_cursor_data_virgl(VirtIOGPU *g, - struct virtio_gpu_scanout *s, - uint32_t resource_id) -{ - uint32_t width, height; - uint32_t pixels, *data; - - data =3D virgl_renderer_get_cursor_data(resource_id, &width, &height); - if (!data) { - return; - } - - if (width !=3D s->current_cursor->width || - height !=3D s->current_cursor->height) { - free(data); - return; - } - - pixels =3D s->current_cursor->width * s->current_cursor->height; - memcpy(s->current_cursor->data, data, pixels * sizeof(uint32_t)); - free(data); -} - -#endif - static void update_cursor(VirtIOGPU *g, struct virtio_gpu_update_cursor *c= ursor) { struct virtio_gpu_scanout *s; + VirtIOGPUClass *vgc =3D VIRTIO_GPU_GET_CLASS(g); bool move =3D cursor->hdr.type =3D=3D VIRTIO_GPU_CMD_MOVE_CURSOR; =20 if (cursor->pos.scanout_id >=3D g->parent_obj.conf.max_outputs) { @@ -131,8 +105,7 @@ static void update_cursor(VirtIOGPU *g, struct virtio_g= pu_update_cursor *cursor) s->current_cursor->hot_y =3D cursor->hot_y; =20 if (cursor->resource_id > 0) { - VIRGL(g, update_cursor_data_virgl, update_cursor_data_simple, - g, s, cursor->resource_id); + vgc->update_cursor_data(g, s, cursor->resource_id); } dpy_cursor_define(s->con, s->current_cursor); =20 @@ -1190,6 +1163,7 @@ static void virtio_gpu_class_init(ObjectClass *klass,= void *data) =20 vgc->handle_ctrl =3D virtio_gpu_handle_ctrl; vgc->process_cmd =3D virtio_gpu_simple_process_cmd; + vgc->update_cursor_data =3D virtio_gpu_update_cursor_data; =20 vdc->realize =3D virtio_gpu_device_realize; vdc->reset =3D virtio_gpu_reset; --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619786072; cv=none; d=zohomail.com; s=zohoarc; b=cz4CeyLkfdz7RUo8J989TVB7KDV/kWAElbGpdbckarBSljcMhA56LqGsaqOKjUuQCzoCpdUPg25uczMkgMYx+bR9+wTvHbrO47P2Qp56pHyKjI4bFi4/Zv7fkY2XU+sOJ7EpGewC2FOAwat5mLBSGXpd2+UzD71v751FinuMpNM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619786072; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FqAYOsMnPWZx85KmwaW1n5DtDkhnNWnH1Jn/W4qaUiE=; b=nns+Ck+7pHNx9AUxMaHZcIJbPJ4X7SS+W4zZv0Xp6/uGEeUZGJ5Xzk8wLCrBOWkdLfd4KrLfVLy5MXtxJ1fnuFgHsSvMCoRQXE8xsqmGIVC1wXD6cxC0HEzTHgSaRgJjc1wmO/BMQtVOIvGhJ+7XUtggsmIYYsKhqMZH3z4qTeI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619786072012895.3903052821549; Fri, 30 Apr 2021 05:34:32 -0700 (PDT) Received: from localhost ([::1]:57590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSLm-0002Pu-Su for importer@patchew.org; Fri, 30 Apr 2021 08:34:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRt-0000kT-1x for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRRo-0001Y8-St for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:44 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-BQ6fCX10OtaSWeZrqe2f7A-1; Fri, 30 Apr 2021 07:36:38 -0400 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 1761F1922962; Fri, 30 Apr 2021 11:36:37 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A37CC1007607; Fri, 30 Apr 2021 11:36:29 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A25A71800796; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FqAYOsMnPWZx85KmwaW1n5DtDkhnNWnH1Jn/W4qaUiE=; b=DW82cLAC1fPax+2dPdmVS+GHFy321jJQ4Ey2jvFFbCKXcyUVlslFfqthfeJXHpHKLMWvif hyB8nd/abXCABpVqJHFaLg/t47K9mC4aBEAK9SRGlKXomhTPZGO0OIwak/4FT2PuADvPKJ 4XBNEKEZbZBLOya2Uu8LhXYdoU9VKcI= X-MC-Unique: BQ6fCX10OtaSWeZrqe2f7A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 10/16] virtio-gpu: drop VIRGL() macro Date: Fri, 30 Apr 2021 13:35:41 +0200 Message-Id: <20210430113547.1816178-11-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Drops last virgl/opengl dependency from virtio-gpu-device. Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 2c0065277ffd..34cf35127a3d 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -39,23 +39,6 @@ virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource= _id); static void virtio_gpu_cleanup_mapping(VirtIOGPU *g, struct virtio_gpu_simple_resource *= res); =20 -#ifdef CONFIG_VIRGL -#include -#define VIRGL(_g, _virgl, _simple, ...) \ - do { \ - if (_g->parent_obj.use_virgl_renderer) { \ - _virgl(__VA_ARGS__); \ - } else { \ - _simple(__VA_ARGS__); \ - } \ - } while (0) -#else -#define VIRGL(_g, _virgl, _simple, ...) \ - do { \ - _simple(__VA_ARGS__); \ - } while (0) -#endif - void virtio_gpu_update_cursor_data(VirtIOGPU *g, struct virtio_gpu_scanout *s, uint32_t resource_id) --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619787500; cv=none; d=zohomail.com; s=zohoarc; b=UOXLxQmqDuIj6qlL+5+7tVWSgTTvnFNXrElrHIexj7ecpmUNC+iPLXgTtjC58xGQvaWmCnoBS8b9pXpemV3I7OyaIH3nj4TD4XyErjEArgNvGa7m6emkWYBLHxkCsD5s/fhjzi7RFRF9YeuUs6merguQpURw1APwcExwEbNUz1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619787500; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9S5KSuAtwx7d0soDjJhrNRJVtmAvbBUCJHoQWxSVLgs=; b=U/VDf0K6GCVLFACwAlrKUWq1Usopa4dRNwCXHbEba7lA6Tmtkh3Bg2gEeABZc9Kas8mbPAGrgzcFP3SdcBLZW6n2MFw47xgs7i+Lg8r1hfVSOSDQMgF4+CMhKV0hfJc4puSlcIojrTTkck+woceWva+RPhZ1mPaD5wlTPRACwEk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619787500306242.21667211858653; Fri, 30 Apr 2021 05:58:20 -0700 (PDT) Received: from localhost ([::1]:44098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSip-0006sR-BI for importer@patchew.org; Fri, 30 Apr 2021 08:58:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRSA-00017Z-4M for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44473) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRS8-0001hg-72 for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:01 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-OKQmI2bXNfKZtYCP_D_UwQ-1; Fri, 30 Apr 2021 07:36:54 -0400 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 87CBB501FA; Fri, 30 Apr 2021 11:36:53 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E76306F442; Fri, 30 Apr 2021 11:36:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AE7B7180079D; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9S5KSuAtwx7d0soDjJhrNRJVtmAvbBUCJHoQWxSVLgs=; b=XdEqB0xl6O2pLiRh1PSEHmR5GeApcFeCVKG76ifvxpN7qtLrcttBndrCYNf+x8uEoQmDBI mcvTYJ8P5k7aRuEHeUrfxWkEpb5Q0xJDM2n+WMw17UBV4Nw10qJQ8EObBcdI+xbqEK7gJO kKZPZXA/l2GiJo4G/6rBVFltgY6Eyhg= X-MC-Unique: OKQmI2bXNfKZtYCP_D_UwQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 11/16] virtio-gpu: move virtio-gpu-gl-device to separate module Date: Fri, 30 Apr 2021 13:35:42 +0200 Message-Id: <20210430113547.1816178-12-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- util/module.c | 4 +++- hw/display/meson.build | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/util/module.c b/util/module.c index 47bba1182841..c8f3e5a0a736 100644 --- a/util/module.c +++ b/util/module.c @@ -182,6 +182,8 @@ static const struct { { "ui-spice-app", "ui-spice-core" }, { "ui-spice-app", "chardev-spice" }, =20 + { "hw-display-virtio-gpu-gl", "hw-display-virtio-gpu" }, + #ifdef CONFIG_OPENGL { "ui-egl-headless", "ui-opengl" }, { "ui-gtk", "ui-opengl" }, @@ -301,7 +303,7 @@ static struct { { "qxl-vga", "hw-", "display-qxl" }, { "qxl", "hw-", "display-qxl" }, { "virtio-gpu-device", "hw-", "display-virtio-gpu" }, - { "virtio-gpu-gl-device", "hw-", "display-virtio-gpu" }, + { "virtio-gpu-gl-device", "hw-", "display-virtio-gpu-gl" }, { "vhost-user-gpu", "hw-", "display-virtio-gpu" }, { "virtio-gpu-pci-base", "hw-", "display-virtio-gpu-pci" }, { "virtio-gpu-pci", "hw-", "display-virtio-gpu-pci" }, diff --git a/hw/display/meson.build b/hw/display/meson.build index 5161efa08a6e..3c3e47c47ed1 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -56,11 +56,14 @@ softmmu_ss.add(when: [pixman, 'CONFIG_ATI_VGA'], if_tru= e: files('ati.c', 'ati_2d if config_all_devices.has_key('CONFIG_VIRTIO_GPU') virtio_gpu_ss =3D ss.source_set() virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU', - if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), = pixman, virgl]) - virtio_gpu_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRGL'], - if_true: [files('virtio-gpu-gl.c', 'virtio-gpu-virgl.c= '), pixman, virgl]) + if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), = pixman]) virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-u= ser-gpu.c')) hw_display_modules +=3D {'virtio-gpu': virtio_gpu_ss} + + virtio_gpu_gl_ss =3D ss.source_set() + virtio_gpu_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRGL', opengl], + if_true: [files('virtio-gpu-gl.c', 'virtio-gpu-virg= l.c'), pixman, virgl]) + hw_display_modules +=3D {'virtio-gpu-gl': virtio_gpu_gl_ss} endif =20 if config_all_devices.has_key('CONFIG_VIRTIO_PCI') --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619785028; cv=none; d=zohomail.com; s=zohoarc; b=MhWaJqoTfQHpTbmeeouxlNYhAGp+ooQv+aeITgg7Y9Lyb9e1JaYVYlBYjWiEUXC5nsL9YXCTIV5wW6wogOxpQ/49FBLlw3oG8lkMPhJpuZ5zTUwU5J6Tg/tveDtZQ6cjcNxWqYp440TIG51OkUmqBQy/F8owhK1vYL8gcwq4G2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619785028; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jrkxG63TNThk+XeYHZrBXUFuTeY0glajiLouqEzD6Bs=; b=HJIoWrE0PXX2v2YfAqRsIkZSa6J5RqitIOaH40tYRN2fJ1eJR6+PIj0ruo+53akPzAKgusGzctZAb/xnzuDD8GdGmYiRqz20KdMp1D1gfJDSaYMYVK8ji+tTx2u7uSR70oCo2s20/anoqHgJDFHVm9OlKhVU2PxvSH8/7aUhTa4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619785028585344.5138266197407; Fri, 30 Apr 2021 05:17:08 -0700 (PDT) Received: from localhost ([::1]:52038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcS4w-0004u3-Sc for importer@patchew.org; Fri, 30 Apr 2021 08:17:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRS4-000169-FF for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRS2-0001f3-Cg for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:36:56 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-588-N9mEo93COO2D9O7frzVRow-1; Fri, 30 Apr 2021 07:36:51 -0400 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 CBF3A107ACC7; Fri, 30 Apr 2021 11:36:50 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6C038D5A6; Fri, 30 Apr 2021 11:36:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BE08E180079E; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jrkxG63TNThk+XeYHZrBXUFuTeY0glajiLouqEzD6Bs=; b=J6FMWb72l5zteWD0Lw9JH2q8rrn8sak41Zv9m+/91Nvf5vMMTiRsVpMCTPEpfUKk5rRFhq OhqR7ZTW4oDqlZ4FCx6x8+C3VFCaEbpOlkdAqVziA+Nb/cnQjuO3u0huSbxWLCzfG5IGfQ YToQ3GLer1k/rqttNxBqXVusr4ii7Jc= X-MC-Unique: N9mEo93COO2D9O7frzVRow-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 12/16] virtio-gpu: drop use_virgl_renderer Date: Fri, 30 Apr 2021 13:35:43 +0200 Message-Id: <20210430113547.1816178-13-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Now that we have separated the gl and non-gl code flows to two different devices there is little reason turn on and off virglrenderer usage at runtime. The gl code can simply use virglrenderer unconditionally. So drop use_virgl_renderer field and just do that. Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-gpu.h | 1 - hw/display/virtio-gpu-base.c | 6 +---- hw/display/virtio-gpu-gl.c | 44 ++++++++++------------------------ 3 files changed, 14 insertions(+), 37 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index cd55c2d07090..9629885c895f 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -111,7 +111,6 @@ struct VirtIOGPUBase { struct virtio_gpu_config virtio_config; const GraphicHwOps *hw_ops; =20 - bool use_virgl_renderer; int renderer_blocked; int enable; =20 diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 25f8920fdb67..afb3ee7d9afc 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -25,7 +25,6 @@ virtio_gpu_base_reset(VirtIOGPUBase *g) int i; =20 g->enable =3D 0; - g->use_virgl_renderer =3D false; =20 for (i =3D 0; i < g->conf.max_outputs; i++) { g->scanout[i].resource_id =3D 0; @@ -162,7 +161,6 @@ virtio_gpu_base_device_realize(DeviceState *qdev, return false; } =20 - g->use_virgl_renderer =3D false; if (virtio_gpu_virgl_enabled(g->conf)) { error_setg(&g->migration_blocker, "virgl is not yet migratable"); if (migrate_add_blocker(g->migration_blocker, errp) < 0) { @@ -218,10 +216,8 @@ static void virtio_gpu_base_set_features(VirtIODevice *vdev, uint64_t features) { static const uint32_t virgl =3D (1 << VIRTIO_GPU_F_VIRGL); - VirtIOGPUBase *g =3D VIRTIO_GPU_BASE(vdev); =20 - g->use_virgl_renderer =3D ((features & virgl) =3D=3D virgl); - trace_virtio_gpu_features(g->use_virgl_renderer); + trace_virtio_gpu_features(((features & virgl) =3D=3D virgl)); } =20 static void diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index b4303cc5bb41..1642a973549e 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -32,34 +32,20 @@ static void virtio_gpu_gl_update_cursor_data(VirtIOGPU = *g, uint32_t width, height; uint32_t pixels, *data; =20 - if (g->parent_obj.use_virgl_renderer) { - data =3D virgl_renderer_get_cursor_data(resource_id, &width, &heig= ht); - if (!data) { - return; - } + data =3D virgl_renderer_get_cursor_data(resource_id, &width, &height); + if (!data) { + return; + } =20 - if (width !=3D s->current_cursor->width || - height !=3D s->current_cursor->height) { - free(data); - return; - } - - pixels =3D s->current_cursor->width * s->current_cursor->height; - memcpy(s->current_cursor->data, data, pixels * sizeof(uint32_t)); + if (width !=3D s->current_cursor->width || + height !=3D s->current_cursor->height) { free(data); return; } - virtio_gpu_update_cursor_data(g, s, resource_id); -} =20 -static void virtio_gpu_gl_process_cmd(VirtIOGPU *g, - struct virtio_gpu_ctrl_command *cmd) -{ - if (g->parent_obj.use_virgl_renderer) { - virtio_gpu_virgl_process_cmd(g, cmd); - return; - } - virtio_gpu_simple_process_cmd(g, cmd); + pixels =3D s->current_cursor->width * s->current_cursor->height; + memcpy(s->current_cursor->data, data, pixels * sizeof(uint32_t)); + free(data); } =20 static void virtio_gpu_gl_flushed(VirtIOGPUBase *b) @@ -82,7 +68,7 @@ static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vdev,= VirtQueue *vq) return; } =20 - if (!g->renderer_inited && g->parent_obj.use_virgl_renderer) { + if (!g->renderer_inited) { virtio_gpu_virgl_init(g); g->renderer_inited =3D true; } @@ -97,10 +83,7 @@ static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vdev= , VirtQueue *vq) } =20 virtio_gpu_process_cmdq(g); - - if (g->parent_obj.use_virgl_renderer) { - virtio_gpu_virgl_fence_poll(g); - } + virtio_gpu_virgl_fence_poll(g); } =20 static void virtio_gpu_gl_reset(VirtIODevice *vdev) @@ -109,13 +92,12 @@ static void virtio_gpu_gl_reset(VirtIODevice *vdev) =20 virtio_gpu_reset(vdev); =20 - if (g->parent_obj.use_virgl_renderer) { + if (g->renderer_inited) { if (g->parent_obj.renderer_blocked) { g->renderer_reset =3D true; } else { virtio_gpu_virgl_reset(g); } - g->parent_obj.use_virgl_renderer =3D false; } } =20 @@ -155,7 +137,7 @@ static void virtio_gpu_gl_class_init(ObjectClass *klass= , void *data) =20 vbc->gl_flushed =3D virtio_gpu_gl_flushed; vgc->handle_ctrl =3D virtio_gpu_gl_handle_ctrl; - vgc->process_cmd =3D virtio_gpu_gl_process_cmd; + vgc->process_cmd =3D virtio_gpu_virgl_process_cmd; vgc->update_cursor_data =3D virtio_gpu_gl_update_cursor_data; =20 vdc->realize =3D virtio_gpu_gl_device_realize; --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619786483; cv=none; d=zohomail.com; s=zohoarc; b=HbChtoFtLwsX3CR0qSuS/nST9KL55ZduJ2Z6XrZWqtjq+id6D47oSCQ02N069V5cQiaSZmHB3yxKEJF6gCAJzdf6x16VHSjjAwOh3bwzom7We6Og7DUocAjOAsN+om//4Vi/E2roqFuGnAYwah2Q2GlZEVyLqCGPumG17mnpxI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619786483; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AJ1JBrLBxe9EHq3xWl9922BvWfAX+kOOzzkjmeLFekE=; b=aMWRJkYo1iUTc4+vL+aZDecGoUFyXsqH3xJRDIJpOrXkXsRr2KEu48pBAuy3zdgWx0s8JaLYBdz9RYc4pJkUsGEb6AlhclHM51TKoX5g1KtSprHKGi/F13VLGzAZv9FgWx3YsPqvRvgiIeg3G2ct3IEDG+g13rLSyhZgo8GvHW8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619786483415856.0478344444723; Fri, 30 Apr 2021 05:41:23 -0700 (PDT) Received: from localhost ([::1]:45122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSSQ-0000ah-CI for importer@patchew.org; Fri, 30 Apr 2021 08:41:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRSQ-0001ED-RM for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51796) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRSF-0001ky-Mk for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:18 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-450-YU8IWIe3MriBOPhSt9YN2Q-1; Fri, 30 Apr 2021 07:37:00 -0400 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 748B5107ACC7; Fri, 30 Apr 2021 11:36:59 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 751691007607; Fri, 30 Apr 2021 11:36:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CB27B18007A1; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AJ1JBrLBxe9EHq3xWl9922BvWfAX+kOOzzkjmeLFekE=; b=Xc0RM4pKyb8q+wMj0N6sd8xbvzqe1wNrnHSixCl6n5UT9wrb9xJ8g/b4dX5ESiXfZIlq70 Aaek8OYH8BCCYbDshr8sGVqdtDxdOaMk0JP5rSJEDZgM2zhMYKbDbvVNCQMK0SJx3Uj0Fw 80iwx29HGIzFszsGwMhmqD1cZmO9ekM= X-MC-Unique: YU8IWIe3MriBOPhSt9YN2Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 13/16] virtio-gpu: move fields to struct VirtIOGPUGL Date: Fri, 30 Apr 2021 13:35:44 +0200 Message-Id: <20210430113547.1816178-14-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Move two virglrenderer state variables to struct VirtIOGPUGL. Signed-off-by: Gerd Hoffmann --- include/hw/virtio/virtio-gpu.h | 5 +++-- hw/display/virtio-gpu-gl.c | 15 +++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 9629885c895f..0a8281aeb555 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -151,8 +151,6 @@ struct VirtIOGPU { uint64_t hostmem; =20 bool processing_cmdq; - bool renderer_inited; - bool renderer_reset; QEMUTimer *fence_poll; QEMUTimer *print_stats; =20 @@ -177,6 +175,9 @@ struct VirtIOGPUClass { =20 struct VirtIOGPUGL { struct VirtIOGPU parent_obj; + + bool renderer_inited; + bool renderer_reset; }; =20 struct VhostUserGPU { diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 1642a973549e..d971b480806a 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -51,9 +51,10 @@ static void virtio_gpu_gl_update_cursor_data(VirtIOGPU *= g, static void virtio_gpu_gl_flushed(VirtIOGPUBase *b) { VirtIOGPU *g =3D VIRTIO_GPU(b); + VirtIOGPUGL *gl =3D VIRTIO_GPU_GL(b); =20 - if (g->renderer_reset) { - g->renderer_reset =3D false; + if (gl->renderer_reset) { + gl->renderer_reset =3D false; virtio_gpu_virgl_reset(g); } virtio_gpu_process_cmdq(g); @@ -62,15 +63,16 @@ static void virtio_gpu_gl_flushed(VirtIOGPUBase *b) static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) { VirtIOGPU *g =3D VIRTIO_GPU(vdev); + VirtIOGPUGL *gl =3D VIRTIO_GPU_GL(vdev); struct virtio_gpu_ctrl_command *cmd; =20 if (!virtio_queue_ready(vq)) { return; } =20 - if (!g->renderer_inited) { + if (!gl->renderer_inited) { virtio_gpu_virgl_init(g); - g->renderer_inited =3D true; + gl->renderer_inited =3D true; } =20 cmd =3D virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command)); @@ -89,12 +91,13 @@ static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vde= v, VirtQueue *vq) static void virtio_gpu_gl_reset(VirtIODevice *vdev) { VirtIOGPU *g =3D VIRTIO_GPU(vdev); + VirtIOGPUGL *gl =3D VIRTIO_GPU_GL(vdev); =20 virtio_gpu_reset(vdev); =20 - if (g->renderer_inited) { + if (gl->renderer_inited) { if (g->parent_obj.renderer_blocked) { - g->renderer_reset =3D true; + gl->renderer_reset =3D true; } else { virtio_gpu_virgl_reset(g); } --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619785983; cv=none; d=zohomail.com; s=zohoarc; b=Ck/6q1Igjl8XIPFcdJmXyk87RNzIoFsGpWKpO3rFTkgRPf8CjCsGKGwvTI5xjbImGB2x3Ukz/ReyemxeRzxtcWnh52SZFZ+yLIme0d+pwC5ZMwRRbgs1afUtHGQaEES1+gjxQFcsxEMuBDyC9kLHUkDi7mHVu71oIzSl5uKtjvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619785983; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/2MSFZWInfdpArGGLWTQmBx3MJx3cUf05FRzeb35Kdg=; b=KQLkZCA6Di8cU0jQKFG+mLoToPAC1hq1EDbvb/LRBDJDaJbMhHQkvTkm7JPOODpr2jlwnZ5CDWuKzR9hFH7UFOmRII/6GpIAB8caxmdqXZPkIsziR2/96t1utnMNshTq7kD4X1A5iDi7vkRTiQvv+Pzb9V4eTmM9m+3ozQl7DrU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16197859837411.8225241414140783; Fri, 30 Apr 2021 05:33:03 -0700 (PDT) Received: from localhost ([::1]:54510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSKM-00010b-7n for importer@patchew.org; Fri, 30 Apr 2021 08:33:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRSL-0001CT-6u for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33214) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRSC-0001kG-Vz for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:12 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-377-6EQMCg-BMoOVY43vXgNv8Q-1; Fri, 30 Apr 2021 07:37:00 -0400 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 750AB1020C24; Fri, 30 Apr 2021 11:36:59 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 293291007624; Fri, 30 Apr 2021 11:36:55 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DA40718007A4; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/2MSFZWInfdpArGGLWTQmBx3MJx3cUf05FRzeb35Kdg=; b=ealUJhrWQpi/oTydEMK1+CEnt+oRfEU/8/iiniiZhw55iyJJwGD3Z30wznTV4okKHhaMJg ghds+eWgO33m+AQ9CV0c+mXF5br63P+DwLTGdnkrXujD225jvAOrV/pFOWOnNoIVY8PnxR nYmwMvNG+cjF76z+QoEVuVa72ne/6IM= X-MC-Unique: 6EQMCg-BMoOVY43vXgNv8Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 14/16] virtio-gpu: add virtio-gpu-gl-pci Date: Fri, 30 Apr 2021 13:35:45 +0200 Message-Id: <20210430113547.1816178-15-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add pci proxy for virtio-gpu-gl-device. Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu-pci-gl.c | 55 ++++++++++++++++++++++++++++++++++ util/module.c | 2 ++ hw/display/meson.build | 5 ++++ 3 files changed, 62 insertions(+) create mode 100644 hw/display/virtio-gpu-pci-gl.c diff --git a/hw/display/virtio-gpu-pci-gl.c b/hw/display/virtio-gpu-pci-gl.c new file mode 100644 index 000000000000..902dda345275 --- /dev/null +++ b/hw/display/virtio-gpu-pci-gl.c @@ -0,0 +1,55 @@ +/* + * Virtio video device + * + * Copyright Red Hat + * + * Authors: + * Dave Airlie + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/module.h" +#include "hw/pci/pci.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/virtio.h" +#include "hw/virtio/virtio-bus.h" +#include "hw/virtio/virtio-gpu-pci.h" +#include "qom/object.h" + +#define TYPE_VIRTIO_GPU_GL_PCI "virtio-gpu-gl-pci" +typedef struct VirtIOGPUGLPCI VirtIOGPUGLPCI; +DECLARE_INSTANCE_CHECKER(VirtIOGPUGLPCI, VIRTIO_GPU_GL_PCI, + TYPE_VIRTIO_GPU_GL_PCI) + +struct VirtIOGPUGLPCI { + VirtIOGPUPCIBase parent_obj; + VirtIOGPUGL vdev; +}; + +static void virtio_gpu_gl_initfn(Object *obj) +{ + VirtIOGPUGLPCI *dev =3D VIRTIO_GPU_GL_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_GPU_GL); + VIRTIO_GPU_PCI_BASE(obj)->vgpu =3D VIRTIO_GPU_BASE(&dev->vdev); +} + +static const VirtioPCIDeviceTypeInfo virtio_gpu_gl_pci_info =3D { + .generic_name =3D TYPE_VIRTIO_GPU_GL_PCI, + .parent =3D TYPE_VIRTIO_GPU_PCI_BASE, + .instance_size =3D sizeof(VirtIOGPUGLPCI), + .instance_init =3D virtio_gpu_gl_initfn, +}; + +static void virtio_gpu_gl_pci_register_types(void) +{ + virtio_pci_types_register(&virtio_gpu_gl_pci_info); +} + +type_init(virtio_gpu_gl_pci_register_types) diff --git a/util/module.c b/util/module.c index c8f3e5a0a736..fc545c35bcd2 100644 --- a/util/module.c +++ b/util/module.c @@ -183,6 +183,7 @@ static const struct { { "ui-spice-app", "chardev-spice" }, =20 { "hw-display-virtio-gpu-gl", "hw-display-virtio-gpu" }, + { "hw-display-virtio-gpu-pci-gl", "hw-display-virtio-gpu-pci" }, =20 #ifdef CONFIG_OPENGL { "ui-egl-headless", "ui-opengl" }, @@ -307,6 +308,7 @@ static struct { { "vhost-user-gpu", "hw-", "display-virtio-gpu" }, { "virtio-gpu-pci-base", "hw-", "display-virtio-gpu-pci" }, { "virtio-gpu-pci", "hw-", "display-virtio-gpu-pci" }, + { "virtio-gpu-gl-pci", "hw-", "display-virtio-gpu-pci-gl" }, { "vhost-user-gpu-pci", "hw-", "display-virtio-gpu-pci" }, { "virtio-gpu-ccw", "hw-", "s390x-virtio-gpu-ccw" }, { "virtio-vga-base", "hw-", "display-virtio-vga" }, diff --git a/hw/display/meson.build b/hw/display/meson.build index 3c3e47c47ed1..8ca2e7ab6362 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -73,6 +73,11 @@ if config_all_devices.has_key('CONFIG_VIRTIO_PCI') virtio_gpu_pci_ss.add(when: ['CONFIG_VHOST_USER_GPU', 'CONFIG_VIRTIO_PCI= '], if_true: files('vhost-user-gpu-pci.c')) hw_display_modules +=3D {'virtio-gpu-pci': virtio_gpu_pci_ss} + + virtio_gpu_pci_gl_ss =3D ss.source_set() + virtio_gpu_pci_gl_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_PCI'= , 'CONFIG_VIRGL', opengl], + if_true: [files('virtio-gpu-pci-gl.c'), pixman]) + hw_display_modules +=3D {'virtio-gpu-pci-gl': virtio_gpu_pci_gl_ss} endif =20 if config_all_devices.has_key('CONFIG_VIRTIO_VGA') --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619786222; cv=none; d=zohomail.com; s=zohoarc; b=NZ8SrplK7A+y9N8hknq0zn+2XZdeCLSQ4cOkaHfWSw1UiB46CENxywIP66A+qyhBCvFupN39xQ+yewq9RKcirxI6VU+KcpdZoPddD7i8kXyVYlLcGzGpeI5+2VVwthYS3I4+nQjzNSAAeEgUfaccE3o7fLjGTZ/5UOF6KT/b3wg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619786222; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w1HS3FPzeemdBuzJ0MMLNIXg7ZaeNhkU7tj//MSnykU=; b=YvQnWVFh5RvzC3srO6hryUUaRgUbwYkBFCFCWlm/gLRtxP7BycxghMZ4iBdNOu0gQpILCV/dezfeUOZxSEt2dqM+inYDwcmSVZT6oFqMDE45cGrQoES2SXjhl9Z5cN97lAHXMk5gNvShLjMTZKjc6/sl+Ts1gfVoRUyKijARJSo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619786222664967.0296139099715; Fri, 30 Apr 2021 05:37:02 -0700 (PDT) Received: from localhost ([::1]:33980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSOD-0004Rd-3h for importer@patchew.org; Fri, 30 Apr 2021 08:37:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRSR-0001Eh-0a for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24072) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRSK-0001o0-Th for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:18 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-132-1NLom1taMGSV-tIvzPrDvQ-1; Fri, 30 Apr 2021 07:37:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A965B9196A1; Fri, 30 Apr 2021 11:37:07 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 071925D719; Fri, 30 Apr 2021 11:37:01 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E726F18007A5; Fri, 30 Apr 2021 13:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w1HS3FPzeemdBuzJ0MMLNIXg7ZaeNhkU7tj//MSnykU=; b=f61AOPlCQQPwuWoqLtV9Ft+s8GpfgmnHODzaaA9FvMAT1rBtfxyiYJWkKZvHipKFQraBOk zgOhgs8O22Id/LkYjeDD9lQPQgkcCWbeo00MTisaSqLibYCjMQ88L08I1UWSS+UYYu2gz7 Ax2h7MKulkPr56xD4XRqSN1SCZEph+c= X-MC-Unique: 1NLom1taMGSV-tIvzPrDvQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 15/16] modules: add have_vga Date: Fri, 30 Apr 2021 13:35:46 +0200 Message-Id: <20210430113547.1816178-16-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Introduce a symbol which can be used to prevent display modules which need vga support being loaded into system emulators with CONFIG_VGA=3Dn. Signed-off-by: Gerd Hoffmann --- include/hw/display/vga.h | 6 ++++++ hw/display/vga.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/hw/display/vga.h b/include/hw/display/vga.h index ca0003dbfd92..5f7825e0e368 100644 --- a/include/hw/display/vga.h +++ b/include/hw/display/vga.h @@ -11,6 +11,12 @@ =20 #include "exec/hwaddr.h" =20 +/* + * modules can reference this symbol to avoid being loaded + * into system emulators without vga support + */ +extern bool have_vga; + enum vga_retrace_method { VGA_RETRACE_DUMB, VGA_RETRACE_PRECISE diff --git a/hw/display/vga.c b/hw/display/vga.c index 836ad50c7b6d..28a90e30d0cf 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -39,6 +39,8 @@ //#define DEBUG_VGA_MEM //#define DEBUG_VGA_REG =20 +bool have_vga =3D true; + /* 16 state changes per vertical frame @60 Hz */ #define VGA_TEXT_CURSOR_PERIOD_MS (1000 * 2 * 16 / 60) =20 --=20 2.30.2 From nobody Fri May 17 06:43:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619786405; cv=none; d=zohomail.com; s=zohoarc; b=nVpBjhVS/x55LMAxhccV/xkoL/NqAqe3kf6aRi0qYDRzvIR2w1CW7dYP5awfivUIBLkH6R+GUvP+5L7Rqb46lRg2zNx+rpNH7EahD43qX439e6WMhHiH+ZsHAS2soY9FQvz/BP7Xsf1EVPfYQ9rXMKRTnZfV1LjZYBhHFXrMlWU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619786405; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ldyAMmm/MqSouCO97qButlnMQ7+UyDEUdMOfe785qBA=; b=crgQRBvs3OAyTa5T8A3n1lfOIuSUB1k5J3m48wJuQufraQbufH4GqkO35ilp7TXQM5mDFWywXOnVvRB/jVWJIUH1xy6pNT1i0O1o8ytdRYzpEWnc10vqBHJm0tY+NQGXBL+OAE6LCqxtNHwbyKqdR3sT7Wl+VTmPtikBL8OVSpo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619786405376413.3763383713142; Fri, 30 Apr 2021 05:40:05 -0700 (PDT) Received: from localhost ([::1]:41816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcSRA-0007fK-AY for importer@patchew.org; Fri, 30 Apr 2021 08:40:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRSS-0001Ie-Gc for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27966) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcRSM-0001o7-OC for qemu-devel@nongnu.org; Fri, 30 Apr 2021 07:37:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-datoc80jOtqp5Ww6idu1EA-1; Fri, 30 Apr 2021 07:37:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8AA381922967; Fri, 30 Apr 2021 11:37:10 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-203.ams2.redhat.com [10.36.112.203]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08D5919C45; Fri, 30 Apr 2021 11:37:01 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 01E7718007A7; Fri, 30 Apr 2021 13:35:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619782633; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ldyAMmm/MqSouCO97qButlnMQ7+UyDEUdMOfe785qBA=; b=KRH2mB+KpbA1pod5kyyaPXK50p6TY3mfO2m0sd6e2w1kADRCs7ZP5/wTfgSZ2uVKaRu2W4 Bi9fLIviwHOi+uwxOM9NbeEVd7Z01fEUr2/t3xqrVFrnO8RgV4Bxjm/skgc08Vvk3q0fJE ZeTyOmuHvkwySfESPEO78AoEv4agsdQ= X-MC-Unique: datoc80jOtqp5Ww6idu1EA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 16/16] virtio-gpu: add virtio-vga-gl Date: Fri, 30 Apr 2021 13:35:47 +0200 Message-Id: <20210430113547.1816178-17-kraxel@redhat.com> In-Reply-To: <20210430113547.1816178-1-kraxel@redhat.com> References: <20210430113547.1816178-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.22, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , tina.zhang@intel.com, Gerd Hoffmann , vivek.kasireddy@intel.com, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add pci proxy for virtio-gpu-gl-device, with vga compatibility. Signed-off-by: Gerd Hoffmann --- hw/display/virtio-vga-gl.c | 47 ++++++++++++++++++++++++++++++++++++++ util/module.c | 2 ++ hw/display/meson.build | 5 ++++ 3 files changed, 54 insertions(+) create mode 100644 hw/display/virtio-vga-gl.c diff --git a/hw/display/virtio-vga-gl.c b/hw/display/virtio-vga-gl.c new file mode 100644 index 000000000000..c971340ebb1a --- /dev/null +++ b/hw/display/virtio-vga-gl.c @@ -0,0 +1,47 @@ +#include "qemu/osdep.h" +#include "hw/pci/pci.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/virtio-gpu.h" +#include "hw/display/vga.h" +#include "qapi/error.h" +#include "qemu/module.h" +#include "virtio-vga.h" +#include "qom/object.h" + +#define TYPE_VIRTIO_VGA_GL "virtio-vga-gl" + +typedef struct VirtIOVGAGL VirtIOVGAGL; +DECLARE_INSTANCE_CHECKER(VirtIOVGAGL, VIRTIO_VGA_GL, + TYPE_VIRTIO_VGA_GL) + +struct VirtIOVGAGL { + VirtIOVGABase parent_obj; + + VirtIOGPUGL vdev; +}; + +static void virtio_vga_gl_inst_initfn(Object *obj) +{ + VirtIOVGAGL *dev =3D VIRTIO_VGA_GL(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_GPU_GL); + VIRTIO_VGA_BASE(dev)->vgpu =3D VIRTIO_GPU_BASE(&dev->vdev); +} + + +static VirtioPCIDeviceTypeInfo virtio_vga_gl_info =3D { + .generic_name =3D TYPE_VIRTIO_VGA_GL, + .parent =3D TYPE_VIRTIO_VGA_BASE, + .instance_size =3D sizeof(VirtIOVGAGL), + .instance_init =3D virtio_vga_gl_inst_initfn, +}; + +static void virtio_vga_register_types(void) +{ + if (have_vga) { + virtio_pci_types_register(&virtio_vga_gl_info); + } +} + +type_init(virtio_vga_register_types) diff --git a/util/module.c b/util/module.c index fc545c35bcd2..eee8ff2de136 100644 --- a/util/module.c +++ b/util/module.c @@ -184,6 +184,7 @@ static const struct { =20 { "hw-display-virtio-gpu-gl", "hw-display-virtio-gpu" }, { "hw-display-virtio-gpu-pci-gl", "hw-display-virtio-gpu-pci" }, + { "hw-display-virtio-vga-gl", "hw-display-virtio-vga" }, =20 #ifdef CONFIG_OPENGL { "ui-egl-headless", "ui-opengl" }, @@ -313,6 +314,7 @@ static struct { { "virtio-gpu-ccw", "hw-", "s390x-virtio-gpu-ccw" }, { "virtio-vga-base", "hw-", "display-virtio-vga" }, { "virtio-vga", "hw-", "display-virtio-vga" }, + { "virtio-vga-gl", "hw-", "display-virtio-vga-gl" }, { "vhost-user-vga", "hw-", "display-virtio-vga" }, { "chardev-braille", "chardev-", "baum" }, { "chardev-spicevmc", "chardev-", "spice" }, diff --git a/hw/display/meson.build b/hw/display/meson.build index 8ca2e7ab6362..612cd6582d0c 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -87,6 +87,11 @@ if config_all_devices.has_key('CONFIG_VIRTIO_VGA') virtio_vga_ss.add(when: 'CONFIG_VHOST_USER_VGA', if_true: files('vhost-user-vga.c')) hw_display_modules +=3D {'virtio-vga': virtio_vga_ss} + + virtio_vga_gl_ss =3D ss.source_set() + virtio_vga_gl_ss.add(when: ['CONFIG_VIRTIO_VGA', 'CONFIG_VIRGL', opengl], + if_true: [files('virtio-vga-gl.c'), pixman]) + hw_display_modules +=3D {'virtio-vga-gl': virtio_vga_gl_ss} endif =20 specific_ss.add(when: [x11, opengl, 'CONFIG_MILKYMIST_TMU2'], if_true: fil= es('milkymist-tmu2.c')) --=20 2.30.2