From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Volker Rümelin" <vr_qemu@t-online.de>,
"Gerd Hoffmann" <kraxel@redhat.com>
Cc: QEMU <qemu-devel@nongnu.org>, Nikola Pavlica <pavlica.nikola@gmail.com>
Subject: Re: [PATCH 1/3] ui/gtk: don't try to redefine SI prefixes
Date: Thu, 14 Jan 2021 12:11:52 +0100 [thread overview]
Message-ID: <a5f9e021-ef72-6d1c-18c1-f21d449b7b3c@redhat.com> (raw)
In-Reply-To: <20201213165724.13418-1-vr_qemu@t-online.de>
On 12/13/20 5:57 PM, Volker Rümelin wrote:
> 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ümelin <vr_qemu@t-online.de>
> ---
> 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 eaeb450f91..80851fb4c7 100644
> --- a/include/ui/gtk.h
> +++ b/include/ui/gtk.h
> @@ -24,8 +24,6 @@
> #include "ui/egl-context.h"
> #endif
>
> -#define MILLISEC_PER_SEC 1000000
Indeed this is MICROSEC_PER_SEC.
> -
> typedef struct GtkDisplayState GtkDisplayState;
>
> typedef struct VirtualGfxConsole {
> diff --git a/ui/gtk.c b/ui/gtk.c
> index a752aa22be..86b386a20d 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 = gd_refresh_rate_millihz(vc->window ?
> vc->window : s->window);
> if (refresh_rate_millihz) {
> - vc->gfx.dcl.update_interval = MILLISEC_PER_SEC / refresh_rate_millihz;
> + /* T = 1 / f = 1 [s*Hz] / f = 1000*1000 [ms*mHz] / f */
> + vc->gfx.dcl.update_interval = 1000 * 1000 / refresh_rate_millihz;
> }
>
> fbw = surface_width(vc->gfx.ds);
>
next prev parent reply other threads:[~2021-01-14 11:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-13 16:56 [PATCH 0/3] ui/gtk: paper over a gtk bug on Windows Volker Rümelin
2020-12-13 16:57 ` [PATCH 1/3] ui/gtk: don't try to redefine SI prefixes Volker Rümelin
2021-01-14 11:11 ` Philippe Mathieu-Daudé [this message]
2020-12-13 16:57 ` [PATCH 2/3] ui/gtk: rename variable window to widget Volker Rümelin
2020-12-13 16:57 ` [PATCH 3/3] ui/gtk: limit virtual console max update interval Volker Rümelin
2021-01-14 9:38 ` [PATCH 0/3] ui/gtk: paper over a gtk bug on Windows Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a5f9e021-ef72-6d1c-18c1-f21d449b7b3c@redhat.com \
--to=philmd@redhat.com \
--cc=kraxel@redhat.com \
--cc=pavlica.nikola@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=vr_qemu@t-online.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).