From nobody Tue Nov 26 14:23:26 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=1706658636; cv=none; d=zohomail.com; s=zohoarc; b=aOAkMsdaIcI0EWsPNgprDrQW8Xi8Ff/eP7M4kaWVCDE5fe3yhLl0Gs3c6K8kJR/0cdLZD+x81nOYCwIgDNys+AWdsy0sS/2NERva92DiPEIu2ffV7j7qI6hAMlRHeaTc+SSxMF2QrxMUOkj4nOH89VZ0J4Vk33LhcPWumFencEE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706658636; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=7/6BsF6srxfQzgKU8YUsVyBTHJKg2upo7xATphm6ftw=; b=Rls4DuXI9NlcfMlfP4u3lHX7GhFFDD+Adywg+Sg32qsAybyAbru+621vZHMtr72qOCvqKphS5asXQyOcXIHXJzgwXBYSPV5Egpspz5WKDymPnZ1nZBazNZSATk5MevuzK73502eIB5AcmnAmAK6PVGfbbmQzSGhCCKYfC48AU1A= 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 1706658636593832.1019827161483; Tue, 30 Jan 2024 15:50:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUxrC-0000pM-RR; Tue, 30 Jan 2024 18:49:34 -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 1rUxrB-0000ow-9B for qemu-devel@nongnu.org; Tue, 30 Jan 2024 18:49:33 -0500 Received: from mgamail.intel.com ([134.134.136.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUxr9-0003Zp-BI for qemu-devel@nongnu.org; Tue, 30 Jan 2024 18:49:33 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 15:49:23 -0800 Received: from dongwonk-z390-aorus-ultra.fm.intel.com ([10.105.129.124]) by orsmga003.jf.intel.com with ESMTP; 30 Jan 2024 15:49:23 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706658571; x=1738194571; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=KY/AMnlQUPEtmtyCg8/YEs9GcXSzmt79ngRlqR1yPJA=; b=SRBo0Cph0BFfAnQgNBQ3ANKPhrr87X/4/+SW056N85Qb1LGXSI9sAj0J hfPq6ABMGknJMR7OkMc4rTIxbMAGG8fwA8r3hkrgbAHqHAtLhdUGmv4ka a3EjmlSB1Q49iGJaHcfiagdC7Ns34COx/53aJHukvIHSQhveJdNQpxmFS S/EL9szEMmTmIZlvSefI7suq6ADMD3H0zEQDObhOMATH5hkgxdJJrYqzP V79O3IApayPVY3Zq70DcgxQJrymD2AJByVitDaWu52oeV0PF544q6SITL t9d84RGtH2N7O68g0s/dSxEtjc6pcU0s6DRIxlXgMMg/4h3Z6MpltVEYu w==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="393887939" X-IronPort-AV: E=Sophos;i="6.05,230,1701158400"; d="scan'208";a="393887939" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="737919634" X-IronPort-AV: E=Sophos;i="6.05,230,1701158400"; d="scan'208";a="737919634" From: dongwon.kim@intel.com To: qemu-devel@nongnu.org Subject: [PATCH 1/3] ui/gtk: skip drawing guest scanout when associated VC is invisible Date: Tue, 30 Jan 2024 15:48:38 -0800 Message-Id: <20240130234840.53122-2-dongwon.kim@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240130234840.53122-1-dongwon.kim@intel.com> References: <20240130234840.53122-1-dongwon.kim@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=134.134.136.20; envelope-from=dongwon.kim@intel.com; helo=mgamail.intel.com X-Spam_score_int: -56 X-Spam_score: -5.7 X-Spam_bar: ----- X-Spam_report: (-5.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.292, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1706658637515100001 From: Dongwon Kim A new flag "visible" is added to show visibility status of the gfx console. The flag is set to 'true' when the VC is visible but set to 'false' when it is hidden or closed. When the VC is invisible, drawing guest frames should be skipped as it will never be completed and it would potentially lock up the guest display especially when blob scanout is used. Cc: Marc-Andr=C3=A9 Lureau Cc: Gerd Hoffmann Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- include/ui/gtk.h | 1 + ui/gtk-egl.c | 8 ++++++++ ui/gtk-gl-area.c | 8 ++++++++ ui/gtk.c | 10 +++++++++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index aa3d637029..2de38e5724 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -57,6 +57,7 @@ typedef struct VirtualGfxConsole { bool y0_top; bool scanout_mode; bool has_dmabuf; + bool visible; #endif } VirtualGfxConsole; =20 diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 3af5ac5bcf..993c283191 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -265,6 +265,10 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, #ifdef CONFIG_GBM VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 + if (!vc->gfx.visible) { + return; + } + eglMakeCurrent(qemu_egl_display, vc->gfx.esurface, vc->gfx.esurface, vc->gfx.ectx); =20 @@ -363,6 +367,10 @@ void gd_egl_flush(DisplayChangeListener *dcl, VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); GtkWidget *area =3D vc->gfx.drawing_area; =20 + if (!vc->gfx.visible) { + return; + } + if (vc->gfx.guest_fb.dmabuf && !vc->gfx.guest_fb.dmabuf->draw_submitte= d) { graphic_hw_gl_block(vc->gfx.dcl.con, true); vc->gfx.guest_fb.dmabuf->draw_submitted =3D true; diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 52dcac161e..04e07bd7ee 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -285,6 +285,10 @@ void gd_gl_area_scanout_flush(DisplayChangeListener *d= cl, { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 + if (!vc->gfx.visible) { + return; + } + if (vc->gfx.guest_fb.dmabuf && !vc->gfx.guest_fb.dmabuf->draw_submitte= d) { graphic_hw_gl_block(vc->gfx.dcl.con, true); vc->gfx.guest_fb.dmabuf->draw_submitted =3D true; @@ -299,6 +303,10 @@ void gd_gl_area_scanout_dmabuf(DisplayChangeListener *= dcl, #ifdef CONFIG_GBM VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 + if (!vc->gfx.visible) { + return; + } + gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); egl_dmabuf_import_texture(dmabuf); if (!dmabuf->texture) { diff --git a/ui/gtk.c b/ui/gtk.c index 810d7fc796..02eb667d8a 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1312,15 +1312,20 @@ static void gd_menu_quit(GtkMenuItem *item, void *o= paque) static void gd_menu_switch_vc(GtkMenuItem *item, void *opaque) { GtkDisplayState *s =3D opaque; - VirtualConsole *vc =3D gd_vc_find_by_menu(s); + VirtualConsole *vc; GtkNotebook *nb =3D GTK_NOTEBOOK(s->notebook); gint page; =20 + vc =3D gd_vc_find_current(s); + vc->gfx.visible =3D false; + + vc =3D gd_vc_find_by_menu(s); gtk_release_modifiers(s); if (vc) { page =3D gtk_notebook_page_num(nb, vc->tab_item); gtk_notebook_set_current_page(nb, page); gtk_widget_grab_focus(vc->focus); + vc->gfx.visible =3D true; } } =20 @@ -1350,6 +1355,7 @@ static gboolean gd_tab_window_close(GtkWidget *widget= , GdkEvent *event, VirtualConsole *vc =3D opaque; GtkDisplayState *s =3D vc->s; =20 + vc->gfx.visible =3D false; gtk_widget_set_sensitive(vc->menu_item, true); gd_widget_reparent(vc->window, s->notebook, vc->tab_item); gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(s->notebook), @@ -1423,6 +1429,7 @@ static void gd_menu_untabify(GtkMenuItem *item, void = *opaque) gd_update_geometry_hints(vc); gd_update_caption(s); } + vc->gfx.visible =3D true; } =20 static void gd_menu_show_menubar(GtkMenuItem *item, void *opaque) @@ -2471,6 +2478,7 @@ static void gtk_display_init(DisplayState *ds, Displa= yOptions *opts) #ifdef CONFIG_GTK_CLIPBOARD gd_clipboard_init(s); #endif /* CONFIG_GTK_CLIPBOARD */ + vc->gfx.visible =3D true; } =20 static void early_gtk_display_init(DisplayOptions *opts) --=20 2.34.1 From nobody Tue Nov 26 14:23:26 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=1706658643; cv=none; d=zohomail.com; s=zohoarc; b=CSB+yppnqXy0yOHCFyq48FvTxOOzS475huS/EVtVFi1DitmfePhtMQQJf90A01b2lPOtVCM8UZqc2/tL20OC+9ZbfGjUpwn9tB6qkQXru0ExEChXsBdZMMmYXCs5p1kOzpj7QWNV3RUuWWhfZ4Ou1fXJOdQxwYVhBqQtl5g9BUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706658643; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=bf0GbJJaP4jEs6mz+409foojiX/n2HlH8bUZwaJ8at8=; b=dFcJOxo54btD6ykTeMs4WERx/9f8u5O4OaWlxTmyHpsSBHjA2RbSMhUJSS4TdDH3VGm1qeQgUC3t93flJtmnvQKje7g1i8odEudYMQ+gd0SKWLsRngwdwGpXlC89VivUON86wGjnv5d3E63lfBZW4GK7Z9n+Fn9AKYiUJ0LiluI= 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 1706658643944994.7067143645145; Tue, 30 Jan 2024 15:50:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUxrE-0000ph-98; Tue, 30 Jan 2024 18:49:36 -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 1rUxrC-0000pQ-Nn for qemu-devel@nongnu.org; Tue, 30 Jan 2024 18:49:34 -0500 Received: from mgamail.intel.com ([134.134.136.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUxrA-0003aZ-IT for qemu-devel@nongnu.org; Tue, 30 Jan 2024 18:49:34 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 15:49:23 -0800 Received: from dongwonk-z390-aorus-ultra.fm.intel.com ([10.105.129.124]) by orsmga003.jf.intel.com with ESMTP; 30 Jan 2024 15:49:23 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706658572; x=1738194572; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=bb/3yJcemveiuLaTpVp3K/Yfk9j4pt1mh8V2LegPHPE=; b=WFnrWlakIX8YZdPD/tqXckZ80vN8vySu+pckwN59+2Dxnl/FaS+ZUTNQ c/ZyIoBtQohweTPVuMxyojQyBgbu98YwKpjiD8HxQnDdS0HzP8NFEpsMR 3J7ZJvFOjYezfoqNxhClu/nWB9/o/E26F8aqU5CeoPZ/bHXAxleBDZTh5 iirvGLUhuLZpL1pQ+ZQE7xChvWeuadrE5Lag9v/R1DWYE11ksYh+idvXq 6+jjm9qu8SX2XYqe2KwbuCz/BCJeiWtvEhZ3IhX/tTp8vKPPVvM4RfggU 9zpiCbVGGAjjkAQjtBk0fMm9TDPWO7GPd3y6u6PjjMRjKNHmpFM2mfkeO A==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="393887940" X-IronPort-AV: E=Sophos;i="6.05,230,1701158400"; d="scan'208";a="393887940" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="737919635" X-IronPort-AV: E=Sophos;i="6.05,230,1701158400"; d="scan'208";a="737919635" From: dongwon.kim@intel.com To: qemu-devel@nongnu.org Subject: [PATCH 2/3] ui/gtk: set the ui size to 0 when invisible Date: Tue, 30 Jan 2024 15:48:39 -0800 Message-Id: <20240130234840.53122-3-dongwon.kim@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240130234840.53122-1-dongwon.kim@intel.com> References: <20240130234840.53122-1-dongwon.kim@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=134.134.136.20; envelope-from=dongwon.kim@intel.com; helo=mgamail.intel.com X-Spam_score_int: -56 X-Spam_score: -5.7 X-Spam_bar: ----- X-Spam_report: (-5.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.292, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1706658645524100003 From: Dongwon Kim UI size is set to 0 when the VC is invisible, which will prevent the further scanout update by notifying the guest that the display is not in active state. Then it is restored to the original size whenever the VC becomes visible again. Cc: Marc-Andr=C3=A9 Lureau Cc: Gerd Hoffmann Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- ui/gtk.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index 02eb667d8a..651ed3492f 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1314,10 +1314,12 @@ static void gd_menu_switch_vc(GtkMenuItem *item, vo= id *opaque) GtkDisplayState *s =3D opaque; VirtualConsole *vc; GtkNotebook *nb =3D GTK_NOTEBOOK(s->notebook); + GdkWindow *window; gint page; =20 vc =3D gd_vc_find_current(s); vc->gfx.visible =3D false; + gd_set_ui_size(vc, 0, 0); =20 vc =3D gd_vc_find_by_menu(s); gtk_release_modifiers(s); @@ -1325,6 +1327,9 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void= *opaque) page =3D gtk_notebook_page_num(nb, vc->tab_item); gtk_notebook_set_current_page(nb, page); gtk_widget_grab_focus(vc->focus); + window =3D gtk_widget_get_window(vc->gfx.drawing_area); + gd_set_ui_size(vc, gdk_window_get_width(window), + gdk_window_get_height(window)); vc->gfx.visible =3D true; } } @@ -1356,6 +1361,7 @@ static gboolean gd_tab_window_close(GtkWidget *widget= , GdkEvent *event, GtkDisplayState *s =3D vc->s; =20 vc->gfx.visible =3D false; + gd_set_ui_size(vc, 0, 0); gtk_widget_set_sensitive(vc->menu_item, true); gd_widget_reparent(vc->window, s->notebook, vc->tab_item); gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(s->notebook), @@ -1391,6 +1397,7 @@ static gboolean gd_win_grab(void *opaque) static void gd_menu_untabify(GtkMenuItem *item, void *opaque) { GtkDisplayState *s =3D opaque; + GdkWindow *window; VirtualConsole *vc =3D gd_vc_find_current(s); =20 if (vc->type =3D=3D GD_VC_GFX && @@ -1429,6 +1436,10 @@ static void gd_menu_untabify(GtkMenuItem *item, void= *opaque) gd_update_geometry_hints(vc); gd_update_caption(s); } + + window =3D gtk_widget_get_window(vc->gfx.drawing_area); + gd_set_ui_size(vc, gdk_window_get_width(window), + gdk_window_get_height(window)); vc->gfx.visible =3D true; } =20 @@ -1753,7 +1764,9 @@ static gboolean gd_configure(GtkWidget *widget, { VirtualConsole *vc =3D opaque; =20 - gd_set_ui_size(vc, cfg->width, cfg->height); + if (vc->gfx.visible) { + gd_set_ui_size(vc, cfg->width, cfg->height); + } return FALSE; } =20 --=20 2.34.1 From nobody Tue Nov 26 14:23:26 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=1706658631; cv=none; d=zohomail.com; s=zohoarc; b=Ei1nLkDG3YWlFyTnV8O6QM2b/LfNZBJu5VOIazH8l0L8DD8zEWIAiBSlSsctm6b6Tx6Ye/w/IwfwlknNzYiafwBt/ujQ05TUQhxZcpnk8fK2Eo18aOhD0cxmN+SYtEiOLowAF5tAqVkMEuP41NR7ts1WnfdEDcVVT61/hWR95AY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706658631; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=E1MyE/yR5rFtMcE/KR7DU7Gq3AxonsUpTD26hUgIUj4=; b=nxRfU+FAv0llHsKCDRXU3IuAdON/WRhJlfKdypHCjPUIMIq5DxH5qk32Lp6S7R4ipGRRsZaoaOGl2RXciA8tLTdborSb7VDAA95OX6rInQSgQYprAZoUxX91sOE8vj18ooWOgY6OT/rSSq4SBtdOdJ7yk+4Z37O8SasX45iUzPQ= 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 1706658631370892.2855742497004; Tue, 30 Jan 2024 15:50:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUxrG-0000qI-RS; Tue, 30 Jan 2024 18:49:38 -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 1rUxrD-0000pb-Tr for qemu-devel@nongnu.org; Tue, 30 Jan 2024 18:49:36 -0500 Received: from mgamail.intel.com ([134.134.136.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUxrB-0003Zp-R5 for qemu-devel@nongnu.org; Tue, 30 Jan 2024 18:49:35 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 15:49:23 -0800 Received: from dongwonk-z390-aorus-ultra.fm.intel.com ([10.105.129.124]) by orsmga003.jf.intel.com with ESMTP; 30 Jan 2024 15:49:23 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706658573; x=1738194573; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=y85khj6V6EsqOOpJ23xy73wtS49z/4+TEmxb+QPXG+0=; b=m4TOli8mtBg2ZLU3cIESjTXACVIqhls+Rr+6Oq8EEPuuM4pq2YbyyBGx Pc3G3i3asaZoUl6CVNpHECiVZwchleTRAN68YLBMU34uHykocXYoqTfWG sm5EI8r9KV+dFIScmqmg9bwRXBCgn2lGV5+aptfGlAqGtR0fHxPX1458E S6oGiESgVU7zsl5C9xJvtE6k8X4vE5wkfpdWtK63q+YRDoN3SeYWvQI7p UsrRpFusnDt45BfU3/L8/32Wrq36mo2DGEE13fXnnIsq2n8GUAesD3ixA GNI8U7SoP2DdLD7eZnDo6SsSI0bg7AXAoDO+NgX/So8PmD08s4riaJj7s w==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="393887942" X-IronPort-AV: E=Sophos;i="6.05,230,1701158400"; d="scan'208";a="393887942" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="737919636" X-IronPort-AV: E=Sophos;i="6.05,230,1701158400"; d="scan'208";a="737919636" From: dongwon.kim@intel.com To: qemu-devel@nongnu.org Subject: [PATCH 3/3] ui/gtk: reset visible flag when window is minimized Date: Tue, 30 Jan 2024 15:48:40 -0800 Message-Id: <20240130234840.53122-4-dongwon.kim@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240130234840.53122-1-dongwon.kim@intel.com> References: <20240130234840.53122-1-dongwon.kim@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=134.134.136.20; envelope-from=dongwon.kim@intel.com; helo=mgamail.intel.com X-Spam_score_int: -56 X-Spam_score: -5.7 X-Spam_bar: ----- X-Spam_report: (-5.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.292, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1706658633794100003 From: Dongwon Kim Adding a callback for window-state-event that resets the flag, 'visible' when associated window is minimized or restored. When minimizing, it cancels any of queued draw events associated with the VC. Cc: Marc-Andr=C3=A9 Lureau Cc: Gerd Hoffmann Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- ui/gtk.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 651ed3492f..5bbcb7de62 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1381,6 +1381,37 @@ static gboolean gd_tab_window_close(GtkWidget *widge= t, GdkEvent *event, return TRUE; } =20 +static gboolean gd_window_state_event(GtkWidget *widget, GdkEvent *event, + void *opaque) +{ + VirtualConsole *vc =3D opaque; + + if (!vc) { + return TRUE; + } + + if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED)= { + vc->gfx.visible =3D false; + gd_set_ui_size(vc, 0, 0); + if (vc->gfx.guest_fb.dmabuf && + vc->gfx.guest_fb.dmabuf->draw_submitted) { + vc->gfx.guest_fb.dmabuf->draw_submitted =3D false; + graphic_hw_gl_block(vc->gfx.dcl.con, false); + } + /* Showing the ui only if window exists except for the current vc as G= TK + * window for 's' is being used to display the GUI */ + } else if (vc->window || vc =3D=3D gd_vc_find_current(vc->s)) { + GdkWindow *window; + window =3D gtk_widget_get_window(vc->gfx.drawing_area); + gd_set_ui_size(vc, gdk_window_get_width(window), + gdk_window_get_height(window)); + + vc->gfx.visible =3D true; + } + + return TRUE; +} + static gboolean gd_win_grab(void *opaque) { VirtualConsole *vc =3D opaque; @@ -1422,6 +1453,9 @@ static void gd_menu_untabify(GtkMenuItem *item, void = *opaque) =20 g_signal_connect(vc->window, "delete-event", G_CALLBACK(gd_tab_window_close), vc); + g_signal_connect(vc->window, "window-state-event", + G_CALLBACK(gd_window_state_event), vc); + gtk_widget_show_all(vc->window); =20 if (qemu_console_is_graphic(vc->gfx.dcl.con)) { @@ -2470,6 +2504,11 @@ static void gtk_display_init(DisplayState *ds, Displ= ayOptions *opts) } =20 vc =3D gd_vc_find_current(s); + + g_signal_connect(s->window, "window-state-event", + G_CALLBACK(gd_window_state_event), + vc); + gtk_widget_set_sensitive(s->view_menu, vc !=3D NULL); #ifdef CONFIG_VTE gtk_widget_set_sensitive(s->copy_item, --=20 2.34.1