From patchwork Mon Dec 4 18:40:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kim, Dongwon" X-Patchwork-Id: 13479319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91237C4167B for ; Tue, 5 Dec 2023 02:41:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rALMX-0007SL-Ln; Mon, 04 Dec 2023 21:40:41 -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 1rALMQ-0007Re-9A for qemu-devel@nongnu.org; Mon, 04 Dec 2023 21:40:35 -0500 Received: from mgamail.intel.com ([134.134.136.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rALMM-0005QE-Cx for qemu-devel@nongnu.org; Mon, 04 Dec 2023 21:40:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701744030; x=1733280030; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BStm0IG0TGW8yLK+dWHICb7ZIscZLOYUIoVfC1+k9gg=; b=WjmHmWMIUMU7Y0PPlsd9tOvhR9gw7iI1AAVKNrg6IkiLlCwGskv7wG71 tPzHSFyc4XznC0l2d8/5xH3VH8QV1x/8UwP0SkuEBz8DptU4y5TXtks4F HfF1a8HeZG4dC64za7N45/3ae2fob9CuBSbchYtKcDHD9jhlk5qsK930C O6dbkr9RMC/KOl+CioTLid+u8dXgcKLjqajOXuYcklSHYPTFp5Dsq2S5b r1Td66/reoEAT5d+2QqpO5MSjtaYqauXAS7Mkyj/mm+/l7yr4Lu2QnTRX mmilufnCq2i2nf1WfrHeeNzJTPBSRXa8d/WuGlQsMCgARXvJu1PXqZ+Y6 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="458153847" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="458153847" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 18:40:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="18799006" Received: from unknown (HELO localhost.fm.intel.com) ([10.105.154.69]) by orviesa001.jf.intel.com with ESMTP; 04 Dec 2023 18:40:25 -0800 From: Dongwon Kim To: qemu-devel@nongnu.org Cc: Dongwon Kim , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Vivek Kasireddy Subject: [PATCH] ui/gtk: flush display pipeline before saving vmstate when blob=true Date: Mon, 4 Dec 2023 18:40:51 +0000 Message-Id: <20231204184051.16873-1-dongwon.kim@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=134.134.136.31; envelope-from=dongwon.kim@intel.com; helo=mgamail.intel.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_06_12=1.543, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org If the guest state is paused before it gets a response for the current scanout frame submission (resource-flush), it won't start submitting new frames after being restored as it still waits for the old response, which is accepted as a scanout render done signal. So it's needed to unblock the current scanout render pipeline before the run state is changed to make sure the guest receives the response for the current frame submission. Cc: Marc-André Lureau Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- ui/gtk.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 810d7fc796..0f6237dd2f 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -678,6 +678,18 @@ static const DisplayGLCtxOps egl_ctx_ops = { static void gd_change_runstate(void *opaque, bool running, RunState state) { GtkDisplayState *s = opaque; + int i; + + if (state == RUN_STATE_SAVE_VM) { + for (i = 0; i < s->nb_vcs; i++) { + VirtualConsole *vc = &s->vc[i]; + + if (vc->gfx.guest_fb.dmabuf) { + /* force flushing current scanout blob rendering process */ + gd_hw_gl_flushed(vc); + } + } + } gd_update_caption(s); } From patchwork Wed Dec 13 20:24:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kim, Dongwon" X-Patchwork-Id: 13492254 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1721C46CA2 for ; Thu, 14 Dec 2023 04:25:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDdHd-0006Y5-67; Wed, 13 Dec 2023 23:25:14 -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 1rDdHV-0006Xw-UG for qemu-devel@nongnu.org; Wed, 13 Dec 2023 23:25:06 -0500 Received: from mgamail.intel.com ([192.55.52.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rDdHS-00047B-SQ for qemu-devel@nongnu.org; Wed, 13 Dec 2023 23:25:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702527902; x=1734063902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6wxqxaULlUE7+5E/y38yXUu9fle7w0xHuXtl3GH8lSA=; b=Uanenacu2D8n4mocp9obIA91fOjuiSEJTP7OtVkHJ41dDBQuKY5aCG4Y P8h3jog+95zu51FHAReOuanjaULkdQph8djkgznELJcjTx/Z92xOCOnR2 yh/RcUb+QU+J3E98UOC1MT86lPypIZhp1vaoPvROaUyxb2eSNAIi9S/7D m+/jOHwb4T82O2sdm7fp/8jtY4KvoX8fglPqKB0eMb/skkZlxvatg1ujD +BDCDY7bu6cVlAcg/jfdE/PCy62MuT6ZeZXcv3cIg1ZWx/UYhkDTrLno3 aACgQv0B1xIF6lLNo93y1IglZlM6l0C0CCKS1mxaAu9jrIrnemJBTkBW9 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="481261834" X-IronPort-AV: E=Sophos;i="6.04,274,1695711600"; d="scan'208";a="481261834" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 20:24:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="803127560" X-IronPort-AV: E=Sophos;i="6.04,274,1695711600"; d="scan'208";a="803127560" Received: from unknown (HELO localhost.fm.intel.com) ([10.105.154.69]) by orsmga008.jf.intel.com with ESMTP; 13 Dec 2023 20:24:57 -0800 From: Dongwon Kim To: qemu-devel@nongnu.org Cc: Dongwon Kim , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Vivek Kasireddy Subject: [PATCH 2/3] ui/gtk: unblock pipeline only if fence hasn't been signaled yet Date: Wed, 13 Dec 2023 20:24:18 +0000 Message-Id: <20231213202419.15459-2-dongwon.kim@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231213202419.15459-1-dongwon.kim@intel.com> References: <20231204184051.16873-1-dongwon.kim@intel.com> <20231213202419.15459-1-dongwon.kim@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.43; envelope-from=dongwon.kim@intel.com; helo=mgamail.intel.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_06_12=1.543, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org It is needed to unblock the pipeline only if there is an active dmabuf to be rendered and the fence for it is not yet signaled. Cc: Marc-André Lureau Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- ui/gtk.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index ea8d07833e..073c9eadb8 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -597,10 +597,16 @@ void gd_hw_gl_flushed(void *vcon) VirtualConsole *vc = vcon; QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf; - qemu_set_fd_handler(dmabuf->fence_fd, NULL, NULL, NULL); - close(dmabuf->fence_fd); - dmabuf->fence_fd = -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 = -1; + graphic_hw_gl_block(vc->gfx.dcl.con, false); + } } /** DisplayState Callbacks (opengl version) **/ From patchwork Wed Dec 13 20:24:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kim, Dongwon" X-Patchwork-Id: 13492255 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 65B36C4332F for ; Thu, 14 Dec 2023 04:26:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDdHx-0006Zz-1O; Wed, 13 Dec 2023 23:25:35 -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 1rDdHY-0006YA-4U for qemu-devel@nongnu.org; Wed, 13 Dec 2023 23:25:11 -0500 Received: from mgamail.intel.com ([192.55.52.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rDdHW-00047B-AY for qemu-devel@nongnu.org; Wed, 13 Dec 2023 23:25:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702527906; x=1734063906; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GB7Aw2ZUWFlZrpDmc0tXArN8lQPdhA8HuiP+BBWfeHI=; b=lw0dfIOgaK8QpH2HlMA7OQTPhECh/JNbhOOKjB27bx1qVWeNxg4mrVzs SSc346aDS+TSlkZu49LgDh6ftjE1xKza7U8Tmk1kACAGxhhbkQR/4I0F0 +hR4TDJkWXS7+5GOOZDpWHrcLxNCXiiRhFyswHmHWUZEpsCjdf61w+uU5 YnSb0e536qCUiqvWez07spwXuXwAjiGgACsaCXAMv2vzji7+Pu/jNNI71 jR72JqNCshgjqKnEDbTsE9HWq1xmqt2F6ACyEow2PFV7oucLDgBbcYxcB Tw4e9bS6iqUpea9YbYjXpyqQfodRws/u/WhDQDmEmYFrjj1SnqBTQWwRo w==; X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="481261836" X-IronPort-AV: E=Sophos;i="6.04,274,1695711600"; d="scan'208";a="481261836" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2023 20:24:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="803127566" X-IronPort-AV: E=Sophos;i="6.04,274,1695711600"; d="scan'208";a="803127566" Received: from unknown (HELO localhost.fm.intel.com) ([10.105.154.69]) by orsmga008.jf.intel.com with ESMTP; 13 Dec 2023 20:24:58 -0800 From: Dongwon Kim To: qemu-devel@nongnu.org Cc: Dongwon Kim , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Vivek Kasireddy Subject: [PATCH 3/3] virtio-gpu: first surface update with blob scanout after resumed Date: Wed, 13 Dec 2023 20:24:19 +0000 Message-Id: <20231213202419.15459-3-dongwon.kim@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231213202419.15459-1-dongwon.kim@intel.com> References: <20231204184051.16873-1-dongwon.kim@intel.com> <20231213202419.15459-1-dongwon.kim@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.43; envelope-from=dongwon.kim@intel.com; helo=mgamail.intel.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_06_12=1.543, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The guest surface needs to be updated with a blob scanout after resumed from saved vm state if blob is enabled. Cc: Marc-André Lureau Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- hw/display/virtio-gpu.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index b016d3bac8..34dc0ab9fc 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1417,19 +1417,27 @@ static int virtio_gpu_post_load(void *opaque, int version_id) if (!res) { return -EINVAL; } - scanout->ds = qemu_create_displaysurface_pixman(res->image); - if (!scanout->ds) { - return -EINVAL; - } + + if (res->blob_size) { + assert(g->dmabuf.primary[i] != NULL); + g->dmabuf.primary[i]->buf.fd = res->dmabuf_fd; + dpy_gl_scanout_dmabuf(scanout->con, &g->dmabuf.primary[i]->buf); + } else { + scanout->ds = qemu_create_displaysurface_pixman(res->image); + if (!scanout->ds) { + return -EINVAL; + } #ifdef WIN32 - qemu_displaysurface_win32_set_handle(scanout->ds, res->handle, 0); + qemu_displaysurface_win32_set_handle(scanout->ds, res->handle, 0); #endif + dpy_gfx_replace_surface(scanout->con, scanout->ds); + dpy_gfx_update_full(scanout->con); + } - dpy_gfx_replace_surface(scanout->con, scanout->ds); - dpy_gfx_update_full(scanout->con); if (scanout->cursor.resource_id) { update_cursor(g, &scanout->cursor); } + res->scanout_bitmask |= (1 << i); }