From nobody Tue Nov 26 17:18:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1705712021; cv=none; d=zohomail.com; s=zohoarc; b=ULmLF3iNMjdCBG09T35rpfKzzQIUytKjUIX5MyYmDDsEEYJPhCYzdG7scuJsae4/1VzE1JZcuczFshfApDy6G8zRsDcAaFNtRgICSfQsQHm4okuhVDm9ZbNTw/Nk5tXyuQCKOEbRoS6PuXdg5oLr/A9Vxu5xDLp64ZC959XBkOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705712021; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Omt1pKTbizm61Z/51d53xq8np4tAndYOcQcnKdYWJG8=; b=FV9e6UIOiZfXHf30fgifXsRME75FdeDfGutiYZBIPXvFRjahbL2qT++zGX/lcXS0xk7q2N0A6SVGmOlig8tB/5n27/GAmJ0OBHGlBZfwBz3MPdb/iRlYd5RGqnfbw8VMz55qm4Y0BjArx5I6V+ph5j9cE6OGmInOq41NuRHv6tM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705712021909616.7996883692341; Fri, 19 Jan 2024 16:53:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQzbb-0001rE-Sj; Fri, 19 Jan 2024 19:53:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbZ-0001qh-MB for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:02 -0500 Received: from mgamail.intel.com ([192.55.52.120]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbX-0000HA-SX for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:01 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 Received: from vkasired-desk2.fm.intel.com ([10.105.128.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705711979; x=1737247979; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VhMoDg2Dfnr8VM+IjInSXHA29VWyPI/mwx53F/p9aJY=; b=hM1TerbUVWkZDHdAyba3nD5IA2j3dHSVEvKOaDTqqFn5zAHzHrRu+pSb yJlaZJmva/Vb2jv53t2/gk4VXmoyDZ3F5JzfJiltShAPr+KPORw1lqAw8 hNwaitC1BnCHGn8jvyKYkTtXJpffmoTcbzvDr6beBabrtI4xMrbE3L1oS vdaSFtF+YAm24bgEVqR4NnJ/5v9DGFcHJNpUcLb6kt7/ULGPZnFgQeT8K zjbVa4IIZTcm3f/fzkKCPrgL7Xkn85uUWqoFniEKcPTd3vHGVhiAtkZuC GIciFiHho33TZz/lKJXHr/ASlmtWhVGoaj90YhOmS5Xmk5IRd9AjU7mXj A==; X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="399763752" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="399763752" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="904297436" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="904297436" From: Vivek Kasireddy To: qemu-devel@nongnu.org Cc: Vivek Kasireddy , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Frediano Ziglio , Dongwon Kim Subject: [PATCH v1 1/7] ui/spice: Add an option for users to provide a preferred codec Date: Fri, 19 Jan 2024 16:30:07 -0800 Message-Id: <20240120003013.1829757-2-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240120003013.1829757-1-vivek.kasireddy@intel.com> References: <20240120003013.1829757-1-vivek.kasireddy@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.120; envelope-from=vivek.kasireddy@intel.com; helo=mgamail.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1705712022739100003 Giving users an option to choose a particular codec will enable them to make an appropriate decision based on their hardware and use-case. Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Cc: Frediano Ziglio Cc: Dongwon Kim Signed-off-by: Vivek Kasireddy --- v2: - Don't override the default Spice codec if preferred-codec is not provided (Frediano) --- qemu-options.hx | 5 +++++ ui/spice-core.c | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index b66570ae00..caaafe01d5 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2260,6 +2260,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice, " [,streaming-video=3D[off|all|filter]][,disable-copy-paste=3Don= |off]\n" " [,disable-agent-file-xfer=3Don|off][,agent-mouse=3D[on|off]]\n" " [,playback-compression=3D[on|off]][,seamless-migration=3D[on|o= ff]]\n" + " [,preferred-codec=3D:\n" " [,gl=3D[on|off]][,rendernode=3D]\n" " enable spice\n" " at least one of {port, tls-port} is mandatory\n", @@ -2348,6 +2349,10 @@ SRST ``seamless-migration=3D[on|off]`` Enable/disable spice seamless migration. Default is off. =20 + ``preferred-codec=3D:`` + Provide the preferred codec the Spice server should use. + Default would be spice:mjpeg. + ``gl=3D[on|off]`` Enable/disable OpenGL context. Default is off. =20 diff --git a/ui/spice-core.c b/ui/spice-core.c index db21db2c94..13bfbe4e89 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -488,6 +488,9 @@ static QemuOptsList qemu_spice_opts =3D { },{ .name =3D "streaming-video", .type =3D QEMU_OPT_STRING, + },{ + .name =3D "preferred-codec", + .type =3D QEMU_OPT_STRING, },{ .name =3D "agent-mouse", .type =3D QEMU_OPT_BOOL, @@ -663,6 +666,7 @@ static void qemu_spice_init(void) char *x509_key_file =3D NULL, *x509_cert_file =3D NULL, *x509_cacert_file =3D NULL; + const char *preferred_codec =3D NULL; int port, tls_port, addr_flags; spice_image_compression_t compression; spice_wan_compression_t wan_compr; @@ -802,6 +806,14 @@ static void qemu_spice_init(void) spice_server_set_streaming_video(spice_server, SPICE_STREAM_VIDEO_= OFF); } =20 + preferred_codec =3D qemu_opt_get(opts, "preferred-codec"); + if (preferred_codec) { + if (spice_server_set_video_codecs(spice_server, preferred_codec)) { + error_report("Preferred codec name is not valid"); + exit(1); + } + } + spice_server_set_agent_mouse (spice_server, qemu_opt_get_bool(opts, "agent-mouse", 1)); spice_server_set_playback_compression --=20 2.39.2 From nobody Tue Nov 26 17:18:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1705712041; cv=none; d=zohomail.com; s=zohoarc; b=BUAGgrfp9wNoKyu4uXtyrA+qiSp8dtA1QZ7p7UptdxrM3Vlj5zAH9OQIYH3DKl8NINg4CRwGVhpmEeQBVH9jAWOjBxWsRMU0VLmfZl6iUF84+Fq2i5kXL29Rbo45QM07GXxoh1N95xmM/kPgjYUg/4KlUHiBuK7+nafg8Cgju0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705712041; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8W1R5F8c9rWYGGop3g013PpUnrBuQl2xDoUaJk3yLy4=; b=TumbNwqIdrbEjBrxE8H//L28fbdjxUjfzzFxofCZu8+BqYRG8gb4v5vIResJY5uOpEi+M/SJzWSDtleV4gNERfnlxxneS38R4O5wTGBZ0nKBUGlO4ExKG3BAug7wPYviSXx5TGWT1sncoqMVfnsVCE+SZCmLptccVA/IOjTzas4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705712041061163.56566806309309; Fri, 19 Jan 2024 16:54:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQzbe-0001rt-5I; Fri, 19 Jan 2024 19:53:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbb-0001rA-LL for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:03 -0500 Received: from mgamail.intel.com ([192.55.52.120]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbZ-0000HV-HK for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:03 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 Received: from vkasired-desk2.fm.intel.com ([10.105.128.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705711981; x=1737247981; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UmuSXtMKLQfmwnfzVXPDW5lf8tnHK7D5DmWuTya8UEE=; b=dL0FCcarpjhkx0r6z+nF5RCWfz8O9oN55Jw5GqOxAoIT8zkqd6fxWY02 NpUCZwEYyV+pbvL1pN/PQn92kb82uuBRJGRqMIfx9ul61R5jfOgaR4KmE Zcx2DLRq5dqQBMGeZm84OJOZyBxTkhz0o9y1NcO1VIC+1IdSQSFfytIcv r8mknfw3mparzTP3Sa9nG3dKQYB8u/fyU4na2z85bpHTm+I9LLKnaR4PR dyHXuP4ah41ltwK3jrT50+l/Rb5ZuFryXwMj6MwEtyDP/pkDSUEep2JVR LyD8UzbbVJ1tWgdWoaBj4wFywDa2ri0W3GNrwPC7hA4SWamPgFeh/9j4B Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="399763755" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="399763755" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="904297439" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="904297439" From: Vivek Kasireddy To: qemu-devel@nongnu.org Cc: Vivek Kasireddy , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Frediano Ziglio , Dongwon Kim Subject: [PATCH v1 2/7] ui/spice: Enable gl=on option for non-local or remote clients Date: Fri, 19 Jan 2024 16:30:08 -0800 Message-Id: <20240120003013.1829757-3-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240120003013.1829757-1-vivek.kasireddy@intel.com> References: <20240120003013.1829757-1-vivek.kasireddy@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.120; envelope-from=vivek.kasireddy@intel.com; helo=mgamail.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1705712042348100005 Newer versions of Spice server should be able to accept dmabuf fds from Qemu for clients that are connected via the network. In other words, when this option is enabled, Qemu would share a dmabuf fd with Spice which would encode and send the data associated with the fd to a client that could be located on a different machine. Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Cc: Frediano Ziglio Cc: Dongwon Kim Signed-off-by: Vivek Kasireddy --- include/ui/spice-display.h | 1 + ui/spice-core.c | 4 ++++ ui/spice-display.c | 1 + 3 files changed, 6 insertions(+) diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h index e1a9b36185..f4922dd74b 100644 --- a/include/ui/spice-display.h +++ b/include/ui/spice-display.h @@ -151,6 +151,7 @@ struct SimpleSpiceCursor { }; =20 extern bool spice_opengl; +extern bool remote_client; =20 int qemu_spice_rect_is_empty(const QXLRect* r); void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r); diff --git a/ui/spice-core.c b/ui/spice-core.c index 13bfbe4e89..3b9a54685f 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -849,9 +849,13 @@ static void qemu_spice_init(void) #ifdef HAVE_SPICE_GL if (qemu_opt_get_bool(opts, "gl", 0)) { if ((port !=3D 0) || (tls_port !=3D 0)) { +#if SPICE_SERVER_VERSION >=3D 0x000f03 /* release 0.15.3 */ + remote_client =3D 1; +#else error_report("SPICE GL support is local-only for now and " "incompatible with -spice port/tls-port"); exit(1); +#endif } egl_init(qemu_opt_get(opts, "rendernode"), DISPLAYGL_MODE_ON, &err= or_fatal); spice_opengl =3D 1; diff --git a/ui/spice-display.c b/ui/spice-display.c index 6eb98a5a5c..384b8508d4 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -29,6 +29,7 @@ #include "ui/spice-display.h" =20 bool spice_opengl; +bool remote_client; =20 int qemu_spice_rect_is_empty(const QXLRect* r) { --=20 2.39.2 From nobody Tue Nov 26 17:18:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1705712102; cv=none; d=zohomail.com; s=zohoarc; b=PFr8oNysL85ZdFC8rnIxvTQSHpbkttQ6e0+e2u8jI1kZUhKvWe23MtxCDBzE07rNydtnCswU8zS/vJQXNG2MZ0quqxSbWLmm0Djv8HLibEsjXrQfQmzn9K2P8qqeF1O2ZzDkK2MbXuuysS3a4cCj6HL2HYcEEKx+G5ycoteG25Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705712102; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vw+gHb6ZSoqnYwTeXx34xqiEL70yO1+wnz54vnIbke0=; b=Q3J3dQvPpMIBeNAHxbySP1lIrixskj9T6aE2asE20sU0SrHlDP4I0RUy2/N2tF9KTS43XH8+pE/MbIjk3qj3+fYYu3PlAZazG5iwXMBUT+9fvuft9WX1NgqIS9TRKsoPRk32Jxa3XfAUw/nn5QsTgO8fQ/EQyUBm4j2qxuARmL0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705712102197875.9166781864564; Fri, 19 Jan 2024 16:55:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQzbf-0001sn-Av; Fri, 19 Jan 2024 19:53:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbd-0001ri-32 for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:05 -0500 Received: from mgamail.intel.com ([192.55.52.120]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzba-0000Hu-NP for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:04 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 Received: from vkasired-desk2.fm.intel.com ([10.105.128.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705711982; x=1737247982; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kCCgPG2+hBw8fqMp3Qo56Mmdj33nLHntNW1mtEsJTKU=; b=STi+O1SAemSybpxBkFcljss2C19vUusAMrhrY4zQBBQMduge/Y5XOwRf rkbyKmOOffDY08sfME7HVY3btus/dMGtWVkm6zWJff8U+eTBKTu9TdIRJ cp4IRxVLzz8WRiuvJM8jssxvppa2B83rabvpix6zpVlG6wh2duEFtIivf sVOmyfMup4BiLiijF+324PjDdJJ1pUrrXcwab+AVsyANuTvNGG+KQtc+2 3hUbD719RwHmUx0KMMNtGJnCKSqbL6yCdRK+3j1rDtFoYDX5sGsjyB9uv 5rhLJDNDGFGgWS2WsK8EFRO9/5tNc1Rn3eYgW1/DQhCe2NftFXPsAl6SX Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="399763758" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="399763758" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="904297442" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="904297442" From: Vivek Kasireddy To: qemu-devel@nongnu.org Cc: Vivek Kasireddy , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Frediano Ziglio , Dongwon Kim Subject: [PATCH v1 3/7] ui/spice: Submit the gl_draw requests at 60 FPS for remote clients Date: Fri, 19 Jan 2024 16:30:09 -0800 Message-Id: <20240120003013.1829757-4-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240120003013.1829757-1-vivek.kasireddy@intel.com> References: <20240120003013.1829757-1-vivek.kasireddy@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.120; envelope-from=vivek.kasireddy@intel.com; helo=mgamail.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1705712102492100001 In the specific case where the display layer (virtio-gpu) is using dmabuf, and if remote clients are enabled (-spice gl=3Don,port=3Dxxxx), it makes sense to limit the maximum (streaming) rate to 60 FPS using the GUI timer. This matches the behavior of GTK UI where the display updates are submitted at 60 FPS (assuming the underlying mode is WxY@60). Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Cc: Frediano Ziglio Cc: Dongwon Kim Signed-off-by: Vivek Kasireddy --- ui/spice-display.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index 384b8508d4..90c04623ec 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -841,12 +841,31 @@ static void qemu_spice_gl_block_timer(void *opaque) warn_report("spice: no gl-draw-done within one second"); } =20 +static void spice_gl_draw(SimpleSpiceDisplay *ssd, + uint32_t x, uint32_t y, uint32_t w, uint32_t h) +{ + uint64_t cookie; + + 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); +} + static void spice_gl_refresh(DisplayChangeListener *dcl) { SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); - uint64_t cookie; + QemuDmaBuf *dmabuf =3D ssd->guest_dmabuf; =20 - if (!ssd->ds || qemu_console_is_gl_blocked(ssd->dcl.con)) { + if (!ssd->ds) { + return; + } + + if (qemu_console_is_gl_blocked(ssd->dcl.con)) { + if (remote_client && ssd->gl_updates && dmabuf) { + spice_gl_draw(ssd, 0, 0, dmabuf->width, dmabuf->height); + ssd->gl_updates =3D 0; + /* To stream at 60 FPS, the (GUI) timer delay needs to be ~17 = ms */ + dcl->update_interval =3D 1000 / (2 * GUI_REFRESH_INTERVAL_DEFA= ULT) + 1; + } return; } =20 @@ -854,11 +873,8 @@ static void spice_gl_refresh(DisplayChangeListener *dc= l) if (ssd->gl_updates && ssd->have_surface) { qemu_spice_gl_block(ssd, true); glFlush(); - cookie =3D (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_GL_DRAW_DONE,= 0); - spice_qxl_gl_draw_async(&ssd->qxl, 0, 0, - surface_width(ssd->ds), - surface_height(ssd->ds), - cookie); + spice_gl_draw(ssd, 0, 0, + surface_width(ssd->ds), surface_height(ssd->ds)); ssd->gl_updates =3D 0; } } @@ -1025,7 +1041,6 @@ static void qemu_spice_gl_update(DisplayChangeListene= r *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) { @@ -1098,8 +1113,11 @@ static void qemu_spice_gl_update(DisplayChangeListen= er *dcl, trace_qemu_spice_gl_update(ssd->qxl.id, w, h, x, y); qemu_spice_gl_block(ssd, true); glFlush(); - 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); + if (remote_client) { + ssd->gl_updates++; + } else { + spice_gl_draw(ssd, x, y, w, h); + } } =20 static const DisplayChangeListenerOps display_listener_gl_ops =3D { --=20 2.39.2 From nobody Tue Nov 26 17:18:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1705712038; cv=none; d=zohomail.com; s=zohoarc; b=bTfwGSLYIh4hG2XIQ8ib5VrHvm3XgKdeG3fJm+SQN3xLUVSonsIaINPTp97wMh3N3kKtwjHjugrx1IG+hajb065EXMxfyYZDch4+lxF9LvCE6z2Cl7SM387lHbl+q0pBmxDUNmLgVbo7BMgkiV2Bs3ra17aHGH2HJO5cguflWr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705712038; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=En+NQ9P7CRsI0TkLfzyE1yf6nOfP/sy1xXmnXpF2MVc=; b=k30wCXPFEwt1HNSn4P0iyu9ZwsW48n5vxXH/W945nGRiK4emYCJ/TVGDYb6KABxaDMfvJsYvB/RB3VcymgbG4ylVmiizdt7fFcyz+1NLmY558FeShwh4RUPR9jLk7X3KjK1KAE2vx0pc67zbukM+lotx+/0ybQXHA3PzXKgbLv8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705712038432464.2170372820732; Fri, 19 Jan 2024 16:53:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQzbe-0001rr-4z; Fri, 19 Jan 2024 19:53:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbb-0001rB-PE for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:03 -0500 Received: from mgamail.intel.com ([192.55.52.120]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzba-0000HA-1R for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:03 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 Received: from vkasired-desk2.fm.intel.com ([10.105.128.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705711982; x=1737247982; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w6zsMuKR5+dos2BSIN9Npc/spxx3lltKpXTlvh/rSkg=; b=dyGbyXxfsN3GGJdRD7svG8LKuvZOXpeb1P7MEOfmyGzncU4LZjbrfJ+c eVvpDE2OxFkEmBGqkl5w1nup4eGlSR+5fjFpDyGLO6SFXZ9/AUuHLpXB8 mjqlopVcq0iIgoXpMJeeaXm73y5aX/+g6JC3+Dq+Tlx45N2LFvQ0F/dba mNp9TMSBBcCSIsEguRptoFuwldJW/evXb1C1H6vVhvyB8JHOMLgNNiE9r AOV5gVLJndu/SRuHe3yDvwOmYHl28dzjxxEmcjht50p7zEHKYVbQaWglY nq4Oo+Mx8A77icWz1O3rS5szbY59QBNNHJes/3M/IfZvPrQCOSX6EMUEJ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="399763762" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="399763762" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="904297445" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="904297445" From: Vivek Kasireddy To: qemu-devel@nongnu.org Cc: Vivek Kasireddy , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Frediano Ziglio , Dongwon Kim Subject: [PATCH v1 4/7] ui/console-gl: Add an option to override a surface's glformat Date: Fri, 19 Jan 2024 16:30:10 -0800 Message-Id: <20240120003013.1829757-5-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240120003013.1829757-1-vivek.kasireddy@intel.com> References: <20240120003013.1829757-1-vivek.kasireddy@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.120; envelope-from=vivek.kasireddy@intel.com; helo=mgamail.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1705712040324100003 In some cases where a UI component (e.g, Spice) needs to choose a particular glformat for a surface while creating a texture, this new GLenum provides an option to do so. One situation where this needs to be done is when the Host endianness is causing issues such as interchanged R and B channels. Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Cc: Frediano Ziglio Cc: Dongwon Kim Signed-off-by: Vivek Kasireddy --- include/ui/surface.h | 1 + ui/console-gl.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/ui/surface.h b/include/ui/surface.h index 4244e0ca4a..a39fee55a2 100644 --- a/include/ui/surface.h +++ b/include/ui/surface.h @@ -20,6 +20,7 @@ typedef struct DisplaySurface { uint8_t flags; #ifdef CONFIG_OPENGL GLenum glformat; + GLenum target_glformat; GLenum gltype; GLuint texture; #endif diff --git a/ui/console-gl.c b/ui/console-gl.c index 103b954017..dee317f42c 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -72,6 +72,12 @@ void surface_gl_create_texture(QemuGLShader *gls, g_assert_not_reached(); } =20 + /* The caller wants to override the glformat in some specific cases */ + if (surface->target_glformat && + surface->target_glformat !=3D surface->glformat) { + surface->glformat =3D surface->target_glformat; + } + glGenTextures(1, &surface->texture); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, surface->texture); --=20 2.39.2 From nobody Tue Nov 26 17:18:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1705712094; cv=none; d=zohomail.com; s=zohoarc; b=M6MIGKd94TPIx58QkQZE1Xy2MBXPmHbqeo69y5ebAHklo2m89LIuHV0fY81M4lgao/rHHy+WOODGK/ZvWyGDuAKN73dr2ISdzNNDWBi5KIO/m0RqRfaijPkfZBxSUkK38DF6uVEcIn45Z5VX5A2wj6eZTKvHyZ5NdDG+nmTwvoA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705712094; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Tc5q9l49pZmvihTdOEDxIbQ2BF8YeExLyeO577DJALg=; b=M5xxLux7AjFKXX9cBf3vSKvKmleNEm4yq5BG8ZVrumV21FxWJHPv4jw+sEpSNsCwWtpj5B3VVkIpEKEMmbxCXEWEucyModg8uaM57W4gHVyVTGLOxkqktUgHOVWHmB86ZIWmOFDFJtf4kAQYhplQUYC5nZwlHuTnZpfZIHx60xk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705712094643841.8722803054231; Fri, 19 Jan 2024 16:54:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQzbf-0001t8-Vf; Fri, 19 Jan 2024 19:53:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbd-0001ru-ST for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:05 -0500 Received: from mgamail.intel.com ([192.55.52.120]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbc-0000HV-17 for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:05 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 Received: from vkasired-desk2.fm.intel.com ([10.105.128.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705711984; x=1737247984; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0l+PsH2fLrrdH4iP9164gk31Qk9B4U0bQLvvhVpe58M=; b=Pv4BhBECiqxDv/7v/JMTL460RkbcL1cG7HheGgYZU1UFSuiR3i2vcW30 r1ao8vHTOtVqy4orCJ1f+v2Id4urqKiV+++C8xDAaGwui0mKZPGx/Koxy hYtZfHhA/P9m4D4p46Xbqxo23w+PIDlNgddQtjNArTG52bNaqDoTG47DG +YdArDKtyrM8nQxC1kfMS67K9XrEldQQqgApdfRXg7w+zWGVCjr41rIMI wRg1Dz35dup36o7BhJnr/969KiO0GrQk5vdgMIGOW9NaDt2nl1Se1Ss6x c6wFOERL8Jhr7UlKYVqeO6ZEHlVK/Upe7klbShik9ipeSwOzJzxCowtTJ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="399763765" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="399763765" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="904297449" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="904297449" From: Vivek Kasireddy To: qemu-devel@nongnu.org Cc: Vivek Kasireddy , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Frediano Ziglio , Dongwon Kim Subject: [PATCH v1 5/7] ui/spice: Override the surface's glformat when gl=on is enabled Date: Fri, 19 Jan 2024 16:30:11 -0800 Message-Id: <20240120003013.1829757-6-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240120003013.1829757-1-vivek.kasireddy@intel.com> References: <20240120003013.1829757-1-vivek.kasireddy@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.120; envelope-from=vivek.kasireddy@intel.com; helo=mgamail.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1705712096466100003 When testing with gl=3Don on an Intel Host, it was noticed that the R and B channels were interchanged while the Guest FB image was displayed. This was only seen if the display layer (virtio-gpu) did not directly share the dmabuf fd with Spice (i.e, blob=3Dfalse). One of the main differences in the case where blob=3Dtrue vs blob=3Dfalse is that we create the dmabuf fd from a texture in the latter case whereas we directly pass the fd from the display layer to Spice in the former case. Although, the surface's format (PIXMAN_BE_b8g8r8x8) is the same in both cases, the creation of the texture (which involves copying data from Pixman image into a GPU buffer) appears to somehow result in having the R and B channels interchanged. One way to ensure correct behavior is we have glformat=3DGL_RGBA while creating the texture. It looks like having glformat=3DGL_RGBA and gltype =3D GL_UNSIGNED_BYTE should work regardless of the Host's endianness but let us limit this change only to this specific use-case for now. Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Cc: Frediano Ziglio Cc: Dongwon Kim Signed-off-by: Vivek Kasireddy --- ui/spice-display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/spice-display.c b/ui/spice-display.c index 90c04623ec..08b4aec921 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -900,6 +900,9 @@ static void spice_gl_switch(DisplayChangeListener *dcl, } ssd->ds =3D new_surface; if (ssd->ds) { + if (remote_client && surface_format(ssd->ds) !=3D PIXMAN_r5g6b5) { + ssd->ds->target_glformat =3D GL_RGBA; + } surface_gl_create_texture(ssd->gls, ssd->ds); fd =3D egl_get_fd_for_texture(ssd->ds->texture, &stride, &fourcc, --=20 2.39.2 From nobody Tue Nov 26 17:18:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1705712020; cv=none; d=zohomail.com; s=zohoarc; b=RdmoS9SFfCzuVDyAw+0iSC8hoMlNfpSuqZQ96CCIyGeF5E4xhL2o5BUljkFUuvJysA13Su0oZkqbXJwl0y+qVpoYvY/vreh4chYC6n75vFDfapCNEwfEk6+BH0kDlzZMEuCTobRd67geG0QvVeYK5kFePL2HrM7ZFamKklBkvDE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705712020; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T0s145H4Na113wadt8MFqTXDoslEk66EJDByR0q6yG8=; b=GKRLFewUuGchFNu90CO2w7mVplqgQPPW3CpoqPqLrzmS/S4Nu2IWfXKdP4J443hph4p6IEnA8VsCpiNubYG5gnO/sKuK1wwH1Sx47azrJ3vh8dkjcY7zfkaiyAVtoFRRltC6XvFtRxcdPjDeD8Tdi7eYjBUa0ndlSVb/0LIFqy8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1705712020984265.2998106351399; Fri, 19 Jan 2024 16:53:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQzbk-0001u2-WC; Fri, 19 Jan 2024 19:53:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbd-0001rs-SC for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:05 -0500 Received: from mgamail.intel.com ([192.55.52.120]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbc-0000HA-2Z for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:05 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 Received: from vkasired-desk2.fm.intel.com ([10.105.128.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705711984; x=1737247984; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aH1svmPvRSrhxRPRQhEiXVSt38d9wIOqogeHz9Ctq7s=; b=IM0a9SzRIoctuLI/m83TXFIz1HKsVTq+v/JX92Xj4LJ9YUp8FwX59poi XN2+G6NjjqGBgv4/0zQGZPNbHP/ZCu3kfOo4S8OGqu4q2YQZwTT/JWKA0 mwEJ53DUi8l4j2+XIkI7f7ljnPMgj2K1nwehEau9dJwQyHNuZ4Kom4+tK 4LC94ajKUVPAcmNup0cI5JpoIWt1pvRlLK2d6kif7AZH0GelzhYWHk1Wo YuxD4XEYiLyNs81SyqrS6rwbkrNG8RfGbBANB26AGWhU5I2j+e315W/LL hzxBA2iCt9U/FGtaQuhX9yU9AHsBBYIEdCDrPJalhS7aYmmJQo+9gA8hV Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="399763768" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="399763768" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="904297451" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="904297451" From: Vivek Kasireddy To: qemu-devel@nongnu.org Cc: Vivek Kasireddy , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Frediano Ziglio , Dongwon Kim Subject: [PATCH v1 6/7] ui/console-gl: Add a helper to create a texture with linear memory layout Date: Fri, 19 Jan 2024 16:30:12 -0800 Message-Id: <20240120003013.1829757-7-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240120003013.1829757-1-vivek.kasireddy@intel.com> References: <20240120003013.1829757-1-vivek.kasireddy@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.120; envelope-from=vivek.kasireddy@intel.com; helo=mgamail.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1705712022738100002 There are cases where we do not want the memory layout of a texture to be tiled as the component processing the texture memory would not know how to de-tile either via software or hardware. Therefore, ensuring that the memory backing the texture has a linear layout is absolutely necessary in these situations. Note that, requesting GL implementation to create a texture with linear memory layout can only be done using memory objects. And, a memory object can be created by importing a dmabuf fd. Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Cc: Frediano Ziglio Cc: Dongwon Kim Signed-off-by: Vivek Kasireddy --- include/ui/console.h | 2 ++ ui/console-gl.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index a4a49ffc64..e53e3ce03e 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -444,6 +444,8 @@ bool console_gl_check_format(DisplayChangeListener *dcl, pixman_format_code_t format); void surface_gl_create_texture(QemuGLShader *gls, DisplaySurface *surface); +void surface_gl_create_texture_from_fd(DisplaySurface *surface, + int fd, GLuint *texture); void surface_gl_update_texture(QemuGLShader *gls, DisplaySurface *surface, int x, int y, int w, int h); diff --git a/ui/console-gl.c b/ui/console-gl.c index dee317f42c..2c1b2ae377 100644 --- a/ui/console-gl.c +++ b/ui/console-gl.c @@ -102,6 +102,32 @@ void surface_gl_create_texture(QemuGLShader *gls, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } =20 +void surface_gl_create_texture_from_fd(DisplaySurface *surface, + int fd, GLuint *texture) +{ + unsigned long size =3D surface_stride(surface) * surface_height(surfac= e); + GLuint mem_obj; + + if (!epoxy_has_gl_extension("GL_EXT_memory_object") || + !epoxy_has_gl_extension("GL_EXT_memory_object_fd")) { + return; + } + +#ifdef GL_EXT_memory_object_fd + glCreateMemoryObjectsEXT(1, &mem_obj); + glImportMemoryFdEXT(mem_obj, size, GL_HANDLE_TYPE_OPAQUE_FD_EXT, fd); + if (!glIsMemoryObjectEXT(mem_obj)) { + return; + } + + glGenTextures(1, texture); + glBindTexture(GL_TEXTURE_2D, *texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_TILING_EXT, GL_LINEAR_TILING= _EXT); + glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8, surface_width(surface= ), + surface_height(surface), mem_obj, 0); +#endif +} + void surface_gl_update_texture(QemuGLShader *gls, DisplaySurface *surface, int x, int y, int w, int h) --=20 2.39.2 From nobody Tue Nov 26 17:18:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1705712028; cv=none; d=zohomail.com; s=zohoarc; b=FMqXuuDwPHJjV9Xu9khxWphYY+qdLSD40/T2DayQjybbUdQ/nedOO+O/B6vxV5k+ZeMnKr6/O+IP6BI2guP7VoNjG/+q43POzjENXvct1ucPwzEOKPbdv2dWldTSxAMxrkTdKk92a7gg7KgVXIRos0Dmp7JIpqHOhKCUVRWWkEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705712028; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Zh28+TEFK7PEeAGp+cPL3DCq0FtiAtllpARGGtVWVEA=; b=SWW7jkfXxPSl5nPCDFcizdcug0wXrB6LTUvyVpkek1VC7Jgnom2Jr9EQvVOIZ9tF1o8G0hZfHBUO0uaocTvlkcStnOMOsLz6N3u7Raw+BOoxPWYFuRVvXPlmb+gMaAhZXZ/YcTIXud14Mu4gcLbxP8+zyXeXV7XYXFNaAWd6Zpw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170571202819734.36950698079306; Fri, 19 Jan 2024 16:53:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQzbl-0001u3-RL; Fri, 19 Jan 2024 19:53:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbf-0001sX-5P for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:07 -0500 Received: from mgamail.intel.com ([192.55.52.120]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQzbd-0000Hu-Dc for qemu-devel@nongnu.org; Fri, 19 Jan 2024 19:53:06 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 Received: from vkasired-desk2.fm.intel.com ([10.105.128.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2024 16:52:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705711985; x=1737247985; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MJ8rtDIcQk012Iggqg+BBERZJYsckiVBOTAXB2wUZy0=; b=YFE+8avgDCMHfXAzI2m3CQFRnxp2CTdbFNGR5UV+FnImn1iMBFxOLFYx kTXhA6Y1OxtaJuHAHuxA2nM0Gw64ebmLzfJHvFQR/tEc+XUaBNBApmyJ6 7ZrxS1pjEGXTqjdO85vSXJiViFLvasBv5LUGdbZavuojof/meCy/eVXIX ZpG3pVXiGYzbcV5iuKwpnaprVvAzWy9aOAFt7Gw9wsND9jKCDKNjkiVPt GoOEO5UBhwKh7riEmbDuQwTGXaiD3B2i36pyYaZx1Qfb1VHzi2Rocpsp8 berQaktZKloEzjg+2Gfzzrg+3f/3feixuF/Bqcyl6BSjlgaG5UQEQWMJm g==; X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="399763771" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="399763771" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10957"; a="904297454" X-IronPort-AV: E=Sophos;i="6.05,206,1701158400"; d="scan'208";a="904297454" From: Vivek Kasireddy To: qemu-devel@nongnu.org Cc: Vivek Kasireddy , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Frediano Ziglio , Dongwon Kim Subject: [PATCH v1 7/7] ui/spice: Create another texture with linear layout when gl=on is enabled Date: Fri, 19 Jan 2024 16:30:13 -0800 Message-Id: <20240120003013.1829757-8-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240120003013.1829757-1-vivek.kasireddy@intel.com> References: <20240120003013.1829757-1-vivek.kasireddy@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.120; envelope-from=vivek.kasireddy@intel.com; helo=mgamail.intel.com X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.519, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1705712030608100003 Since most encoders (invoked by Spice) may not work with tiled memory associated with a texture, we need to create another texture that has linear memory layout and use that instead. Note that, there does not seem to be a direct way to indicate to the GL implementation that a texture's backing memory needs to be linear. Instead, we have to do it in a roundabout way where we first need to create a tiled texture and obtain a dmabuf fd associated with it via EGL. Next, we have to create a memory object by importing the dmabuf fd created earlier and finally create a linear texture by using the memory object as the texture storage mechanism. Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Cc: Frediano Ziglio Cc: Dongwon Kim Signed-off-by: Vivek Kasireddy --- ui/spice-display.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/ui/spice-display.c b/ui/spice-display.c index 08b4aec921..94cb378dbe 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -893,6 +893,7 @@ static void spice_gl_switch(DisplayChangeListener *dcl, { SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); EGLint stride, fourcc; + GLuint texture =3D 0; int fd; =20 if (ssd->ds) { @@ -912,6 +913,38 @@ static void spice_gl_switch(DisplayChangeListener *dcl, return; } =20 + if (remote_client && surface_format(ssd->ds) !=3D PIXMAN_r5g6b5) { + /* + * We really want to ensure that the memory layout of the text= ure + * is linear; otherwise, the encoder's output may show corrupt= ion. + */ + surface_gl_create_texture_from_fd(ssd->ds, fd, &texture); + + /* + * A successful return after glImportMemoryFdEXT() means that + * the ownership of fd has been passed to GL. In other words, + * the fd we got above should not be used anymore. + */ + if (texture > 0) { + fd =3D egl_get_fd_for_texture(texture, + &stride, &fourcc, + NULL); + if (fd < 0) { + glDeleteTextures(1, &texture); + fd =3D egl_get_fd_for_texture(ssd->ds->texture, + &stride, &fourcc, + NULL); + if (fd < 0) { + surface_gl_destroy_texture(ssd->gls, ssd->ds); + return; + } + } else { + surface_gl_destroy_texture(ssd->gls, ssd->ds); + ssd->ds->texture =3D texture; + } + } + } + trace_qemu_spice_gl_surface(ssd->qxl.id, surface_width(ssd->ds), surface_height(ssd->ds), --=20 2.39.2