From nobody Sat Apr 20 08:43:11 2024 Delivered-To: importer@patchew.org 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; 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=1578996201; cv=none; d=zohomail.com; s=zohoarc; b=Ku4Z4uWzZjQuA2qHsRciVjHXRbSr5DskWouzAwOuncHltp5RAcsONopt5mscXUvwBN+suKKgBmGac0IPdDvYftsFo+zjRGam3RnrX49zzUWNPCLWUQu5vuJiGOTEniPv5lsVmkUOjqhB+oRMmBsC12cJYUvRBDZzdDgb/BQj3mQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578996201; 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=kR2nVww05ym0vlHchhoZc7r2HWmOi45mH/ICojPZnUA=; b=DBekDGfHvdXQ46m3poPBItu8TNddYSEXgnlFd6puu6nUbxWppTEvTpiiB2V+B81tyhrCZ9CcPyl1XjjgUiNON3PQwtCBa8GzDq6qwmcDdy8ie2kkGs8x0Yv3S9mqn8yPnmRMiddR07zryseK7et6fxU+VrBIBiSdM0yH0seW4CQ= 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 1578996201843612.2578576887034; Tue, 14 Jan 2020 02:03:21 -0800 (PST) Received: from localhost ([::1]:35818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irJ2e-0003Km-2F for importer@patchew.org; Tue, 14 Jan 2020 05:03:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36448) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irJ0x-0001dT-RH for qemu-devel@nongnu.org; Tue, 14 Jan 2020 05:01:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irJ0w-0007xq-9V for qemu-devel@nongnu.org; Tue, 14 Jan 2020 05:01:35 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:22507 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1irJ0w-0007xc-5j for qemu-devel@nongnu.org; Tue, 14 Jan 2020 05:01: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-354-wfU8bavKNu-sfIUuM_NkRQ-1; Tue, 14 Jan 2020 05:01:29 -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 B4A82DBA5 for ; Tue, 14 Jan 2020 10:01:28 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-106.ams2.redhat.com [10.36.116.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC42C19C5B; Tue, 14 Jan 2020 10:01:25 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 275C1784F; Tue, 14 Jan 2020 11:01:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578996093; 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=kR2nVww05ym0vlHchhoZc7r2HWmOi45mH/ICojPZnUA=; b=KDy8QcMLvR4H3Cp/B5VwPJwGEkQy/UeNJeHQmYuHoq1tJ/SO+8ZFNOvCrl1Jgmae8zl5Y5 aSJoJYo7WAJjzwPgI0xadlJWzlbw4wA5+A/+F6Fv65ooqmDrlKIkFDusazG72YaomTIs3A WqqZmEuk2sCP7M0l39bnttdLKN9Kwy4= From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 1/2] ui: Print available display backends with '-display help' Date: Tue, 14 Jan 2020 11:01:24 +0100 Message-Id: <20200114100125.31604-2-kraxel@redhat.com> In-Reply-To: <20200114100125.31604-1-kraxel@redhat.com> References: <20200114100125.31604-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: wfU8bavKNu-sfIUuM_NkRQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Paolo Bonzini , Thomas Huth , Gerd Hoffmann 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: Thomas Huth We already print availabled devices with "-device help", or available backends with "-netdev help" or "-chardev help". Let's provide a way for the users to query the available display backends, too. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth Message-id: 20200108144702.29969-1-thuth@redhat.com Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 1 + ui/console.c | 15 +++++++++++++++ vl.c | 5 +++++ qemu-options.hx | 3 ++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/ui/console.h b/include/ui/console.h index 281f9c145b58..f35b4fc082b4 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -442,6 +442,7 @@ void qemu_display_register(QemuDisplay *ui); bool qemu_display_find_default(DisplayOptions *opts); void qemu_display_early_init(DisplayOptions *opts); void qemu_display_init(DisplayState *ds, DisplayOptions *opts); +void qemu_display_help(void); =20 /* vnc.c */ void vnc_display_init(const char *id, Error **errp); diff --git a/ui/console.c b/ui/console.c index ac79d679f576..69339b028bb2 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2333,6 +2333,21 @@ void qemu_display_init(DisplayState *ds, DisplayOpti= ons *opts) dpys[opts->type]->init(ds, opts); } =20 +void qemu_display_help(void) +{ + int idx; + + printf("Available display backend types:\n"); + for (idx =3D DISPLAY_TYPE_NONE; idx < DISPLAY_TYPE__MAX; idx++) { + if (!dpys[idx]) { + ui_module_load_one(DisplayType_str(idx)); + } + if (dpys[idx]) { + printf("%s\n", DisplayType_str(dpys[idx]->type)); + } + } +} + void qemu_chr_parse_vc(QemuOpts *opts, ChardevBackend *backend, Error **er= rp) { int val; diff --git a/vl.c b/vl.c index 158a05ed321c..751401214c80 100644 --- a/vl.c +++ b/vl.c @@ -1869,6 +1869,11 @@ static void parse_display(const char *p) { const char *opts; =20 + if (is_help_option(p)) { + qemu_display_help(); + exit(0); + } + if (strstart(p, "sdl", &opts)) { /* * sdl DisplayType needs hand-crafted parser instead of diff --git a/qemu-options.hx b/qemu-options.hx index d4b73ef60c1d..709162c159ad 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1669,7 +1669,8 @@ STEXI @item -display @var{type} @findex -display Select type of display to use. This option is a replacement for the -old style -sdl/-curses/... options. Valid values for @var{type} are +old style -sdl/-curses/... options. Use @code{-display help} to list +the available display types. Valid values for @var{type} are @table @option @item sdl Display video output via SDL (usually in a separate graphics --=20 2.18.1 From nobody Sat Apr 20 08:43:11 2024 Delivered-To: importer@patchew.org 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; 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=1578996422; cv=none; d=zohomail.com; s=zohoarc; b=cRVWpg9LLJkuQXQDDDLRHr9ak58+h4EckKnSWBY4QPnF2pLkMNZbfO5VUpVZxt8TNd3TiW9oGwqZXjpBdbWy1EJP3yO1KUcwZisMlnCnikh+xREmjWrCYVbKyXSWgpaeRxfkiyQZivWFS19sEOV92I2ofP0Ngc4gNN7N6Oan+rY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578996422; 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=H+wwx5gtqKMjzn51dAG5RDWTWqf4qRz3vTw65dq5YdA=; b=KdhMpK6gGw5RS0nzooNmmtkDhEg2FUn5VFEA+myPzQ7j66V3vRb3DPvEBjYlxKJLQ/dVuXSLOAP0Zg5HN5Io8Kpd9xisPgYZaU5rwtWawxTThJfg1+/TwpCC+/5JkJvBP4+UiVLD0k3Ju4Cv8z2FTERSW2ka5RSqEfKYRdee/FE= 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 1578996422174637.7675167311584; Tue, 14 Jan 2020 02:07:02 -0800 (PST) Received: from localhost ([::1]:35984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irJ6D-0007a2-53 for importer@patchew.org; Tue, 14 Jan 2020 05:07:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36432) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irJ0w-0001bh-1n for qemu-devel@nongnu.org; Tue, 14 Jan 2020 05:01:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irJ0u-0007xO-RP for qemu-devel@nongnu.org; Tue, 14 Jan 2020 05:01:33 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:37351 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1irJ0u-0007xB-NG for qemu-devel@nongnu.org; Tue, 14 Jan 2020 05:01:32 -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-315--aZ7qzk8O5WKVHZHxOXTeg-1; Tue, 14 Jan 2020 05:01:29 -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 99733801E7A; Tue, 14 Jan 2020 10:01:28 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-106.ams2.redhat.com [10.36.116.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF4D55C1B0; Tue, 14 Jan 2020 10:01:25 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 30F5031E8E; Tue, 14 Jan 2020 11:01:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578996092; 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=H+wwx5gtqKMjzn51dAG5RDWTWqf4qRz3vTw65dq5YdA=; b=Nn9OwrjDfBuFZTcwTToyW+nceFG0t2bD4PJniE+nL6ke77VZtimAD+qsG+ZJIBIBXyCffO KZG8PNJT6WrAYFh+V2xB1EJdVu0yK5R2LXnd5gYxmHy4emttj+moaY8JeUObYrKQebXA2C 6OAntEb5Ze6uox8M9hkCUAqHZR4EuVQ= From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 2/2] display/gtk: get proper refreshrate Date: Tue, 14 Jan 2020 11:01:25 +0100 Message-Id: <20200114100125.31604-3-kraxel@redhat.com> In-Reply-To: <20200114100125.31604-1-kraxel@redhat.com> References: <20200114100125.31604-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: -aZ7qzk8O5WKVHZHxOXTeg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: Paolo Bonzini , 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 Because some VMs in QEMU can get GPU virtualization (using technologies such as iGVT-g, as mentioned previously), they could produce a video output that had a higher display refresh rate than of what the GTK display was displaying. (fxp. Playing a video game inside of a Windows VM at 60 Hz, while the output stood locked at 33 Hz because of defaults set in include/ui/console.h) Since QEMU does indeed have internal systems for determining frame times as defined in ui/console.c. The code checks for a variable called update_interval that it later uses for time calculation. This variable, however, isn't defined anywhere in ui/gtk.c and instead ui/console.c just sets it to GUI_REFRESH_INTERVAL_DEFAULT which is 30 update_interval represents the number of milliseconds per display refresh, and by doing some math we get that 1000/30 =3D 33.33... Hz This creates the mentioned problem and what this patch does is that it checks for the display refresh rate reported by GTK itself (we can take this as a safe value) and just converts it back to a number of milliseconds per display refresh. Signed-off-by: Nikola Pavlica Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20200108121342.29597-1-pavlica.nikola@gmail.com [ kraxel: style tweak: add blank line between vars and code ] Signed-off-by: Gerd Hoffmann --- include/ui/gtk.h | 2 ++ ui/gtk.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index d9eedad976ef..d1b230848a7b 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -28,6 +28,8 @@ #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 692ccc7bbb90..7355d34fcffd 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1966,6 +1966,11 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vi= rtualConsole *vc, GSList *group, GtkWidget *view_menu) { bool zoom_to_fit =3D false; + int refresh_rate_millihz; + + GdkDisplay *dpy =3D gtk_widget_get_display(s->window); + GdkWindow *win =3D gtk_widget_get_window(s->window); + GdkMonitor *monitor =3D gdk_display_get_monitor_at_window(dpy, win); =20 vc->label =3D qemu_console_get_label(con); vc->s =3D s; @@ -2026,6 +2031,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, Vi= rtualConsole *vc, =20 vc->gfx.kbd =3D qkbd_state_init(con); vc->gfx.dcl.con =3D con; + + refresh_rate_millihz =3D gdk_monitor_get_refresh_rate(monitor); + if (refresh_rate_millihz) { + vc->gfx.dcl.update_interval =3D MILLISEC_PER_SEC / refresh_rate_mi= llihz; + } + register_displaychangelistener(&vc->gfx.dcl); =20 gd_connect_vc_gfx_signals(vc); --=20 2.18.1