qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nikola Pavlica <pavlica.nikola@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [PATCH v2 1/1] ui/gtk: Launching GTK UI with OpenGL on causes the
 refreshrate update to not run
Date: Sun, 06 Dec 2020 14:46:51 +0100	[thread overview]
Message-ID: <3M7XKQ.PR753U54CKM21@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]

As suggested before, I've instead copied the code to the appropriate 
callback function so that the refresh rate gets properly updated.

Also to avoid repeating the gd_refresh_rate_millihz function, I've 
globalized it. I hope you don't mind.

Signed-off-by: Nikola Pavlica (pavlica.nikola@gmail.com)
---
diff --git a/include/ui/gtk.h b/include/ui/gtk.h
index eaeb450f91..6025a4f030 100644
--- a/include/ui/gtk.h
+++ b/include/ui/gtk.h
@@ -88,6 +88,7 @@ extern bool gtk_use_gl_area;

 /* ui/gtk.c */
 void gd_update_windowsize(VirtualConsole *vc);
+int gd_refresh_rate_millihz(GtkWidget *window);

 /* ui/gtk-egl.c */
 void gd_egl_init(VirtualConsole *vc);
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 99231a3597..a9131783f0 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -112,6 +112,14 @@ void gd_egl_update(DisplayChangeListener *dcl,
 void gd_egl_refresh(DisplayChangeListener *dcl)
 {
     VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+    int refresh_rate_millihz;
+
+    refresh_rate_millihz = gd_refresh_rate_millihz(vc->window ? 
vc->window :
+                                                   
vc->gfx.drawing_area);
+    if (refresh_rate_millihz) {
+        vc->gfx.dcl.update_interval = MILLISEC_PER_SEC / 
refresh_rate_millihz;
+    }
+

     if (!vc->gfx.esurface) {
         gd_egl_init(vc);
diff --git a/ui/gtk.c b/ui/gtk.c
index a752aa22be..3b8755b746 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -752,7 +752,7 @@ 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)
+int gd_refresh_rate_millihz(GtkWidget *window)
 {
 #ifdef GDK_VERSION_3_22
     GdkWindow *win = gtk_widget_get_window(window);
-- 
2.21.1


[-- Attachment #2: Type: text/html, Size: 3131 bytes --]

             reply	other threads:[~2020-12-06 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06 13:46 Nikola Pavlica [this message]
2020-12-10 12:24 ` [PATCH v2 1/1] ui/gtk: Launching GTK UI with OpenGL on causes the? refreshrate update to not run 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=3M7XKQ.PR753U54CKM21@gmail.com \
    --to=pavlica.nikola@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).