qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] gtk: sync guest display updates to host display refresh
@ 2018-11-13  9:02 Gerd Hoffmann
  2018-11-14  3:10 ` Chen Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2018-11-13  9:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, tgfbeta

Reduce console refresh timer to idle refresh rate.  Register a frame
tick callback (called by gtk on each display frame) and use that to kick
display updates instead.

That should sync qemu refresh rate to display refresh rate.  It'll also
stop updating the qemu display in case the qemu is not visible (gtk
stops calling the frame tick callback then).

Buglink: https://bugs.launchpad.net/bugs/1802915
Suggested-by: Chen Zhang <tgfbeta@me.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 579990b865..8f79dfe42c 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1661,6 +1661,16 @@ static gboolean gd_configure(GtkWidget *widget,
     return FALSE;
 }
 
+static gboolean gd_frame_tick(GtkWidget *widget,
+                              GdkFrameClock *frame_clock,
+                              gpointer opaque)
+{
+    VirtualConsole *vc = opaque;
+
+    vc->gfx.dcl.ops->dpy_refresh(&vc->gfx.dcl);
+    return G_SOURCE_CONTINUE;
+}
+
 /** Virtual Console Callbacks **/
 
 static GSList *gd_vc_menu_init(GtkDisplayState *s, VirtualConsole *vc,
@@ -1911,6 +1921,12 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc)
                          G_CALLBACK(gd_focus_out_event), vc);
         g_signal_connect(vc->gfx.drawing_area, "configure-event",
                          G_CALLBACK(gd_configure), vc);
+        if (1 /* make that a config option ??? */) {
+            update_displaychangelistener(&vc->gfx.dcl,
+                                         GUI_REFRESH_INTERVAL_IDLE);
+            gtk_widget_add_tick_callback(vc->gfx.drawing_area,
+                                         gd_frame_tick, vc, NULL);
+        }
     } else {
         g_signal_connect(vc->gfx.drawing_area, "key-press-event",
                          G_CALLBACK(gd_text_key_down), vc);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-26  3:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-13  9:02 [Qemu-devel] [PATCH] gtk: sync guest display updates to host display refresh Gerd Hoffmann
2018-11-14  3:10 ` Chen Zhang
2018-11-14  9:40   ` Chen Zhang
2018-11-26  3:24     ` Chen Zhang

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).