From nobody Wed Oct 30 22:12:50 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=1612276222; cv=none; d=zohomail.com; s=zohoarc; b=hidv4i5/kc5blUVUAkShbUbtUBq69CDnJ0DsCTiQonat8FPjThU8BE4a8N7+9sU6efVjiwUBlbMF5kBBmPuExcJLZ5PeYMxiC+JX3/02FsDKK5AMnkSHI9dYu5mI49+wJk/u+RvvZdxI4dYVxsDa7CBbrxVipfRd/R9WZQ/oEC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276222; 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=LozQ8kueB/LQJR7kb2gHRct2sSy2On6VON7QqVvD5zqEBQzsbuXnrPNPoijzjO/RUE8xVATrvClROdrtSKLNomzzBY9MbdORuKZ4hYIPYPL0uwr39I4+o7N0sOlx97wuO1bw/QfZdEy8mIq8Y8NzT9RZD7ZRu2Jf9RkwAr1toOQ= 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 1612276222953559.9634153482065; Tue, 2 Feb 2021 06:30:22 -0800 (PST) Received: from localhost ([::1]:37588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6whB-0003Sf-4c for importer@patchew.org; Tue, 02 Feb 2021 09:30:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wdj-0006u8-Kj for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:26:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wdh-0002kw-UP for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:26:47 -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-562-JMA2AJ_LOFuXXcKunDPBmQ-1; Tue, 02 Feb 2021 09:26:43 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A8EAD9CDA3 for ; Tue, 2 Feb 2021 14:26:42 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 766DD1992D; Tue, 2 Feb 2021 14:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276005; 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=YLhqeb/Vb7/M+bkGbEq1pDnOoW5h0YzckO6Zu+PCNtB5ZSjc+utBv7ra3vvVZDLKrQQm5g SnufpQ0J/aPemCNiCXlkTNS0mq6UA+3GJ3jS9txNcIrPMZFDYYbHTIo6Qa7R526uS83KL5 1d1fsRQOqo5kkJ1Y4fInumzAQYrtlKk= X-MC-Unique: JMA2AJ_LOFuXXcKunDPBmQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 01/20] vhost-user-gpu: check backend for EDID support Date: Tue, 2 Feb 2021 18:26:06 +0400 Message-Id: <20210202142625.609070-2-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276345; cv=none; d=zohomail.com; s=zohoarc; b=Xi+jz/945GA+eCX9RMRpTRIfL9o82KmtL1rT16WA4cgqS+kX5SPoMhVlY7zV8/iyjudYJBkbNtCSVMs9tqgFHW9THoXVzZGVt8OLzcl3Mw6zjcgjunyiyARw9tMRVF3WrvZVj8L7teOmIMFcdrt77Pqj2ihfpk3ZRdaHW/is3uU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276345; 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=eOPeqRdqDxOFZ3Tzt9+ZdC/iHqwALSbRTyltotRzyUULiILjWcClvLGfNl2nH93aagc/pRNaOLWFTvcFhFWkNwsOH0N5axgn6qBGKEAq/dohzhWIWS7/eD1uCrC9SpeaNoE7EhQZsZzmdpIzSvQMDUQKYvz0zZdtwIXi/lL/L8k= 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 161227634555541.98903030256997; Tue, 2 Feb 2021 06:32:25 -0800 (PST) Received: from localhost ([::1]:42340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wj9-0005eS-M9 for importer@patchew.org; Tue, 02 Feb 2021 09:32:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wdu-00079K-U1 for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:26:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34905) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wdt-0002qW-AG for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:26:58 -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-581-xxNCE92HM62toaFr5X8ZJw-1; Tue, 02 Feb 2021 09:26:55 -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 4466C9CDA0 for ; Tue, 2 Feb 2021 14:26:54 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEF2D4D; Tue, 2 Feb 2021 14:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276016; 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=g9QqLS8VAL4FOslu4EhGoNcdKPCV9Oi9Joh1LkyCz9yBasF2at+rtZXhBAiLCqHxJaqPRH 0cFdSJfa8wqyHcjg8hNZ4f96l+weVJJ1i7SvaN4V2jDKxu4yljEY3OdWU84Cb9NphIJPF9 y4K/z9DlUmk9N9i84Crd3iqwBxNxEbA= X-MC-Unique: xxNCE92HM62toaFr5X8ZJw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 02/20] vhost-user-gpu: handle vhost-user-gpu features in a callback Date: Tue, 2 Feb 2021 18:26:07 +0400 Message-Id: <20210202142625.609070-3-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276402; cv=none; d=zohomail.com; s=zohoarc; b=bIFEBxIuCuRc6EbWM9sdpDTfjr4W1i+KwBrTHAYreRrfwg0y+ArZUbCfjttPwRKezdKnH7+wdER6WQvo6aSFyo/Wu5hrulT05BsjijP7CyqsX0NwinbSexbmHRXJX2T7CI+dVXjnAPqiJfBV5xrVUmMUbZFRXLB/6VHuxXipY44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276402; 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=LKdFBezqHTdWQClV0NMuFir2Bchl6Zi6mphDl05U9niB/u8sxo0W2chlMHUaMbBpi95sno7Nx7RaGQ0c8mYbMNsUalUUW+xQqk4OVAgsVNK55D51Nu8hbPsXduU4vjuOtOv0losrAxzoMYHRL6AlFDYo0FPOJ7buhAceKdPQILM= 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 1612276402497268.18697344489294; Tue, 2 Feb 2021 06:33:22 -0800 (PST) Received: from localhost ([::1]:47038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wk4-0007do-WC for importer@patchew.org; Tue, 02 Feb 2021 09:33:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6we5-0007Vo-5u for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20420) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6we3-0002uY-Bp for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27:08 -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-275-paeftFUUNL2sEUZ2sZQJjg-1; Tue, 02 Feb 2021 09:27:03 -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 015D09CDB2 for ; Tue, 2 Feb 2021 14:27:03 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24BFF5B4A6; Tue, 2 Feb 2021 14:26:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276026; 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=XdwJqE6oZfe7aYKKwmcL1gcMYtYozOAoYDCNQhLg3qqmp+7xxdG0jb7HD7dF6NfIpcz+TP iEtZK3V4OAz4q0cZAOkhP0xSaaZLc91e/L7FzjCLfGgaV9NFkPYs4GjkojyAc07EpG8AVt L0Do09XG717QE1INVGryjLhw+kXBEDI= X-MC-Unique: paeftFUUNL2sEUZ2sZQJjg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 03/20] vhost-user-gpu: use an extandable state enum for commands Date: Tue, 2 Feb 2021 18:26:08 +0400 Message-Id: <20210202142625.609070-4-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 --- 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 Wed Oct 30 22:12:50 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=1612276162; cv=none; d=zohomail.com; s=zohoarc; b=gUauX8lHX9nOh7N4lpoaYULNq9TjcIyBrLAj8I07yovYkg25N8ncVCfuQzrJ9se4iW6CMeIXjIVGenryBGZYhtSZmSTvGXVoC+7emZhuvoLSVhYX+zKF83OKweIsvkJuds//TFBAtxdcQtxh4OQ74xiZpmPGRRF9BmBQdYwYNXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276162; 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=hZxn5/y1LDkwsOmG5P9eoyp02iUGT6dW8d6reQHc3bg=; b=OrOM5s7H+TB9tmEgBBeZgYES5j1gnbHPUzYYRcQA45IiUZPDnKegLV1W+nSJtAIF+QRQD2fZgkwYTc45W//NmPHBZzT93YUoo7PNP9efoQ1rMD7E8BdoxjbCwJxNsD+JEL8molUKlbY4doAR7d0ns0HXDg//1KQDU0jeAUo8OJI= 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 1612276162447166.2863061056612; Tue, 2 Feb 2021 06:29:22 -0800 (PST) Received: from localhost ([::1]:34932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wgD-0002C0-47 for importer@patchew.org; Tue, 02 Feb 2021 09:29:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6weK-0007wm-V8 for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:20310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6weJ-00030O-3q for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27: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-471-gHR6MU5zP6ycklNvhwSHfg-1; Tue, 02 Feb 2021 09:27:18 -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 9405985B677 for ; Tue, 2 Feb 2021 14:27:17 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EA2E60C72; Tue, 2 Feb 2021 14:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276042; 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=hZxn5/y1LDkwsOmG5P9eoyp02iUGT6dW8d6reQHc3bg=; b=b9Khj8oNzwRMqvySlqiaOZuPMfjekilUyPukUcSCKStrUAQo4lh/FmsOWOqHX3wKVGtcxK 2Cu5Lobt3dhAVxpdi5ftgA1Cj0YoybAfG0NCZTTuUqz//hb9LWvpM+H+DH5R6RqWj1IyKz /RTquMRHNlWTPz6snMWU1Ai7bJ3PCbo= X-MC-Unique: gHR6MU5zP6ycklNvhwSHfg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 04/20] vhost-user-gpu: handle display-info in a callback Date: Tue, 2 Feb 2021 18:26:09 +0400 Message-Id: <20210202142625.609070-5-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 | 32 ++++++++++++++++++++----- 1 file changed, 26 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..810e227382 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -261,10 +261,32 @@ 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 +295,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 Wed Oct 30 22:12:50 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=1612276388; cv=none; d=zohomail.com; s=zohoarc; b=Ne3kards2uLkmXELRlAXayZTnYK9+XQ3ptDIECSEhcVG4qNHLodJJB1iAN3u0QtwynhsbMnIkY8zTAZgS6Jz87nDTiNu/qgs6RlkJFQnvbfJ0Ps4EC9Z+6sOowjU2R6hFmMZ7tkftV4PzSQqjcxF9wu/SUHqi579UTCRrN/1n3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276388; 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=Cf+/NYR1OohQ4kAzsinvikLg0/mzCYlasL2DFL9gOYFQToLHE8iKR65zgSmjiPk32zB+gHdKgFX/wY4cIwYgMaF7SLvY97e9/WROPZivjexQ2EtP2u7/qV3+fVUSbKNWYvfitdtyNSLQoBWO5eCSLSWQdJMpzAyZxiLozT0XF4M= 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 1612276388182402.0053703863339; Tue, 2 Feb 2021 06:33:08 -0800 (PST) Received: from localhost ([::1]:45578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wjq-00073Y-7I for importer@patchew.org; Tue, 02 Feb 2021 09:33:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6weV-0008Fh-Ta for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6weU-00035X-7o for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27:35 -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-215-K6S0UC5VPRqkbE3IA_MUUQ-1; Tue, 02 Feb 2021 09:27:30 -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 A2C988710FE for ; Tue, 2 Feb 2021 14:27:29 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E0795B4A6; Tue, 2 Feb 2021 14:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276052; 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=ihUeuQB7988+rNofs72MzfC2jFvqCiw0X7Ey2Z/GTTM3SwMn4AToxCr5XaE7NgcrB8Iudp A5qRjmS8O80Esgc2Az30EH3zBioZ0YKn4ugLMMrFXML1iwdxA1tLI8h3Qc5bWQa7PXdJfq peIuxHUYW+cD6lzuVjxn9Z3Wa7D7lW0= X-MC-Unique: K6S0UC5VPRqkbE3IA_MUUQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 05/20] ui: remove extra #ifdef CONFIG_OPENGL Date: Tue, 2 Feb 2021 18:26:10 +0400 Message-Id: <20210202142625.609070-6-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276561; cv=none; d=zohomail.com; s=zohoarc; b=ad51wxoNBu6B/oVoKEj4qbOBzoDTNfB2Nuem9DoNtAEF0k2msvJSxxwf2P2YsDY2mUQJfLiDHQpGtOuFO4iCxeCLEqbft9YwLT7mmTxTgb3G5C48k+eRZBdld6b3AvMkfEo7Qb9Pv2HykcNyXDAJywSzmyXgXQKbYfN+UJx9Fag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276561; 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=CLg/rHGWuc/rqoPRxK97CkhvweenWmHUVJYux6QqVVCMbMLCA66degPmMTUsa4suUfrYjaaix/H0wWmFYwY9OQVic3/J5oCok91lFLWEeHQ13XB5Hz7+CJbx+UBDT/ioSfgPZD/pkgWz8PB/1TMRr9Pp5Ml0h+Q7yayjjoKIAlU= 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 1612276561199889.5285374344946; Tue, 2 Feb 2021 06:36:01 -0800 (PST) Received: from localhost ([::1]:53940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wme-00029e-03 for importer@patchew.org; Tue, 02 Feb 2021 09:36:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6weh-0008K5-Lk for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:48544) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wef-0003B0-8l for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27:47 -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-394-ieEN16WkOSauPnxXiVQm1g-1; Tue, 02 Feb 2021 09:27:42 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 10533107ACE4 for ; Tue, 2 Feb 2021 14:27:41 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC6861A26A; Tue, 2 Feb 2021 14:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276064; 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=ETGHnBYvI/pAKQl+c+ooneHr6RZqTPfTdCPo92Wdye4CMIXUHJXvOw0lZrx7XSh0dW/pOw fui83Wnfalx9EuSo2L7+rmKN+gqCTECl4PP3lXK3jTr3TVXDDPe+oAyROw/lfEFYju9W5R yhbLbSS65IRvz+SAR9vXnvea68epoog= X-MC-Unique: ieEN16WkOSauPnxXiVQm1g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 06/20] ui: remove gl_ctx_get_current Date: Tue, 2 Feb 2021 18:26:11 +0400 Message-Id: <20210202142625.609070-7-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276757; cv=none; d=zohomail.com; s=zohoarc; b=NZXeRDMYceHq/1/JlLxiTXYO+DCeBCiDLMlzMn1jBsNYRz+emwe/ycOcLzwJSDZW9XxOIow2NNO43KHBXQs7mLQvn8OISlpOKIBDavYAtaF3rVhVEmMV4yx4HhbynoqC4RMF0QiYvuGaqyvt6IQGXPf34Weclad+Iin00hT9jm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276757; 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=nwnOdZz95tYBA8Tfcq3PrlAr9rvS9d5kMzcuzfUScvz0Fk0Qq2Ee475WY2jtdqoXyPu3taGoJGjXl6xJKDlmihMl3tJRbMmfYqQH6qkzRTeroXdo/9FsQiuoLgdjv8eVoHROn7aF2SlTUVT6fpwcym7JM+dsogJcKBqibakT5Gw= 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 16122767576111011.9723988517808; Tue, 2 Feb 2021 06:39:17 -0800 (PST) Received: from localhost ([::1]:34142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wpk-0005yg-Gg for importer@patchew.org; Tue, 02 Feb 2021 09:39:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wes-0008SX-GG for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:22860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6weq-0003GC-L6 for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:27:58 -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-404-ZXcNNjPqM_Sg0BzL_NLl7g-1; Tue, 02 Feb 2021 09:27:53 -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 ED62B108C21B for ; Tue, 2 Feb 2021 14:27:52 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FABB6E71A; Tue, 2 Feb 2021 14:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276075; 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=aZDMqnZWycM6XmFK23z6LWC1mQI49izr4bJGolNbkjzN8sT/ZUcB17UfkV3emGmRYjqk+O aIJJDbQL6jhpMDNGWlHV8NpOLWxIF/EuFbE8yzCQ5zP4ymb3xVY9XMKQDtkuxJ0rbL39K7 bDsEYknz5Bj1Sn2QIU2MGzAAfa1q/YE= X-MC-Unique: ZXcNNjPqM_Sg0BzL_NLl7g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 07/20] ui: add gd_gl_area_scanout_disable Date: Tue, 2 Feb 2021 18:26:12 +0400 Message-Id: <20210202142625.609070-8-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276359; cv=none; d=zohomail.com; s=zohoarc; b=GCIdVJ8Zk/QZvvsTxA79RnVlK/wPw+F8nYObKuFJ5vlDrECGFjclEbM+wFwph5pg/tgs7AyMfJfgKkyIq3YkchoakkKPx4B0hkqPli2R9tBaDG5DODNAGU5FlQei0hx26GVQTXVZNpAYqlXeK+7lIayQnj4Hlv/njTRgOFvpTdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276359; 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=Ztm6fptzl+2hLh9Q7+l04dzS15pcj5WM6MKV8+hPrxJ1hzVP2zGpTO0De2t1Hv3LF4Q8kFNo9T7DCIByR7owI+WeePCT9rbwSPefynQhxv4Ey1Y0soAhwbzwg9/SHfaLwCL2oLYS7C/HrnyW/GTw6klQWx07AQDaJPa3TmaE9Fc= 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 1612276359743553.38014615697; Tue, 2 Feb 2021 06:32:39 -0800 (PST) Received: from localhost ([::1]:43366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wjO-00065d-6x for importer@patchew.org; Tue, 02 Feb 2021 09:32:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wf3-0000XW-BV for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wf1-0003LN-IO for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28:09 -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-476-Txr_ROVdPEyntqwShOjWuw-1; Tue, 02 Feb 2021 09:28:05 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 53A87801B13 for ; Tue, 2 Feb 2021 14:28:04 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 743D01F6; Tue, 2 Feb 2021 14:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276086; 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=dY4xZvvOHIih7DQd8SpZBgWp0pvjm3DDET8PUEaGLBb/NIQ3osmxFN2Q+K2r4GP2M0JHIs ER/BtweVm1TMX9ugGIDCGxffgpqzWcsz5Gw1rvduLXtK8w15s1uUknKX63PmibBNyY5C1p t46SViy+9OIVf/2xZPaynZ/+owqqPLA= X-MC-Unique: Txr_ROVdPEyntqwShOjWuw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 08/20] ui: annotate DCLOps callback requirements Date: Tue, 2 Feb 2021 18:26:13 +0400 Message-Id: <20210202142625.609070-9-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276675; cv=none; d=zohomail.com; s=zohoarc; b=nENdglwRQ96pqjBXFyrzRuXtDX9oq9ndPLTRj2Bu1WiDWEezaxNdn6oX434QB0mo6KBm6K2ffOtR5YfYHtwZrCNzqVw/G8d5cey8Z9ZWRuGYPLPo8s1dNJCZu7lnjOqeeJF8Ue0kBgk7aMtBZurjNkFOmbuCkrpP/N3LAccKvUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276675; 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=adMuF9b5tScU7Qup7Rk0RezIHMl8bEJO+PXWny9a3am40bQV9H6KjO0mvIh81k9cZbGGRX0Il9kP1HLSWmAGZL3wPE3OinXArcfS2/wL1LDqezXkiePiQEOmICjsLj7m8eRNSC1Nkij93jjo5H/6rhbyT1Yey5YJubW8x1nrK+I= 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 1612276675449149.914433412162; Tue, 2 Feb 2021 06:37:55 -0800 (PST) Received: from localhost ([::1]:59024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6woU-0004PW-Bw for importer@patchew.org; Tue, 02 Feb 2021 09:37:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wfE-00011c-Bc for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33257) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wfC-0003Pq-DE for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28:20 -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-591-W9bEqNQvNa6Uh9lHvjwokg-1; Tue, 02 Feb 2021 09:28:16 -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 2D8E6874981 for ; Tue, 2 Feb 2021 14:28:15 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82F1E60C5F; Tue, 2 Feb 2021 14:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276097; 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=YRBYjHVfyWRo7Egz7Es6/4DCbvFxZ9ticlvfH+8Vdtl2tseZKfcY0vwI3odAdlLfzW9jf8 1BRGh/XYOcxvWNBxAXdjcWtE/GDOvEWtc8qT0Q8fQzaC01cviFr2bS0LoggsPBnVr162cr EB7LQ8y4I2PToYeuDqNChq78Qr2+jKY= X-MC-Unique: W9bEqNQvNa6Uh9lHvjwokg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 09/20] ui: remove console_has_gl_dmabuf() Date: Tue, 2 Feb 2021 18:26:14 +0400 Message-Id: <20210202142625.609070-10-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276519; cv=none; d=zohomail.com; s=zohoarc; b=H6CZcqwa83qEmBZvZALs7Sh4mZgWRLXmcqf4CGTSOtKV6kLf7VymZHCAG7naowU1ZnlU7Bv4RmGy8XV602TUXKeOsotMKvRwRvnG4DIV9KShXWptWjW0gX33xjmMT51TJsFYNrshmwdWfmcGta5QHK2WRM3hm2Y1PL0Ng5+ydOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276519; 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=TSlTxiCuJf6PLtwyqqAiQESh/ehnqogmpaXomCXm3aKn3sLvttg/vcamyjBWA//sKkPu1Hs/rBNw68uFKLqJyzpv7nUxUM5MHivCM50MaqM34y5CvuHQDYPqI+XWQKf+l390B9f4j5Xy88eckfeKO6EPwGNLSdVO1BZhohAm1vk= 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 1612276519225302.2409933066433; Tue, 2 Feb 2021 06:35:19 -0800 (PST) Received: from localhost ([::1]:51812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wlx-0001GB-U9 for importer@patchew.org; Tue, 02 Feb 2021 09:35:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wfR-0001FM-Lo for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wfN-0003Vl-If for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28:33 -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-83-1OMC9aR8PSGzd_dbOMpmcA-1; Tue, 02 Feb 2021 09:28:27 -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 9AD5B100A649 for ; Tue, 2 Feb 2021 14:28:26 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA6B410016F4; Tue, 2 Feb 2021 14:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276109; 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=XPu+o+D0mxLvogyC1E5RyKHvwP8Scc0+Oy2/ZtLiIfH6kfs4tGBL8F5exIUSytEq/72CvX w7B3HO/40ZC3+U9OTrOS4Lx2pUvQrjhO1RFgrfrJenTqAQ5gMaljzm8F1KeZbDbL7O74l3 1Mf/HnFIBkNTpESMtblFIxxRN1A+pWs= X-MC-Unique: 1OMC9aR8PSGzd_dbOMpmcA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 10/20] vhost-user-gpu: add a configuration flag for dmabuf usage Date: Tue, 2 Feb 2021 18:26:15 +0400 Message-Id: <20210202142625.609070-11-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276956; cv=none; d=zohomail.com; s=zohoarc; b=eOLL9sMSgjQ+NslC9taLS2PGPP0U1oB3HrZ3gSbqhOGetdQRAws0/KJzutld+p61Uu3iCHHG6qXV9dCopJabQnkE0WF0fyHlEgtlTBls/41JSDFwp4jAlD5L0xp1bztBSoNCCF+29syc2IQxEdEMOvjLPwy0Box9C/0lmRON3S8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276956; 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=e1ONAKPa56mSww2DdLMC697fRFbTm0B0fS5E+Sdhw+s=; b=PtyVpvM+AXu7D4j6N2lctgGLVrTEO9JxYPFuAndScKzRGFiJ8QBIWiBWaYzdkV+SLPDaAF01sLkB770h4YNwmcICagJPsBiD61RzYAmPNtbV2k/sHNNttBo2zy/nl1Oyi6RP85bFccbjwd6wh3CLkTPk0RBMTB7hyp+7FlN1uVA= 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 1612276956045824.1511938314259; Tue, 2 Feb 2021 06:42:36 -0800 (PST) Received: from localhost ([::1]:42480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wt0-0001Yw-R2 for importer@patchew.org; Tue, 02 Feb 2021 09:42:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wfa-0001gf-TY for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wfY-0003aj-T8 for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28: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-396-o5F9kfdUNuinNoa9L5b92A-1; Tue, 02 Feb 2021 09:28:38 -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 909FEAFA99 for ; Tue, 2 Feb 2021 14:28:37 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id D228C5C22B; Tue, 2 Feb 2021 14:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276120; 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=e1ONAKPa56mSww2DdLMC697fRFbTm0B0fS5E+Sdhw+s=; b=d6iFO7+HFAKwMmcCXpAs0gVI8o0j6L1nnvm49e74YbYU/FFA9csM0+X3O5H+vpuTQpBnqk jV/uJ764h4ro0y//1lg8OHuC88qwjT+/cv0D97ige/hADqv/bhLSSu7E9oQT/ulNwDQbK6 6/cX+o8g1sP4vjlWerenHAQXa4wBzGo= X-MC-Unique: o5F9kfdUNuinNoa9L5b92A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 11/20] ui: add an optional get_flags callback to GraphicHwOps Date: Tue, 2 Feb 2021 18:26:16 +0400 Message-Id: <20210202142625.609070-12-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 | 16 ++++++++++++++++ hw/display/virtio-vga.c | 9 +++++++++ hw/vfio/display.c | 6 ++++++ 4 files changed, 40 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..82c37aac62 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -114,7 +114,23 @@ 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 Wed Oct 30 22:12:50 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=1612276612; cv=none; d=zohomail.com; s=zohoarc; b=aBNtfXVCt8t84XX6iO3kXA26W8WIB5tYGlpkJtvviTYI+hOBTBdHpw0m+nFdpXlhhb3+wVb9a2vQyabPp5O3Eajng/dQ5lUDytTjeNqdnV9/UzARvbXAIr8VvgHhrhNtUZECNsOPsQuGCjc/+PWDGxYxKsfJ+T9dc09zTCnUuQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276612; 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=XOag8mHl6oIEDGC1xSfUPZkY54uORKiYNrughHrEYSHGzYJ8+T/t2fBsnbnIxN5Cmlt6fAh06v2kwQ8K0KNQiPPEI4o215mMTR534Wxn57YcB9WKf0GiQIFjWeoKuUfnHX2MVUW4kcxejXmOIhq0OrDovIbZIoBTWRip26NfGoU= 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 1612276612177423.35964892607717; Tue, 2 Feb 2021 06:36:52 -0800 (PST) Received: from localhost ([::1]:56130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wnS-00037D-O9 for importer@patchew.org; Tue, 02 Feb 2021 09:36:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wfo-0002Bq-Ca for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38452) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wfk-0003fb-1Q for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:28: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-487-VPP3ppp-PzScfSen2lblsg-1; Tue, 02 Feb 2021 09:28:49 -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 C0E92AFA80 for ; Tue, 2 Feb 2021 14:28:48 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0F44100164C; Tue, 2 Feb 2021 14:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276131; 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=jQ7+aixLBn0Jk6wLXu1+d3PFWIUFPfa+Jn85fzlNCdJzpSAOhi0Ro9Pzj3GjX2lC1QngC3 ZQmSVS0qhNBAZRKxF5u137G5eNeVeVx+FbOmQP0LPVr3AWvjYPtKPQs8gI7/gJsaoBymRJ BVCYdHDKQpE2DHUZUVKqA1/mqf6OOoM= X-MC-Unique: VPP3ppp-PzScfSen2lblsg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 12/20] ui: add a DCLOps callback to check dmabuf support Date: Tue, 2 Feb 2021 18:26:17 +0400 Message-Id: <20210202142625.609070-13-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276843; cv=none; d=zohomail.com; s=zohoarc; b=jWnWUjjlH27uj6YgBymAY6R4U5lAe/rLVvqaTH+O5U3/FqQCWGuyjIP6tlsepuwY9+EqBDrY5jbRXSNmpb6/KX0DjK4s3aGC6NJr+hxBukz3D0dB+jcLFwcWyydEnx0X3nihbp32RJDnfV14uzd/OetGFWWEGeuwz8tHcp/JZCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276843; 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=lN/zrAVgjUgHVJw9bt4R0pSPcAByrbjFLBRCvcxIKls=; b=bIjYpseDyHAG045cbTtHXGApB0fMg2ZFoF2JwjBWtmuVJA/9Bev7v8M68fqX2SarKT9y3oc3H5JDAcCZdL5dRQs80UbvD9PbtUmCC+TsP6c3qQCVGkEtwHc+Rn1e/OJYA6HYBzqhIRM+MNxmHas8tb4rO4p8yPjGT2UsKcmOK14= 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 1612276843950265.3888581230175; Tue, 2 Feb 2021 06:40:43 -0800 (PST) Received: from localhost ([::1]:36128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wrC-0006pv-Si for importer@patchew.org; Tue, 02 Feb 2021 09:40:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wfw-0002Kn-Nx for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:29:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:24625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wfv-0003k6-2O for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:29:04 -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-350-ZoYoDh1WM4ugpR2XgSw-Lg-1; Tue, 02 Feb 2021 09:29:00 -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 04D05803F43 for ; Tue, 2 Feb 2021 14:29:00 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 079CD5C1CF; Tue, 2 Feb 2021 14:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276142; 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=lN/zrAVgjUgHVJw9bt4R0pSPcAByrbjFLBRCvcxIKls=; b=HLsZcFFTbFIYtFSq8AfnZvRAoTTlueDfcJtDWb6rsigOHSJE4bV//cTHqKYnDpBXaFkvyK JJT9AsCQ+K2IPupWLQHPwoMgGejBuo/u5bXiNqhXn+jrJ9TW9kuCcObpnRhg+iTp4vaat7 HJRz7cEmCVkuJhHXpU0EmePK/59CYeg= X-MC-Unique: ZoYoDh1WM4ugpR2XgSw-Lg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 13/20] ui: check hw requirements during DCL registration Date: Tue, 2 Feb 2021 18:26:18 +0400 Message-Id: <20210202142625.609070-14-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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=63.128.21.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ui/console.c b/ui/console.c index a645418ada..47124e8cad 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1476,12 +1476,34 @@ static bool displaychangelistener_has_dmabuf(Displa= yChangeListener *dcl) return false; } =20 +static bool dpy_compatible_with(QemuConsole *con, DisplayChangeListener *d= cl, 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 +1518,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 Wed Oct 30 22:12:50 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=1612277103; cv=none; d=zohomail.com; s=zohoarc; b=K5nNVTThtYkfzjJSEXS5RPUFb6im30vvW7VKr0hZeQaMaPUcS0ezOuVG5zQ/K6jO8nFX5BqR6WNS00TZIEObEUyWXfl48aAgVYjhmGDkmqIRo3eZvRg/afFqKTPNWuHLIhmmFjFhJxnDZuOUq/tFZHHS+8Zo2ShawUhBt28bSko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612277103; 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=B03CWPY8tWikzQ1qOHk3IHE3M1lP9ggMffOQOK4yy1k=; b=KFbUlQHWsgSQH2Oq2C1ZXvrKmcvWsBpVkvAQI6deGSE+8fStuH39q9gAE3e4vvGEscKDXA2Sr/KGcfu1ylkMYQailb83vSnwazu+tOZxQ2sQhY0YR/D/2fus1fnhgFwCUGNtbnQwiiimCuMg5+gJdRMmwa36hmcFzxHgoFrVlns= 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 1612277103363811.2537302358231; Tue, 2 Feb 2021 06:45:03 -0800 (PST) Received: from localhost ([::1]:53378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wvO-00061T-6W for importer@patchew.org; Tue, 02 Feb 2021 09:45:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wgC-0002yg-I0 for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:29:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48063) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wgA-0003tQ-Uf for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:29:20 -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-233-D0CKF5sfOly-36mZ5aYGrQ-1; Tue, 02 Feb 2021 09:29:16 -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 B3684100CCC8 for ; Tue, 2 Feb 2021 14:29:15 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1C5D5B4B2; Tue, 2 Feb 2021 14:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276158; 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=B03CWPY8tWikzQ1qOHk3IHE3M1lP9ggMffOQOK4yy1k=; b=IBKvxGk3WDd0KV8Lx4e4NeP43k19lNh3mSmTdD7MYD5ivwdq5sKyutXdn0m8j3FaR79Sui CbLDxuhX17yGT13CDZpycL4Xf8LaZM9MGFV65xXURZOkw/fugFHyKJamxWWHMQz3lCDGuP i3m6ouQJ1KWp+pJYhsjeayYAlCAIoEY= X-MC-Unique: D0CKF5sfOly-36mZ5aYGrQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 14/20] ui: add qemu_egl_has_dmabuf helper Date: Tue, 2 Feb 2021 18:26:19 +0400 Message-Id: <20210202142625.609070-15-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 | 9 +++++++++ 2 files changed, 10 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..0fe62fb885 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -441,6 +441,15 @@ 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 || + !epoxy_has_egl_extension(qemu_egl_display, "EGL_EXT_image_dma_buf_= import")) { + return false; + } + return true; +} + EGLContext qemu_egl_init_ctx(void) { static const EGLint ctx_att_core[] =3D { --=20 2.29.0 From nobody Wed Oct 30 22:12:50 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=1612277466; cv=none; d=zohomail.com; s=zohoarc; b=X5Eti/8Pdsk8y2t4cQf03Es8jXLOez5EXwUAYftYykX5uSWzi71AKDH0FeezErtTL5C8gpi9zjC+IZuoeDGm/5IO7/KxypmAvOeJo5JpvCRz7NLD6vZYMXpCW7f4SYOQWDVjwtKmrAWcfL4fASKnG5IyWgmI17AramqZXRrRcAM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612277466; 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=nKnQJEot0t3FTmuuQBuPMnmzMsGFNqIZ0NAhebvMIpHAPw3ZTQwGcb6bZ5WoHwf5SfBVij3iyI1uRP0WcI38Ugz9iSb5TxQFlf5o0v/3W+qCKtAwuFNgUK365eCD5tDxNGrpCgHLSJOxrP6Kg2ZQt3Kr+US9Y+YDjDAmAeT8GDU= 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 1612277466045296.3185982879379; Tue, 2 Feb 2021 06:51:06 -0800 (PST) Received: from localhost ([::1]:33774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6x1E-0001Zi-TN for importer@patchew.org; Tue, 02 Feb 2021 09:51:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wgV-0003DR-Ao for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:29:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:23891) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wgP-0003zc-NJ for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:29:37 -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-464-GzVyfvfaPB6mmMRfzLwWXA-1; Tue, 02 Feb 2021 09:29:30 -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 8645BBBEF0 for ; Tue, 2 Feb 2021 14:29:29 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 044265D9C6; Tue, 2 Feb 2021 14:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276172; 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=NUUKQ0mi4xJgjRBKhbnhQJfcdou+h7ZoV5FRB3ZzZr0dwrFTsyCQeP4EN6U3Z7xZqySZWp 382vQt+w1NYqCovHLKJwvsjnpkCrNW401vqSfbqgeXiLcfd5dICSGZ+mMZWDXMOfKzosIZ xjYFYZ2Hks4szTcjwxZ0VGWErhzx56Y= X-MC-Unique: GzVyfvfaPB6mmMRfzLwWXA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 15/20] ui: check gtk-egl dmabuf support Date: Tue, 2 Feb 2021 18:26:20 +0400 Message-Id: <20210202142625.609070-16-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612277084; cv=none; d=zohomail.com; s=zohoarc; b=IDXIinL+JgwPmFBrZxLjNX2zYNhwIllZ8DpNdtWv9nwD1FBgO8Nbz9zdmf/jKCwEYpzAWb9DCV4vZUSKF6PPtCPL23lTjSInfhCa1sZJQpS49M9rJUSzWdgEuZ12/lRAq8NtkeN8tSTS0yB4WWirVCKRi5y9wlhskRLqJs8KvIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612277084; 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=DAKPtIAKt855f7/zmKTw7BPcvecef0vP+gA4BTHVxgqvHlCEmE2Jp/0LqRHNrh/csWgM/s2kfTYPmSE/gB8SDqLxlrG4Hh23D2GZDy3eQ2+4OXtNl9q5B0TivqWreMVhE9d75yWraV8EL+Kk/ROvggunTQsdrbQeS2+5r1fGkbM= 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 1612277084630313.19614642937154; Tue, 2 Feb 2021 06:44:44 -0800 (PST) Received: from localhost ([::1]:51990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wv5-0005RU-A8 for importer@patchew.org; Tue, 02 Feb 2021 09:44:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wgd-0003OO-Eb for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:29:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31168) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6wgb-000444-Hy for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:29:47 -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-371-rmJCq2g2Opa-N7wYcqMglw-1; Tue, 02 Feb 2021 09:29:43 -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 69D34BBEE0 for ; Tue, 2 Feb 2021 14:29:42 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id E618950EDE; Tue, 2 Feb 2021 14:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276184; 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=DQn62ZAeFNuVB4ONYl7K6B++jTFelJoZPgBpGU8bVb2e29YmyM7lhGXDIgUfgBQDE6ZwB+ vXYsMG6qYhpMVGDHVy74qt7kQjYyCTGDrYhbpF0x3u+2gmVcr2MJg449K9s2+IYpfnSRjV z/UQNPVeHnU3E8Wwick9ui30MsIqdw0= X-MC-Unique: rmJCq2g2Opa-N7wYcqMglw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 16/20] ui: add egl dmabuf import to gtkglarea Date: Tue, 2 Feb 2021 18:26:21 +0400 Message-Id: <20210202142625.609070-17-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612276917; cv=none; d=zohomail.com; s=zohoarc; b=H/HTD0///XkBDlhD5VvjBNcpjC86b4s2IZJ4Fduaz/ePK9701UcJNjNLUveY+WIwmLFQT9LJzmQNp8P63h5XPBD0ZG1a+ifqNLkQzEZM8P47BjwOmRrTIRtlfj0ZPh56cHYQLaY2MiOBmo1AFCTNT0vxcej27Mc7/7XkbtMdPy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276917; 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=FFQE72pOHDEjwo2t2ocuMF/DtKhdUyRkBz38FJtcT5CW7L58uLaR+1gHp5jvu53psPSSLzI6fbJItbF2msClje2nA6wy+WVnsW3+I2OspEGNIPVvSVBK45GBCRo03ZZGde6cLJSS7N0FtFsFJc1dqOSDVl3m5agU0WO7LkTmK9M= 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 1612276917243638.1052987968379; Tue, 2 Feb 2021 06:41:57 -0800 (PST) Received: from localhost ([::1]:40402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wsN-0000fa-48 for importer@patchew.org; Tue, 02 Feb 2021 09:41:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6whF-0004QB-OV for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:30:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39644) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6whD-0004MH-UE for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:30: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-157-jP71c5WkMQ2KWY8I2ieMcA-1; Tue, 02 Feb 2021 09:30:21 -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 D93B8393BE for ; Tue, 2 Feb 2021 14:30:20 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC5EB5D9E8; Tue, 2 Feb 2021 14:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276223; 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=MYDSJOoFF2CGouw5YaaGRtNppeRu5tNuTCg8qLvwKDJZBN9k7D7ZWzcyiYb8AzXUViN2Ji q16H5AytwuM1ZxlSf8nJcs+ICsvCU7rRYsnqPdKadqtRmihdu3iDNa4H8lCzBQiNHdvPnI 7TzYIMVQflKLPLZXBu86qP7R4/yiulQ= X-MC-Unique: jP71c5WkMQ2KWY8I2ieMcA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 17/20] virtio-gpu: avoid re-entering cmdq processing Date: Tue, 2 Feb 2021 18:26:22 +0400 Message-Id: <20210202142625.609070-18-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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=216.205.24.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612277425; cv=none; d=zohomail.com; s=zohoarc; b=aeyYvfkcD9e5a/h8KBGA8Qmo/vzQoBAoUpHvzNz6r9pWq2UNmpRmRACXYHvf/cuD7J/aVPxlX+2rAB4r5/npDNd3ux3gqwkUA3I6iSP6lHglcV5v4JRSn7z8p9uwkwZLCgr1gSR9kg/Hr44LjCG+Zsr98Z1AGcWOXVk1otqO6Oo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612277425; 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=eFvI+HYDT/uNmb9gv/g+8Wj2/+by2z6yvIFI5ecFucY=; b=XGMfxesoGJbqKmuSjTZsVPgq/MXdujXgr2IY7RtlU3OTjOl/UpcvXZI6gtCA7jgtmFq6smmgXJsnvsHm/JlK0pdTgxhEOYPNDsHWnJkrmMJjGbhllxu6zNEtO5/noP8MMU1WxVddLoZqtaorXDwmV57RWhjf9wOWLXJ7MJN2W+Y= 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 1612277425907713.8228496248911; Tue, 2 Feb 2021 06:50:25 -0800 (PST) Received: from localhost ([::1]:60628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6x0a-00011F-Df for importer@patchew.org; Tue, 02 Feb 2021 09:50:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6whg-00059p-J5 for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:30:52 -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 1l6whe-0004Y8-Fk for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:30:52 -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-452-_WVTgapfOHWfBkRHP6l0BQ-1; Tue, 02 Feb 2021 09:30:47 -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 D3993C7424 for ; Tue, 2 Feb 2021 14:30:25 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A25562A02; Tue, 2 Feb 2021 14:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276249; 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=eFvI+HYDT/uNmb9gv/g+8Wj2/+by2z6yvIFI5ecFucY=; b=b1QHAo39XRzXNcp7Km9kAagLOd8+8qV4Y/pKybTVFb60oNI3LSdYgXB4gkIjuOSbTKOAXg bbkiJ+x5xBTJAcKM18zwaPAfKn7UZnfodb4ryvzZRdfZIeH6MaH/x1qufBQm9ylYyQr4XP DhzVKkLtmfvp8ixuS/VX0KS0C9Q7AsY= X-MC-Unique: _WVTgapfOHWfBkRHP6l0BQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 18/20] display/ui: add a callback to indicate GL state is flushed Date: Tue, 2 Feb 2021 18:26:23 +0400 Message-Id: <20210202142625.609070-19-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 82c37aac62..6d6b5eed63 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 @@ -136,6 +142,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 47124e8cad..0de287713f 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 Wed Oct 30 22:12:50 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=1612276968; cv=none; d=zohomail.com; s=zohoarc; b=mPBdKj7z6xDGuGDJdZ6MCtWolUC3m/D58wpLet9audtNEFSrDR3g+mMPeMzJ2A6bEAR8vB09rOdFt8VY+mYByZT+RqDZ3DWSowS9aPiwvW0/DbkIDyTk/yvF3Yt2ERSL9i9jmciNBfkqefBHqpDozVEoP422SynGHhVniTqwQ2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276968; 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=AG8+tIlMDVeIHYWekecG3QyWNX0D9HGpdrLFcaio3yea8p2+BqrcthJpTC3vNRjSTNbTNgZstyZDgy28W+leoOhBCMCt+LWmjtty/GcyeWtj6YA8+Am58f4jKVVYs9TVPcCyLaOMnWyUPPy8go25CSsoCU7vU0rhB9YTpj21cBc= 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 1612276968105433.0984639865161; Tue, 2 Feb 2021 06:42:48 -0800 (PST) Received: from localhost ([::1]:43404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wtC-0001wH-5M for importer@patchew.org; Tue, 02 Feb 2021 09:42:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6whu-0005HF-S9 for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:31:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:22719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6who-0004fe-EL for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:31:04 -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-306-lxXgxoNNP5a9eKs_l33_cA-1; Tue, 02 Feb 2021 09:30:58 -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 B584E189229D for ; Tue, 2 Feb 2021 14:30:31 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 299BC1002393; Tue, 2 Feb 2021 14:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276259; 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=bhLOb2ghVQvfQZCVrNEXqbXYb5h8WwCy5Ja5BWWRvATcoas5LYnJQYQX2aa9QvX3B/Ikc8 12J+JYfo0JAVF5pDtGCaD/2MqVFqrY5PjAs9KPoQRs+GAm85sFsG1zThvcL7EPxLrOIsvb DFllBtR0r/HPN9wVFI5OEkKXymzQ9j0= X-MC-Unique: lxXgxoNNP5a9eKs_l33_cA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 19/20] chardev: check if the chardev is registered for yanking Date: Tue, 2 Feb 2021 18:26:24 +0400 Message-Id: <20210202142625.609070-20-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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 Wed Oct 30 22:12:50 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=1612277551; cv=none; d=zohomail.com; s=zohoarc; b=iG4jwU6IS5VTv4AHCrnkN4fytADMFjJsigBkBMy9IMFPBWD6OHKjqUvs/Bb7PQcOmBJM6+0fWh2p59dhUZAf2k/YZHZz90qaAfTcTg/8oAdk8bGXbtCqjhK5dbrWLJxt6kuFQdTiHc16cRwn1EyqalhXFKA3c6yHMRHNxaCZ6WA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612277551; 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=AvYt1tkIsXw7bEzgj+0tJAL++QzJYfzXrHvM8N6Pku4=; b=lVSpu/t8etIANXm9nC1iOc/EC0h/RsYdMZfS87jA13DRRbN1wslzL7lkn8ToFgVkdBAmEWH/3nvluJ3Bvku9JI1cg3UvQBHUtt/oMPBKYsG3AYmGQVtBtXtF7K/bokANfwmuoMyimcyUjERIrMxWDxP16y5ipkGID8gO02m0eUQ= 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 1612277551270451.96492859093803; Tue, 2 Feb 2021 06:52:31 -0800 (PST) Received: from localhost ([::1]:40984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6x2c-0004gp-6O for importer@patchew.org; Tue, 02 Feb 2021 09:52:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6wi5-0005JW-Sj for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:31:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60507) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6why-0004is-Q8 for qemu-devel@nongnu.org; Tue, 02 Feb 2021 09:31:17 -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-158--9WeaYqRPQ6bQVG7p6UVNw-1; Tue, 02 Feb 2021 09:31:06 -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 6CFC5835E42 for ; Tue, 2 Feb 2021 14:30:37 +0000 (UTC) Received: from localhost (unknown [10.36.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00EA23828; Tue, 2 Feb 2021 14:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276269; 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=AvYt1tkIsXw7bEzgj+0tJAL++QzJYfzXrHvM8N6Pku4=; b=IMrviiU2IvvTSA4SWiNNZcoOx30DBHnYwOSTVYsNFPvehgiIxa7FMB15S/zFXOVQnTw+0Y 8BnD05BzEmsKHyCjdxauHp71xMuBoj6G424VYywmvhpF/vWG1lyoPAm38fy9Z3BWBUR2KV ghgAew9Qodt2N8nF8pHpDekdKxL/xJY= X-MC-Unique: -9WeaYqRPQ6bQVG7p6UVNw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH 20/20] RFC: tests: add some virtio-gpu & vhost-user-gpu acceptance test Date: Tue, 2 Feb 2021 18:26:25 +0400 Message-Id: <20210202142625.609070-21-marcandre.lureau@redhat.com> In-Reply-To: <20210202142625.609070-1-marcandre.lureau@redhat.com> References: <20210202142625.609070-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: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, 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?= , Gerd Hoffmann , Cleber Rosa 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. There are many other things that could be checked, but that's a start. I also don't know yet how to nicely skip on incompatible host & configurations. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/acceptance/virtio-gpu.py | 150 +++++++++++++++++++++++++++++++++ 1 file changed, 150 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..8da20dcc4a --- /dev/null +++ b/tests/acceptance/virtio-gpu.py @@ -0,0 +1,150 @@ +# 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 s= yncing", 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.S= OCK_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