From nobody Sat May 18 20:15:26 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=1612436053; cv=none; d=zohomail.com; s=zohoarc; b=RlrAW4bxvjBDrF1ONmYgnykPhFF+kCFh/WwvjOZHTff7d3g9Mm9At2Y7sbzEeb6M7fk73U3IsApUCmPaAFrPTDiycYynFw0toYP5faxnZhwXD1UncbgrdDMcVpVfHyqrKfLfWbvE5oYnp8CqqcutSOZU+4/DiA/dZTaFShmwyLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436053; 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=2QYLQNuo1/GQkJXOYC2pwycnW+jQ8l5ng1q4YCXlrzM=; b=b4Dv1wO6yINinLesB0SwVdFG4b+ZVzUboIOlLaGxm89PGZNQW8txN0z/xRgz36MA6X+a8DBPHfikR3Yhf5w77x/8/LbzkAn+aSAfnrqn1LJkZVveOPWxtYI8UE6QDmufbM7kdHls2QtWz5rJTiDt0nw3IRpLqnPtNJA+8wmrBe4= 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 1612436053901716.3155459841014; Thu, 4 Feb 2021 02:54:13 -0800 (PST) Received: from localhost ([::1]:49374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cH6-0006BK-9r for importer@patchew.org; Thu, 04 Feb 2021 05:54:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cFx-000518-AZ for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30412) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cFv-0007MT-9f for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:01 -0500 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-231-94ww_gewOUGJVyB0Ur2oYw-1; Thu, 04 Feb 2021 05:52:57 -0500 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 459AF801962 for ; Thu, 4 Feb 2021 10:52:56 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DFE560C66; Thu, 4 Feb 2021 10:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612435978; 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=2QYLQNuo1/GQkJXOYC2pwycnW+jQ8l5ng1q4YCXlrzM=; b=V0GLMdkLwd91rP4xG7fAcsXu7VQhP1csIfL/913vMk9Dy70Rn/PFTu6J4RgHQYciOy9b94 4tcsRXXxUIAy5lrkR20/hfQAJOmiXxhngDmzbi7GfDMXg1dGRxx1KXk6YH24JxrOOV3kF/ v/eTvLKfJUXleiN4kCmuMRAogJTGi28= X-MC-Unique: 94ww_gewOUGJVyB0Ur2oYw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 01/20] vhost-user-gpu: check backend for EDID support Date: Thu, 4 Feb 2021 14:52:13 +0400 Message-Id: <20210204105232.834642-2-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau EDID has been enabled by default, but the backend may not implement it (such as the contrib backend). This results in extra warnings and potentially other issues in the guest. The option shouldn't probably have been added to VIRTIO_GPU_BASE, but it's a bit too late now, report an error and disable EDID when it's not available. Fixes: 0a7196625 ("edid: flip the default to enabled") Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/display/vhost-user-gpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 51f1747c4a..55b0ed15f2 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -555,6 +555,12 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error= **errp) if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_VIRGL)) { g->parent_obj.conf.flags |=3D 1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED; } + if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_EDID)) { + g->parent_obj.conf.flags |=3D 1 << VIRTIO_GPU_FLAG_EDID_ENABLED; + } else { + error_report("EDID requested but the backend doesn't support it."); + g->parent_obj.conf.flags &=3D ~(1 << VIRTIO_GPU_FLAG_EDID_ENABLED); + } =20 if (!virtio_gpu_base_device_realize(qdev, NULL, NULL, errp)) { return; --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436071; cv=none; d=zohomail.com; s=zohoarc; b=YDtt+zj+oeeDiobvVh3Q1QIAzVQeXpNIS4PoNvnVUWX1nj3v3Epzu9p0hqZcJWAhQuaSsyf5vHr1TKnRQkraKpj7iLjQxc4I+DyqUx4f6dBPYlKkbceZGxMDoQH5XkLrI/BCLIcddNLmFesBDyv53MFbEoviwuItx5CPwkRzmrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436071; 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=5kVr4+NxZFK0H8CVsMhbXmR7YdDKgqEyyPzMZ0kNsj4=; b=Ezk8CGNonF1cbeHv6zm/uQjxbZpU0n84sW3PSAScC41shrc19P6B9APwyD2GIjZsvh8akHIgF8MDg9JhJ0ufMiDkNtA6CnXertbSH3cvcQVVHOyiGuzY9o22fNy/rGQCXHAj9uigLfqlEgwI8YfF7C0Cf3dIp/ilqMZekpxkTvE= 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 1612436071594119.05539255623194; Thu, 4 Feb 2021 02:54:31 -0800 (PST) Received: from localhost ([::1]:50184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cHO-0006XG-5R for importer@patchew.org; Thu, 04 Feb 2021 05:54:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cG8-0005Ci-Q3 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28162) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cG7-0007RD-22 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:12 -0500 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-494-mTdNt_ZrP3KUcXajCM-2mg-1; Thu, 04 Feb 2021 05:53:08 -0500 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 F01A08030B5 for ; Thu, 4 Feb 2021 10:53:07 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 597F910016F9; Thu, 4 Feb 2021 10:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612435990; 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=5kVr4+NxZFK0H8CVsMhbXmR7YdDKgqEyyPzMZ0kNsj4=; b=SR2PRZRmuTDWiiyhKP3jzel5iJ2QOUGcmuriN7G62/OqApxNWGP4YoxiM7J9okIIP6n37c GxzStHqv2HD3B0MS4wQjURUWGVw/DEpn2bOEZditbAmL2mIwbvcvQzUy/hvfCOngpXCmxQ 4+h1QDv19yDtbsFu18+X1MIcKoEU3+Y= X-MC-Unique: mTdNt_ZrP3KUcXajCM-2mg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 02/20] vhost-user-gpu: handle vhost-user-gpu features in a callback Date: Thu, 4 Feb 2021 14:52:14 +0400 Message-Id: <20210204105232.834642-3-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Fixes a deadlock where the backend calls QEMU, while QEMU also calls the backend simultaneously, both ends waiting for each other. Signed-off-by: Marc-Andr=C3=A9 Lureau --- contrib/vhost-user-gpu/vugpu.h | 2 +- contrib/vhost-user-gpu/vhost-user-gpu.c | 37 ++++++++++++++++++------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/contrib/vhost-user-gpu/vugpu.h b/contrib/vhost-user-gpu/vugpu.h index ad664c4df8..86f3ac86aa 100644 --- a/contrib/vhost-user-gpu/vugpu.h +++ b/contrib/vhost-user-gpu/vugpu.h @@ -118,7 +118,7 @@ typedef struct VuGpu { int sock_fd; int drm_rnode_fd; GSource *renderer_source; - guint wait_ok; + guint wait_in; =20 bool virgl; bool virgl_inited; diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-g= pu/vhost-user-gpu.c index f445ef28ec..85c16404fb 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -124,7 +124,7 @@ source_wait_cb(gint fd, GIOCondition condition, gpointe= r user_data) } =20 /* resume */ - g->wait_ok =3D 0; + g->wait_in =3D 0; vg_handle_ctrl(&g->dev.parent, 0); =20 return G_SOURCE_REMOVE; @@ -133,8 +133,8 @@ source_wait_cb(gint fd, GIOCondition condition, gpointe= r user_data) void vg_wait_ok(VuGpu *g) { - assert(g->wait_ok =3D=3D 0); - g->wait_ok =3D g_unix_fd_add(g->sock_fd, G_IO_IN | G_IO_HUP, + assert(g->wait_in =3D=3D 0); + g->wait_in =3D g_unix_fd_add(g->sock_fd, G_IO_IN | G_IO_HUP, source_wait_cb, g); } =20 @@ -270,7 +270,7 @@ vg_get_display_info(VuGpu *vg, struct virtio_gpu_ctrl_c= ommand *cmd) .size =3D 0, }; =20 - assert(vg->wait_ok =3D=3D 0); + assert(vg->wait_in =3D=3D 0); =20 vg_send_msg(vg, &msg, -1); if (!vg_recv_msg(vg, msg.request, sizeof(dpy_info), &dpy_info)) { @@ -815,7 +815,7 @@ vg_handle_ctrl(VuDev *dev, int qidx) size_t len; =20 for (;;) { - if (vg->wait_ok !=3D 0) { + if (vg->wait_in !=3D 0) { return; } =20 @@ -969,18 +969,17 @@ vg_queue_set_started(VuDev *dev, int qidx, bool start= ed) } } =20 -static void -set_gpu_protocol_features(VuGpu *g) +static gboolean +protocol_features_cb(gint fd, GIOCondition condition, gpointer user_data) { + VuGpu *g =3D user_data; uint64_t u64; VhostUserGpuMsg msg =3D { .request =3D VHOST_USER_GPU_GET_PROTOCOL_FEATURES }; =20 - assert(g->wait_ok =3D=3D 0); - vg_send_msg(g, &msg, -1); if (!vg_recv_msg(g, msg.request, sizeof(u64), &u64)) { - return; + return G_SOURCE_CONTINUE; } =20 msg =3D (VhostUserGpuMsg) { @@ -989,6 +988,24 @@ set_gpu_protocol_features(VuGpu *g) .payload.u64 =3D 0 }; vg_send_msg(g, &msg, -1); + + g->wait_in =3D 0; + vg_handle_ctrl(&g->dev.parent, 0); + + return G_SOURCE_REMOVE; +} + +static void +set_gpu_protocol_features(VuGpu *g) +{ + VhostUserGpuMsg msg =3D { + .request =3D VHOST_USER_GPU_GET_PROTOCOL_FEATURES + }; + + vg_send_msg(g, &msg, -1); + assert(g->wait_in =3D=3D 0); + g->wait_in =3D g_unix_fd_add(g->sock_fd, G_IO_IN | G_IO_HUP, + protocol_features_cb, g); } =20 static int --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436183; cv=none; d=zohomail.com; s=zohoarc; b=ggZED3VfrdYmrRGecCINHKUiITvgOAzPDozo7Ab7AQCFLWtFi1Jtihs5TfaU2wZlPNG+r5xMNvAP7j0zGS0ucUvOSeGtdilk7Jthw5rplv2BsLm2dSeWffAFHzq2B1OXLt3gHQGdmQDzZt+62qbdFN2n1JLYIJZMRh4KaKx8j74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436183; 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=eX0974lm+9I+ehw+Y4NHbyrd2U9aeN7RgR9DP8fzj7k=; b=CvU7fCzfNTdym7RFPREwtJToNYfGTH1bpgEXEntXsfFMXDAV0DumWG4qkw22viVyopj4d4WhJLMI7PPAUV1Of5yQCfjYtrlg5trkhrCxyZbBY9xo75QyPvpXPcLTxFxuyu+fnnlRL1P6XpkPjNSqEs7PEnnfgpgqO9owY/v9B40= 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 1612436183738454.95069207522204; Thu, 4 Feb 2021 02:56:23 -0800 (PST) Received: from localhost ([::1]:58734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cJC-0001gl-OS for importer@patchew.org; Thu, 04 Feb 2021 05:56:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cGL-0005ez-Oq for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cGK-0007XT-3U for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:25 -0500 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-500-vOeGsMeJMjGMlzFlAUxOfA-1; Thu, 04 Feb 2021 05:53:22 -0500 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 2170C801962 for ; Thu, 4 Feb 2021 10:53:21 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24C44722CF; Thu, 4 Feb 2021 10:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436003; 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=eX0974lm+9I+ehw+Y4NHbyrd2U9aeN7RgR9DP8fzj7k=; b=iY2xox4pcltlwj2+f/LfrGoH0rZeigz2oEZn0AA3PKAugXvUpBdelICCfaBMJClgOEtCV5 mFrIgYGmF0bPDBYUIuufxrR1WoN7RKDBHyd7jMxIwyXtTh+RivfzqzvfJnSe/M9FAMsmNn 8cNaG6Qa8LDEJOfK9wJzXRwAxzvVqsY= X-MC-Unique: vOeGsMeJMjGMlzFlAUxOfA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 03/20] vhost-user-gpu: use an extandable state enum for commands Date: Thu, 4 Feb 2021 14:52:15 +0400 Message-Id: <20210204105232.834642-4-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Introduce a pending state for commands which aren't finished yet, but are being handled. See following patch. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- contrib/vhost-user-gpu/vugpu.h | 8 +++++++- contrib/vhost-user-gpu/vhost-user-gpu.c | 8 ++++---- contrib/vhost-user-gpu/virgl.c | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/contrib/vhost-user-gpu/vugpu.h b/contrib/vhost-user-gpu/vugpu.h index 86f3ac86aa..04d5615812 100644 --- a/contrib/vhost-user-gpu/vugpu.h +++ b/contrib/vhost-user-gpu/vugpu.h @@ -129,12 +129,18 @@ typedef struct VuGpu { QTAILQ_HEAD(, virtio_gpu_ctrl_command) fenceq; } VuGpu; =20 +enum { + VG_CMD_STATE_NEW, + VG_CMD_STATE_PENDING, + VG_CMD_STATE_FINISHED, +}; + struct virtio_gpu_ctrl_command { VuVirtqElement elem; VuVirtq *vq; struct virtio_gpu_ctrl_hdr cmd_hdr; uint32_t error; - bool finished; + int state; QTAILQ_ENTRY(virtio_gpu_ctrl_command) next; }; =20 diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-g= pu/vhost-user-gpu.c index 85c16404fb..7dcc02966c 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -246,7 +246,7 @@ vg_ctrl_response(VuGpu *g, } vu_queue_push(&g->dev.parent, cmd->vq, &cmd->elem, s); vu_queue_notify(&g->dev.parent, cmd->vq); - cmd->finished =3D true; + cmd->state =3D VG_CMD_STATE_FINISHED; } =20 void @@ -800,7 +800,7 @@ vg_process_cmd(VuGpu *vg, struct virtio_gpu_ctrl_comman= d *cmd) cmd->error =3D VIRTIO_GPU_RESP_ERR_UNSPEC; break; } - if (!cmd->finished) { + if (cmd->state =3D=3D VG_CMD_STATE_NEW) { vg_ctrl_response_nodata(vg, cmd, cmd->error ? cmd->error : VIRTIO_GPU_RESP_OK_NODATA); } @@ -825,7 +825,7 @@ vg_handle_ctrl(VuDev *dev, int qidx) } cmd->vq =3D vq; cmd->error =3D 0; - cmd->finished =3D false; + cmd->state =3D VG_CMD_STATE_NEW; =20 len =3D iov_to_buf(cmd->elem.out_sg, cmd->elem.out_num, 0, &cmd->cmd_hdr, sizeof(cmd->cmd_hdr)); @@ -844,7 +844,7 @@ vg_handle_ctrl(VuDev *dev, int qidx) vg_process_cmd(vg, cmd); } =20 - if (!cmd->finished) { + if (cmd->state !=3D VG_CMD_STATE_FINISHED) { QTAILQ_INSERT_TAIL(&vg->fenceq, cmd, next); vg->inflight++; } else { diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c index e647278052..8bb3c563d9 100644 --- a/contrib/vhost-user-gpu/virgl.c +++ b/contrib/vhost-user-gpu/virgl.c @@ -482,7 +482,7 @@ void vg_virgl_process_cmd(VuGpu *g, struct virtio_gpu_c= trl_command *cmd) break; } =20 - if (cmd->finished) { + if (cmd->state !=3D VG_CMD_STATE_NEW) { return; } =20 --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436171; cv=none; d=zohomail.com; s=zohoarc; b=LW30xhWDCeItAAdkQKndTPxdTortCsKMcTivzQJOQPCgYj6kcImcmzO/xnPxWZNEhwph/j9CziOcW75ohNdT7lsnkasbNhZ+8UajcWHLjW7jzb+HeuTSpHBjjvnv0lRNvt2RBUsCA0QvaA3yfIZ39qrEmnsHQxlKWqtC5g1I5oY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436171; 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=ATK0/nnS9Pn49Dgrg0R3dSdoQmWdieWyxZxlwESSCzA=; b=i6+MVp0hnSRAT7JG6B5wubkEnM520j2MGyBGWYDF89porVuN168P30qEWt/lyIE4Qv+SsIu7SQrXpQfMeoYP/DmrhHIlzxNGOPBr1kKrakpPTP/kMNtOToTN7E755u4X/S1cSHFrDxDPTnH4mQOonhOGAxIBzKQjf/eoG5SwuHE= 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 1612436171881474.6972286638112; Thu, 4 Feb 2021 02:56:11 -0800 (PST) Received: from localhost ([::1]:57574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cJ0-0001Ck-QC for importer@patchew.org; Thu, 04 Feb 2021 05:56:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cGR-0005su-Ub for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50135) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cGQ-0007aF-AE for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:31 -0500 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-11-pijZgt3FNEuGvAAgnWw6HA-1; Thu, 04 Feb 2021 05:53:27 -0500 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 EC81A107ACE4 for ; Thu, 4 Feb 2021 10:53:26 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8A8A722CF; Thu, 4 Feb 2021 10:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436009; 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=ATK0/nnS9Pn49Dgrg0R3dSdoQmWdieWyxZxlwESSCzA=; b=G+unbO+K4C3rOZFYpmtjfPl3MlbEcoKeVv5zci7quMHrI1B/L4G6HrX2L35BnnJzYH5qdu f4nvQOcAqZV506+xPjDRCRa0R1RPcScx1cTk7X6RUqEDgOO/273+zLjCJg7O1JYulr6kS2 mb5DR4l5z664QGId591uG+HgsxOH5Pk= X-MC-Unique: pijZgt3FNEuGvAAgnWw6HA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 04/20] vhost-user-gpu: handle display-info in a callback Date: Thu, 4 Feb 2021 14:52:16 +0400 Message-Id: <20210204105232.834642-5-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Fixes a deadlock where the backend calls QEMU, while QEMU also calls the backend simultaneously, both ends waiting for each other. Signed-off-by: Marc-Andr=C3=A9 Lureau --- contrib/vhost-user-gpu/vhost-user-gpu.c | 33 ++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-g= pu/vhost-user-gpu.c index 7dcc02966c..b27990ffdb 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -261,10 +261,33 @@ vg_ctrl_response_nodata(VuGpu *g, vg_ctrl_response(g, cmd, &resp, sizeof(resp)); } =20 + +static gboolean +get_display_info_cb(gint fd, GIOCondition condition, gpointer user_data) +{ + struct virtio_gpu_resp_display_info dpy_info =3D { {} }; + VuGpu *vg =3D user_data; + struct virtio_gpu_ctrl_command *cmd =3D QTAILQ_LAST(&vg->fenceq); + + g_debug("disp info cb"); + assert(cmd->cmd_hdr.type =3D=3D VIRTIO_GPU_CMD_GET_DISPLAY_INFO); + if (!vg_recv_msg(vg, VHOST_USER_GPU_GET_DISPLAY_INFO, + sizeof(dpy_info), &dpy_info)) { + return G_SOURCE_CONTINUE; + } + + QTAILQ_REMOVE(&vg->fenceq, cmd, next); + vg_ctrl_response(vg, cmd, &dpy_info.hdr, sizeof(dpy_info)); + + vg->wait_in =3D 0; + vg_handle_ctrl(&vg->dev.parent, 0); + + return G_SOURCE_REMOVE; +} + void vg_get_display_info(VuGpu *vg, struct virtio_gpu_ctrl_command *cmd) { - struct virtio_gpu_resp_display_info dpy_info =3D { {} }; VhostUserGpuMsg msg =3D { .request =3D VHOST_USER_GPU_GET_DISPLAY_INFO, .size =3D 0, @@ -273,11 +296,9 @@ vg_get_display_info(VuGpu *vg, struct virtio_gpu_ctrl_= command *cmd) assert(vg->wait_in =3D=3D 0); =20 vg_send_msg(vg, &msg, -1); - if (!vg_recv_msg(vg, msg.request, sizeof(dpy_info), &dpy_info)) { - return; - } - - vg_ctrl_response(vg, cmd, &dpy_info.hdr, sizeof(dpy_info)); + vg->wait_in =3D g_unix_fd_add(vg->sock_fd, G_IO_IN | G_IO_HUP, + get_display_info_cb, vg); + cmd->state =3D VG_CMD_STATE_PENDING; } =20 static void --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436409; cv=none; d=zohomail.com; s=zohoarc; b=XVYW53ijdb5ZKKUPL3d0jatib5UakKHfV3GBKlIfAYtRQYvIcErrRvcVucbCXa3HCeulYaZHV7GaBoTbLx/xTrVLVGLbNle4g+ex6yl8DZ5idFogMXidT+Zc5DVTymHiXpoIzrlMmzbneX2EVLcUoCMD/FDuK5VaxpxRbB+H0uM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436409; 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=zunxw6yF88ILKrQTkQaQG+MuxNlRhuf4zon9WKmeQZ4=; b=TefYDzx6jWE3EA322MQRVGA4FD4ztltZ7j0klHf2t88MJ2JaQ2GKLBWofeOAMsPur9Km2Ze8gwuIInOFvYqNtXhfeVPBQzTBYJuRUO/Whev/YAYaWhT90N7ezxzQoOyNR0RfoWDqT/jWdSQ1JkKzv/+R4KxLh+THKy+pCx3MTN8= 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 1612436409343948.60661816082; Thu, 4 Feb 2021 03:00:09 -0800 (PST) Received: from localhost ([::1]:45266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cMp-0007i2-SX for importer@patchew.org; Thu, 04 Feb 2021 06:00:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cGc-0006Hi-V0 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cGb-0007fc-Aj for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:53:42 -0500 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-530-9WjAs6e0OB-F0BUJ_9aJ7w-1; Thu, 04 Feb 2021 05:53:38 -0500 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 12FDD8030BC for ; Thu, 4 Feb 2021 10:53:38 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id A764777BF8; Thu, 4 Feb 2021 10:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436020; 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=zunxw6yF88ILKrQTkQaQG+MuxNlRhuf4zon9WKmeQZ4=; b=WfkAhLUNqswENFE3H1J4uyJKHzNFUROLb/EPM9QNgU4MW1PC2wt4L0X9aoCIfWyb/5mj/r uTpq1Km2jM5tNFDlJGtzmYjGev3nY5D+sqXJVV0uQULaVGDHqGWwdyVF/IiQL9vPiZKWRs dZrffVRCfQj/yRxmi3Dp/f4XatdHTnM= X-MC-Unique: 9WjAs6e0OB-F0BUJ_9aJ7w-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 05/20] ui: remove extra #ifdef CONFIG_OPENGL Date: Thu, 4 Feb 2021 14:52:17 +0400 Message-Id: <20210204105232.834642-6-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Since commit 5cb69566daa8081abb82a13403dcc0fffed02007 ("gtk: remove CONFIG_GTK_GL"), some #ifdef are redundants. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/gtk.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 26665cd2e6..e1ee0840b3 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -625,8 +625,6 @@ static const DisplayChangeListenerOps dcl_ops =3D { =20 /** DisplayState Callbacks (opengl version) **/ =20 -#if defined(CONFIG_OPENGL) - static const DisplayChangeListenerOps dcl_gl_area_ops =3D { .dpy_name =3D "gtk-egl", .dpy_gfx_update =3D gd_gl_area_update, @@ -644,8 +642,6 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = =3D { .dpy_gl_update =3D gd_gl_area_scanout_flush, }; =20 -#endif /* CONFIG_OPENGL */ - static const DisplayChangeListenerOps dcl_egl_ops =3D { .dpy_name =3D "gtk-egl", .dpy_gfx_update =3D gd_egl_update, @@ -1993,13 +1989,10 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, V= irtualConsole *vc, =20 #if defined(CONFIG_OPENGL) if (display_opengl) { -#if defined(CONFIG_OPENGL) if (gtk_use_gl_area) { vc->gfx.drawing_area =3D gtk_gl_area_new(); vc->gfx.dcl.ops =3D &dcl_gl_area_ops; - } else -#endif /* CONFIG_OPENGL */ - { + } else { vc->gfx.drawing_area =3D gtk_drawing_area_new(); /* * gtk_widget_set_double_buffered() was deprecated in 3.14. --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436143; cv=none; d=zohomail.com; s=zohoarc; b=XDlmxOEzeIlISByLdHZWfWbQCuMcHNqIKjXRVFuoWphqOf1BWgJAItljnbRF5LIZq8r3vgvGQVhqauMpQGy0WWQGl/vEantaGQUH9F5i9WX2GkvWwzFZblcU1afcxco2BJkEM/GUhM8btizv7ImxT6Qvv2GvDKW6PHQbnMUl1a0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436143; 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=Ufzcxut9hqsDbgsGTw4h3BfUlLSPZwvpQca4XVetbak=; b=cAZC3XsVFiOAJ6LoNlxcMl5SZmMWWqpqZBV68mFSIGWLYUSC8ddMVncu3u/ojgHMUw86ARsL1hdLLxX3J3rOgUTn+g0YP7nqlEw5sO7prtJfqZcrwI8EqN8FFqpag/eL/n2oAmWCGX/dX1wC7xC4Vhvec3DpZFbVVtC/msQ54/Q= 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 1612436143572757.0895175816433; Thu, 4 Feb 2021 02:55:43 -0800 (PST) Received: from localhost ([::1]:54558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cIY-0008KG-Dc for importer@patchew.org; Thu, 04 Feb 2021 05:55:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cGu-0006ai-EH for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32319) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cGs-0007n7-FY for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:00 -0500 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-178-WSHMVjhjPICGdWorSw-Yyw-1; Thu, 04 Feb 2021 05:53:56 -0500 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 207091084D9E for ; Thu, 4 Feb 2021 10:53:55 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19DD95B695; Thu, 4 Feb 2021 10:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436037; 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=Ufzcxut9hqsDbgsGTw4h3BfUlLSPZwvpQca4XVetbak=; b=NCkRYc9ehTE4jMVXmrtr9aD1P1qC8iKBjYrPQnvdEiidFtwRDQNAYUxwVB7EXGhYQpsm+A EYt/jT9jx7Lk95F/FURYoprKE67fsnztrF8YUHpW62ahFLDfUIojnLo7JjqLk1ibR8GOjt iUX1HT34ZeVpZhlFuZEN6HyyMfDlh7Y= X-MC-Unique: WSHMVjhjPICGdWorSw-Yyw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 06/20] ui: remove gl_ctx_get_current Date: Thu, 4 Feb 2021 14:52:18 +0400 Message-Id: <20210204105232.834642-7-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau There are no users left. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 2 -- include/ui/egl-context.h | 1 - include/ui/sdl2.h | 1 - ui/console.c | 6 ------ ui/egl-context.c | 5 ----- ui/egl-headless.c | 1 - ui/gtk.c | 2 -- ui/sdl2-gl.c | 8 -------- ui/sdl2.c | 1 - ui/spice-display.c | 1 - 10 files changed, 28 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 7a3fc11abf..ce6c72e37c 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -201,7 +201,6 @@ typedef struct DisplayChangeListenerOps { QEMUGLContext ctx); int (*dpy_gl_ctx_make_current)(DisplayChangeListener *dcl, QEMUGLContext ctx); - QEMUGLContext (*dpy_gl_ctx_get_current)(DisplayChangeListener *dcl); =20 void (*dpy_gl_scanout_disable)(DisplayChangeListener *dcl); void (*dpy_gl_scanout_texture)(DisplayChangeListener *dcl, @@ -303,7 +302,6 @@ QEMUGLContext dpy_gl_ctx_create(QemuConsole *con, QEMUGLParams *params); void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext ctx); int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx); -QEMUGLContext dpy_gl_ctx_get_current(QemuConsole *con); =20 bool console_has_gl(QemuConsole *con); bool console_has_gl_dmabuf(QemuConsole *con); diff --git a/include/ui/egl-context.h b/include/ui/egl-context.h index f004ce11a7..9374fe41e3 100644 --- a/include/ui/egl-context.h +++ b/include/ui/egl-context.h @@ -9,6 +9,5 @@ QEMUGLContext qemu_egl_create_context(DisplayChangeListener= *dcl, void qemu_egl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ct= x); int qemu_egl_make_context_current(DisplayChangeListener *dcl, QEMUGLContext ctx); -QEMUGLContext qemu_egl_get_current_context(DisplayChangeListener *dcl); =20 #endif /* EGL_CONTEXT_H */ diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index 0875b8d56b..f85c117a78 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -70,7 +70,6 @@ QEMUGLContext sdl2_gl_create_context(DisplayChangeListene= r *dcl, void sdl2_gl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx= ); int sdl2_gl_make_context_current(DisplayChangeListener *dcl, QEMUGLContext ctx); -QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl); =20 void sdl2_gl_scanout_disable(DisplayChangeListener *dcl); void sdl2_gl_scanout_texture(DisplayChangeListener *dcl, diff --git a/ui/console.c b/ui/console.c index d80ce7037c..c0b1a3689c 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1803,12 +1803,6 @@ int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGL= Context ctx) return con->gl->ops->dpy_gl_ctx_make_current(con->gl, ctx); } =20 -QEMUGLContext dpy_gl_ctx_get_current(QemuConsole *con) -{ - assert(con->gl); - return con->gl->ops->dpy_gl_ctx_get_current(con->gl); -} - void dpy_gl_scanout_disable(QemuConsole *con) { assert(con->gl); diff --git a/ui/egl-context.c b/ui/egl-context.c index 4aa1cbb50c..368ffa49d8 100644 --- a/ui/egl-context.c +++ b/ui/egl-context.c @@ -35,8 +35,3 @@ int qemu_egl_make_context_current(DisplayChangeListener *= dcl, return eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx); } - -QEMUGLContext qemu_egl_get_current_context(DisplayChangeListener *dcl) -{ - return eglGetCurrentContext(); -} diff --git a/ui/egl-headless.c b/ui/egl-headless.c index fe2a0d1eab..da377a74af 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -160,7 +160,6 @@ static const DisplayChangeListenerOps egl_ops =3D { .dpy_gl_ctx_create =3D egl_create_context, .dpy_gl_ctx_destroy =3D qemu_egl_destroy_context, .dpy_gl_ctx_make_current =3D qemu_egl_make_context_current, - .dpy_gl_ctx_get_current =3D qemu_egl_get_current_context, =20 .dpy_gl_scanout_disable =3D egl_scanout_disable, .dpy_gl_scanout_texture =3D egl_scanout_texture, diff --git a/ui/gtk.c b/ui/gtk.c index e1ee0840b3..a0e6b60ac4 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -637,7 +637,6 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = =3D { .dpy_gl_ctx_create =3D gd_gl_area_create_context, .dpy_gl_ctx_destroy =3D gd_gl_area_destroy_context, .dpy_gl_ctx_make_current =3D gd_gl_area_make_current, - .dpy_gl_ctx_get_current =3D gd_gl_area_get_current_context, .dpy_gl_scanout_texture =3D gd_gl_area_scanout_texture, .dpy_gl_update =3D gd_gl_area_scanout_flush, }; @@ -654,7 +653,6 @@ static const DisplayChangeListenerOps dcl_egl_ops =3D { .dpy_gl_ctx_create =3D gd_egl_create_context, .dpy_gl_ctx_destroy =3D qemu_egl_destroy_context, .dpy_gl_ctx_make_current =3D gd_egl_make_current, - .dpy_gl_ctx_get_current =3D qemu_egl_get_current_context, .dpy_gl_scanout_disable =3D gd_egl_scanout_disable, .dpy_gl_scanout_texture =3D gd_egl_scanout_texture, .dpy_gl_scanout_dmabuf =3D gd_egl_scanout_dmabuf, diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index c73d273bf8..82139ba49e 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -185,14 +185,6 @@ int sdl2_gl_make_context_current(DisplayChangeListener= *dcl, return SDL_GL_MakeCurrent(scon->real_window, sdlctx); } =20 -QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl) -{ - SDL_GLContext sdlctx; - - sdlctx =3D SDL_GL_GetCurrentContext(); - return (QEMUGLContext)sdlctx; -} - void sdl2_gl_scanout_disable(DisplayChangeListener *dcl) { struct sdl2_console *scon =3D container_of(dcl, struct sdl2_console, d= cl); diff --git a/ui/sdl2.c b/ui/sdl2.c index 5e49709283..a203cb0239 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -781,7 +781,6 @@ static const DisplayChangeListenerOps dcl_gl_ops =3D { .dpy_gl_ctx_create =3D sdl2_gl_create_context, .dpy_gl_ctx_destroy =3D sdl2_gl_destroy_context, .dpy_gl_ctx_make_current =3D sdl2_gl_make_context_current, - .dpy_gl_ctx_get_current =3D sdl2_gl_get_current_context, .dpy_gl_scanout_disable =3D sdl2_gl_scanout_disable, .dpy_gl_scanout_texture =3D sdl2_gl_scanout_texture, .dpy_gl_update =3D sdl2_gl_scanout_flush, diff --git a/ui/spice-display.c b/ui/spice-display.c index 0178d5766d..6a5e189a67 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -1102,7 +1102,6 @@ static const DisplayChangeListenerOps display_listene= r_gl_ops =3D { .dpy_gl_ctx_create =3D qemu_spice_gl_create_context, .dpy_gl_ctx_destroy =3D qemu_egl_destroy_context, .dpy_gl_ctx_make_current =3D qemu_egl_make_context_current, - .dpy_gl_ctx_get_current =3D qemu_egl_get_current_context, =20 .dpy_gl_scanout_disable =3D qemu_spice_gl_scanout_disable, .dpy_gl_scanout_texture =3D qemu_spice_gl_scanout_texture, --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436670; cv=none; d=zohomail.com; s=zohoarc; b=Rx6oAhBfe6lSD9UmDHkbMVfky5z55kZG2hMnAluw5Ua95/mFRz74Bm/CGkN3HHccf5/dZn7YmmqiITPPC1dMmn+sugk5GMlnanIhmmNRpFUyO/CvgkRFsj2yLKKYKJptOFYi8dEb6axkOfjnfR7Z32zprsOoMnCU4mimZPNnQdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436670; 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=gqma0burnlHUoNw3xXyxvaS56E6bstS4Ok5rSSzEyj8=; b=CTTru5FMJ8FxOiLYFLVYF1uVXOxwLEzswKFC0sFGtRMWGbee8djs9R+dXdzl8qBoU4YFxiN1MLehy9l+5Nws74fuDuLWECAYzxfD0x1AQPluzkGpx9SPz1HvbX6oLaP131ZR9mjoZ+I8LuiNpu5eWB0Kyiuwmnewy9yEDDBu0YY= 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 1612436670956841.808983455704; Thu, 4 Feb 2021 03:04:30 -0800 (PST) Received: from localhost ([::1]:56748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cR3-0004CH-Ep for importer@patchew.org; Thu, 04 Feb 2021 06:04:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cH8-0006pk-Aa for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59187) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cH6-0007tW-5t for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:14 -0500 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-582-6dQXFgj0NoaQLUkzAYPt9Q-1; Thu, 04 Feb 2021 05:54:09 -0500 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 D07CB195D560 for ; Thu, 4 Feb 2021 10:54:08 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 715EC5D9EF; Thu, 4 Feb 2021 10:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436051; 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=gqma0burnlHUoNw3xXyxvaS56E6bstS4Ok5rSSzEyj8=; b=Dvw/nPVKwBijD5yB873XsA6J7QhnYtAP9C4bWzyPdR51faasvAzFfQKE67Td6MXBmO/0gs DWkQK8oEwvu6T2o8U2T/rA4UI0HmH5ujb1NbgAYWqtf/RftowrDInmEHc8LKI3/IhIhWLO ziCFNwirgBecwIsgVOONbPA9jSHDcNo= X-MC-Unique: 6dQXFgj0NoaQLUkzAYPt9Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 07/20] ui: add gd_gl_area_scanout_disable Date: Thu, 4 Feb 2021 14:52:19 +0400 Message-Id: <20210204105232.834642-8-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Require the callback, drop the fallback path. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/gtk.h | 1 + ui/console.c | 7 +------ ui/gtk-gl-area.c | 7 +++++++ ui/gtk.c | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 3f395d7f94..7569d090fa 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -140,6 +140,7 @@ void gd_gl_area_scanout_texture(DisplayChangeListener *= dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h); +void gd_gl_area_scanout_disable(DisplayChangeListener *dcl); void gd_gl_area_scanout_flush(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t= h); void gtk_gl_area_init(void); diff --git a/ui/console.c b/ui/console.c index c0b1a3689c..ab9224429e 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1806,12 +1806,7 @@ int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGL= Context ctx) void dpy_gl_scanout_disable(QemuConsole *con) { assert(con->gl); - if (con->gl->ops->dpy_gl_scanout_disable) { - con->gl->ops->dpy_gl_scanout_disable(con->gl); - } else { - con->gl->ops->dpy_gl_scanout_texture(con->gl, 0, false, 0, 0, - 0, 0, 0, 0); - } + con->gl->ops->dpy_gl_scanout_disable(con->gl); } =20 void dpy_gl_scanout_texture(QemuConsole *con, diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 98c22d23f5..96fbe75387 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -198,6 +198,13 @@ void gd_gl_area_scanout_texture(DisplayChangeListener = *dcl, backing_id, false); } =20 +void gd_gl_area_scanout_disable(DisplayChangeListener *dcl) +{ + VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); + + gtk_gl_area_set_scanout_mode(vc, false); +} + void gd_gl_area_scanout_flush(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h) { diff --git a/ui/gtk.c b/ui/gtk.c index a0e6b60ac4..00045881b1 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -638,6 +638,7 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = =3D { .dpy_gl_ctx_destroy =3D gd_gl_area_destroy_context, .dpy_gl_ctx_make_current =3D gd_gl_area_make_current, .dpy_gl_scanout_texture =3D gd_gl_area_scanout_texture, + .dpy_gl_scanout_disable =3D gd_gl_area_scanout_disable, .dpy_gl_update =3D gd_gl_area_scanout_flush, }; =20 --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436262; cv=none; d=zohomail.com; s=zohoarc; b=QYCDW7lyVUxoJL4jPm02SD+BfTxe5h6CWVL+0OYW7/saqmGiwOR6eA+njWn7KCg/wGrDvBpK758I3ZvvR8NyaXkEI3B+k7Veg3weM6MTnF8tDvP8x1fRwchyk2Q1MkH7BnaZz42ov9VUDmObbEQLehKdGkWD3tgfvzJGj7D6YCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436262; 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=cUzDXpRqEv5VZgfSoKIGtEVGT6KJtVlzOdFvjwVT2vE=; b=do8lZBdfu9YPMFQDLGSw9QaSCY2q7EXmPPTLcEDTrpSYF75siScY9ygpDYppLCZy4PKjsyuTmPr/OJys51NtG+YBoMQwa4wplXx/IgSJHfPjuWiVAekGeMuk5MuRGzQgZqGFUs01bopNw2ia2W0jAxB50NQSDEaSCctY6O9/58c= 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 161243626239433.38983941591141; Thu, 4 Feb 2021 02:57:42 -0800 (PST) Received: from localhost ([::1]:34938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cKT-0003UN-7k for importer@patchew.org; Thu, 04 Feb 2021 05:57:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cHJ-00072t-27 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29902) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cHH-0007zn-BP for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:24 -0500 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-595-QebEVOLEPnOoHe-IJTYOxg-1; Thu, 04 Feb 2021 05:54:21 -0500 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 3679A107ACE3 for ; Thu, 4 Feb 2021 10:54:20 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4659E722CF; Thu, 4 Feb 2021 10:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436062; 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=cUzDXpRqEv5VZgfSoKIGtEVGT6KJtVlzOdFvjwVT2vE=; b=alETCbFCuekOoBHwSCMHpDspR2oI8TQnGNi3W2U3eu2oY2rTJ0tZZQYyGy/dE8AjtsYFgt 3HSrLiG9s3WHSEYu0XfuRPSRoBYWukWfnldRAS9Y171elw6oULuMdzJDP3D4oeRTeAlwO9 YH1PYLXcDNre/ewARkE2m7Z2UD/jE8k= X-MC-Unique: QebEVOLEPnOoHe-IJTYOxg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 08/20] ui: annotate DCLOps callback requirements Date: Thu, 4 Feb 2021 14:52:20 +0400 Message-Id: <20210204105232.834642-9-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index ce6c72e37c..bea2b6329a 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -174,35 +174,49 @@ typedef struct DisplayState DisplayState; typedef struct DisplayChangeListenerOps { const char *dpy_name; =20 + /* optional */ void (*dpy_refresh)(DisplayChangeListener *dcl); =20 + /* optional */ void (*dpy_gfx_update)(DisplayChangeListener *dcl, int x, int y, int w, int h); + /* optional */ void (*dpy_gfx_switch)(DisplayChangeListener *dcl, struct DisplaySurface *new_surface); + /* optional */ bool (*dpy_gfx_check_format)(DisplayChangeListener *dcl, pixman_format_code_t format); =20 + /* optional */ void (*dpy_text_cursor)(DisplayChangeListener *dcl, int x, int y); + /* optional */ void (*dpy_text_resize)(DisplayChangeListener *dcl, int w, int h); + /* optional */ void (*dpy_text_update)(DisplayChangeListener *dcl, int x, int y, int w, int h); =20 + /* optional */ void (*dpy_mouse_set)(DisplayChangeListener *dcl, int x, int y, int on); + /* optional */ void (*dpy_cursor_define)(DisplayChangeListener *dcl, QEMUCursor *cursor); =20 + /* required if GL */ QEMUGLContext (*dpy_gl_ctx_create)(DisplayChangeListener *dcl, QEMUGLParams *params); + /* required if GL */ void (*dpy_gl_ctx_destroy)(DisplayChangeListener *dcl, QEMUGLContext ctx); + /* required if GL */ int (*dpy_gl_ctx_make_current)(DisplayChangeListener *dcl, QEMUGLContext ctx); =20 + /* required if GL */ void (*dpy_gl_scanout_disable)(DisplayChangeListener *dcl); + /* required if GL */ void (*dpy_gl_scanout_texture)(DisplayChangeListener *dcl, uint32_t backing_id, bool backing_y_0_top, @@ -210,15 +224,20 @@ typedef struct DisplayChangeListenerOps { uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h); + /* optional */ void (*dpy_gl_scanout_dmabuf)(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf); + /* optional */ void (*dpy_gl_cursor_dmabuf)(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf, bool have_hot, uint32_t hot_x, uint32_t hot_y); + /* optional */ void (*dpy_gl_cursor_position)(DisplayChangeListener *dcl, uint32_t pos_x, uint32_t pos_y); + /* optional */ void (*dpy_gl_release_dmabuf)(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf); + /* required if GL */ void (*dpy_gl_update)(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); =20 --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436834; cv=none; d=zohomail.com; s=zohoarc; b=G+q3YwkdTyr/8QCI/rk/vy1pQqaf/sabLamKF/d8STt/LCKIMPTw7Jhj5k3+XVbExWA62MART9n6y3JHBpgTnD2DfJCAtBymUpmfvyXRJf+y4gqEncFEPT0NJFfQQzh+XoFw3HDh8va89WqoVzYgAMfI79Z8ExCcqL/0oXGZFlg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436834; 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=eb2CGzD3TyOgBuW3soHR73dC4rDlZH0FmrocXLTMxhI=; b=d5mLwZN7StI7C2Jz0OBC/TLvaYp/h7uC5euX6R3u9gqGQNEgdShPswM7uWBF7MdubUYUSLlozYWBWp6tE7u47r76Nx6zCOJnY3I8hd1WZWORq6dtqSwCYF8PXzObo2T7sFGguysh2nxcVvXEH053XMb2hrY6xBgUw6iMMlvf8sk= 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 1612436834501708.9918860925059; Thu, 4 Feb 2021 03:07:14 -0800 (PST) Received: from localhost ([::1]:36518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cTh-0007cm-Cu for importer@patchew.org; Thu, 04 Feb 2021 06:07:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cHW-0007XQ-9K for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21021) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cHU-00087W-Fz for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:38 -0500 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-531-Sv5vAkHkMiiUGgSvgjavPg-1; Thu, 04 Feb 2021 05:54:34 -0500 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 54918195D562 for ; Thu, 4 Feb 2021 10:54:33 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 547EF60C78; Thu, 4 Feb 2021 10:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436075; 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=eb2CGzD3TyOgBuW3soHR73dC4rDlZH0FmrocXLTMxhI=; b=aE59vPKuzaq3ir6h52JnCiuw6bvjVk1X86+GZATNI8zGhMWprq0Zx4mTWwLIliFudKy0XK PRWwd4kY/r0mUiYAYLh8XZaP6OIQCS+xOs7NcdkQqnam/X+aVhXrPZM4b8uBQkFnG2VAkf e0TzqHDXCkkkorxHZSkakDzwral3jhU= X-MC-Unique: Sv5vAkHkMiiUGgSvgjavPg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 09/20] ui: remove console_has_gl_dmabuf() Date: Thu, 4 Feb 2021 14:52:21 +0400 Message-Id: <20210204105232.834642-10-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau This check is currently limited. It only is used by vhost-user-gpu (not by vfio-display), and will print an error repeatedly during run-time. We are going to dissociate the GL context from the DisplayChangeListener, and listeners may come and go. The following patches will address this differently. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 1 - hw/display/vhost-user-gpu.c | 5 ----- ui/console.c | 5 ----- 3 files changed, 11 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index bea2b6329a..ac989fdf70 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -323,7 +323,6 @@ void dpy_gl_ctx_destroy(QemuConsole *con, QEMUGLContext= ctx); int dpy_gl_ctx_make_current(QemuConsole *con, QEMUGLContext ctx); =20 bool console_has_gl(QemuConsole *con); -bool console_has_gl_dmabuf(QemuConsole *con); =20 static inline int surface_stride(DisplaySurface *s) { diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 55b0ed15f2..dd587436ff 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -224,11 +224,6 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUs= erGpuMsg *msg) close(dmabuf->fd); dmabuf->fd =3D -1; } - if (!console_has_gl_dmabuf(con)) { - /* it would be nice to report that error earlier */ - error_report("console doesn't support dmabuf!"); - break; - } dpy_gl_release_dmabuf(con, dmabuf); if (fd =3D=3D -1) { dpy_gl_scanout_disable(con); diff --git a/ui/console.c b/ui/console.c index ab9224429e..b5bc3f7699 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1463,11 +1463,6 @@ bool console_has_gl(QemuConsole *con) return con->gl !=3D NULL; } =20 -bool console_has_gl_dmabuf(QemuConsole *con) -{ - return con->gl !=3D NULL && con->gl->ops->dpy_gl_scanout_dmabuf !=3D N= ULL; -} - void register_displaychangelistener(DisplayChangeListener *dcl) { static const char nodev[] =3D --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436369; cv=none; d=zohomail.com; s=zohoarc; b=ZsOXZgq5UVgLMJ4jLGrT/g81vRqBKy1Kga6Qy8OK6TXE7LvuG7G6QfOoIP+i68gkNIA2zZKVS76lPcB0rX1AhkjI6RUOe4i8nLcJeamVnMh+AMiGiYNqWYDE+2hFzldlEcBE5/rDdiZLEYUjhDyr6RFcPSfUdDkfa2O699V2Psg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436369; 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=dIyy5vmNRolTVyHmnt4JivqphRRjGpYRnUmqFs8/g84=; b=OZ22g+rcR4GKimdStaYkmlpmevlrOXqSOc7Kw9qvmD1ahLYnqdwMdA6LaKktSbcnmVoKBaeQnBnWRT5oaRWNItDvFLtXKglP3BpiiW/drU81mWTputfvM6mAMuU58qRwHOq+qQ84h37uEnanKu3Jx3MXlWVeIqplkVrVV3EDS8U= 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 1612436369113853.5718243168865; Thu, 4 Feb 2021 02:59:29 -0800 (PST) Received: from localhost ([::1]:43534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cMA-0006x6-1J for importer@patchew.org; Thu, 04 Feb 2021 05:59:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cHh-0007zS-3I for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29281) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cHf-0008FH-Bq for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:48 -0500 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-387-UU89KUyqNfaMxVVvuT1QMA-1; Thu, 04 Feb 2021 05:54:45 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9569B195D566 for ; Thu, 4 Feb 2021 10:54:44 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 562345FC3A; Thu, 4 Feb 2021 10:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436086; 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=dIyy5vmNRolTVyHmnt4JivqphRRjGpYRnUmqFs8/g84=; b=MGjm3o7nObF1q4fehvclGPxC1CVqPomkUyTUQab/n6zXgLFWOgfsC+nNCYnDNM4RaaPYA+ 5mzj+roVxe1ke3Yd5sKJP8R9fAhEQunTHe8eZtFtoa4vbrrZefEKg0E1owzv94TTop+Bwb wIDTPDbqYghM3CFMhj3nrRg5u3Nb2xo= X-MC-Unique: UU89KUyqNfaMxVVvuT1QMA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 10/20] vhost-user-gpu: add a configuration flag for dmabuf usage Date: Thu, 4 Feb 2021 14:52:22 +0400 Message-Id: <20210204105232.834642-11-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Let's inform VirtioGPUBase that vhost-user-gpu require DMABUF messages. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/virtio/virtio-gpu.h | 3 +++ hw/display/vhost-user-gpu.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 1aed7275c8..4f3dbf79f9 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -71,6 +71,7 @@ enum virtio_gpu_base_conf_flags { VIRTIO_GPU_FLAG_VIRGL_ENABLED =3D 1, VIRTIO_GPU_FLAG_STATS_ENABLED, VIRTIO_GPU_FLAG_EDID_ENABLED, + VIRTIO_GPU_FLAG_DMABUF_ENABLED, }; =20 #define virtio_gpu_virgl_enabled(_cfg) \ @@ -79,6 +80,8 @@ enum virtio_gpu_base_conf_flags { (_cfg.flags & (1 << VIRTIO_GPU_FLAG_STATS_ENABLED)) #define virtio_gpu_edid_enabled(_cfg) \ (_cfg.flags & (1 << VIRTIO_GPU_FLAG_EDID_ENABLED)) +#define virtio_gpu_dmabuf_enabled(_cfg) \ + (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DMABUF_ENABLED)) =20 struct virtio_gpu_base_conf { uint32_t max_outputs; diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index dd587436ff..b7bde9feb6 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -547,6 +547,8 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error = **errp) return; } =20 + /* existing backend may send DMABUF, so let's add that requirement */ + g->parent_obj.conf.flags |=3D 1 << VIRTIO_GPU_FLAG_DMABUF_ENABLED; if (virtio_has_feature(g->vhost->dev.features, VIRTIO_GPU_F_VIRGL)) { g->parent_obj.conf.flags |=3D 1 << VIRTIO_GPU_FLAG_VIRGL_ENABLED; } --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436289; cv=none; d=zohomail.com; s=zohoarc; b=R5yb533RFfugvg93ZuWeIblQQy9Uh4wZZkszdS9tW/ovd12g2SrOLHndIp9HxlrXxGawoDq21vru8Bxwg9xSCY4jpwlu7If5ntdzOfZ7PIj8sR1WbALgWjNaSBNgmmZbtuIpi20vlWI32QRSkHU1RzPY0IPbD4VRZqDy6CB3WEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436289; 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=yde8X9XnmKn2gyM1YtGKEctJEWrVEdKdCqcaQ86u+Kk=; b=P3UL4yH/KKNDa41xkAN+VTnFO/oYpff5GAcfg+ozn4TOqPMSbOhRsCYrKKnq9SbSMp7S2WkvaBlGqX/dbIMuG19cK3ETpBfh6XL3gEdvTrCLFpGvAqSK9w6mb35QX0ND7jDw93JcM3H50vpvIZ2jXElWtXv5EPMFJIloTVfFis0= 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 1612436289364133.07088143741987; Thu, 4 Feb 2021 02:58:09 -0800 (PST) Received: from localhost ([::1]:37886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cKu-0004g0-9t for importer@patchew.org; Thu, 04 Feb 2021 05:58:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cHm-0008Eg-SK for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cHk-0008I0-W4 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:54:54 -0500 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-31-RnZtLy4XNd2ZRAjgDhi7ng-1; Thu, 04 Feb 2021 05:54:50 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3221874983 for ; Thu, 4 Feb 2021 10:54:49 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id C99215FC3A; Thu, 4 Feb 2021 10:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436092; 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=yde8X9XnmKn2gyM1YtGKEctJEWrVEdKdCqcaQ86u+Kk=; b=O4jZdQP/dYk1tuOXAC07hBlS/3X3a0QQ6lTs71cH5BZ5xGOdBxdFX1ZiMTys5ykEae9hE1 wD4xv1W0idxjn4Jb2gXQFV5Bl+fZFKT8NMyKu9IpgpFBzhTMFhrlxEIlCMDPZQ2TzYNlWv KHIQ+gPNKDw8UHQAIW8WwbLAZ0l5oHE= X-MC-Unique: RnZtLy4XNd2ZRAjgDhi7ng-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 11/20] ui: add an optional get_flags callback to GraphicHwOps Date: Thu, 4 Feb 2021 14:52:23 +0400 Message-Id: <20210204105232.834642-12-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Those flags can be used to express different requirements for the display or other needs. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 9 +++++++++ hw/display/virtio-gpu-base.c | 18 ++++++++++++++++++ hw/display/virtio-vga.c | 9 +++++++++ hw/vfio/display.c | 6 ++++++ 4 files changed, 42 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index ac989fdf70..0595aa9953 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -368,7 +368,16 @@ static inline void console_write_ch(console_ch_t *dest= , uint32_t ch) *dest =3D ch; } =20 +enum { + GRAPHIC_FLAGS_NONE =3D 0, + /* require a console/display with GL callbacks */ + GRAPHIC_FLAGS_GL =3D 1 << 0, + /* require a console/display with DMABUF import */ + GRAPHIC_FLAGS_DMABUF =3D 1 << 1, +}; + typedef struct GraphicHwOps { + int (*get_flags)(void *opaque); /* optional, default 0 */ void (*invalidate)(void *opaque); void (*gfx_update)(void *opaque); bool gfx_update_async; /* if true, calls graphic_hw_update_done() */ diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 40ccd00f94..f27a6fbe75 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -114,7 +114,25 @@ virtio_gpu_gl_block(void *opaque, bool block) } } =20 +static int +virtio_gpu_get_flags(void *opaque) +{ + VirtIOGPUBase *g =3D opaque; + int flags =3D GRAPHIC_FLAGS_NONE; + + if (virtio_gpu_virgl_enabled(g->conf)) { + flags |=3D GRAPHIC_FLAGS_GL; + } + + if (virtio_gpu_dmabuf_enabled(g->conf)) { + flags |=3D GRAPHIC_FLAGS_DMABUF; + } + + return flags; +} + static const GraphicHwOps virtio_gpu_ops =3D { + .get_flags =3D virtio_gpu_get_flags, .invalidate =3D virtio_gpu_invalidate_display, .gfx_update =3D virtio_gpu_update_display, .text_update =3D virtio_gpu_text_update, diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 81f776ee36..b071909b68 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -68,7 +68,16 @@ static void virtio_vga_base_gl_block(void *opaque, bool = block) } } =20 +static int virtio_vga_base_get_flags(void *opaque) +{ + VirtIOVGABase *vvga =3D opaque; + VirtIOGPUBase *g =3D vvga->vgpu; + + return g->hw_ops->get_flags(g); +} + static const GraphicHwOps virtio_vga_base_ops =3D { + .get_flags =3D virtio_vga_base_get_flags, .invalidate =3D virtio_vga_base_invalidate_display, .gfx_update =3D virtio_vga_base_update_display, .text_update =3D virtio_vga_base_text_update, diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 42d67e870b..f04473e3ce 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -335,7 +335,13 @@ static void vfio_display_dmabuf_update(void *opaque) } } =20 +static int vfio_display_get_flags(void *opaque) +{ + return GRAPHIC_FLAGS_GL | GRAPHIC_FLAGS_DMABUF; +} + static const GraphicHwOps vfio_display_dmabuf_ops =3D { + .get_flags =3D vfio_display_get_flags, .gfx_update =3D vfio_display_dmabuf_update, .ui_info =3D vfio_display_edid_ui_info, }; --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436320; cv=none; d=zohomail.com; s=zohoarc; b=JjeM2hBWXJpXkpMI4RSwxkiHhSnyXhGlMTgF9zjXR99mLKaYWdUVRMvM80XNikowX+e56O7h6ny/9PxzHJ+0PgLDxtd31tcf8st18I4AFDWTH44pifha7cy6ge6KWKGyiCRf/mZapXqQKg8Mlq7c38j05qqaou4fOfB2gzd0ROU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436320; 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=CGEYaMdQF0uuuI2IAqAAi7C/Z/1gz+tjJgCi42jCNic=; b=jRi2U/rA7r4tIgXLesuI9zwtlhovr+HE+YW1Fk7+Nar4RSSYRPuObWnmkZgpU2znGtDs0u8OXbiojamXVL8x4EdFT+C57OZr03Gtmk448KeuL25MfX/ZfL1UVKQzdNV6bVq5Vpr+eiFRnSKA7z4aGvHz/D24KIFF3ixtMpBloCo= 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 1612436320437843.1388552291222; Thu, 4 Feb 2021 02:58:40 -0800 (PST) Received: from localhost ([::1]:39216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cLP-0005CX-FH for importer@patchew.org; Thu, 04 Feb 2021 05:58:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cHu-0008LX-2F for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51633) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cHp-0008JO-IR for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:00 -0500 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-27-Mt1jHjDHPW6jCIH5GQxxNQ-1; Thu, 04 Feb 2021 05:54:55 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 687C3874986 for ; Thu, 4 Feb 2021 10:54:54 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FEEE71C9C; Thu, 4 Feb 2021 10:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436097; 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=CGEYaMdQF0uuuI2IAqAAi7C/Z/1gz+tjJgCi42jCNic=; b=jFK2MnKn1GEm545G6heVixqmM0hL1E7FkJKd6ecP3E6mL3q3neICXr4MCorGN+D02kc41c ayuUop752qQjZA7IWBVstxGbiMySuGh6CaziY41/xwtKJpfpEsY1GYxRaw9PC31/n5iHZM z2+KeaK+r/U6+OUPBQ6gq6cHgpSzeaU= X-MC-Unique: Mt1jHjDHPW6jCIH5GQxxNQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 12/20] ui: add a DCLOps callback to check dmabuf support Date: Thu, 4 Feb 2021 14:52:24 +0400 Message-Id: <20210204105232.834642-13-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/console.h | 2 ++ ui/console.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index 0595aa9953..875885d9c7 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -224,6 +224,8 @@ typedef struct DisplayChangeListenerOps { uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h); + /* optional (default to true if has dpy_gl_scanout_dmabuf) */ + bool (*dpy_has_dmabuf)(DisplayChangeListener *dcl); /* optional */ void (*dpy_gl_scanout_dmabuf)(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf); diff --git a/ui/console.c b/ui/console.c index b5bc3f7699..a645418ada 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1463,6 +1463,19 @@ bool console_has_gl(QemuConsole *con) return con->gl !=3D NULL; } =20 +static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl) +{ + if (dcl->ops->dpy_has_dmabuf) { + return dcl->ops->dpy_has_dmabuf(dcl); + } + + if (dcl->ops->dpy_gl_scanout_dmabuf) { + return true; + } + + return false; +} + void register_displaychangelistener(DisplayChangeListener *dcl) { static const char nodev[] =3D --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436447; cv=none; d=zohomail.com; s=zohoarc; b=FuzNdro/bRqu8gcJ/2zv3jdT24qJbD7RUnjjZrogj2ZfRi8woiiDnXR+lQqbsGRUh4b75I7eyBBc+2h3jI+a+zhDVroTNjdyJygyrpXMWSP8UQFYZ6FLkbfqTBQcp0rM9hPe/DrfyVdEwT2tdD/H416iykaF+wd4VVPnv2sEshA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436447; 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=+qhXw4Teb4iB7F+1sn1YUEn7LdT1/1iDGCqwCLBci3Y=; b=cg7gyFZrQoJRlHwQmdUKUubealiippXX6hyRl6QTliAK43spyZavBEKuu3Ye/yTtqjxhK01CMivDUgXZsdpjgsDZ0+twjcqo/Q4oR1w9MDd9z8os3LGaQ/rkQhiVDcuBeftmaeVLOicaPj+OBcDMn41P4xrC/2OIEKKP3c/8zSs= 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 1612436446998697.0952136352344; Thu, 4 Feb 2021 03:00:46 -0800 (PST) Received: from localhost ([::1]:46282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cNQ-00088a-6c for importer@patchew.org; Thu, 04 Feb 2021 06:00:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cI2-0000B1-JF for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27554) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cI0-0008NU-Qw for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:10 -0500 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-247-sp4ZturWO_mJOW0rC6cZpQ-1; Thu, 04 Feb 2021 05:55:06 -0500 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 AA1F3801967 for ; Thu, 4 Feb 2021 10:55:05 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F9CC722E4; Thu, 4 Feb 2021 10:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436108; 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=+qhXw4Teb4iB7F+1sn1YUEn7LdT1/1iDGCqwCLBci3Y=; b=Omi/HR0rOqQi1kQk6cFZiRObbPdEPP8iriXq3T6/L6Lywr5Z+Cxs9ad0ycjT1ungXgCRLV dPd7eHjTUhvdROybzc2fdhDgUBNA5ERGo6uybIJJEp8aytD181rNxQgMgbZPrOTqZgAUAq PdXT6/bdnvUHO/OKzKWrhUHnOCgia74= X-MC-Unique: sp4ZturWO_mJOW0rC6cZpQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 13/20] ui: check hw requirements during DCL registration Date: Thu, 4 Feb 2021 14:52:25 +0400 Message-Id: <20210204105232.834642-14-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ui/console.c b/ui/console.c index a645418ada..d8cc640c28 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1476,12 +1476,37 @@ static bool displaychangelistener_has_dmabuf(Displa= yChangeListener *dcl) return false; } =20 +static bool dpy_compatible_with(QemuConsole *con, + DisplayChangeListener *dcl, Error **errp) +{ + ERRP_GUARD(); + int flags; + + flags =3D con->hw_ops->get_flags ? con->hw_ops->get_flags(con->hw) : 0; + + if (flags & GRAPHIC_FLAGS_GL && + !console_has_gl(con)) { + error_setg(errp, "The console requires a GL context."); + return false; + + } + + if (flags & GRAPHIC_FLAGS_DMABUF && + !displaychangelistener_has_dmabuf(dcl)) { + error_setg(errp, "The console requires display DMABUF support."); + return false; + } + + return true; +} + void register_displaychangelistener(DisplayChangeListener *dcl) { static const char nodev[] =3D "This VM has no graphic display device."; static DisplaySurface *dummy; QemuConsole *con; + Error *err =3D NULL; =20 assert(!dcl->ds); =20 @@ -1496,6 +1521,11 @@ void register_displaychangelistener(DisplayChangeLis= tener *dcl) dcl->con->gl =3D dcl; } =20 + if (dcl->con && !dpy_compatible_with(dcl->con, dcl, &err)) { + error_report_err(err); + exit(1); + } + trace_displaychangelistener_register(dcl, dcl->ops->dpy_name); dcl->ds =3D get_alloc_displaystate(); QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next); --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436604; cv=none; d=zohomail.com; s=zohoarc; b=MnaWNqjgKLrdVVE8/cJV7hybtuM34t/b8ZeXXKlGBOcRPg8RLzBpA72xjQ7i2ANGgCiGxTIqr6Ea8WzdoGvGRmGMSOtRg0ntgYk8xBafBvD51HXHI1ZrriTCPp6aR9o78B1G3JSEp0SWVdCQj/+uacqRAA2gIfQi4U7yoRsoGAk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436604; 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=Dou1qOpZaEkFXcKWgOv3gzF6OQH87OBQVOoeDaU0xPs=; b=ZeJCyNvr4mC/zA7md5HCUVIqK/XvayBzJE7L5m0F5DkzLp1JfyAal1Ad+X4vJROgbtFwai0uSs24QuqIS8XQJYb7DqKQlNVgDYquF6UdaDvJVnz+sH4Ta0GdChahjQ4JxTi3+efD7ugHVJGXRiyn6Td3VH75c/VbPCLF5yv7XoU= 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 1612436604274146.15450107010565; Thu, 4 Feb 2021 03:03:24 -0800 (PST) Received: from localhost ([::1]:51824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cPz-0002Bb-2I for importer@patchew.org; Thu, 04 Feb 2021 06:03:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cII-0000QN-Vp for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cIE-0008UC-7S for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:26 -0500 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-49-k6fhMOs7MDmcPHyPOJu1rQ-1; Thu, 04 Feb 2021 05:55:19 -0500 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 B2292107ACED for ; Thu, 4 Feb 2021 10:55:18 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A9B060C66; Thu, 4 Feb 2021 10:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436121; 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=Dou1qOpZaEkFXcKWgOv3gzF6OQH87OBQVOoeDaU0xPs=; b=LbnFiQWYfvr0yW7miiP9PcuTv81LJlGSaJXILLdqVeEvtSMSd6x2GYnYYhG5UzEdKSH0Ix 2HjmDpAw2TyXGbZbdyHOK1iFw2aQ+6O8yR6oeetovMum39WbuUdym9ONcAybXeuoUMzkEh P6XsT+JaKPzY84hymoRyWcAzgNa0s+k= X-MC-Unique: k6fhMOs7MDmcPHyPOJu1rQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 14/20] ui: add qemu_egl_has_dmabuf helper Date: Thu, 4 Feb 2021 14:52:26 +0400 Message-Id: <20210204105232.834642-15-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/egl-helpers.h | 1 + ui/egl-helpers.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h index 94a4b3e6f3..5b1f7fafe0 100644 --- a/include/ui/egl-helpers.h +++ b/include/ui/egl-helpers.h @@ -51,5 +51,6 @@ EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGL= NativeWindowType win); int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode); int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, DisplayGLMode mode); EGLContext qemu_egl_init_ctx(void); +bool qemu_egl_has_dmabuf(void); =20 #endif /* EGL_HELPERS_H */ diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 7c530c2825..73fe61f878 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -441,6 +441,16 @@ int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, D= isplayGLMode mode) #endif } =20 +bool qemu_egl_has_dmabuf(void) +{ + if (qemu_egl_display =3D=3D EGL_NO_DISPLAY) { + return false; + } + + return epoxy_has_egl_extension(qemu_egl_display, + "EGL_EXT_image_dma_buf_import"); +} + EGLContext qemu_egl_init_ctx(void) { static const EGLint ctx_att_core[] =3D { --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436490; cv=none; d=zohomail.com; s=zohoarc; b=AcVhzAdaJOu+upC9XQGVu2oDmxNvhRPgyM4vthj2m7mmnTZQk7V7BP7xIKCm1iMEVeic5fsTdLOUCorS196VACdNhmH8qvD07j8J9pPaBunHiAAtzD7jDjy1EAIE127H13cMCAwuVY0GJywwGLXvXif97riRNnuxewsyiAJludo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436490; 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=iAjgD2HxI5CRJrYmtMdOMhwLEqD+c2PlXBfujPZTe+8=; b=Xg41wcrSRaKcmBLAf6BhACZHo+IdZ6EIWXN7ODylxYJEzpFXm6Jhbp43ORMQKnUcsokOOoWUxHOjZJDQ+zrounbYU97pxK/fgKSh9ATrENO2ZyRZPU0gKGdxJUgisX9Xm1SXkyd7fsgl6fCIJtPN8ny92g+lb7rmRPqjxOPNRg4= 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 1612436490137912.790337535725; Thu, 4 Feb 2021 03:01:30 -0800 (PST) Received: from localhost ([::1]:47620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cO6-0000IV-Nx for importer@patchew.org; Thu, 04 Feb 2021 06:01:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cIU-0000UP-KX for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:33240) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cIR-0000A8-Ps for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:38 -0500 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-546-R4HwjlHqP0KEUraZ46zVvA-1; Thu, 04 Feb 2021 05:55:32 -0500 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 F12F2801960 for ; Thu, 4 Feb 2021 10:55:31 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id B015D10023B9; Thu, 4 Feb 2021 10:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436134; 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=iAjgD2HxI5CRJrYmtMdOMhwLEqD+c2PlXBfujPZTe+8=; b=EGSp8ocXbQm3fpugTuz5QkkX9nPBlQ/mIBbmt7Pq8tAqUalteLfXx9qUcmX48eldAme6ME vml1zmNqr3jLLfXaScV+2KK8pdZa9wMsz2YS1sHnzkuFSbW2+h/GqARuRROafbxkLrlK2g sE7fusj49qpH8MkHLMOE9juMnrUDIM4= X-MC-Unique: R4HwjlHqP0KEUraZ46zVvA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 15/20] ui: check gtk-egl dmabuf support Date: Thu, 4 Feb 2021 14:52:27 +0400 Message-Id: <20210204105232.834642-16-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/gtk.h | 1 + ui/gtk.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 7569d090fa..aaef884b95 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -48,6 +48,7 @@ typedef struct VirtualGfxConsole { int cursor_y; bool y0_top; bool scanout_mode; + bool has_dmabuf; #endif } VirtualGfxConsole; =20 diff --git a/ui/gtk.c b/ui/gtk.c index 00045881b1..f41c396cb9 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -623,6 +623,13 @@ static const DisplayChangeListenerOps dcl_ops =3D { =20 #if defined(CONFIG_OPENGL) =20 +static bool gd_has_dmabuf(DisplayChangeListener *dcl) +{ + VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); + + return vc->gfx.has_dmabuf; +} + /** DisplayState Callbacks (opengl version) **/ =20 static const DisplayChangeListenerOps dcl_gl_area_ops =3D { @@ -661,6 +668,7 @@ static const DisplayChangeListenerOps dcl_egl_ops =3D { .dpy_gl_cursor_position =3D gd_egl_cursor_position, .dpy_gl_release_dmabuf =3D gd_egl_release_dmabuf, .dpy_gl_update =3D gd_egl_scanout_flush, + .dpy_has_dmabuf =3D gd_has_dmabuf, }; =20 #endif /* CONFIG_OPENGL */ @@ -2004,6 +2012,7 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, gtk_widget_set_double_buffered(vc->gfx.drawing_area, FALSE); #pragma GCC diagnostic pop vc->gfx.dcl.ops =3D &dcl_egl_ops; + vc->gfx.has_dmabuf =3D qemu_egl_has_dmabuf(); } } else #endif --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436665; cv=none; d=zohomail.com; s=zohoarc; b=lwOGR9+eOpu8RCMfAdoxIBxdZ8rF6RghNy06764l0cGLiP1zVYqO0kfn96K7BotuzWGSu0hcLlx/FTr/74eaXsxTaY9jjAHJjIL9XPjeiXtWspXGZXYY/g//zdvPQ8XOx6hzn3saq+pHPoVmPtP/sLPG3L+gZjYgaec8EheWlU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436665; 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=tHU9eQ8/lwEMfkMk5/jGnEOGPo9ByyH5DGiXx/j9cZ0=; b=fl5BVw4ar+vtdsCXI3w7hEy2qMUnISq7ga6eLPgiJRBpjjzCMJ0tlJ/drkWFOGhpwcaRtb7D0SF2gaSVjjPDAGCGicgqPkfFfXxjhTtRF9PyX1LQasH2psoWG8xfWYEQuR7hQYK2k2a8pNNaSepFadQeWGu1L2UHPvmHVJ6pAyw= 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 1612436665987157.8462759982816; Thu, 4 Feb 2021 03:04:25 -0800 (PST) Received: from localhost ([::1]:56218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cQy-0003z9-So for importer@patchew.org; Thu, 04 Feb 2021 06:04:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cIf-0000yF-RX for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30086) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cIe-0000N8-0J for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:55:49 -0500 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-406-HGJZMuZ_O7-zlixZh0ty1Q-1; Thu, 04 Feb 2021 05:55:44 -0500 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 EAA80801977 for ; Thu, 4 Feb 2021 10:55:43 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DE685B695; Thu, 4 Feb 2021 10:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436147; 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=tHU9eQ8/lwEMfkMk5/jGnEOGPo9ByyH5DGiXx/j9cZ0=; b=J5jJoOiEsijzHkamsylxcJsUycOxqXLE8ajDzmSq/Vs+nmyKHwsbz2u3HtONP0Aop2eURo uE4e4RbSXil6XiYgepw8iojBTKq+O95eMlK1qTMyN7Pacomk3i5rZsX5sEOxcIzIlswJ2s d8oiCKuQ24BThsdasqfxJt8P9uEvgH4= X-MC-Unique: HGJZMuZ_O7-zlixZh0ty1Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 16/20] ui: add egl dmabuf import to gtkglarea Date: Thu, 4 Feb 2021 14:52:28 +0400 Message-Id: <20210204105232.834642-17-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau GtkGLArea is used on wayland, where EGL is usually available. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/ui/gtk.h | 2 ++ ui/gtk-gl-area.c | 18 ++++++++++++++++++ ui/gtk.c | 22 ++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index aaef884b95..3c1cd98db8 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -134,6 +134,8 @@ QEMUGLContext gd_gl_area_create_context(DisplayChangeLi= stener *dcl, QEMUGLParams *params); void gd_gl_area_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx); +void gd_gl_area_scanout_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf); void gd_gl_area_scanout_texture(DisplayChangeListener *dcl, uint32_t backing_id, bool backing_y_0_top, diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 96fbe75387..72bcd94918 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -213,6 +213,24 @@ void gd_gl_area_scanout_flush(DisplayChangeListener *d= cl, gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); } =20 +void gd_gl_area_scanout_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf) +{ +#ifdef CONFIG_OPENGL_DMABUF + VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); + + gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); + egl_dmabuf_import_texture(dmabuf); + if (!dmabuf->texture) { + return; + } + + gd_gl_area_scanout_texture(dcl, dmabuf->texture, + false, dmabuf->width, dmabuf->height, + 0, 0, dmabuf->width, dmabuf->height); +#endif +} + void gtk_gl_area_init(void) { display_opengl =3D 1; diff --git a/ui/gtk.c b/ui/gtk.c index f41c396cb9..79dc240120 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -627,6 +627,12 @@ static bool gd_has_dmabuf(DisplayChangeListener *dcl) { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 + if (gtk_use_gl_area && !gtk_widget_get_realized(vc->gfx.drawing_area))= { + /* FIXME: Assume it will work, actual check done after realize */ + /* fixing this would require delaying listener registration */ + return true; + } + return vc->gfx.has_dmabuf; } =20 @@ -647,6 +653,8 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = =3D { .dpy_gl_scanout_texture =3D gd_gl_area_scanout_texture, .dpy_gl_scanout_disable =3D gd_gl_area_scanout_disable, .dpy_gl_update =3D gd_gl_area_scanout_flush, + .dpy_gl_scanout_dmabuf =3D gd_gl_area_scanout_dmabuf, + .dpy_has_dmabuf =3D gd_has_dmabuf, }; =20 static const DisplayChangeListenerOps dcl_egl_ops =3D { @@ -1983,6 +1991,18 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayS= tate *s) return machine_menu; } =20 +#if defined(CONFIG_OPENGL) +static void gl_area_realize(GtkGLArea *area, VirtualConsole *vc) +{ + gtk_gl_area_make_current(area); + qemu_egl_display =3D eglGetCurrentDisplay(); + vc->gfx.has_dmabuf =3D qemu_egl_has_dmabuf(); + if (!vc->gfx.has_dmabuf) { + error_report("GtkGLArea console lacks DMABUF support."); + } +} +#endif + static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc, QemuConsole *con, int idx, GSList *group, GtkWidget *view_menu) @@ -1998,6 +2018,8 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vir= tualConsole *vc, if (display_opengl) { if (gtk_use_gl_area) { vc->gfx.drawing_area =3D gtk_gl_area_new(); + g_signal_connect(vc->gfx.drawing_area, "realize", + G_CALLBACK(gl_area_realize), vc); vc->gfx.dcl.ops =3D &dcl_gl_area_ops; } else { vc->gfx.drawing_area =3D gtk_drawing_area_new(); --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436645; cv=none; d=zohomail.com; s=zohoarc; b=VrbygUS7/+F4xnYSMhb3q0IcopNzxp4dSW6U5BOe1rcftQNUzFFjkRDgic3jCjr0QrFdbw5vKvrKtcF4acl/k2erAdt1vSN+bHROTFAYDx2WqdzPcO15AphuwPybzOkbuBE4y5Keehydb7DG7BtWtBnCU9RsIJDVusLBqhRKXt0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436645; 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=2hjXGn6r0/yrb9LYWphq3SI0hUk92h1ayDItWCET1Jg=; b=j7gY4SyNpi3VPOHV/gBvCQdoTXPCbmiEzQLpjP29/Iv612QOFXikzm8NjgMepN7fXvENHH7PKgD1t489ZB7Xz6qWEyR4gIYNQpKx/kNRa9SE1rUAAcJj0UfrEQQc556v7Eiyuz7rRxqMsZK3IJhUK/b9dsZ3e5fKCCQZfPiMAeQ= 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 1612436645981277.60522063378835; Thu, 4 Feb 2021 03:04:05 -0800 (PST) Received: from localhost ([::1]:54830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cQe-0003QX-QW for importer@patchew.org; Thu, 04 Feb 2021 06:04:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cIq-0001Uy-RD for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:56:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cIo-0000RQ-M1 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:56:00 -0500 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-29-u78lF6crOZGa6wV3jOkA2w-1; Thu, 04 Feb 2021 05:55:56 -0500 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 B7ED4801968 for ; Thu, 4 Feb 2021 10:55:55 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67A04100164C; Thu, 4 Feb 2021 10:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436158; 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=2hjXGn6r0/yrb9LYWphq3SI0hUk92h1ayDItWCET1Jg=; b=LjMYZuMoSwtvw1XhT+hgoJ34xECvoF6d+1pgi63JWG4YxZp5bL4IBKuB+I5RsqQKhAqWvd DHk9DDOJC58ajSDXYPisVUq4jvhzWS1p6e18frhAxy/OTIvnxpfqp17ZBAe02SgjDVHDNt e8eRwpJAM7sKdOGj+pc9RENiIBrIYwc= X-MC-Unique: u78lF6crOZGa6wV3jOkA2w-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 17/20] virtio-gpu: avoid re-entering cmdq processing Date: Thu, 4 Feb 2021 14:52:29 +0400 Message-Id: <20210204105232.834642-18-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau The next patch will notify the GL context got flush, which will resume the queue processing. However, if this happens within the caller context, it will end up with a stack overflow flush/update loop. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 4f3dbf79f9..0043268e90 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -148,6 +148,7 @@ struct VirtIOGPU { =20 uint64_t hostmem; =20 + bool processing_cmdq; bool renderer_inited; bool renderer_reset; QEMUTimer *fence_poll; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 0e833a462b..7eb4265a6d 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -814,6 +814,10 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g) { struct virtio_gpu_ctrl_command *cmd; =20 + if (g->processing_cmdq) { + return; + } + g->processing_cmdq =3D true; while (!QTAILQ_EMPTY(&g->cmdq)) { cmd =3D QTAILQ_FIRST(&g->cmdq); =20 @@ -843,6 +847,7 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g) g_free(cmd); } } + g->processing_cmdq =3D false; } =20 static void virtio_gpu_gl_unblock(VirtIOGPUBase *b) --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436976; cv=none; d=zohomail.com; s=zohoarc; b=BZASNBs/o+/Hv6eb3R2+RpkQIWW/DWC2rK//znZwVI4DnUQeY2N8c5MNPtF2K5p/Ex1YlUIrmvhIJ5yHNXkrjUdiPdh3l7M72XBpRNmQnhkELN6FTVPNCooXym6SVGuso8Grnc1fiyS5HH07llWp8kHm4MOYBWmwuXbsI6xnZME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436976; 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=5ZMXOQ/ay69NN18p8OGrAgE37Jw2rGk0zURd/oLRZzw=; b=j2umG4fqzWChNd5DQAAC2X/Oos1fozsZasSCDYTu2KNgpVhJT+hydJcG94piVNC/AsQlzjWxp4uX8o5atyrfp9/BT2yRCbGxUGoR8nMUw4m63u3jip/RwVPjhCT9wj0hgBjHQG7yGnnchCK0J8xZieVyIGO9U1OPn/q0wzqXLbg= 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 1612436976615158.46908120706223; Thu, 4 Feb 2021 03:09:36 -0800 (PST) Received: from localhost ([::1]:42918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cVz-0001wK-E6 for importer@patchew.org; Thu, 04 Feb 2021 06:09:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cJ3-00022M-F5 for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:56:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46819) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cJ0-0000Ww-RH for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:56:13 -0500 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-40-8W9E6SWsP_6gkSmzEcMpLQ-1; Thu, 04 Feb 2021 05:56:08 -0500 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 A0E69874983 for ; Thu, 4 Feb 2021 10:56:07 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 309957770F; Thu, 4 Feb 2021 10:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436170; 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=5ZMXOQ/ay69NN18p8OGrAgE37Jw2rGk0zURd/oLRZzw=; b=V9RaAK5tjSrpQJ7mVXs8VJFFr+C/Dqrz1B42HYDnUtKf3fbMrqF9Nsiwwz6xom9s3o+w0A Tm1eepfVZn+6dx1NvruGB+tYIItwOCB6edfhnO58KyxVq0u6mm/HLeHAWaoGJDGqAs83nS 5i5+Mc4NdKKk30xrXg6Q1JAiTDv4c1Y= X-MC-Unique: 8W9E6SWsP_6gkSmzEcMpLQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 18/20] display/ui: add a callback to indicate GL state is flushed Date: Thu, 4 Feb 2021 14:52:30 +0400 Message-Id: <20210204105232.834642-19-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Displaying rendered resources requires blocking qemu GPU to avoid extra framebuffer copies. For an external display, via Spice currently, there is a callback to block/unblock the rendering in the same thread. But with the vhost-user-gpu backend, the qemu process doesn't handle the rendering itself, and the blocking callback isn't effective. Instead, the backend must be notified when the display code is done. Fix this by adding a new GraphicHwOps callback to indicate the GL state is flushed, and we are done manipulating the shared GL resources. Call it from gtk and spice display. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/virtio/virtio-gpu.h | 2 +- include/ui/console.h | 2 ++ hw/display/vhost-user-gpu.c | 4 ++-- hw/display/virtio-gpu-base.c | 17 ++++++++++++----- hw/display/virtio-gpu.c | 4 ++-- hw/display/virtio-vga.c | 11 +++++++++++ ui/console.c | 9 +++++++++ ui/gtk-egl.c | 3 +++ ui/gtk-gl-area.c | 3 +++ ui/sdl2-gl.c | 2 ++ ui/spice-display.c | 1 + 11 files changed, 48 insertions(+), 10 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 0043268e90..fae149235c 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -121,7 +121,7 @@ struct VirtIOGPUBase { struct VirtIOGPUBaseClass { VirtioDeviceClass parent; =20 - void (*gl_unblock)(VirtIOGPUBase *g); + void (*gl_flushed)(VirtIOGPUBase *g); }; =20 #define VIRTIO_GPU_BASE_PROPERTIES(_state, _conf) \ diff --git a/include/ui/console.h b/include/ui/console.h index 875885d9c7..d30e972d0b 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -387,6 +387,7 @@ typedef struct GraphicHwOps { void (*update_interval)(void *opaque, uint64_t interval); int (*ui_info)(void *opaque, uint32_t head, QemuUIInfo *info); void (*gl_block)(void *opaque, bool block); + void (*gl_flushed)(void *opaque); } GraphicHwOps; =20 QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head, @@ -402,6 +403,7 @@ void graphic_hw_update_done(QemuConsole *con); void graphic_hw_invalidate(QemuConsole *con); void graphic_hw_text_update(QemuConsole *con, console_ch_t *chardata); void graphic_hw_gl_block(QemuConsole *con, bool block); +void graphic_hw_gl_flushed(QemuConsole *con); =20 void qemu_console_early_init(void); =20 diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index b7bde9feb6..4d8cb3525b 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -360,7 +360,7 @@ vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blo= cked) } =20 static void -vhost_user_gpu_gl_unblock(VirtIOGPUBase *b) +vhost_user_gpu_gl_flushed(VirtIOGPUBase *b) { VhostUserGPU *g =3D VHOST_USER_GPU(b); =20 @@ -578,7 +578,7 @@ vhost_user_gpu_class_init(ObjectClass *klass, void *dat= a) VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); VirtIOGPUBaseClass *vgc =3D VIRTIO_GPU_BASE_CLASS(klass); =20 - vgc->gl_unblock =3D vhost_user_gpu_gl_unblock; + vgc->gl_flushed =3D vhost_user_gpu_gl_flushed; =20 vdc->realize =3D vhost_user_gpu_device_realize; vdc->reset =3D vhost_user_gpu_reset; diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index f27a6fbe75..4a57350917 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -97,21 +97,27 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t id= x, QemuUIInfo *info) } =20 static void -virtio_gpu_gl_block(void *opaque, bool block) +virtio_gpu_gl_flushed(void *opaque) { VirtIOGPUBase *g =3D opaque; VirtIOGPUBaseClass *vgc =3D VIRTIO_GPU_BASE_GET_CLASS(g); =20 + if (vgc->gl_flushed) { + vgc->gl_flushed(g); + } +} + +static void +virtio_gpu_gl_block(void *opaque, bool block) +{ + VirtIOGPUBase *g =3D opaque; + if (block) { g->renderer_blocked++; } else { g->renderer_blocked--; } assert(g->renderer_blocked >=3D 0); - - if (g->renderer_blocked =3D=3D 0) { - vgc->gl_unblock(g); - } } =20 static int @@ -138,6 +144,7 @@ static const GraphicHwOps virtio_gpu_ops =3D { .text_update =3D virtio_gpu_text_update, .ui_info =3D virtio_gpu_ui_info, .gl_block =3D virtio_gpu_gl_block, + .gl_flushed =3D virtio_gpu_gl_flushed, }; =20 bool diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 7eb4265a6d..2e4a9822b6 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -850,7 +850,7 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g) g->processing_cmdq =3D false; } =20 -static void virtio_gpu_gl_unblock(VirtIOGPUBase *b) +static void virtio_gpu_gl_flushed(VirtIOGPUBase *b) { VirtIOGPU *g =3D VIRTIO_GPU(b); =20 @@ -1257,7 +1257,7 @@ static void virtio_gpu_class_init(ObjectClass *klass,= void *data) VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_CLASS(klass); VirtIOGPUBaseClass *vgc =3D VIRTIO_GPU_BASE_CLASS(klass); =20 - vgc->gl_unblock =3D virtio_gpu_gl_unblock; + 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; diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index b071909b68..d3c6404061 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -68,6 +68,16 @@ static void virtio_vga_base_gl_block(void *opaque, bool = block) } } =20 +static void virtio_vga_base_gl_flushed(void *opaque) +{ + VirtIOVGABase *vvga =3D opaque; + VirtIOGPUBase *g =3D vvga->vgpu; + + if (g->hw_ops->gl_flushed) { + g->hw_ops->gl_flushed(g); + } +} + static int virtio_vga_base_get_flags(void *opaque) { VirtIOVGABase *vvga =3D opaque; @@ -83,6 +93,7 @@ static const GraphicHwOps virtio_vga_base_ops =3D { .text_update =3D virtio_vga_base_text_update, .ui_info =3D virtio_vga_base_ui_info, .gl_block =3D virtio_vga_base_gl_block, + .gl_flushed =3D virtio_vga_base_gl_flushed, }; =20 static const VMStateDescription vmstate_virtio_vga_base =3D { diff --git a/ui/console.c b/ui/console.c index d8cc640c28..c5d11bc701 100644 --- a/ui/console.c +++ b/ui/console.c @@ -294,6 +294,15 @@ void graphic_hw_gl_block(QemuConsole *con, bool block) } } =20 +void graphic_hw_gl_flushed(QemuConsole *con) +{ + assert(con !=3D NULL); + + if (con->hw_ops->gl_flushed) { + con->hw_ops->gl_flushed(con->hw); + } +} + int qemu_console_get_window_id(QemuConsole *con) { return con->window_id; diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 71c3d698b4..588e7b1bb1 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -92,6 +92,9 @@ void gd_egl_draw(VirtualConsole *vc) vc->gfx.scale_x =3D (double)ww / surface_width(vc->gfx.ds); vc->gfx.scale_y =3D (double)wh / surface_height(vc->gfx.ds); } + + glFlush(); + graphic_hw_gl_flushed(vc->gfx.dcl.con); } =20 void gd_egl_update(DisplayChangeListener *dcl, diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 72bcd94918..e7ca73c7b1 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -70,6 +70,9 @@ void gd_gl_area_draw(VirtualConsole *vc) surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, ww, wh); surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds); } + + glFlush(); + graphic_hw_gl_flushed(vc->gfx.dcl.con); } =20 void gd_gl_area_update(DisplayChangeListener *dcl, diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index 82139ba49e..fd594d7461 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -58,6 +58,7 @@ static void sdl2_gl_render_surface(struct sdl2_console *s= con) =20 surface_gl_render_texture(scon->gls, scon->surface); SDL_GL_SwapWindow(scon->real_window); + graphic_hw_gl_flushed(scon->dcl.con); } =20 void sdl2_gl_update(DisplayChangeListener *dcl, @@ -240,4 +241,5 @@ void sdl2_gl_scanout_flush(DisplayChangeListener *dcl, egl_fb_blit(&scon->win_fb, &scon->guest_fb, !scon->y0_top); =20 SDL_GL_SwapWindow(scon->real_window); + graphic_hw_gl_flushed(dcl->con); } diff --git a/ui/spice-display.c b/ui/spice-display.c index 6a5e189a67..7247a93924 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -826,6 +826,7 @@ static void qemu_spice_gl_unblock_bh(void *opaque) SimpleSpiceDisplay *ssd =3D opaque; =20 qemu_spice_gl_block(ssd, false); + graphic_hw_gl_flushed(ssd->dcl.con); } =20 static void qemu_spice_gl_block_timer(void *opaque) --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436748; cv=none; d=zohomail.com; s=zohoarc; b=fUXO3STXqFDqyyFsCq68PyIFoDDPhSLjXCtjYiCwblHKCfwlw7BG/xr5BkDs68XQgVapMxC8GVl3EWfQ5/mLyvVIt7TEuANb8ylyBG66xyp3GWU+xWFjiMElMdVrJj60QSmI4n3fDZUrC3BAIZM3+7UzgIeXfy0vQT5+1FpRTrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436748; 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=CcVIYzU8Vah5IooifUfmsNNrxruf4I59VHvEBnISRbo=; b=Z9CB7d4xkoOYukCP1+dsZhQIyZBvPOE5Q8j6j9PYrI1XaXfShVxOOj7IVEyOkp/R+1t5nEBWWfnnutbWLKN18kmyrt5n3fbk6tO/mrec9oK/PeUbgJDJYM0AwZmWpnz6Dgzsdvo+1mxUETrGGaiJz761ZUCAYoj0v9qe2UsqbN4= 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 1612436748043329.0372739860918; Thu, 4 Feb 2021 03:05:48 -0800 (PST) Received: from localhost ([::1]:60686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cSJ-0005qL-0K for importer@patchew.org; Thu, 04 Feb 2021 06:05:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cJF-0002XN-9s for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:56:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cJD-0000dS-Hm for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:56:25 -0500 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-220-cpvfmIXTO_y-bLAr3NQjpA-1; Thu, 04 Feb 2021 05:56:20 -0500 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 E6C7D195D567 for ; Thu, 4 Feb 2021 10:56:19 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1FC395B695; Thu, 4 Feb 2021 10:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436182; 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=CcVIYzU8Vah5IooifUfmsNNrxruf4I59VHvEBnISRbo=; b=EM3FvHj7x83ujOFkX4/rfBYqolRuiCXiEDTBdk5xHTtXg7ZrP2FnVD7hVyaKUXI0EJfGUf s2DIFn85+rxEhYOtiYMuiOK7PD+3mkWC4Owg11bpDDBsJvpGQZHuP/kkls3EaLe5oPZn4v y4JM9aOQL4R050689HyNk+wbSvalKrg= X-MC-Unique: cpvfmIXTO_y-bLAr3NQjpA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 19/20] chardev: check if the chardev is registered for yanking Date: Thu, 4 Feb 2021 14:52:31 +0400 Message-Id: <20210204105232.834642-20-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Not all chardevs are created via qmp_chardev_open_socket(), and those should not call the yank function registration, as this will eventually assert() not being registered. Signed-off-by: Marc-Andr=C3=A9 Lureau --- chardev/char-socket.c | 53 +++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 8a707d766c..9061981f6d 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -417,8 +417,9 @@ static void tcp_chr_free_connection(Chardev *chr) =20 tcp_set_msgfds(chr, NULL, 0); remove_fd_in_watch(chr); - if (s->state =3D=3D TCP_CHARDEV_STATE_CONNECTING - || s->state =3D=3D TCP_CHARDEV_STATE_CONNECTED) { + if (s->registered_yank && + (s->state =3D=3D TCP_CHARDEV_STATE_CONNECTING + || s->state =3D=3D TCP_CHARDEV_STATE_CONNECTED)) { yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label), yank_generic_iochannel, QIO_CHANNEL(s->sioc)); @@ -940,9 +941,11 @@ static int tcp_chr_add_client(Chardev *chr, int fd) } tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING); tcp_chr_set_client_ioc_name(chr, sioc); - yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), - yank_generic_iochannel, - QIO_CHANNEL(sioc)); + if (s->registered_yank) { + yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); + } ret =3D tcp_chr_new_client(chr, sioc); object_unref(OBJECT(sioc)); return ret; @@ -957,9 +960,11 @@ static void tcp_chr_accept(QIONetListener *listener, =20 tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING); tcp_chr_set_client_ioc_name(chr, cioc); - yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), - yank_generic_iochannel, - QIO_CHANNEL(cioc)); + if (s->registered_yank) { + yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(cioc)); + } tcp_chr_new_client(chr, cioc); } =20 @@ -975,9 +980,11 @@ static int tcp_chr_connect_client_sync(Chardev *chr, E= rror **errp) object_unref(OBJECT(sioc)); return -1; } - yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), - yank_generic_iochannel, - QIO_CHANNEL(sioc)); + if (s->registered_yank) { + yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); + } tcp_chr_new_client(chr, sioc); object_unref(OBJECT(sioc)); return 0; @@ -993,9 +1000,11 @@ static void tcp_chr_accept_server_sync(Chardev *chr) tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING); sioc =3D qio_net_listener_wait_client(s->listener); tcp_chr_set_client_ioc_name(chr, sioc); - yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), - yank_generic_iochannel, - QIO_CHANNEL(sioc)); + if (s->registered_yank) { + yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); + } tcp_chr_new_client(chr, sioc); object_unref(OBJECT(sioc)); } @@ -1124,9 +1133,11 @@ static void qemu_chr_socket_connected(QIOTask *task,= void *opaque) =20 if (qio_task_propagate_error(task, &err)) { tcp_chr_change_state(s, TCP_CHARDEV_STATE_DISCONNECTED); - yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label), - yank_generic_iochannel, - QIO_CHANNEL(sioc)); + if (s->registered_yank) { + yank_unregister_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); + } check_report_connect_error(chr, err); goto cleanup; } @@ -1160,9 +1171,11 @@ static void tcp_chr_connect_client_async(Chardev *ch= r) tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING); sioc =3D qio_channel_socket_new(); tcp_chr_set_client_ioc_name(chr, sioc); - yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), - yank_generic_iochannel, - QIO_CHANNEL(sioc)); + if (s->registered_yank) { + yank_register_function(CHARDEV_YANK_INSTANCE(chr->label), + yank_generic_iochannel, + QIO_CHANNEL(sioc)); + } /* * Normally code would use the qio_channel_socket_connect_async * method which uses a QIOTask + qio_task_set_error internally --=20 2.29.0 From nobody Sat May 18 20:15:26 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=1612436817; cv=none; d=zohomail.com; s=zohoarc; b=SK/PTDsmwGaD7g257VqLI4jxAWlPRFfuV4a2ifnVfvC7Gyesa1gAbzKtkVKtdlWg43Z6Xc55CFTUagwr/Ss5vocUi+pWMEUSNwdAnOUpXqRTcdYcF33qNA1yR9uVAm29aw0IvgtQewDcZ5GVqQHoOg3mwhICR/rLidkpQutBH+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612436817; 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=x5jWEgCLPoNTuA5DzKgepySnwHLIPIQXTFjTsCa882w=; b=Jv8YYZeXfDBGWAUxHs7g6aCWnhtdblfzPe7x8HhoRB+cX1Ci0ZCUa15HSdwmXDeO4gs9sBrtIzmndRrX475fHWv++Osbq5f0RxAGGj5Wg82AhFXeav7cCJRJyewNE3abnzp+MczM9OF0+39fObh5NgrWJ+nDo8hCFGH7Pl43YQc= 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 1612436817299145.57161373447263; Thu, 4 Feb 2021 03:06:57 -0800 (PST) Received: from localhost ([::1]:35276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7cTO-00073i-5k for importer@patchew.org; Thu, 04 Feb 2021 06:06:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7cJT-0002mp-Vo for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:56:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l7cJQ-0000hD-Bv for qemu-devel@nongnu.org; Thu, 04 Feb 2021 05:56:39 -0500 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-303-Pkv68FgKPNSyLU4a7zlT2Q-1; Thu, 04 Feb 2021 05:56:33 -0500 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 395A1195D561 for ; Thu, 4 Feb 2021 10:56:32 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 213187770F; Thu, 4 Feb 2021 10:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612436195; 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=x5jWEgCLPoNTuA5DzKgepySnwHLIPIQXTFjTsCa882w=; b=TuxIqxMP27ff/cVx+D6xdORKBVx2YxK76aBhVItQkNZm6LRFWLN9I5mvw4oDuX6mdfKGuW N9hYlbm1Z+1+M8NxPlBC2Z+5bYLoQfiz1y8Ly38NgT/UrXUMnL1HwNnQ1ppqrwLVxGaxJ8 RrjVydeLFq7GjOSPtNYsPKAli5ggr6k= X-MC-Unique: Pkv68FgKPNSyLU4a7zlT2Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH v2 20/20] tests: add some virtio-gpu & vhost-user-gpu acceptance test Date: Thu, 4 Feb 2021 14:52:32 +0400 Message-Id: <20210204105232.834642-21-marcandre.lureau@redhat.com> In-Reply-To: <20210204105232.834642-1-marcandre.lureau@redhat.com> References: <20210204105232.834642-1-marcandre.lureau@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=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.539, 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_H3=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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau This will check virtio/vhost-user-vga & virgl are correctly initialized by the Linux kernel on an egl-headless display. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/acceptance/virtio-gpu.py | 161 +++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 tests/acceptance/virtio-gpu.py diff --git a/tests/acceptance/virtio-gpu.py b/tests/acceptance/virtio-gpu.py new file mode 100644 index 0000000000..211f02932f --- /dev/null +++ b/tests/acceptance/virtio-gpu.py @@ -0,0 +1,161 @@ +# virtio-gpu tests +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + + +from avocado_qemu import Test +from avocado_qemu import BUILD_DIR +from avocado_qemu import wait_for_console_pattern +from avocado_qemu import exec_command_and_wait_for_pattern +from avocado_qemu import is_readable_executable_file + +from qemu.accel import kvm_available + +import os +import socket +import subprocess + + +ACCEL_NOT_AVAILABLE_FMT =3D "%s accelerator does not seem to be available" +KVM_NOT_AVAILABLE =3D ACCEL_NOT_AVAILABLE_FMT % "KVM" + + +def pick_default_vug_bin(): + relative_path =3D "./contrib/vhost-user-gpu/vhost-user-gpu" + if is_readable_executable_file(relative_path): + return relative_path + + bld_dir_path =3D os.path.join(BUILD_DIR, relative_path) + if is_readable_executable_file(bld_dir_path): + return bld_dir_path + + +class VirtioGPUx86(Test): + """ + :avocado: tags=3Dvirtio-gpu + """ + + KERNEL_COMMON_COMMAND_LINE =3D "printk.time=3D0 " + KERNEL_URL =3D ( + "https://archives.fedoraproject.org/pub/fedora" + "/linux/releases/33/Everything/x86_64/os/images" + "/pxeboot/vmlinuz" + ) + INITRD_URL =3D ( + "https://archives.fedoraproject.org/pub/fedora" + "/linux/releases/33/Everything/x86_64/os/images" + "/pxeboot/initrd.img" + ) + + def wait_for_console_pattern(self, success_message, vm=3DNone): + wait_for_console_pattern( + self, + success_message, + failure_message=3D"Kernel panic - not syncing", + vm=3Dvm, + ) + + def test_virtio_vga_virgl(self): + """ + :avocado: tags=3Darch:x86_64 + :avocado: tags=3Ddevice:virtio-vga + """ + kernel_command_line =3D ( + self.KERNEL_COMMON_COMMAND_LINE + "console=3DttyS0 rdinit=3D/b= in/bash" + ) + # FIXME: should check presence of virtio, virgl etc + if not kvm_available(self.arch, self.qemu_bin): + self.cancel(KVM_NOT_AVAILABLE) + + kernel_path =3D self.fetch_asset(self.KERNEL_URL) + initrd_path =3D self.fetch_asset(self.INITRD_URL) + + self.vm.set_console() + self.vm.add_args("-cpu", "host") + self.vm.add_args("-m", "2G") + self.vm.add_args("-machine", "pc,accel=3Dkvm") + self.vm.add_args("-device", "virtio-vga,virgl=3Don") + self.vm.add_args("-display", "egl-headless") + self.vm.add_args( + "-kernel", + kernel_path, + "-initrd", + initrd_path, + "-append", + kernel_command_line, + ) + self.vm.launch() + self.wait_for_console_pattern("as init process") + exec_command_and_wait_for_pattern( + self, "/usr/sbin/modprobe virtio_gpu", "" + ) + self.wait_for_console_pattern("features: +virgl +edid") + + def test_vhost_user_vga_virgl(self): + """ + :avocado: tags=3Darch:x86_64 + :avocado: tags=3Ddevice:vhost-user-vga + """ + kernel_command_line =3D ( + self.KERNEL_COMMON_COMMAND_LINE + "console=3DttyS0 rdinit=3D/b= in/bash" + ) + # FIXME: should check presence of vhost-user-gpu, virgl, memfd etc + if not kvm_available(self.arch, self.qemu_bin): + self.cancel(KVM_NOT_AVAILABLE) + + vug =3D pick_default_vug_bin() + if not vug: + self.cancel("Could not find vhost-user-gpu") + + kernel_path =3D self.fetch_asset(self.KERNEL_URL) + initrd_path =3D self.fetch_asset(self.INITRD_URL) + + # Create socketpair to connect proxy and remote processes + qemu_sock, vug_sock =3D socket.socketpair( + socket.AF_UNIX, socket.SOCK_STREAM + ) + os.set_inheritable(qemu_sock.fileno(), True) + os.set_inheritable(vug_sock.fileno(), True) + + self._vug_log_path =3D os.path.join( + self.vm._test_dir, "vhost-user-gpu.log" + ) + self._vug_log_file =3D open(self._vug_log_path, "wb") + print(self._vug_log_path) + + vugp =3D subprocess.Popen( + [vug, "--virgl", "--fd=3D%d" % vug_sock.fileno()], + stdin=3Dsubprocess.DEVNULL, + stdout=3Dself._vug_log_file, + stderr=3Dsubprocess.STDOUT, + shell=3DFalse, + close_fds=3DFalse, + ) + + self.vm.set_console() + self.vm.add_args("-cpu", "host") + self.vm.add_args("-m", "2G") + self.vm.add_args("-object", "memory-backend-memfd,id=3Dmem,size=3D= 2G") + self.vm.add_args("-machine", "pc,memory-backend=3Dmem,accel=3Dkvm") + self.vm.add_args("-chardev", "socket,id=3Dvug,fd=3D%d" % qemu_sock= .fileno()) + self.vm.add_args("-device", "vhost-user-vga,chardev=3Dvug") + self.vm.add_args("-display", "egl-headless") + self.vm.add_args( + "-kernel", + kernel_path, + "-initrd", + initrd_path, + "-append", + kernel_command_line, + ) + self.vm.launch() + self.wait_for_console_pattern("as init process") + exec_command_and_wait_for_pattern( + self, "/usr/sbin/modprobe virtio_gpu", "" + ) + self.wait_for_console_pattern("features: +virgl -edid") + self.vm.shutdown() + qemu_sock.close() + vugp.terminate() + vugp.wait() --=20 2.29.0