From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706390; cv=none; d=zohomail.com; s=zohoarc; b=n90vMPA1afCLf8WSfLCYt2WDvZfQmPzuM7oqkT2fGUhSyhIbwaVh4jMe6/SNYMIY1MH0Yu0mtrk0nBUM/Wayv808Z5TSTQc73oDbDMhraMYzyRMV8KKcj1AFg0/zrwuvspRlc2o3Fxyi1J9sT0VlbmcABfmMl9EiqnoHihW3qXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706390; 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=qJPJOwoXCkGwbiSuYbbJgdkoZrMN9/UHCtD1+osMbYU=; b=aN5YI7TMtR2HNEx736kbfLeFemBXj+mKZWYEI4XTdWL/kVQV9abbJXZdZYvsxD/Gn710GcpCXXfgEO4PvgbPg2nmj9fgRRtaj2fpM1gbVfDfa1fi/3dbF6YQ6NUpq7PaR+KTMsp2wrtlyL02XzYJllvE6gnBXWppLdj0p+fS/2Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706390114113.54347381609557; Fri, 15 Jan 2021 02:26:30 -0800 (PST) Received: from localhost ([::1]:35730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0MJI-0004Wi-To for importer@patchew.org; Fri, 15 Jan 2021 05:26:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHS-0002sL-TT for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46709) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHR-0007rj-Dr for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-17-8gPTT4lcPwWtdDAJSocEMA-1; Fri, 15 Jan 2021 05:24:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A09015723; Fri, 15 Jan 2021 10:24:29 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 43C0F60BF3; Fri, 15 Jan 2021 10:24:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 85EE91800607; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qJPJOwoXCkGwbiSuYbbJgdkoZrMN9/UHCtD1+osMbYU=; b=dCQNkX8psPjqaTWEhmD5rehxXBTZnj6t5TMMYtWLoLasMBQtqNTXZVkDJDMhk65N5ZdPCK yYyfphIXImhhpM//xar8zyPtzw7Z0FAf7CLbTPKGHj8Sq6BdOr4jGn+8So8ri/FKFOizfG JxsGbe713RV/fj1JC0WqTmt02b/r0RQ= X-MC-Unique: 8gPTT4lcPwWtdDAJSocEMA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 01/11] ui/gtk: don't try to redefine SI prefixes Date: Fri, 15 Jan 2021 11:24:14 +0100 Message-Id: <20210115102424.1360437-2-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Redefining SI prefixes is always wrong. 1s has per definition 1000ms. Remove the misnamed named constant and replace it with a comment explaining the frequency to period conversion in two simple steps. Now you can cancel out the unit mHz in the comment with the implicit unit mHz in refresh_rate_millihz and see why the implicit unit ms for update_interval remains. Signed-off-by: Volker R=C3=BCmelin Message-Id: <20201213165724.13418-1-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- include/ui/gtk.h | 2 -- ui/gtk.c | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index eaeb450f913e..80851fb4c7e1 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -24,8 +24,6 @@ #include "ui/egl-context.h" #endif =20 -#define MILLISEC_PER_SEC 1000000 - typedef struct GtkDisplayState GtkDisplayState; =20 typedef struct VirtualGfxConsole { diff --git a/ui/gtk.c b/ui/gtk.c index e8474456df88..a83c8c3785e1 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -798,7 +798,8 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_= t *cr, void *opaque) refresh_rate_millihz =3D gd_refresh_rate_millihz(vc->window ? vc->window : s->window); if (refresh_rate_millihz) { - vc->gfx.dcl.update_interval =3D MILLISEC_PER_SEC / refresh_rate_mi= llihz; + /* T =3D 1 / f =3D 1 [s*Hz] / f =3D 1000*1000 [ms*mHz] / f */ + vc->gfx.dcl.update_interval =3D 1000 * 1000 / refresh_rate_millihz; } =20 fbw =3D surface_width(vc->gfx.ds); --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706390; cv=none; d=zohomail.com; s=zohoarc; b=gzNpRtWUI68AQciwjLPqSrfy7F3GPMzUQPuAlSSmhMaTct4pEiXRU5mfPVsHnI3Lqn0775k48BM+qk8rZTgTBTJ/hJYWjHDR60oIfmC4Qkht5XHwWZBGSnQa1OHqLHO/GvaP1BexbkTrnVhtbhxawePax9XBTb1fIKHF3ne4isg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706390; 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=JI1YAzibacN63t/KW2J5k75OQ8GJCXwRx6N7KHNkqo4=; b=GOOvy+WoM+C9coFkvIIQVTCHZgdoXiON/PzhD0+1gvdnwyJFI6b3iJ00gkEpuJoSOJ4Qadz2L5PYFL4vVDor9VMaEwpPPYLTvtWp8t/kfpZG22LMR/VvN2FKqBuggYvcrtybYnvdVI8QHc2la7FqsoiY5c9v8+yTZJwXl8Qn4BU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706390216209.60587316593217; Fri, 15 Jan 2021 02:26:30 -0800 (PST) Received: from localhost ([::1]:35652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0MJJ-0004V4-4L for importer@patchew.org; Fri, 15 Jan 2021 05:26:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHS-0002sE-Mq for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHR-0007rg-2Z for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-oSvGreWjMu-QlcPmyWGqJQ-1; Fri, 15 Jan 2021 05:24:30 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 354E4107ACF8; Fri, 15 Jan 2021 10:24:29 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F4CB5D9E3; Fri, 15 Jan 2021 10:24:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 905FE1800610; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JI1YAzibacN63t/KW2J5k75OQ8GJCXwRx6N7KHNkqo4=; b=GQd/+y7mzwWATBJIhJ1wa+DWrUVSKp6GWzdrS33ZdCFEXiIJHem96HlIX4TNypSeP1lN3p mXpLqAyczqHmxjsEWN3wyodz/RBLimOpYMR3AOvwo7pk6bHDpepWa8SVvSLIIA3qW1l9L6 AIWjD5WFc1/hZCG5h2wjfeI8PEF08+4= X-MC-Unique: oSvGreWjMu-QlcPmyWGqJQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 02/11] ui/gtk: rename variable window to widget Date: Fri, 15 Jan 2021 11:24:15 +0100 Message-Id: <20210115102424.1360437-3-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin The type of the variable window is GtkWidget. Rename the variable from window to widget, because windows and widgets are different things. Signed-off-by: Volker R=C3=BCmelin Message-Id: <20201213165724.13418-2-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index a83c8c3785e1..439c1e949fd9 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -752,13 +752,13 @@ static void gd_resize_event(GtkGLArea *area, * If available, return the refresh rate of the display in milli-Hertz, * else return 0. */ -static int gd_refresh_rate_millihz(GtkWidget *window) +static int gd_refresh_rate_millihz(GtkWidget *widget) { #ifdef GDK_VERSION_3_22 - GdkWindow *win =3D gtk_widget_get_window(window); + GdkWindow *win =3D gtk_widget_get_window(widget); =20 if (win) { - GdkDisplay *dpy =3D gtk_widget_get_display(window); + GdkDisplay *dpy =3D gtk_widget_get_display(widget); GdkMonitor *monitor =3D gdk_display_get_monitor_at_window(dpy, win= ); =20 return gdk_monitor_get_refresh_rate(monitor); --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706496; cv=none; d=zohomail.com; s=zohoarc; b=cw0uEL0gRivtPFHLIXgeeVtXqML4K/qzPZzTnPcbsR87cu5bz34BWVHigXOv5ZsVc9Dn9yJqPM46cFXlqEDTHS8AeZqszN5w1QGFEtgtcKjkNi45FPbptAgfwwoYeU+KDSgR6Yyl+GzH1j9EJN+STz3Apoj4N/d++AkoODZmxII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706496; 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=os4GO3mreatvo85yozQMNvL9545MSXcMAfCGgg+egBw=; b=GDhMMhFd1RoI8fv/+NmumsiesiJZEbA8Q/KJ6Puwph/yy3ft/amQe4o2dUHtEsGDsHGatWL8mPEBkt3Cr1MaKL/L360riLJ9Zh11T+b6peAJiIM9Tuco1JF8sq/wNlOjIWXs56zleqk4UOSJM9IN4mx1rw/RMcAEoxyK/3kjq1g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706496541145.17008763585272; Fri, 15 Jan 2021 02:28:16 -0800 (PST) Received: from localhost ([::1]:43308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0ML0-0007q1-VL for importer@patchew.org; Fri, 15 Jan 2021 05:28:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHU-0002tp-9E for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35127) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHS-0007sU-54 for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-8yzCrXNXMtC57d5X3UZtvg-1; Fri, 15 Jan 2021 05:24:30 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 76433107ACF9; Fri, 15 Jan 2021 10:24:29 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 43C3B19C45; Fri, 15 Jan 2021 10:24:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9B0601800612; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=os4GO3mreatvo85yozQMNvL9545MSXcMAfCGgg+egBw=; b=RU2u2gC8Jcezdj/mjNLwr1xqQaSQaqrO61+WG1AQ5r01IpBdG+i0StFmyzzGf1e+K6rR8l ZauFkZm5UPYGwFZi+aNL2CIv05ghCPuHFwMZMY5Q223E3cweWlcuVz0nRmzmxMNu3O4SkU oNMzNiylpEoHTDmrW5tj07TzeaVVIMI= X-MC-Unique: 8yzCrXNXMtC57d5X3UZtvg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 03/11] ui/gtk: limit virtual console max update interval Date: Fri, 15 Jan 2021 11:24:16 +0100 Message-Id: <20210115102424.1360437-4-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Limit the virtual console maximum update interval to GUI_REFRESH_INTERVAL_DEFAULT. This papers over a integer overflow bug in gtk3 on Windows where the reported monitor refresh frequency can be much smaller than the real refresh frequency. The gtk bug report can be found here: https://gitlab.gnome.org/GNOME/gtk/-/issues/3394 On my Windows 10 system gtk reports a monitor refresh rate of 1.511Hz instead of 60.031Hz and slows down the screen update rate in qemu to a crawl. Provided you are affected by the gtk bug on Windows, these are the steps to reproduce the issue: Start qemu with -display gtk and activate all qemu virtual consoles and notice the reduced qemu refresh rate. Activating all virtual consoles is necessary, because gui_update() in ui/console.c uses the minimum of all display change listeners update interval and not yet activated virtual consoles report the default update interval (30ms). Signed-off-by: Volker R=C3=BCmelin Message-Id: <20201213165724.13418-3-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 439c1e949fd9..d2004a4dc162 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -749,10 +749,10 @@ static void gd_resize_event(GtkGLArea *area, #endif =20 /* - * If available, return the refresh rate of the display in milli-Hertz, - * else return 0. + * If available, return the update interval of the monitor in ms, + * else return 0 (the default update interval). */ -static int gd_refresh_rate_millihz(GtkWidget *widget) +static int gd_monitor_update_interval(GtkWidget *widget) { #ifdef GDK_VERSION_3_22 GdkWindow *win =3D gtk_widget_get_window(widget); @@ -760,8 +760,13 @@ static int gd_refresh_rate_millihz(GtkWidget *widget) if (win) { GdkDisplay *dpy =3D gtk_widget_get_display(widget); GdkMonitor *monitor =3D gdk_display_get_monitor_at_window(dpy, win= ); + int refresh_rate =3D gdk_monitor_get_refresh_rate(monitor); /* [mH= z] */ =20 - return gdk_monitor_get_refresh_rate(monitor); + if (refresh_rate) { + /* T =3D 1 / f =3D 1 [s*Hz] / f =3D 1000*1000 [ms*mHz] / f */ + return MIN(1000 * 1000 / refresh_rate, + GUI_REFRESH_INTERVAL_DEFAULT); + } } #endif return 0; @@ -774,7 +779,6 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_= t *cr, void *opaque) int mx, my; int ww, wh; int fbw, fbh; - int refresh_rate_millihz; =20 #if defined(CONFIG_OPENGL) if (vc->gfx.gls) { @@ -795,12 +799,8 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo= _t *cr, void *opaque) return FALSE; } =20 - refresh_rate_millihz =3D gd_refresh_rate_millihz(vc->window ? - vc->window : s->window); - if (refresh_rate_millihz) { - /* T =3D 1 / f =3D 1 [s*Hz] / f =3D 1000*1000 [ms*mHz] / f */ - vc->gfx.dcl.update_interval =3D 1000 * 1000 / refresh_rate_millihz; - } + vc->gfx.dcl.update_interval =3D + gd_monitor_update_interval(vc->window ? vc->window : s->window); =20 fbw =3D surface_width(vc->gfx.ds); fbh =3D surface_height(vc->gfx.ds); --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706647; cv=none; d=zohomail.com; s=zohoarc; b=gqigWfrdgXFtnnvQCDBJdB8E5JQ9AcUyGfMjnwI6qF4lGKhInKLsroogWvQAmN8X51WmmJtMFmaK6lXStY+jxCUBCC+8RGa9bh/DnxfomCbWzFBCk/zDKg2BA/Af+IeBtJ0uVFWMRfMy2pAKYxwosCMKSK0MRTj0tsUArWvXGP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706647; 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=EO8CiTvkYhxpMMdPMV09i1bJZpLZdUP8OlhSRKWJhOI=; b=AiIOO1FGjvDZKflP3WZ5+Brlyc17J2tXOVwUNBeKXc1ufzyEPkbK38a988f5DNJ5muOmCFOoOnzOnfJPq6oYXhK0YLWjXJsWgUliImoAjQVSnxZDnp/ec7ZZY79wtY6kpndtGtJD17pVqX+WOSegEvtj0l7OoAEWYm7dCzquRos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706647025767.3510507576974; Fri, 15 Jan 2021 02:30:47 -0800 (PST) Received: from localhost ([::1]:50772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0MNR-0002Zt-UH for importer@patchew.org; Fri, 15 Jan 2021 05:30:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHU-0002vI-SV for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41012) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHT-0007tN-AO for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-ECzy3WbWPL2xzx_6yZJAcg-1; Fri, 15 Jan 2021 05:24:30 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 75466806662; Fri, 15 Jan 2021 10:24:29 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 43E771992D; Fri, 15 Jan 2021 10:24:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A6F9C1800633; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EO8CiTvkYhxpMMdPMV09i1bJZpLZdUP8OlhSRKWJhOI=; b=g9zbk94WxT6NGWulXHp7P6n2gSoN6dr9r+hnXi0fV5WwdzRRCOIF3SyD1EN+aaUQxS5vZ7 LKXk427/5ycL6a9M6uUNG3SbO/lWlcmgy8riUDQ/tE1YKUSg6X/CjjHMHmU4LuVpUEE73N v9YHXor+HDtTMsJ3gvucZ7Su/G7Jzbw= X-MC-Unique: ECzy3WbWPL2xzx_6yZJAcg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 04/11] ui/gtk: expose gd_monitor_update_interval Date: Fri, 15 Jan 2021 11:24:17 +0100 Message-Id: <20210115102424.1360437-5-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , Nikola Pavlica Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Nikola Pavlica The gd_egl_refresh function, as the name suggests, is responsible for refreshing displays when using EGL graphics with QEMU's GTK UI. This is a perfect candidate for a function to update the refresh rate in. Since gd_monitor_update_interval is inaccessible from the gd_egl_refresh function, we need to expose/globalize it in the include/ui/gtk.h file. Signed-off-by: Nikola Pavlica Message-Id: <20210114140153.301473-2-pavlica.nikola@gmail.com> Signed-off-by: Gerd Hoffmann --- include/ui/gtk.h | 1 + ui/gtk.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 80851fb4c7e1..3f395d7f943b 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -86,6 +86,7 @@ extern bool gtk_use_gl_area; =20 /* ui/gtk.c */ void gd_update_windowsize(VirtualConsole *vc); +int gd_monitor_update_interval(GtkWidget *widget); =20 /* ui/gtk-egl.c */ void gd_egl_init(VirtualConsole *vc); diff --git a/ui/gtk.c b/ui/gtk.c index d2004a4dc162..26665cd2e657 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -752,7 +752,7 @@ static void gd_resize_event(GtkGLArea *area, * If available, return the update interval of the monitor in ms, * else return 0 (the default update interval). */ -static int gd_monitor_update_interval(GtkWidget *widget) +int gd_monitor_update_interval(GtkWidget *widget) { #ifdef GDK_VERSION_3_22 GdkWindow *win =3D gtk_widget_get_window(widget); --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706923; cv=none; d=zohomail.com; s=zohoarc; b=cRp3j42P23YmGtjzYYcZoYneG1QbbyjUz2k5iXkqyAz3OInfa2x0ZukS8R5U1a74yhJOtYeGm4fwwDjRLQwhUEyI9Hr9caaJWrOegl3F4VomdoYoWyroinQ72u+x4UNqelSyd9/3lXEC9wBlCxfVD+AeDsH0yANL1D8WAY6fQtg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706923; 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=k0RZJ0aw4Oxsx9G/xx++q/L9Bmqlnx71U7H+bnB6fns=; b=J8uSWqJmrcWIRO9jzitYu8bSkFAQYgmzK5HvuG70MYM/DFpAEZUR371X3iGTJKNHJLx5D+WSy0/syYCtOKU8YzQOk8rxJGO4KUMfgmwlx6S0BM77jILpRlm7e6WE29fq8JsW03qcgxisAS6wt9ff8rALEpnxxtiRjBoOCMypYac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706923481527.4078605006298; Fri, 15 Jan 2021 02:35:23 -0800 (PST) Received: from localhost ([::1]:33326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0MRu-0007Gv-8s for importer@patchew.org; Fri, 15 Jan 2021 05:35:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHX-00032z-Ur for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54239) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHW-0007v6-8H for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:39 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-a_hzYqMPM7-MHPZX2jmxuw-1; Fri, 15 Jan 2021 05:24:34 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB1F41005D4D; Fri, 15 Jan 2021 10:24:33 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF3C46F7ED; Fri, 15 Jan 2021 10:24:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B1D58180063A; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k0RZJ0aw4Oxsx9G/xx++q/L9Bmqlnx71U7H+bnB6fns=; b=Mw/lAq2vZmYNIvaR9cQrOnFlhbn3b2ab+Kp01lQd6Ezo5ilgM1+yHr1gKy84TdZwb5Ui/o oUl86e7X7frdNb232lwX6RIArqgm7jJawzkv3Sg+VhJVMpagWjbG2W2XyRg9CexlirH2sR UOGF+K//8aTFdkx36ybo8JmfgTmircg= X-MC-Unique: a_hzYqMPM7-MHPZX2jmxuw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 05/11] ui/gtk: update monitor interval on egl displays Date: Fri, 15 Jan 2021 11:24:18 +0100 Message-Id: <20210115102424.1360437-6-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , Nikola Pavlica Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Nikola Pavlica When running QEMU's GTK UI without EGL or OGL, the gd_monitor_update_interval function gets executed and the display refresh rate gets updated accordingly. However, when using EGL or just regular OGL, the function never gets executed. Which is why I decided that the function should be in gd_egl_refresh where the display output gets updated, in the same vain as how it's done for normal GTK UIs (aka. those without EGL) - in it's display refresh function. Since the gd_monitor_update_interval function now is exposed, we are going to use it to update the refresh rate. Signed-off-by: Nikola Pavlica Message-Id: <20210114140153.301473-3-pavlica.nikola@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/gtk-egl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 99231a3597f5..71c3d698b400 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -113,6 +113,9 @@ void gd_egl_refresh(DisplayChangeListener *dcl) { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 + vc->gfx.dcl.update_interval =3D gd_monitor_update_interval( + vc->window ? vc->window : vc->gfx.drawing_area); + if (!vc->gfx.esurface) { gd_egl_init(vc); if (!vc->gfx.esurface) { --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706647; cv=none; d=zohomail.com; s=zohoarc; b=gi0e0WncQdUylDR4xBM3EAoXtp1SzWw0Y4z+3RFLTxgP/b0eH2rBXvIDs7XztZgX3GaDMvx0PZI77y/NGO2d5U4jzaOAM1pbmMBo3pVCLjIlC0D8ZYBNjSbhXOR0/qN7DFlkNMIpCMuyFh6jhKUB7SlPqUEUXXVW+zQiXPiApw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706647; 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=MYBIpL3oyEoPKi1X23Tx0weq37PExo0fvKLjB6uMuhA=; b=BBeKNcJ7WVvL73vMqkCgg9gLNhm2eQ2oBOoYFY4wnwWLYlr/ypNRSE/huIR6OhTSTPKCAWXjT0Fx2kHTn+Ah/qTHQg+Ktz8OMeUEYcZgVrQ5MMlQPbU+JzAbz9sHCnGWqneJ5TBN3PpvzCIhAYpnQZoF1x+TsK/u07HNY28ekXY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706647954329.43486980945545; Fri, 15 Jan 2021 02:30:47 -0800 (PST) Received: from localhost ([::1]:50908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0MNS-0002dU-Sj for importer@patchew.org; Fri, 15 Jan 2021 05:30:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHY-000357-NB for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHV-0007uM-N2 for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:40 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-kr0CM-jjMnyIneXhc3eyXw-1; Fri, 15 Jan 2021 05:24:34 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DDF6D806664; Fri, 15 Jan 2021 10:24:33 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6CFE629DA; Fri, 15 Jan 2021 10:24:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BC158180063C; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MYBIpL3oyEoPKi1X23Tx0weq37PExo0fvKLjB6uMuhA=; b=XTJDMuIEw8jr1KOevIBqfHCha8DUoqqKdi3j7jbArIX8P1JiZG7vYU5mxKjoH9vZkYSep4 PwcH7JJUfxz+21GwYATBMg6C6lfprCrqp0+VEtV/9UYRdomF7nAQN77vnTH326e4LrO9/b 8Ah3vOEFYkDhxPlTOQFaoUJf9fJBChk= X-MC-Unique: kr0CM-jjMnyIneXhc3eyXw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 06/11] vnc: fix unfinalized tlscreds for VncDisplay Date: Fri, 15 Jan 2021 11:24:19 +0100 Message-Id: <20210115102424.1360437-7-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zihao Chang , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Zihao Chang In vnc_display_open(), if tls-creds is enabled, do object_ref(object ref 1->2) for tls-creds. While in vnc_display_close(), object_unparent sets object ref to 1(2->1) and unparent the object for root. Problem: 1. the object can not be found from the objects_root, while the object is not finalized. 2. the qemu_opts of tls-creds(id: creds0) is not deleted, so new tls object with the same id(creds0) can not be delete & add. Signed-off-by: Zihao Chang Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20210111131911.805-1-changzihao1@huawei.com> Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/vnc.c b/ui/vnc.c index 7452ac7df2ce..69e92b1ef361 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3234,7 +3234,7 @@ static void vnc_display_close(VncDisplay *vd) vd->auth =3D VNC_AUTH_INVALID; vd->subauth =3D VNC_AUTH_INVALID; if (vd->tlscreds) { - object_unparent(OBJECT(vd->tlscreds)); + object_unref(OBJECT(vd->tlscreds)); vd->tlscreds =3D NULL; } if (vd->tlsauthz) { --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706397; cv=none; d=zohomail.com; s=zohoarc; b=D1BeiKS7jUXyuooy118CPw6HMgzntPdF8rYfn0sgZercNBReL+W0o8T0k4BGNHQvuWHMfDoGu5SwGBpeOcr0gYI8iOvz7ex0/6nwQcnUCGQt+KSwSMtpe7pevY16DKSjtyV34r109hcT/i0v0as8JNWMK/h7eS3Ibd3RAF85fp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706397; 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=wTl5/hEVJ1Qfcp0prF8/Ndx027+dDOhBcIPh8SAdgRs=; b=M53RlCH9gvouUmJPF9BbAxRth0HjJo8p60ULe1JyByikGzyMyuXAPYXpXjklRRgGD9SHeKlUiz5SNQJHPtTRIAyawFPQB9o1wOd643s7WhXGSnu4wVTtEWo8NO+1Y+qB6Nf16C7C/OlBXGtx1an4zSTnGgrRp5otkaQQiNBPSDw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706397994468.0386443910529; Fri, 15 Jan 2021 02:26:37 -0800 (PST) Received: from localhost ([::1]:36450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0MJQ-0004u2-SD for importer@patchew.org; Fri, 15 Jan 2021 05:26:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHX-00031c-C9 for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHV-0007uF-Bs for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:39 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-8wSsBCZuMSaotbFtJcAlsg-1; Fri, 15 Jan 2021 05:24:35 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1BFA0180A097 for ; Fri, 15 Jan 2021 10:24:34 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B12E966A08; Fri, 15 Jan 2021 10:24:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CAAC6180063D; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wTl5/hEVJ1Qfcp0prF8/Ndx027+dDOhBcIPh8SAdgRs=; b=OG/hEbaiv4nkJt8cBGYJ2E1UKm7eXii7htzmSrLPZQe/3QP/0wRqot3v7sb1woA2PRNn4O e7v/8SsZI3Xfa4PdYcExclbjcHCsNrVmelcbRBdyxlTivR9GOleB0LhjxYnECy1HvrNkE0 Nx8PeHhGmxhPmF2yxFl1NMB0h5qdRHU= X-MC-Unique: 8wSsBCZuMSaotbFtJcAlsg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 07/11] ui: add support for remote power control to VNC server Date: Fri, 15 Jan 2021 11:24:20 +0100 Message-Id: <20210115102424.1360437-8-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Daniel P. Berrang=C3=A9 The "XVP" (Xen VNC Proxy) extension defines a mechanism for a VNC client to issue power control requests to trigger graceful shutdown, reboot, or hard reset. This option is not enabled by default, since we cannot assume that users with VNC access implicitly have administrator access to the guest OS. Thus is it enabled with a boolean "power-control" option e.g. -vnc :1,power-control=3Don While, QEMU can easily support shutdown and reset, there's no easy way to wire up reboot support at this time. In theory it could be done by issuing a shutdown, followed by a reset, but there's no convenient wiring for such a pairing in QEMU. It also isn't possible to have the VNC server directly talk to QEMU guest agent, since the agent chardev is typically owned by an external mgmt app. Signed-off-by: Daniel P. Berrang=C3=A9 [ kraxel: rebase to master ] [ kraxel: add missing break ] Signed-off-by: Gerd Hoffmann --- ui/vnc.h | 13 +++++++++++ ui/vnc.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ qemu-options.hx | 4 ++++ 3 files changed, 76 insertions(+) diff --git a/ui/vnc.h b/ui/vnc.h index c8d3ad9ec496..5feeef9df08c 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -176,6 +176,7 @@ struct VncDisplay int ws_subauth; /* Used by websockets */ bool lossy; bool non_adaptive; + bool power_control; QCryptoTLSCreds *tlscreds; QAuthZ *tlsauthz; char *tlsauthzid; @@ -412,6 +413,7 @@ enum { #define VNC_ENCODING_TIGHT_PNG 0xFFFFFEFC /* -260 */ #define VNC_ENCODING_LED_STATE 0XFFFFFEFB /* -261 */ #define VNC_ENCODING_DESKTOP_RESIZE_EXT 0XFFFFFECC /* -308 */ +#define VNC_ENCODING_XVP 0XFFFFFECB /* -309 */ #define VNC_ENCODING_ALPHA_CURSOR 0XFFFFFEC6 /* -314 */ #define VNC_ENCODING_WMVi 0x574D5669 =20 @@ -453,6 +455,7 @@ enum VncFeatures { VNC_FEATURE_ZRLE, VNC_FEATURE_ZYWRLE, VNC_FEATURE_LED_STATE, + VNC_FEATURE_XVP, }; =20 #define VNC_FEATURE_RESIZE_MASK (1 << VNC_FEATURE_RESIZE) @@ -467,6 +470,7 @@ enum VncFeatures { #define VNC_FEATURE_ZRLE_MASK (1 << VNC_FEATURE_ZRLE) #define VNC_FEATURE_ZYWRLE_MASK (1 << VNC_FEATURE_ZYWRLE) #define VNC_FEATURE_LED_STATE_MASK (1 << VNC_FEATURE_LED_STATE) +#define VNC_FEATURE_XVP_MASK (1 << VNC_FEATURE_XVP) =20 =20 /* Client -> Server message IDs */ @@ -519,6 +523,15 @@ enum VncFeatures { #define VNC_MSG_SERVER_QEMU_AUDIO_BEGIN 1 #define VNC_MSG_SERVER_QEMU_AUDIO_DATA 2 =20 +/* XVP server -> client status code */ +#define VNC_XVP_CODE_FAIL 0 +#define VNC_XVP_CODE_INIT 1 + +/* XVP client -> server action request */ +#define VNC_XVP_ACTION_SHUTDOWN 2 +#define VNC_XVP_ACTION_REBOOT 3 +#define VNC_XVP_ACTION_RESET 4 + =20 /*************************************************************************= **** * diff --git a/ui/vnc.c b/ui/vnc.c index 69e92b1ef361..a0bf750767a2 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -30,6 +30,7 @@ #include "trace.h" #include "hw/qdev-core.h" #include "sysemu/sysemu.h" +#include "sysemu/runstate.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/module.h" @@ -2042,6 +2043,17 @@ static void send_ext_audio_ack(VncState *vs) vnc_flush(vs); } =20 +static void send_xvp_message(VncState *vs, int code) +{ + vnc_lock_output(vs); + vnc_write_u8(vs, VNC_MSG_SERVER_XVP); + vnc_write_u8(vs, 0); /* pad */ + vnc_write_u8(vs, 1); /* version */ + vnc_write_u8(vs, code); + vnc_unlock_output(vs); + vnc_flush(vs); +} + static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encod= ings) { int i; @@ -2121,6 +2133,12 @@ static void set_encodings(VncState *vs, int32_t *enc= odings, size_t n_encodings) case VNC_ENCODING_LED_STATE: vs->features |=3D VNC_FEATURE_LED_STATE_MASK; break; + case VNC_ENCODING_XVP: + if (vs->vd->power_control) { + vs->features |=3D VNC_FEATURE_XVP; + send_xvp_message(vs, VNC_XVP_CODE_INIT); + } + break; case VNC_ENCODING_COMPRESSLEVEL0 ... VNC_ENCODING_COMPRESSLEVEL0 += 9: vs->tight->compression =3D (enc & 0x0F); break; @@ -2353,6 +2371,42 @@ static int protocol_client_msg(VncState *vs, uint8_t= *data, size_t len) =20 client_cut_text(vs, read_u32(data, 4), data + 8); break; + case VNC_MSG_CLIENT_XVP: + if (!(vs->features & VNC_FEATURE_XVP)) { + error_report("vnc: xvp client message while disabled"); + vnc_client_error(vs); + break; + } + if (len =3D=3D 1) { + return 4; + } + if (len =3D=3D 4) { + uint8_t version =3D read_u8(data, 2); + uint8_t action =3D read_u8(data, 3); + + if (version !=3D 1) { + error_report("vnc: xvp client message version %d !=3D 1", + version); + vnc_client_error(vs); + break; + } + + switch (action) { + case VNC_XVP_ACTION_SHUTDOWN: + qemu_system_powerdown_request(); + break; + case VNC_XVP_ACTION_REBOOT: + send_xvp_message(vs, VNC_XVP_CODE_FAIL); + break; + case VNC_XVP_ACTION_RESET: + qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_R= ESET); + break; + default: + send_xvp_message(vs, VNC_XVP_CODE_FAIL); + break; + } + } + break; case VNC_MSG_CLIENT_QEMU: if (len =3D=3D 1) return 2; @@ -3379,6 +3433,9 @@ static QemuOptsList qemu_vnc_opts =3D { },{ .name =3D "audiodev", .type =3D QEMU_OPT_STRING, + },{ + .name =3D "power-control", + .type =3D QEMU_OPT_BOOL, }, { /* end of list */ } }, @@ -3942,6 +3999,8 @@ void vnc_display_open(const char *id, Error **errp) vd->non_adaptive =3D true; } =20 + vd->power_control =3D qemu_opt_get_bool(opts, "power-control", false); + if (tlsauthz) { vd->tlsauthzid =3D g_strdup(tlsauthz); } else if (acl) { diff --git a/qemu-options.hx b/qemu-options.hx index 1698a0c751ff..05fe35ceb6f8 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2222,6 +2222,10 @@ SRST transmission. When not using an -audiodev argument, this option must be omitted, otherwise is must be present and specify a valid audiodev. + + ``power-control`` + Permit the remote client to issue shutdown, reboot or reset power + control requests. ERST =20 ARCHHEADING(, QEMU_ARCH_I386) --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706798; cv=none; d=zohomail.com; s=zohoarc; b=OcAt8ZfpUaDtZlcva4tPYYxBxU6oGf2JaTmj2qkwX/qhuAC4QDZDqvAsRyRhmRgOJLSsT+cbROaRJwI0CsDg75xWAPN9cIPxblhiBV5Bd3HYXRFBdB8nqQUDQ5WvhzPHWrK8NIbAqs33FuqAuykfTWwHKKrH9fAsTqf/l3S6Fm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706798; 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=sXHFHe3ZOf2uFOeXicxl4X0/MrBIcV5ZDMSm8c77dn8=; b=jTg6ZtZ00cDiWqGt6mmXtuG1IsmJ8udk2aSH4+PmZq/GVDtVxqx8Zv9n5rcEDgzT0o7dwrzQh1ku8AGcR1echhiGxvOfdK2L827JAZfhR3YtzBw14FPWJunjfIkTr3TxXoo0tLxxzLw+sp6jJ5w0my6o5Dn3Enqwb7aiHAdN1oc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706798735506.56162111155766; Fri, 15 Jan 2021 02:33:18 -0800 (PST) Received: from localhost ([::1]:55944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0MPt-0004tL-86 for importer@patchew.org; Fri, 15 Jan 2021 05:33:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHX-00032A-Om for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHW-0007v1-2r for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:39 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-2NOHv903NUOm-AmwabsDvg-1; Fri, 15 Jan 2021 05:24:35 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ECEA2806665; Fri, 15 Jan 2021 10:24:33 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B43AB6F80A; Fri, 15 Jan 2021 10:24:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D50A9180063E; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sXHFHe3ZOf2uFOeXicxl4X0/MrBIcV5ZDMSm8c77dn8=; b=cOrsdc7Tv8u5ZdLAMczcbEJ7hGLv2clKwDiYEJMU81IJ3ZoYhzm192EhNaQx08lknnoVbi CIQfZGbe3dnSU/1VnrjT0H67W7wRWeVIWI21REqUhGUO6RgfmfnT+HCQDTCkkROr/Y4E8N rReec6I5eSV84nBvMX+TMWq2b5ExntA= X-MC-Unique: 2NOHv903NUOm-AmwabsDvg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 08/11] vnc: Fix a memleak in vnc_display_connect() Date: Fri, 15 Jan 2021 11:24:21 +0100 Message-Id: <20210115102424.1360437-9-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Chen , Laurent Vivier , Li Qiang , Gerd Hoffmann , Euler Robot Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Alex Chen Free the 'sioc' when the qio_channel_socket_connect_sync() fails. Reported-by: Euler Robot Signed-off-by: Alex Chen Reviewed-by: Li Qiang Reviewed-by: Laurent Vivier Message-Id: <20201126065702.35095-1-alex.chen@huawei.com> Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/vnc.c b/ui/vnc.c index a0bf750767a2..d4854d351bac 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3805,6 +3805,7 @@ static int vnc_display_connect(VncDisplay *vd, sioc =3D qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), "vnc-reverse"); if (qio_channel_socket_connect_sync(sioc, saddr[0], errp) < 0) { + object_unref(OBJECT(sioc)); return -1; } vnc_connect(vd, sioc, false, false); --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706803; cv=none; d=zohomail.com; s=zohoarc; b=Clp9vfDXD57IdTOUWNTO1/cToKPfuzjA954RMWp3fSanWjU8EV/QvdcvmzR1vCf0BTDx+sYn5fzUpJIWFLnUhVg9i9NC3jKcNMqFeEXvZWhQ3pWGAgWqWGVPlFb12CxpnLjDkt2OhFbNkKbktrbg4PAchkDluiXEGNM+Oi/Q+B4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706803; 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=iFehVGefFU0nz09U9T1DXqix/akxYDtGmT4nMAfVuVg=; b=B7YbvQGIWZQXJtBBxjbwBvQENGZ7jn+OlS+j6R1qSITeWg6CzlzX9N5TDkAzhDOOQPweh/WVGikZ9+QCSsRjygAtMl1fN9/xQKToVwqZaBR37WyFI1Gl66PWnFBkwBYejMIYW7pi94TdV6lxU+FyOsklnbvVP3jktYX9fygldvc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706803872133.0110051224617; Fri, 15 Jan 2021 02:33:23 -0800 (PST) Received: from localhost ([::1]:56038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0MPy-0004vh-LH for importer@patchew.org; Fri, 15 Jan 2021 05:33:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHa-0003A4-8k for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36512) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHY-0007w9-MF for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:42 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-72-i09v4G3RMTybzFfGjff6mQ-1; Fri, 15 Jan 2021 05:24:37 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E6CC180A092 for ; Fri, 15 Jan 2021 10:24:37 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFFEC5C1A3; Fri, 15 Jan 2021 10:24:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DF6F4180063F; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iFehVGefFU0nz09U9T1DXqix/akxYDtGmT4nMAfVuVg=; b=Kh7tcumhZIR/BlyI8VdrDMpv9TMZgtMg7sNvZcM6x8ZRbre6O1jynpVv/ay1xx7GLeqyZy d42MekxPa8Gh1n3AtB7EQJbaRXrpSOElHan25P2gfVGt1ASQta9rQvMomh2RmLDoPgCpNH Ae43VHmlUAnWr6d73kHZIAkUlsGKql4= X-MC-Unique: i09v4G3RMTybzFfGjff6mQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 09/11] vnc: move check into vnc_cursor_define Date: Fri, 15 Jan 2021 11:24:22 +0100 Message-Id: <20210115102424.1360437-10-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Move the check whenever a cursor exists into the vnc_cursor_define() function so callers don't have to do it. Suggested-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20210112134120.2031837-2-kraxel@redhat.com --- ui/vnc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index d4854d351bac..0f01481cac57 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -793,9 +793,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, QTAILQ_FOREACH(vs, &vd->clients, next) { vnc_colordepth(vs); vnc_desktop_resize(vs); - if (vs->vd->cursor) { - vnc_cursor_define(vs); - } + vnc_cursor_define(vs); memset(vs->dirty, 0x00, sizeof(vs->dirty)); vnc_set_area_dirty(vs->dirty, vd, 0, 0, vnc_width(vd), @@ -929,6 +927,10 @@ static int vnc_cursor_define(VncState *vs) QEMUCursor *c =3D vs->vd->cursor; int isize; =20 + if (!vs->vd->cursor) { + return -1; + } + if (vnc_has_feature(vs, VNC_FEATURE_ALPHA_CURSOR)) { vnc_lock_output(vs); vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); @@ -2155,9 +2157,7 @@ static void set_encodings(VncState *vs, int32_t *enco= dings, size_t n_encodings) vnc_desktop_resize(vs); check_pointer_type_change(&vs->mouse_mode_notifier, NULL); vnc_led_state_change(vs); - if (vs->vd->cursor) { - vnc_cursor_define(vs); - } + vnc_cursor_define(vs); } =20 static void set_pixel_conversion(VncState *vs) --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706394; cv=none; d=zohomail.com; s=zohoarc; b=i0AycqzZ5LfFCDtpvixS6Cba7ttwMm/5ZiCV87ppiIEn1q0AmVlQH89TgzfHvFBNcwFO/1kTg7vaSO0dJ8lMkE8xQd1nNIajTrEdeJtuKzG669eNNmejUHKSsfb/9Bm1TrCQtVF2ebKVcCh8wMSgqgxzYCvNT+u3Qyl+s7sEbtE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706394; 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=BBCT3LB6DyJYH8ndCFyzahlXCB0IUum4nKYjrdpVNfE=; b=EX/zpHfzxOV6JoJ7iaCcNt+CDwdSPTtnBeQzAdNsgTG2967a6VrpPxBcvUXl4JW0ls7ArJ92NjXL5C4YcGUn2To6QENrheHmw1fB+Dka0bLGnZG/VAuYkDLhVsyEDPK+iBSIW2XteMbi6tdllLbmHSTOr185qUW8kFPHBfEAzEM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706394612439.11806590999197; Fri, 15 Jan 2021 02:26:34 -0800 (PST) Received: from localhost ([::1]:36206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0MJN-0004ip-Gf for importer@patchew.org; Fri, 15 Jan 2021 05:26:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHV-0002ws-Kv for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:26551) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHS-0007sS-51 for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:37 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-y3MxJq-oNAO9wUrrLseQ_Q-1; Fri, 15 Jan 2021 05:24:31 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AD7C806668 for ; Fri, 15 Jan 2021 10:24:31 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C26C719C45; Fri, 15 Jan 2021 10:24:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E9DB41800D40; Fri, 15 Jan 2021 11:24:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BBCT3LB6DyJYH8ndCFyzahlXCB0IUum4nKYjrdpVNfE=; b=Hpr2ZoXsIaamDBN16kMD0PB4yEkePzWkptGqsHve3FV+12FC7xk9jAD8kNVwDc8hxn1rkO irhsZheYYPhr11GJELkRiXy+jj+dQmo7xz4jozciqLfiZOzNs4T5IXwwrO7NUDDhRcKbbA anBZg/fkGDjz8dx7VNG+tZR3F1YnqcU= X-MC-Unique: y3MxJq-oNAO9wUrrLseQ_Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 10/11] vnc: move initialization to framebuffer_update_request Date: Fri, 15 Jan 2021 11:24:23 +0100 Message-Id: <20210115102424.1360437-11-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) qemu sends various state info like current cursor shape to newly connected clients in response to a set_encoding message. This is not correct accordi= ng to the rfb spec. Send that information in response to a full (incremental= =3D0) framebuffer update request instead. Also send the resize information unconditionally, not only in case of an actual server-side change. This makes the qemu vnc server conform to the spec and allows clients to request the complete vnc server state without reconnect. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20210112134120.2031837-3-kraxel@redhat.com --- ui/vnc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 0f01481cac57..b4e98cf647f5 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -661,10 +661,6 @@ static void vnc_desktop_resize(VncState *vs) if (vs->ioc =3D=3D NULL || !vnc_has_feature(vs, VNC_FEATURE_RESIZE)) { return; } - if (vs->client_width =3D=3D pixman_image_get_width(vs->vd->server) && - vs->client_height =3D=3D pixman_image_get_height(vs->vd->server)) { - return; - } =20 assert(pixman_image_get_width(vs->vd->server) < 65536 && pixman_image_get_width(vs->vd->server) >=3D 0); @@ -2014,6 +2010,10 @@ static void framebuffer_update_request(VncState *vs,= int incremental, } else { vs->update =3D VNC_STATE_UPDATE_FORCE; vnc_set_area_dirty(vs->dirty, vs->vd, x, y, w, h); + vnc_colordepth(vs); + vnc_desktop_resize(vs); + vnc_led_state_change(vs); + vnc_cursor_define(vs); } } =20 @@ -2154,10 +2154,7 @@ static void set_encodings(VncState *vs, int32_t *enc= odings, size_t n_encodings) break; } } - vnc_desktop_resize(vs); check_pointer_type_change(&vs->mouse_mode_notifier, NULL); - vnc_led_state_change(vs); - vnc_cursor_define(vs); } =20 static void set_pixel_conversion(VncState *vs) --=20 2.29.2 From nobody Fri May 10 02:23:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610706504; cv=none; d=zohomail.com; s=zohoarc; b=jdhGlQ7jpYhkx/TornZGzNSqok4HMrD0aO54Z8jPh9eocUtsPZ401nse+n5X++B/fWa49m8GKCsQ2NfIcvGs1im8uOCBM8l2bI1gDNUr2fvWmfrPEw2LOh3om2g//K2LX7W8ApU1HVcCWsBE2rT3SOY4LxCytWbeUzLva91Lnt4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610706504; 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=e4S//0RAq1sheEAwGBfdtDxCxLG2WR48+gZADyuhQT8=; b=RSeYuUb0SDU6T5hBu5ncpflw9wgmO0HCvp5Kbhw8OG5V9GSadywORPJGgVEXqqQEdmRvwg43LU0qmLRVPWZUbrEnq2W7HGakO4YwNmWyNg3nECCvlwIGAoQoCvtzm8gHwDKUZS+Ls9a+qjdDLGfJwWfkFo6fglFUMM5USPIykHI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610706504007258.5140431060038; Fri, 15 Jan 2021 02:28:24 -0800 (PST) Received: from localhost ([::1]:44066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0ML8-0008AB-8n for importer@patchew.org; Fri, 15 Jan 2021 05:28:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0MHZ-000378-E1 for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45089) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l0MHW-0007v0-2k for qemu-devel@nongnu.org; Fri, 15 Jan 2021 05:24:41 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-g9vRB7juPciezaU19aVXyw-1; Fri, 15 Jan 2021 05:24:35 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E75215726 for ; Fri, 15 Jan 2021 10:24:34 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-182.ams2.redhat.com [10.36.112.182]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C61C56F922; Fri, 15 Jan 2021 10:24:30 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0256C1800D45; Fri, 15 Jan 2021 11:24:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610706277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e4S//0RAq1sheEAwGBfdtDxCxLG2WR48+gZADyuhQT8=; b=CWr3hKhqnxtCZ5scBT3WximhFqiwOtZ4f3dBByodnmHaLqgePUpBnmkVe0OacueVbOGLli J4bjyktd4J0o9l9UFPy5DEmHOaViEsiUPq0bGv5McrtOeon1KV9YBO0hyvq/X3LsG6efW1 tu3wIxBk+0tNcxi7Xcw7BA/EFGNVm2U= X-MC-Unique: g9vRB7juPciezaU19aVXyw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 11/11] vnc: add support for extended desktop resize Date: Fri, 15 Jan 2021 11:24:24 +0100 Message-Id: <20210115102424.1360437-12-kraxel@redhat.com> In-Reply-To: <20210115102424.1360437-1-kraxel@redhat.com> References: <20210115102424.1360437-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.248, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The extended desktop resize encoding adds support for (a) clients sending resize requests to the server, and (b) multihead support. This patch implements (a). All resize requests are rejected by qemu. Qemu can't resize the framebuffer on its own, this is in the hands of the guest, so all qemu can do is forward the request to the guest. Should the guest actually resize the framebuffer we can notify the vnc client later with a separate message. This requires support in the display device. Works with virtio-gpu. https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#extendeddeskt= opsize-pseudo-encoding Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20210112134120.2031837-4-kraxel@redhat.com --- ui/vnc.h | 2 ++ ui/vnc.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/ui/vnc.h b/ui/vnc.h index 5feeef9df08c..116463d5f099 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -444,6 +444,7 @@ enum { =20 enum VncFeatures { VNC_FEATURE_RESIZE, + VNC_FEATURE_RESIZE_EXT, VNC_FEATURE_HEXTILE, VNC_FEATURE_POINTER_TYPE_CHANGE, VNC_FEATURE_WMVI, @@ -459,6 +460,7 @@ enum VncFeatures { }; =20 #define VNC_FEATURE_RESIZE_MASK (1 << VNC_FEATURE_RESIZE) +#define VNC_FEATURE_RESIZE_EXT_MASK (1 << VNC_FEATURE_RESIZE_EXT) #define VNC_FEATURE_HEXTILE_MASK (1 << VNC_FEATURE_HEXTILE) #define VNC_FEATURE_POINTER_TYPE_CHANGE_MASK (1 << VNC_FEATURE_POINTER_TYP= E_CHANGE) #define VNC_FEATURE_WMVI_MASK (1 << VNC_FEATURE_WMVI) diff --git a/ui/vnc.c b/ui/vnc.c index b4e98cf647f5..d429bfee5a65 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -655,10 +655,35 @@ void vnc_framebuffer_update(VncState *vs, int x, int = y, int w, int h, vnc_write_s32(vs, encoding); } =20 +static void vnc_desktop_resize_ext(VncState *vs, int reject_reason) +{ + vnc_lock_output(vs); + vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); + vnc_write_u8(vs, 0); + vnc_write_u16(vs, 1); /* number of rects */ + vnc_framebuffer_update(vs, + reject_reason ? 1 : 0, + reject_reason, + vs->client_width, vs->client_height, + VNC_ENCODING_DESKTOP_RESIZE_EXT); + vnc_write_u8(vs, 1); /* number of screens */ + vnc_write_u8(vs, 0); /* padding */ + vnc_write_u8(vs, 0); /* padding */ + vnc_write_u8(vs, 0); /* padding */ + vnc_write_u32(vs, 0); /* screen id */ + vnc_write_u16(vs, 0); /* screen x-pos */ + vnc_write_u16(vs, 0); /* screen y-pos */ + vnc_write_u16(vs, vs->client_width); + vnc_write_u16(vs, vs->client_height); + vnc_write_u32(vs, 0); /* screen flags */ + vnc_unlock_output(vs); + vnc_flush(vs); +} =20 static void vnc_desktop_resize(VncState *vs) { - if (vs->ioc =3D=3D NULL || !vnc_has_feature(vs, VNC_FEATURE_RESIZE)) { + if (vs->ioc =3D=3D NULL || (!vnc_has_feature(vs, VNC_FEATURE_RESIZE) && + !vnc_has_feature(vs, VNC_FEATURE_RESIZE_EXT)))= { return; } =20 @@ -668,6 +693,12 @@ static void vnc_desktop_resize(VncState *vs) pixman_image_get_height(vs->vd->server) >=3D 0); vs->client_width =3D pixman_image_get_width(vs->vd->server); vs->client_height =3D pixman_image_get_height(vs->vd->server); + + if (vnc_has_feature(vs, VNC_FEATURE_RESIZE_EXT)) { + vnc_desktop_resize_ext(vs, 0); + return; + } + vnc_lock_output(vs); vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); vnc_write_u8(vs, 0); @@ -2114,6 +2145,9 @@ static void set_encodings(VncState *vs, int32_t *enco= dings, size_t n_encodings) case VNC_ENCODING_DESKTOPRESIZE: vs->features |=3D VNC_FEATURE_RESIZE_MASK; break; + case VNC_ENCODING_DESKTOP_RESIZE_EXT: + vs->features |=3D VNC_FEATURE_RESIZE_EXT_MASK; + break; case VNC_ENCODING_POINTER_TYPE_CHANGE: vs->features |=3D VNC_FEATURE_POINTER_TYPE_CHANGE_MASK; break; @@ -2474,6 +2508,34 @@ static int protocol_client_msg(VncState *vs, uint8_t= *data, size_t len) break; } break; + case VNC_MSG_CLIENT_SET_DESKTOP_SIZE: + { + size_t size; + uint8_t screens; + + if (len < 8) { + return 8; + } + + screens =3D read_u8(data, 6); + size =3D 8 + screens * 16; + if (len < size) { + return size; + } + + if (dpy_ui_info_supported(vs->vd->dcl.con)) { + QemuUIInfo info; + memset(&info, 0, sizeof(info)); + info.width =3D read_u16(data, 2); + info.height =3D read_u16(data, 4); + dpy_set_ui_info(vs->vd->dcl.con, &info); + vnc_desktop_resize_ext(vs, 4 /* Request forwarded */); + } else { + vnc_desktop_resize_ext(vs, 3 /* Invalid screen layout */); + } + + break; + } default: VNC_DEBUG("Msg: %d\n", data[0]); vnc_client_error(vs); --=20 2.29.2