From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152084632253557.735723205347995; Mon, 12 Mar 2018 02:18:42 -0700 (PDT) Received: from localhost ([::1]:57271 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJbN-0001kZ-K1 for importer@patchew.org; Mon, 12 Mar 2018 05:18:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXA-0007CE-AA for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX5-0004aq-OL for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:32870 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX5-0004ZJ-K6 for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 45D4A406E897; Mon, 12 Mar 2018 09:14:15 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA7C110B0F33; Mon, 12 Mar 2018 09:14:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DC72696B4E; Mon, 12 Mar 2018 10:14:05 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:13:52 +0100 Message-Id: <20180312091405.19610-2-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 01/14] build: try improve handling of clang warnings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch disables the pragma diagnostic -Wunused-but-set-variable for clang in util/coroutine-ucontext.c. This in turn allows us to remove it from the configure check, so the CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE will succeed for clang. With that in place clang builds (linux) will use -Werror by default, which breaks the build due to warning about unaligned struct members. Just turning off this warning isn't a good idea as it indicates portability problems. So make it a warning again, using -Wno-error=3Daddress-of-packed-member. That way it doesn't break the build but still shows up in the logs. Now clang builds qemu without errors. Well, almost. There are some left in the rdma code. Leaving that to the rdma people. All others can use --disable-rdma to workarounds this. Cc: Peter Maydell Signed-off-by: Gerd Hoffmann Message-Id: <20180309135945.20436-1-kraxel@redhat.com> Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- configure | 2 +- util/coroutine-ucontext.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index f74e1f3b7c..356abee025 100755 --- a/configure +++ b/configure @@ -1692,6 +1692,7 @@ gcc_flags=3D"-Wno-missing-include-dirs -Wempty-body -= Wnested-externs $gcc_flags" gcc_flags=3D"-Wendif-labels -Wno-shift-negative-value $gcc_flags" gcc_flags=3D"-Wno-initializer-overrides -Wexpansion-to-defined $gcc_flags" gcc_flags=3D"-Wno-string-plus-int $gcc_flags" +gcc_flags=3D"-Wno-error=3Daddress-of-packed-member $gcc_flags" # Note that we do not add -Werror to gcc_flags here, because that would # enable it for all configure tests. If a configure test failed due # to -Werror this would just silently disable some features, @@ -4860,7 +4861,6 @@ fi pragma_disable_unused_but_set=3Dno cat > $TMPC << EOF #pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" #pragma GCC diagnostic ignored "-Wstrict-prototypes" #pragma GCC diagnostic pop =20 diff --git a/util/coroutine-ucontext.c b/util/coroutine-ucontext.c index 926d3402e3..090ba21a13 100644 --- a/util/coroutine-ucontext.c +++ b/util/coroutine-ucontext.c @@ -170,7 +170,7 @@ Coroutine *qemu_coroutine_new(void) } =20 #ifdef CONFIG_VALGRIND_H -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE +#if defined(CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE) && !defined(__clang__) /* Work around an unused variable in the valgrind.h macro... */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-but-set-variable" @@ -179,7 +179,7 @@ static inline void valgrind_stack_deregister(CoroutineU= Context *co) { VALGRIND_STACK_DEREGISTER(co->valgrind_stack_id); } -#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE +#if defined(CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846168830609.5527804626394; Mon, 12 Mar 2018 02:16:08 -0700 (PDT) Received: from localhost ([::1]:57261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJYk-0008D6-D3 for importer@patchew.org; Mon, 12 Mar 2018 05:15:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXA-0007CD-A9 for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX6-0004bb-0S for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45364 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX5-0004aM-Su for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A8B78182D33; Mon, 12 Mar 2018 09:14:15 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB67410B0F34; Mon, 12 Mar 2018 09:14:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E49B296B51; Mon, 12 Mar 2018 10:14:05 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:13:53 +0100 Message-Id: <20180312091405.19610-3-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 02/14] make: switch language file build to be gtk module aware X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi , Bruce Rogers Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bruce Rogers Now that gtk support builds as a module, CONFIG_GTK changed from y to m. Adjust Makefile correspondingly. Signed-off-by: Bruce Rogers Message-id: 20180307155517.32570-1-brogers@suse.com Signed-off-by: Gerd Hoffmann --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9a75c48ae0..026fa17dc0 100644 --- a/Makefile +++ b/Makefile @@ -851,7 +851,7 @@ ifneq ($(BLOBS),) $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \ done endif -ifeq ($(CONFIG_GTK),y) +ifeq ($(CONFIG_GTK),m) $(MAKE) -C po $@ endif $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps" --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846168530240.02802921265777; Mon, 12 Mar 2018 02:16:08 -0700 (PDT) Received: from localhost ([::1]:57263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJYo-0008FI-LG for importer@patchew.org; Mon, 12 Mar 2018 05:16:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXA-0007CG-Bb for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX5-0004YT-3V for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49946 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX4-0004Vz-UX for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF8EEBD9E for ; Mon, 12 Mar 2018 09:14:10 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F5952026E03; Mon, 12 Mar 2018 09:14:09 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EF1F2980BB; Mon, 12 Mar 2018 10:14:05 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:13:54 +0100 Message-Id: <20180312091405.19610-4-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 12 Mar 2018 09:14:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 12 Mar 2018 09:14:10 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 03/14] sdl: workaround bug in sdl 2.0.8 headers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D892087 Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20180307154258.9313-1-kraxel@redhat.com --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 356abee025..8c7124bf2b 100755 --- a/configure +++ b/configure @@ -2875,6 +2875,7 @@ if test "$sdl" !=3D "no" ; then int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } EOF sdl_cflags=3D$($sdlconfig --cflags 2>/dev/null) + sdl_cflags=3D"$sdl_cflags -Wno-undef" # workaround 2.0.8 bug if test "$static" =3D "yes" ; then if $pkg_config $sdlname --exists; then sdl_libs=3D$($pkg_config $sdlname --static --libs 2>/dev/null) --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846323733241.70108900170158; Mon, 12 Mar 2018 02:18:43 -0700 (PDT) Received: from localhost ([::1]:57272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJbO-0001kk-PC for importer@patchew.org; Mon, 12 Mar 2018 05:18:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXB-0007CP-LZ for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX5-0004YN-3X for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:21 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42712 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX4-0004Vt-Tm for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2FCFF4068030 for ; Mon, 12 Mar 2018 09:14:11 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1D802026E0E; Mon, 12 Mar 2018 09:14:06 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0550B980BC; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:13:55 +0100 Message-Id: <20180312091405.19610-5-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 12 Mar 2018 09:14:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 12 Mar 2018 09:14:11 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 04/14] ui/gtk: make GtkGlArea usage a runtime option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Compile in both gtk-egl and gtk-gl-area, then allow to choose at runtime instead of compile time which opengl variant we want use. Signed-off-by: Gerd Hoffmann Message-id: 20180306090951.22932-2-kraxel@redhat.com --- include/ui/gtk.h | 2 ++ ui/gtk.c | 53 +++++++++++++++++++++++++++++------------------------ ui/Makefile.objs | 3 +-- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 849c896eef..f6dafc5961 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -90,6 +90,8 @@ typedef struct VirtualConsole { }; } VirtualConsole; =20 +extern bool gtk_use_gl_area; + /* ui/gtk.c */ void gd_update_windowsize(VirtualConsole *vc); =20 diff --git a/ui/gtk.c b/ui/gtk.c index 563cff32b8..856429a02f 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -243,6 +243,8 @@ typedef struct VCChardev { #define TYPE_CHARDEV_VC "chardev-vc" #define VC_CHARDEV(obj) OBJECT_CHECK(VCChardev, (obj), TYPE_CHARDEV_VC) =20 +bool gtk_use_gl_area; + static void gd_grab_pointer(VirtualConsole *vc, const char *reason); static void gd_ungrab_pointer(GtkDisplayState *s); static void gd_grab_keyboard(VirtualConsole *vc, const char *reason); @@ -453,7 +455,7 @@ static void gd_update_full_redraw(VirtualConsole *vc) int ww, wh; gdk_drawable_get_size(gtk_widget_get_window(area), &ww, &wh); #if defined(CONFIG_GTK_GL) - if (vc->gfx.gls) { + if (vc->gfx.gls && gtk_use_gl_area) { gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); return; } @@ -725,7 +727,7 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = =3D { .dpy_gl_update =3D gd_gl_area_scanout_flush, }; =20 -#else +#endif /* CONFIG_GTK_GL */ =20 static const DisplayChangeListenerOps dcl_egl_ops =3D { .dpy_name =3D "gtk-egl", @@ -745,7 +747,6 @@ static const DisplayChangeListenerOps dcl_egl_ops =3D { .dpy_gl_update =3D gd_egl_scanout_flush, }; =20 -#endif /* CONFIG_GTK_GL */ #endif /* CONFIG_OPENGL */ =20 /** QEMU Events **/ @@ -844,13 +845,13 @@ static gboolean gd_draw_event(GtkWidget *widget, cair= o_t *cr, void *opaque) =20 #if defined(CONFIG_OPENGL) if (vc->gfx.gls) { -#if defined(CONFIG_GTK_GL) - /* invoke render callback please */ - return FALSE; -#else - gd_egl_draw(vc); - return TRUE; -#endif + if (gtk_use_gl_area) { + /* invoke render callback please */ + return FALSE; + } else { + gd_egl_draw(vc); + return TRUE; + } } #endif =20 @@ -1993,7 +1994,7 @@ static void gd_connect_vc_gfx_signals(VirtualConsole = *vc) g_signal_connect(vc->gfx.drawing_area, "draw", G_CALLBACK(gd_draw_event), vc); #if defined(CONFIG_GTK_GL) - if (display_opengl) { + if (gtk_use_gl_area) { /* wire up GtkGlArea events */ g_signal_connect(vc->gfx.drawing_area, "render", G_CALLBACK(gd_render_event), vc); @@ -2116,26 +2117,29 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, V= irtualConsole *vc, #if defined(CONFIG_OPENGL) if (display_opengl) { #if defined(CONFIG_GTK_GL) - vc->gfx.drawing_area =3D gtk_gl_area_new(); - vc->gfx.dcl.ops =3D &dcl_gl_area_ops; -#else - vc->gfx.drawing_area =3D gtk_drawing_area_new(); - /* - * gtk_widget_set_double_buffered() was deprecated in 3.14. - * It is required for opengl rendering on X11 though. A - * proper replacement (native opengl support) is only - * available in 3.16+. Silence the warning if possible. - */ + 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_GTK_GL */ + { + vc->gfx.drawing_area =3D gtk_drawing_area_new(); + /* + * gtk_widget_set_double_buffered() was deprecated in 3.14. + * It is required for opengl rendering on X11 though. A + * proper replacement (native opengl support) is only + * available in 3.16+. Silence the warning if possible. + */ #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif - gtk_widget_set_double_buffered(vc->gfx.drawing_area, FALSE); + gtk_widget_set_double_buffered(vc->gfx.drawing_area, FALSE); #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE #pragma GCC diagnostic pop #endif - vc->gfx.dcl.ops =3D &dcl_egl_ops; -#endif /* CONFIG_GTK_GL */ + vc->gfx.dcl.ops =3D &dcl_egl_ops; + } } else #endif { @@ -2437,6 +2441,7 @@ static void early_gtk_display_init(DisplayOptions *op= ts) if (opts->has_gl && opts->gl) { #if defined(CONFIG_OPENGL) #if defined(CONFIG_GTK_GL) + gtk_use_gl_area =3D true; gtk_gl_area_init(); #else gtk_egl_init(); diff --git a/ui/Makefile.objs b/ui/Makefile.objs index dcd54a5287..d1203bb80a 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -52,11 +52,10 @@ common-obj-y +=3D egl-context.o common-obj-$(CONFIG_OPENGL_DMABUF) +=3D egl-headless.o ifeq ($(CONFIG_GTK_GL),y) gtk.mo-objs +=3D gtk-gl-area.o -else +endif gtk.mo-objs +=3D gtk-egl.o gtk.mo-libs +=3D $(OPENGL_LIBS) endif -endif =20 shader.o-libs +=3D $(OPENGL_LIBS) console-gl.o-libs +=3D $(OPENGL_LIBS) --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846327345651.2750251485323; Mon, 12 Mar 2018 02:18:47 -0700 (PDT) Received: from localhost ([::1]:57273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJbS-0001oF-Gb for importer@patchew.org; Mon, 12 Mar 2018 05:18:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXA-0007CF-BI for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX5-0004YB-2m for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45362 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX4-0004Vv-Th for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D69C68182D33 for ; Mon, 12 Mar 2018 09:14:11 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E19D215CDAC; Mon, 12 Mar 2018 09:14:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0DB4B980BE; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:13:56 +0100 Message-Id: <20180312091405.19610-6-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 12 Mar 2018 09:14:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 12 Mar 2018 09:14:11 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 05/14] ui/gtk: group gtk.mo declarations in Makefile X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Message-id: 20180306090951.22932-3-kraxel@redhat.com --- ui/Makefile.objs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ui/Makefile.objs b/ui/Makefile.objs index d1203bb80a..b560ee12c3 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -38,6 +38,13 @@ common-obj-$(CONFIG_GTK) +=3D gtk.mo gtk.mo-objs :=3D gtk.o gtk.mo-cflags :=3D $(GTK_CFLAGS) $(VTE_CFLAGS) gtk.mo-libs :=3D $(GTK_LIBS) $(VTE_LIBS) +ifeq ($(CONFIG_OPENGL),y) +gtk.mo-objs +=3D gtk-egl.o +gtk.mo-libs +=3D $(OPENGL_LIBS) +ifeq ($(CONFIG_GTK_GL),y) +gtk.mo-objs +=3D gtk-gl-area.o +endif +endif =20 common-obj-$(CONFIG_CURSES) +=3D curses.mo curses.mo-objs :=3D curses.o @@ -50,11 +57,6 @@ common-obj-y +=3D console-gl.o common-obj-y +=3D egl-helpers.o common-obj-y +=3D egl-context.o common-obj-$(CONFIG_OPENGL_DMABUF) +=3D egl-headless.o -ifeq ($(CONFIG_GTK_GL),y) -gtk.mo-objs +=3D gtk-gl-area.o -endif -gtk.mo-objs +=3D gtk-egl.o -gtk.mo-libs +=3D $(OPENGL_LIBS) endif =20 shader.o-libs +=3D $(OPENGL_LIBS) --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846922763188.59444649285751; Mon, 12 Mar 2018 02:28:42 -0700 (PDT) Received: from localhost ([::1]:57333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJl4-0001Wp-2K for importer@patchew.org; Mon, 12 Mar 2018 05:28:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXC-0007Cb-0Z for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX7-0004g9-MB for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:21 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43406 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX7-0004fH-HP for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 315794023155 for ; Mon, 12 Mar 2018 09:14:17 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 932C61C4E7; Mon, 12 Mar 2018 09:14:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 15E24980C6; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:13:57 +0100 Message-Id: <20180312091405.19610-7-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 12 Mar 2018 09:14:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 12 Mar 2018 09:14:17 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 06/14] ui/opengl: Makefile cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With gtk.mo bits moved away we don't need the ifeq any more. Also add missing opengl libs for some objects. Signed-off-by: Gerd Hoffmann Message-id: 20180306090951.22932-4-kraxel@redhat.com --- ui/Makefile.objs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/Makefile.objs b/ui/Makefile.objs index b560ee12c3..cc784346cb 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -51,14 +51,14 @@ curses.mo-objs :=3D curses.o curses.mo-cflags :=3D $(CURSES_CFLAGS) curses.mo-libs :=3D $(CURSES_LIBS) =20 -ifeq ($(CONFIG_OPENGL),y) -common-obj-y +=3D shader.o -common-obj-y +=3D console-gl.o -common-obj-y +=3D egl-helpers.o -common-obj-y +=3D egl-context.o +common-obj-$(CONFIG_OPENGL) +=3D shader.o +common-obj-$(CONFIG_OPENGL) +=3D console-gl.o +common-obj-$(CONFIG_OPENGL) +=3D egl-helpers.o +common-obj-$(CONFIG_OPENGL) +=3D egl-context.o common-obj-$(CONFIG_OPENGL_DMABUF) +=3D egl-headless.o -endif =20 shader.o-libs +=3D $(OPENGL_LIBS) console-gl.o-libs +=3D $(OPENGL_LIBS) egl-helpers.o-libs +=3D $(OPENGL_LIBS) +egl-context.o-libs +=3D $(OPENGL_LIBS) +egl-headless.o-libs +=3D $(OPENGL_LIBS) --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846810435717.7288583785634; Mon, 12 Mar 2018 02:26:50 -0700 (PDT) Received: from localhost ([::1]:57322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJjC-00005m-7d for importer@patchew.org; Mon, 12 Mar 2018 05:26:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXA-0007CC-9c for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX5-0004Y5-2Y for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:32865 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX4-0004W0-U8 for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:14 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3BD8E4000B6E for ; Mon, 12 Mar 2018 09:14:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8AAD2026E03; Mon, 12 Mar 2018 09:14:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1E18C980CA; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:13:58 +0100 Message-Id: <20180312091405.19610-8-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 09:14:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 09:14:12 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 07/14] ui/gtk: use GtkGlArea on wayland only X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For dma-buf support we need a egl context. The gtk x11 backend uses glx contexts though. We can't use the GtkGlArea widget on x11 because of that, so use our own gtk-egl code instead. wayland continues to use the GtkGlArea widget. Signed-off-by: Gerd Hoffmann Message-id: 20180306090951.22932-5-kraxel@redhat.com --- ui/gtk.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 856429a02f..4a1622b887 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2440,12 +2440,15 @@ static void early_gtk_display_init(DisplayOptions *= opts) assert(opts->type =3D=3D DISPLAY_TYPE_GTK); if (opts->has_gl && opts->gl) { #if defined(CONFIG_OPENGL) -#if defined(CONFIG_GTK_GL) - gtk_use_gl_area =3D true; - gtk_gl_area_init(); -#else - gtk_egl_init(); +#if defined(CONFIG_GTK_GL) && defined(GDK_WINDOWING_WAYLAND) + if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) { + gtk_use_gl_area =3D true; + gtk_gl_area_init(); + } #endif + { + gtk_egl_init(); + } #endif } =20 --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846484540707.7435175240653; Mon, 12 Mar 2018 02:21:24 -0700 (PDT) Received: from localhost ([::1]:57291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJdq-0004BZ-FM for importer@patchew.org; Mon, 12 Mar 2018 05:21:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXA-0007CB-9d for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX5-0004Yi-4D for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:32864 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX4-0004Vy-UO for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:15 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FE06406E897 for ; Mon, 12 Mar 2018 09:14:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBE1F215CDAC; Mon, 12 Mar 2018 09:14:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 283F2980CC; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:13:59 +0100 Message-Id: <20180312091405.19610-9-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 09:14:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 09:14:12 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 08/14] ui/gtk-egl: add scanout_dmabuf support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for dmabuf scanouts to gtk-egl. Signed-off-by: Gerd Hoffmann Message-id: 20180306090951.22932-6-kraxel@redhat.com --- include/ui/gtk.h | 4 ++++ ui/gtk-egl.c | 23 +++++++++++++++++++++++ ui/gtk.c | 2 ++ 3 files changed, 29 insertions(+) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index f6dafc5961..84c992c227 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -113,6 +113,10 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h); +void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf); +void gd_egl_release_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf); void gd_egl_scanout_flush(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); void gtk_egl_init(void); diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index eb86c26a1d..2c83c22d04 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -194,6 +194,29 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl, backing_id, false); } =20 +void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf) +{ +#ifdef CONFIG_OPENGL_DMABUF + egl_dmabuf_import_texture(dmabuf); + if (!dmabuf->texture) { + return; + } + + gd_egl_scanout_texture(dcl, dmabuf->texture, + false, dmabuf->width, dmabuf->height, + 0, 0, dmabuf->width, dmabuf->height); +#endif +} + +void gd_egl_release_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf) +{ +#ifdef CONFIG_OPENGL_DMABUF + egl_dmabuf_release_texture(dmabuf); +#endif +} + void gd_egl_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 4a1622b887..cf2061d716 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -744,6 +744,8 @@ static const DisplayChangeListenerOps dcl_egl_ops =3D { .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, + .dpy_gl_release_dmabuf =3D gd_egl_release_dmabuf, .dpy_gl_update =3D gd_egl_scanout_flush, }; =20 --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846484450985.5709848339532; Mon, 12 Mar 2018 02:21:24 -0700 (PDT) Received: from localhost ([::1]:57290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJdp-0004AS-CR for importer@patchew.org; Mon, 12 Mar 2018 05:21:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXB-0007CQ-MS for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX6-0004cl-AN for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:21 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43404 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX6-0004bC-5q for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:16 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C9D024023155 for ; Mon, 12 Mar 2018 09:14:15 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1565B2026E03; Mon, 12 Mar 2018 09:14:15 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 32822980CD; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:14:00 +0100 Message-Id: <20180312091405.19610-10-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 09/14] ui/gtk-egl: add cursor_dmabuf support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for cursor dmabufs to gtk-egl. Just blend in the cursor (if we have one) when rendering the dmabuf. Signed-off-by: Gerd Hoffmann Message-id: 20180306090951.22932-7-kraxel@redhat.com --- include/ui/gtk.h | 8 ++++++++ ui/gtk-egl.c | 40 +++++++++++++++++++++++++++++++++++++++- ui/gtk.c | 2 ++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 84c992c227..2922fc64b2 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -54,6 +54,9 @@ typedef struct VirtualGfxConsole { int x, y, w, h; egl_fb guest_fb; egl_fb win_fb; + egl_fb cursor_fb; + int cursor_x; + int cursor_y; bool y0_top; bool scanout_mode; #endif @@ -115,6 +118,11 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl, uint32_t w, uint32_t h); void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf); +void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf, bool have_hot, + uint32_t hot_x, uint32_t hot_y); +void gd_egl_cursor_position(DisplayChangeListener *dcl, + uint32_t pos_x, uint32_t pos_y); void gd_egl_release_dmabuf(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf); void gd_egl_scanout_flush(DisplayChangeListener *dcl, diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 2c83c22d04..9390c6762e 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -19,6 +19,7 @@ #include "ui/console.h" #include "ui/gtk.h" #include "ui/egl-helpers.h" +#include "ui/shader.h" =20 #include "sysemu/sysemu.h" =20 @@ -209,6 +210,35 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, #endif } =20 +void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf, bool have_hot, + uint32_t hot_x, uint32_t hot_y) +{ +#ifdef CONFIG_OPENGL_DMABUF + VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); + + if (dmabuf) { + egl_dmabuf_import_texture(dmabuf); + if (!dmabuf->texture) { + return; + } + egl_fb_setup_for_tex(&vc->gfx.cursor_fb, dmabuf->width, dmabuf->he= ight, + dmabuf->texture, false); + } else { + egl_fb_destroy(&vc->gfx.cursor_fb); + } +#endif +} + +void gd_egl_cursor_position(DisplayChangeListener *dcl, + uint32_t pos_x, uint32_t pos_y) +{ + VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); + + vc->gfx.cursor_x =3D pos_x; + vc->gfx.cursor_y =3D pos_y; +} + void gd_egl_release_dmabuf(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf) { @@ -237,7 +267,15 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl, window =3D gtk_widget_get_window(vc->gfx.drawing_area); gdk_drawable_get_size(window, &ww, &wh); egl_fb_setup_default(&vc->gfx.win_fb, ww, wh); - egl_fb_blit(&vc->gfx.win_fb, &vc->gfx.guest_fb, !vc->gfx.y0_top); + if (vc->gfx.cursor_fb.texture) { + egl_texture_blit(vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.guest_fb, + vc->gfx.y0_top); + egl_texture_blend(vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.cursor_fb, + vc->gfx.y0_top, + vc->gfx.cursor_x, vc->gfx.cursor_y); + } else { + egl_fb_blit(&vc->gfx.win_fb, &vc->gfx.guest_fb, !vc->gfx.y0_top); + } =20 eglSwapBuffers(qemu_egl_display, vc->gfx.esurface); } diff --git a/ui/gtk.c b/ui/gtk.c index cf2061d716..ef5bc42094 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -745,6 +745,8 @@ static const DisplayChangeListenerOps dcl_egl_ops =3D { .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, + .dpy_gl_cursor_dmabuf =3D gd_egl_cursor_dmabuf, + .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, }; --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846604522397.0023071430893; Mon, 12 Mar 2018 02:23:24 -0700 (PDT) Received: from localhost ([::1]:57300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJfv-0005xe-OV for importer@patchew.org; Mon, 12 Mar 2018 05:23:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXC-0007Ck-9k for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX6-0004c7-4e for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:22 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47206 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX5-0004ah-VU for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:16 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D1AA8D746; Mon, 12 Mar 2018 09:14:15 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 207BE10E60DA; Mon, 12 Mar 2018 09:14:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3CCE9980CE; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:14:01 +0100 Message-Id: <20180312091405.19610-11-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 10/14] vnc: deal with surface NULL pointers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Christian Borntraeger , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Secondary displays in multihead setups are allowed to have a NULL DisplaySurface. Typically user interfaces handle this by hiding the window which shows the display in question. This isn't an option for vnc though because it simply hasn't a concept of windows or outputs. So handle the situation by showing a placeholder DisplaySurface instead. Also check in console_select whenever a surface is preset in the first place before requesting an update. This fixes a segfault which can be triggered by switching to an unused display (via vtrl-alt-) in a multihead setup, for example using -device virtio-vga,max_outputs=3D2. Cc: Christian Borntraeger Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Christian Borntraeger Message-id: 20180308161803.6152-1-kraxel@redhat.com --- include/ui/console.h | 2 ++ ui/console.c | 10 ++++++---- ui/vnc.c | 10 ++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index aae9e44cb3..5fca9afcbc 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -260,6 +260,8 @@ DisplaySurface *qemu_create_displaysurface_guestmem(int= width, int height, pixman_format_code_t f= ormat, int linesize, uint64_t addr); +DisplaySurface *qemu_create_message_surface(int w, int h, + const char *msg); PixelFormat qemu_default_pixelformat(int bpp); =20 DisplaySurface *qemu_create_displaysurface(int width, int height); diff --git a/ui/console.c b/ui/console.c index 6ab4ff3baf..348610dd43 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1039,8 +1039,10 @@ void console_select(unsigned int index) dcl->ops->dpy_gfx_switch(dcl, s->surface); } } - dpy_gfx_update(s, 0, 0, surface_width(s->surface), - surface_height(s->surface)); + if (s->surface) { + dpy_gfx_update(s, 0, 0, surface_width(s->surface), + surface_height(s->surface)); + } } if (ds->have_text) { dpy_text_resize(s, s->width, s->height); @@ -1370,8 +1372,8 @@ DisplaySurface *qemu_create_displaysurface_guestmem(i= nt width, int height, return surface; } =20 -static DisplaySurface *qemu_create_message_surface(int w, int h, - const char *msg) +DisplaySurface *qemu_create_message_surface(int w, int h, + const char *msg) { DisplaySurface *surface =3D qemu_create_displaysurface(w, h); pixman_color_t bg =3D color_table_rgb[0][QEMU_COLOR_BLACK]; diff --git a/ui/vnc.c b/ui/vnc.c index 13c28cabb0..e164eb798c 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -746,9 +746,19 @@ static void vnc_update_server_surface(VncDisplay *vd) static void vnc_dpy_switch(DisplayChangeListener *dcl, DisplaySurface *surface) { + static const char placeholder_msg[] =3D + "Display output is not active."; + static DisplaySurface *placeholder; VncDisplay *vd =3D container_of(dcl, VncDisplay, dcl); VncState *vs; =20 + if (surface =3D=3D NULL) { + if (placeholder =3D=3D NULL) { + placeholder =3D qemu_create_message_surface(640, 480, placehol= der_msg); + } + surface =3D placeholder; + } + vnc_abort_display_jobs(vd); vd->ds =3D surface; =20 --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846605057725.3991225606644; Mon, 12 Mar 2018 02:23:25 -0700 (PDT) Received: from localhost ([::1]:57301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJfw-0005y7-9Q for importer@patchew.org; Mon, 12 Mar 2018 05:23:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXA-0007CA-8G for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX5-0004Ze-FC for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43402 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX5-0004Xc-7R for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:15 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D9C884023156 for ; Mon, 12 Mar 2018 09:14:14 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C096215CDAC; Mon, 12 Mar 2018 09:14:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 466EB980CF; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:14:02 +0100 Message-Id: <20180312091405.19610-12-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 12 Mar 2018 09:14:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 12 Mar 2018 09:14:14 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 11/14] spice: drop dprint() debug logging X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some calls are deleted, some are converted into tracepoints. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20180308090618.30147-2-kraxel@redhat.com --- ui/spice-display.c | 75 ++++++++++++++++----------------------------------= ---- ui/trace-events | 9 +++++++ 2 files changed, 31 insertions(+), 53 deletions(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index 98ccdfb687..79ea4df02c 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -26,20 +26,8 @@ =20 #include "ui/spice-display.h" =20 -static int debug =3D 0; bool spice_opengl; =20 -static void GCC_FMT_ATTR(2, 3) dprint(int level, const char *fmt, ...) -{ - va_list args; - - if (level <=3D debug) { - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - } -} - int qemu_spice_rect_is_empty(const QXLRect* r) { return r->top =3D=3D r->bottom || r->left =3D=3D r->right; @@ -322,8 +310,6 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay = *ssd) { QXLDevMemSlot memslot; =20 - dprint(1, "%s/%d:\n", __func__, ssd->qxl.id); - memset(&memslot, 0, sizeof(memslot)); memslot.slot_group_id =3D MEMSLOT_GROUP_HOST; memslot.virt_end =3D ~0; @@ -347,10 +333,6 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay= *ssd) ssd->buf =3D g_malloc(ssd->bufsize); } =20 - dprint(1, "%s/%d: %ux%u (size %" PRIu64 "/%d)\n", __func__, ssd->qxl.i= d, - surface_width(ssd->ds), surface_height(ssd->ds), - surface_size, ssd->bufsize); - surface.format =3D SPICE_SURFACE_FMT_32_xRGB; surface.width =3D surface_width(ssd->ds); surface.height =3D surface_height(ssd->ds); @@ -366,8 +348,6 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay = *ssd) =20 void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd) { - dprint(1, "%s/%d:\n", __func__, ssd->qxl.id); - qemu_spice_destroy_primary_surface(ssd, 0, QXL_SYNC); } =20 @@ -389,8 +369,7 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd, { QXLRect update_area; =20 - dprint(2, "%s/%d: x %d y %d w %d h %d\n", __func__, - ssd->qxl.id, x, y, w, h); + trace_qemu_spice_display_update(ssd->qxl.id, x, y, w, h); update_area.left =3D x, update_area.right =3D x + w; update_area.top =3D y; @@ -413,8 +392,10 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, surface_height(surface) =3D=3D pixman_image_get_height(ssd->surfac= e) && surface_format(surface) =3D=3D pixman_image_get_format(ssd->surfac= e)) { /* no-resize fast path: just swap backing store */ - dprint(1, "%s/%d: fast (%dx%d)\n", __func__, ssd->qxl.id, - surface_width(surface), surface_height(surface)); + trace_qemu_spice_display_surface(ssd->qxl.id, + surface_width(surface), + surface_height(surface), + true); qemu_mutex_lock(&ssd->lock); ssd->ds =3D surface; pixman_image_unref(ssd->surface); @@ -427,11 +408,10 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ss= d, } =20 /* full mode switch */ - dprint(1, "%s/%d: full (%dx%d -> %dx%d)\n", __func__, ssd->qxl.id, - ssd->surface ? pixman_image_get_width(ssd->surface) : 0, - ssd->surface ? pixman_image_get_height(ssd->surface) : 0, - surface ? surface_width(surface) : 0, - surface ? surface_height(surface) : 0); + trace_qemu_spice_display_surface(ssd->qxl.id, + surface ? surface_width(surface) : 0, + surface ? surface_height(surface) : 0, + false); =20 memset(&ssd->dirty, 0, sizeof(ssd->dirty)); if (ssd->surface) { @@ -495,7 +475,6 @@ void qemu_spice_cursor_refresh_bh(void *opaque) =20 void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd) { - dprint(3, "%s/%d:\n", __func__, ssd->qxl.id); graphic_hw_update(ssd->dcl.con); =20 qemu_mutex_lock(&ssd->lock); @@ -505,10 +484,10 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *s= sd) } qemu_mutex_unlock(&ssd->lock); =20 + trace_qemu_spice_display_refresh(ssd->qxl.id, ssd->notify); if (ssd->notify) { ssd->notify =3D 0; qemu_spice_wakeup(ssd); - dprint(2, "%s/%d: notify\n", __func__, ssd->qxl.id); } } =20 @@ -516,21 +495,17 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *s= sd) =20 static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worke= r) { - SimpleSpiceDisplay *ssd =3D container_of(sin, SimpleSpiceDisplay, qxl); - - dprint(1, "%s/%d:\n", __func__, ssd->qxl.id); + /* nothing to do */ } =20 static void interface_set_compression_level(QXLInstance *sin, int level) { - dprint(1, "%s/%d:\n", __func__, sin->id); /* nothing to do */ } =20 #if SPICE_NEEDS_SET_MM_TIME static void interface_set_mm_time(QXLInstance *sin, uint32_t mm_time) { - dprint(3, "%s/%d:\n", __func__, sin->id); /* nothing to do */ } #endif @@ -554,8 +529,6 @@ static int interface_get_command(QXLInstance *sin, QXLC= ommandExt *ext) SimpleSpiceUpdate *update; int ret =3D false; =20 - dprint(3, "%s/%d:\n", __func__, ssd->qxl.id); - qemu_mutex_lock(&ssd->lock); update =3D QTAILQ_FIRST(&ssd->updates); if (update !=3D NULL) { @@ -570,7 +543,6 @@ static int interface_get_command(QXLInstance *sin, QXLC= ommandExt *ext) =20 static int interface_req_cmd_notification(QXLInstance *sin) { - dprint(2, "%s/%d:\n", __func__, sin->id); return 1; } =20 @@ -582,7 +554,6 @@ static void interface_release_resource(QXLInstance *sin, SimpleSpiceCursor *cursor; QXLCommandExt *ext; =20 - dprint(2, "%s/%d:\n", __func__, ssd->qxl.id); ext =3D (void *)(intptr_t)(rext.info->id); switch (ext->cmd.type) { case QXL_CMD_DRAW: @@ -603,8 +574,6 @@ static int interface_get_cursor_command(QXLInstance *si= n, QXLCommandExt *ext) SimpleSpiceDisplay *ssd =3D container_of(sin, SimpleSpiceDisplay, qxl); int ret; =20 - dprint(3, "%s/%d:\n", __func__, ssd->qxl.id); - qemu_mutex_lock(&ssd->lock); if (ssd->ptr_define) { *ext =3D ssd->ptr_define->ext; @@ -623,7 +592,6 @@ static int interface_get_cursor_command(QXLInstance *si= n, QXLCommandExt *ext) =20 static int interface_req_cursor_notification(QXLInstance *sin) { - dprint(2, "%s:\n", __func__); return 1; } =20 @@ -680,7 +648,7 @@ static void interface_set_client_capabilities(QXLInstan= ce *sin, uint8_t client_present, uint8_t caps[58]) { - dprint(3, "%s:\n", __func__); + /* nothing to do */ } =20 static int interface_client_monitors_config(QXLInstance *sin, @@ -705,9 +673,9 @@ static int interface_client_monitors_config(QXLInstance= *sin, info.width =3D mc->monitors[head].width; info.height =3D mc->monitors[head].height; } + + trace_qemu_spice_ui_info(ssd->qxl.id, info.width, info.height); dpy_set_ui_info(ssd->dcl.con, &info); - dprint(1, "%s/%d: size %dx%d\n", __func__, ssd->qxl.id, - info.width, info.height); return 1; } =20 @@ -902,9 +870,10 @@ static void spice_gl_switch(DisplayChangeListener *dcl, return; } =20 - dprint(1, "%s: %dx%d (stride %d/%d, fourcc 0x%x)\n", __func__, - surface_width(ssd->ds), surface_height(ssd->ds), - surface_stride(ssd->ds), stride, fourcc); + trace_qemu_spice_gl_surface(ssd->qxl.id, + surface_width(ssd->ds), + surface_height(ssd->ds), + fourcc); =20 /* note: spice server will close the fd */ spice_qxl_gl_scanout(&ssd->qxl, fd, @@ -932,7 +901,7 @@ static void qemu_spice_gl_scanout_disable(DisplayChange= Listener *dcl) { SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); =20 - dprint(1, "%s: no framebuffer\n", __func__); + trace_qemu_spice_gl_scanout_disable(ssd->qxl.id); spice_qxl_gl_scanout(&ssd->qxl, -1, 0, 0, 0, 0, false); qemu_spice_gl_monitor_config(ssd, 0, 0, 0, 0); ssd->have_surface =3D false; @@ -957,8 +926,7 @@ static void qemu_spice_gl_scanout_texture(DisplayChange= Listener *dcl, fprintf(stderr, "%s: failed to get fd for texture\n", __func__); return; } - dprint(1, "%s: %dx%d (stride %d, fourcc 0x%x)\n", __func__, - w, h, stride, fourcc); + trace_qemu_spice_gl_scanout_texture(ssd->qxl.id, w, h, fourcc); =20 /* note: spice server will close the fd */ spice_qxl_gl_scanout(&ssd->qxl, fd, backing_width, backing_height, @@ -978,7 +946,8 @@ static void qemu_spice_gl_update(DisplayChangeListener = *dcl, return; } =20 - dprint(2, "%s: %dx%d+%d+%d\n", __func__, w, h, x, y); + + trace_qemu_spice_gl_update(ssd->qxl.id, w, h, x, y); qemu_spice_gl_block(ssd, true); cookie =3D (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_GL_DRAW_DONE, 0); spice_qxl_gl_draw_async(&ssd->qxl, x, y, w, h, cookie); diff --git a/ui/trace-events b/ui/trace-events index 861b68a305..518e950a01 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -75,6 +75,15 @@ qemu_spice_create_primary_surface(int qid, uint32_t sid,= void *surface, int asyn qemu_spice_destroy_primary_surface(int qid, uint32_t sid, int async) "%d s= id=3D%u async=3D%d" qemu_spice_wakeup(uint32_t qid) "%d" qemu_spice_create_update(uint32_t left, uint32_t right, uint32_t top, uint= 32_t bottom) "lr %d -> %d, tb -> %d -> %d" +qemu_spice_display_update(int qid, uint32_t x, uint32_t y, uint32_t w, uin= t32_t h) "%d +%d+%d %dx%d" +qemu_spice_display_surface(int qid, uint32_t w, uint32_t h, int fast) "%d = %dx%d, fast %d" +qemu_spice_display_refresh(int qid, int notify) "%d notify %d" +qemu_spice_ui_info(int qid, uint32_t width, uint32_t height) "%d %dx%d" + +qemu_spice_gl_surface(int qid, uint32_t w, uint32_t h, uint32_t fourcc) "%= d %dx%d, fourcc 0x%x" +qemu_spice_gl_scanout_disable(int qid) "%d" +qemu_spice_gl_scanout_texture(int qid, uint32_t w, uint32_t h, uint32_t fo= urcc) "%d %dx%d, fourcc 0x%x" +qemu_spice_gl_update(int qid, uint32_t x, uint32_t y, uint32_t w, uint32_t= h) "%d +%d+%d %dx%d" =20 # ui/keymaps.c keymap_parse(const char *file) "file %s" --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846743669140.29973539496507; Mon, 12 Mar 2018 02:25:43 -0700 (PDT) Received: from localhost ([::1]:57316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJiA-0007lm-UT for importer@patchew.org; Mon, 12 Mar 2018 05:25:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXB-0007Ca-VP for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX6-0004do-NG for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:21 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:32874 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX6-0004cd-JA for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:16 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3980A4000B6E for ; Mon, 12 Mar 2018 09:14:16 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F9781C719; Mon, 12 Mar 2018 09:14:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4EE92980D0; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:14:03 +0100 Message-Id: <20180312091405.19610-13-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 09:14:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 09:14:16 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 12/14] spice: add scanout_dmabuf support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add support for scanout dmabufs. Just pass them through to spice-server. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20180308090618.30147-3-kraxel@redhat.com --- ui/spice-display.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ui/spice-display.c b/ui/spice-display.c index 79ea4df02c..4c33c92ae5 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -936,6 +936,20 @@ static void qemu_spice_gl_scanout_texture(DisplayChang= eListener *dcl, ssd->have_scanout =3D true; } =20 +static void qemu_spice_gl_scanout_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf) +{ + SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); + + /* note: spice server will close the fd, so hand over a dup */ + spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd), + dmabuf->width, dmabuf->height, + dmabuf->stride, dmabuf->fourcc, false); + qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height); + ssd->have_surface =3D false; + ssd->have_scanout =3D true; +} + static void qemu_spice_gl_update(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint3= 2_t h) { @@ -969,6 +983,7 @@ static const DisplayChangeListenerOps display_listener_= gl_ops =3D { =20 .dpy_gl_scanout_disable =3D qemu_spice_gl_scanout_disable, .dpy_gl_scanout_texture =3D qemu_spice_gl_scanout_texture, + .dpy_gl_scanout_dmabuf =3D qemu_spice_gl_scanout_dmabuf, .dpy_gl_update =3D qemu_spice_gl_update, }; =20 --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846705672923.2497970039233; Mon, 12 Mar 2018 02:25:05 -0700 (PDT) Received: from localhost ([::1]:57310 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJhY-0007EI-TP for importer@patchew.org; Mon, 12 Mar 2018 05:25:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXB-0007CR-Lv for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX5-0004Ye-4b for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:21 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42714 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX4-0004Vu-Ud for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15751406804F for ; Mon, 12 Mar 2018 09:14:13 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F487202322A; Mon, 12 Mar 2018 09:14:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5BF6D980D1; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:14:04 +0100 Message-Id: <20180312091405.19610-14-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 12 Mar 2018 09:14:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 12 Mar 2018 09:14:13 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 13/14] spice: add cursor_dmabuf support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add support for cursor dmabufs. qemu has to render the cursor for that, so in case a cursor is present qemu allocates a new dmabuf, blits the scanout, blends in the pointer and passes on the new dmabuf to spice-server. Without cursor qemu continues to simply pass on the scanout dmabuf as-is. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20180308090618.30147-4-kraxel@redhat.com --- include/ui/spice-display.h | 9 ++++ ui/spice-display.c | 114 +++++++++++++++++++++++++++++++++++++++++= ++-- ui/trace-events | 3 ++ 3 files changed, 121 insertions(+), 5 deletions(-) diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h index 6b5c73b21c..87a84a59d4 100644 --- a/include/ui/spice-display.h +++ b/include/ui/spice-display.h @@ -122,6 +122,15 @@ struct SimpleSpiceDisplay { int gl_updates; bool have_scanout; bool have_surface; + + QemuDmaBuf *guest_dmabuf; + bool guest_dmabuf_refresh; + bool render_cursor; + + egl_fb guest_fb; + egl_fb blit_fb; + egl_fb cursor_fb; + bool have_hot; #endif }; =20 diff --git a/ui/spice-display.c b/ui/spice-display.c index 4c33c92ae5..fe734821dd 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -941,25 +941,126 @@ static void qemu_spice_gl_scanout_dmabuf(DisplayChan= geListener *dcl, { SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); =20 - /* note: spice server will close the fd, so hand over a dup */ - spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd), - dmabuf->width, dmabuf->height, - dmabuf->stride, dmabuf->fourcc, false); - qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->height); + ssd->guest_dmabuf =3D dmabuf; + ssd->guest_dmabuf_refresh =3D true; + ssd->have_surface =3D false; ssd->have_scanout =3D true; } =20 +static void qemu_spice_gl_cursor_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf, bool have_hot, + uint32_t hot_x, uint32_t hot_y) +{ + SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); + + ssd->have_hot =3D have_hot; + ssd->hot_x =3D hot_x; + ssd->hot_y =3D hot_y; + + trace_qemu_spice_gl_cursor(ssd->qxl.id, dmabuf !=3D NULL, have_hot); + if (dmabuf) { + egl_dmabuf_import_texture(dmabuf); + if (!dmabuf->texture) { + return; + } + egl_fb_setup_for_tex(&ssd->cursor_fb, dmabuf->width, dmabuf->heigh= t, + dmabuf->texture, false); + } else { + egl_fb_destroy(&ssd->cursor_fb); + } +} + +static void qemu_spice_gl_cursor_position(DisplayChangeListener *dcl, + uint32_t pos_x, uint32_t pos_y) +{ + SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); + + ssd->ptr_x =3D pos_x; + ssd->ptr_y =3D pos_y; +} + +static void qemu_spice_gl_release_dmabuf(DisplayChangeListener *dcl, + QemuDmaBuf *dmabuf) +{ + SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); + + if (ssd->guest_dmabuf =3D=3D dmabuf) { + ssd->guest_dmabuf =3D NULL; + ssd->guest_dmabuf_refresh =3D false; + } + egl_dmabuf_release_texture(dmabuf); +} + static void qemu_spice_gl_update(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint3= 2_t h) { SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); + EGLint stride =3D 0, fourcc =3D 0; + bool render_cursor =3D false; + bool y_0_top =3D false; /* FIXME */ uint64_t cookie; + int fd; =20 if (!ssd->have_scanout) { return; } =20 + if (ssd->cursor_fb.texture) { + render_cursor =3D true; + } + if (ssd->render_cursor !=3D render_cursor) { + ssd->render_cursor =3D render_cursor; + ssd->guest_dmabuf_refresh =3D true; + egl_fb_destroy(&ssd->blit_fb); + } + + if (ssd->guest_dmabuf_refresh) { + QemuDmaBuf *dmabuf =3D ssd->guest_dmabuf; + if (render_cursor) { + egl_dmabuf_import_texture(dmabuf); + if (!dmabuf->texture) { + return; + } + + /* source framebuffer */ + egl_fb_setup_for_tex(&ssd->guest_fb, + dmabuf->width, dmabuf->height, + dmabuf->texture, false); + + /* dest framebuffer */ + if (ssd->blit_fb.width !=3D dmabuf->width || + ssd->blit_fb.height !=3D dmabuf->height) { + trace_qemu_spice_gl_render_dmabuf(ssd->qxl.id, dmabuf->wid= th, + dmabuf->height); + egl_fb_destroy(&ssd->blit_fb); + egl_fb_setup_new_tex(&ssd->blit_fb, + dmabuf->width, dmabuf->height); + fd =3D egl_get_fd_for_texture(ssd->blit_fb.texture, + &stride, &fourcc); + spice_qxl_gl_scanout(&ssd->qxl, fd, + dmabuf->width, dmabuf->height, + stride, fourcc, false); + } + } else { + trace_qemu_spice_gl_forward_dmabuf(ssd->qxl.id, + dmabuf->width, dmabuf->heig= ht); + /* note: spice server will close the fd, so hand over a dup */ + spice_qxl_gl_scanout(&ssd->qxl, dup(dmabuf->fd), + dmabuf->width, dmabuf->height, + dmabuf->stride, dmabuf->fourcc, false); + } + qemu_spice_gl_monitor_config(ssd, 0, 0, dmabuf->width, dmabuf->hei= ght); + ssd->guest_dmabuf_refresh =3D false; + } + + if (render_cursor) { + egl_texture_blit(ssd->gls, &ssd->blit_fb, &ssd->guest_fb, + !y_0_top); + egl_texture_blend(ssd->gls, &ssd->blit_fb, &ssd->cursor_fb, + !y_0_top, ssd->ptr_x, ssd->ptr_y); + glFlush(); + } =20 trace_qemu_spice_gl_update(ssd->qxl.id, w, h, x, y); qemu_spice_gl_block(ssd, true); @@ -984,6 +1085,9 @@ static const DisplayChangeListenerOps display_listener= _gl_ops =3D { .dpy_gl_scanout_disable =3D qemu_spice_gl_scanout_disable, .dpy_gl_scanout_texture =3D qemu_spice_gl_scanout_texture, .dpy_gl_scanout_dmabuf =3D qemu_spice_gl_scanout_dmabuf, + .dpy_gl_cursor_dmabuf =3D qemu_spice_gl_cursor_dmabuf, + .dpy_gl_cursor_position =3D qemu_spice_gl_cursor_position, + .dpy_gl_release_dmabuf =3D qemu_spice_gl_release_dmabuf, .dpy_gl_update =3D qemu_spice_gl_update, }; =20 diff --git a/ui/trace-events b/ui/trace-events index 518e950a01..a957f363f1 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -83,6 +83,9 @@ qemu_spice_ui_info(int qid, uint32_t width, uint32_t heig= ht) "%d %dx%d" qemu_spice_gl_surface(int qid, uint32_t w, uint32_t h, uint32_t fourcc) "%= d %dx%d, fourcc 0x%x" qemu_spice_gl_scanout_disable(int qid) "%d" qemu_spice_gl_scanout_texture(int qid, uint32_t w, uint32_t h, uint32_t fo= urcc) "%d %dx%d, fourcc 0x%x" +qemu_spice_gl_cursor(int qid, bool enabled, bool hotspot) "%d enabled %d, = hotspot %d" +qemu_spice_gl_forward_dmabuf(int qid, uint32_t width, uint32_t height) "%d= %dx%d" +qemu_spice_gl_render_dmabuf(int qid, uint32_t width, uint32_t height) "%d = %dx%d" qemu_spice_gl_update(int qid, uint32_t x, uint32_t y, uint32_t w, uint32_t= h) "%d +%d+%d %dx%d" =20 # ui/keymaps.c --=20 2.9.3 From nobody Fri Oct 24 23:56:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520846847999329.08610168035807; Mon, 12 Mar 2018 02:27:27 -0700 (PDT) Received: from localhost ([::1]:57323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJjn-0000YH-Bv for importer@patchew.org; Mon, 12 Mar 2018 05:27:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evJXC-0007Ci-6J for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evJX6-0004cO-7a for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:22 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49948 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1evJX6-0004az-2n for qemu-devel@nongnu.org; Mon, 12 Mar 2018 05:14:16 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9CB7E44B5 for ; Mon, 12 Mar 2018 09:14:15 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E8D010B0F35; Mon, 12 Mar 2018 09:14:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 654D8980D2; Mon, 12 Mar 2018 10:14:06 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 10:14:05 +0100 Message-Id: <20180312091405.19610-15-kraxel@redhat.com> In-Reply-To: <20180312091405.19610-1-kraxel@redhat.com> References: <20180312091405.19610-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 12 Mar 2018 09:14:15 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 14/14] qapi: Add device ID and head parameters to screendump X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Thomas Huth , Markus Armbruster , "Dr. David Alan Gilbert" , Gerd Hoffmann , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth QEMU's screendump command can only take dumps from the primary display. When using multiple VGA cards, there is no way to get a dump from a secondary card or other display heads yet. So let's add a 'device' and a 'head' parameter to the HMP and QMP commands to be able to specify alternative devices and heads with the screendump command, too. Reviewed-by: Daniel P. Berrang=C3=A9 Acked-by: Dr. David Alan Gilbert Reviewed-by: Gerd Hoffmann Signed-off-by: Thomas Huth Reviewed-by: Eric Blake Message-id: 1520267868-31778-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann --- hmp.c | 4 +++- ui/console.c | 24 +++++++++++++++++++----- hmp-commands.hx | 7 ++++--- qapi/ui.json | 10 +++++++++- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/hmp.c b/hmp.c index 016cb5c4f1..ba9e299ee2 100644 --- a/hmp.c +++ b/hmp.c @@ -2140,9 +2140,11 @@ err_out: void hmp_screendump(Monitor *mon, const QDict *qdict) { const char *filename =3D qdict_get_str(qdict, "filename"); + const char *id =3D qdict_get_try_str(qdict, "device"); + int64_t head =3D qdict_get_try_int(qdict, "head", 0); Error *err =3D NULL; =20 - qmp_screendump(filename, &err); + qmp_screendump(filename, id !=3D NULL, id, id !=3D NULL, head, &err); hmp_handle_error(mon, &err); } =20 diff --git a/ui/console.c b/ui/console.c index 348610dd43..a8868fc04f 100644 --- a/ui/console.c +++ b/ui/console.c @@ -344,14 +344,28 @@ write_err: goto out; } =20 -void qmp_screendump(const char *filename, Error **errp) +void qmp_screendump(const char *filename, bool has_device, const char *dev= ice, + bool has_head, int64_t head, Error **errp) { - QemuConsole *con =3D qemu_console_lookup_by_index(0); + QemuConsole *con; DisplaySurface *surface; =20 - if (con =3D=3D NULL) { - error_setg(errp, "There is no QemuConsole I can screendump from."); - return; + if (has_device) { + con =3D qemu_console_lookup_by_device_name(device, has_head ? head= : 0, + errp); + if (!con) { + return; + } + } else { + if (has_head) { + error_setg(errp, "'head' must be specified together with 'devi= ce'"); + return; + } + con =3D qemu_console_lookup_by_index(0); + if (!con) { + error_setg(errp, "There is no console to take a screendump fro= m"); + return; + } } =20 graphic_hw_update(con); diff --git a/hmp-commands.hx b/hmp-commands.hx index 964eb515cf..1723cbe1df 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -253,9 +253,10 @@ ETEXI =20 { .name =3D "screendump", - .args_type =3D "filename:F", - .params =3D "filename", - .help =3D "save screen into PPM image 'filename'", + .args_type =3D "filename:F,device:s?,head:i?", + .params =3D "filename [device [head]]", + .help =3D "save screen from head 'head' of display device 'd= evice' " + "into PPM image 'filename'", .cmd =3D hmp_screendump, }, =20 diff --git a/qapi/ui.json b/qapi/ui.json index 3e82f25ac5..5d01ad4304 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -77,6 +77,13 @@ # # @filename: the path of a new PPM file to store the image # +# @device: ID of the display device that should be dumped. If this paramet= er +# is missing, the primary display will be used. (Since 2.12) +# +# @head: head to use in case the device supports multiple heads. If this +# parameter is missing, head #0 will be used. Also note that the he= ad +# can only be specified in conjunction with the device ID. (Since 2= .12) +# # Returns: Nothing on success # # Since: 0.14.0 @@ -88,7 +95,8 @@ # <- { "return": {} } # ## -{ 'command': 'screendump', 'data': {'filename': 'str'} } +{ 'command': 'screendump', + 'data': {'filename': 'str', '*device': 'str', '*head': 'int'} } =20 ## # =3D=3D Spice --=20 2.9.3