From nobody Tue Feb 10 16:58:07 2026 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=1687309515; cv=none; d=zohomail.com; s=zohoarc; b=G8QLyQobRemFlQ/2OXWkfosfUuW+7YKNzWSNyQC8DLclZ4UCZ6hEVV+vmieG8POsJcyDkY2VKQfldZeWkOfyrimP7hUclWk7gOLmMhWdC/9JQXBr4VRa69nxaudjuUG72dt6oGPWs8W7c5Guc7T28w3cLXPk31YnDqC6e9DDZV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687309515; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MqSefn+VI4NNzYXYKFLHSy3QpPMeBXSip2cJlIHFZYc=; b=n4PG+CdbpubwYwUJfcqMDYsSC+g5ew4QMptBWFLjOWXDZYvqMdZgOiDyN/8v75AiDQZSvl/vivnVTCKWPfOmfHvjP21GZtNMLQG/AuVX2aK2WS6yozCC8pCscRw7eKvg76kU6iVJD35iKUtMMtZ+ns5vcPM09ScHAC8bPXwDo9s= 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 1687309515580614.3202147494734; Tue, 20 Jun 2023 18:05:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBmGG-0007pA-Do; Tue, 20 Jun 2023 21:03:52 -0400 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 1qBmGF-0007oY-0p for qemu-devel@nongnu.org; Tue, 20 Jun 2023 21:03:51 -0400 Received: from mga11.intel.com ([192.55.52.93]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBmGD-0001GW-9c for qemu-devel@nongnu.org; Tue, 20 Jun 2023 21:03:50 -0400 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2023 18:03:44 -0700 Received: from dongwonk-z390-aorus-ultra-intel-gfx.fm.intel.com ([10.105.129.122]) by orsmga004.jf.intel.com with ESMTP; 20 Jun 2023 18:03:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687309429; x=1718845429; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jsUvvs3uPDjPnHLHhR8XgDCXj27+som4PR/bEyALolQ=; b=F2/1P5vd6T/rN3biRJLkW99xS7EI4l1SDoGhiQ4L4Ms0kFuUvfX13B2o Uag9Q7qrgYqr9dlWT+nmAZ6Hcsy4bsZB36/Wo07qz6oE7qw1Rvfwmd5zb qX9/V69lrSGKAqN9vXsm8bfYcbS7CTPL04hLP0ti6YJKXIn248/boDIgS HUcFizMQsxdZB5qeP9J6L+7tq5kVFSxk48GGVwjIrm5Ec/Awm/3OUlkBF wi3HdyaggFM01Zi3ecL8JG0y9dG3y8VhjLGEuHmoo7ONLaalA8zZbXlOy WuEebHjhJCuJBDX73Un/lQ8ne24G2URsPxJw74efRmy+/X+JAp/V7OWgM w==; X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="357522835" X-IronPort-AV: E=Sophos;i="6.00,258,1681196400"; d="scan'208";a="357522835" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="838429576" X-IronPort-AV: E=Sophos;i="6.00,258,1681196400"; d="scan'208";a="838429576" From: Dongwon Kim To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, berrange@redhat.com, armbru@redhat.com, philmd@linaro.org, marcandre.lureau@redhat.com, vivek.kasireddy@intel.com, Dongwon Kim Subject: [RFC PATCH 7/9] ui/gtk: unblock gl if draw submitted already or fence is not yet signaled Date: Tue, 20 Jun 2023 17:43:53 -0700 Message-Id: <20230621004355.19920-8-dongwon.kim@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230621004355.19920-1-dongwon.kim@intel.com> References: <20230621004355.19920-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=192.55.52.93; envelope-from=dongwon.kim@intel.com; helo=mga11.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1687309516307100001 Remove monitor while a guest frame is still being processed could block the guest (virtio-gpu) scanout pipe line. It is needed to manually flush the pipeline to prevent the permanent lockup. Cc: Gerd Hoffmann Cc: Daniel P. Berrang=C3=A9 Cc: Markus Armbruster Cc: Philippe Mathieu-Daud=C3=A9 Cc: Marc-Andr=C3=A9 Lureau Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- ui/gtk.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index f4c71454a3..e4ef1f7173 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -598,10 +598,21 @@ void gd_hw_gl_flushed(void *vcon) VirtualConsole *vc =3D vcon; QemuDmaBuf *dmabuf =3D vc->gfx.guest_fb.dmabuf; =20 - qemu_set_fd_handler(dmabuf->fence_fd, NULL, NULL, NULL); - close(dmabuf->fence_fd); - dmabuf->fence_fd =3D -1; - graphic_hw_gl_block(vc->gfx.dcl.con, false); + if (!dmabuf) { + return; + } + + if (dmabuf->fence_fd > 0) { + qemu_set_fd_handler(dmabuf->fence_fd, NULL, NULL, NULL); + close(dmabuf->fence_fd); + dmabuf->fence_fd =3D -1; + graphic_hw_gl_block(vc->gfx.dcl.con, false); + } else if (dmabuf->draw_submitted) { + /* if called after a frame is submitted but render event + * is not scheduled yet, cancel submitted draw. */ + dmabuf->draw_submitted =3D false; + graphic_hw_gl_block(vc->gfx.dcl.con, false); + } } =20 /** DisplayState Callbacks (opengl version) **/ @@ -742,6 +753,9 @@ static void gd_set_ui_size(VirtualConsole *vc, gint wid= th, gint height) dpy_set_ui_info(vc->gfx.dcl.con, &info, true); } =20 +static gboolean gd_window_state_event(GtkWidget *widget, GdkEvent *event, + void *opaque); + static void gd_ui_hide(VirtualConsole *vc) { QemuUIInfo info; @@ -751,6 +765,8 @@ static void gd_ui_hide(VirtualConsole *vc) info.width =3D 0; info.height =3D 0; dpy_set_ui_info(vc->gfx.dcl.con, &info, false); + /* forcefully cancel rendering sequence */ + gd_hw_gl_flushed(vc); } =20 static void gd_ui_show(VirtualConsole *vc) @@ -1460,11 +1476,6 @@ static gboolean gd_window_state_event(GtkWidget *wid= get, GdkEvent *event, =20 if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED)= { gd_ui_hide(vc); - 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); - } } else { gd_ui_show(vc); } --=20 2.34.1