qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Slowdown SDL while minimized
Date: Tue, 11 Mar 2008 11:12:51 +0000	[thread overview]
Message-ID: <20080311111251.GA5831@implementation.uk.xensource.com> (raw)

When SDL is invisible/minimized, there is no need to keep calling the
VGA refresh 33 times per second.  This patch reduces in that case the
rate to 2 times per second, which should be responsive enough for the
un-minimizing event.

Index: console.h
===================================================================
RCS file: /sources/qemu/qemu/console.h,v
retrieving revision 1.2
diff -u -p -r1.2 console.h
--- console.h	10 Feb 2008 16:33:13 -0000	1.2
+++ console.h	11 Mar 2008 11:05:08 -0000
@@ -71,6 +71,7 @@
     int height;
     void *opaque;
     struct QEMUTimer *gui_timer;
+    uint64_t gui_timer_interval;
 
     void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
     void (*dpy_resize)(struct DisplayState *s, int w, int h);
Index: sdl.c
===================================================================
RCS file: /sources/qemu/qemu/sdl.c,v
retrieving revision 1.46
--- sdl.c	10 Mar 2008 19:34:27 -0000	1.46
+++ sdl.c	11 Mar 2008 11:05:08 -0000
@@ -506,6 +506,15 @@
                 !ev->active.gain && !gui_fullscreen_initial_grab) {
                 sdl_grab_end();
             }
+	    if (ev->active.state & SDL_APPACTIVE) {
+		if (ev->active.gain) {
+		    /* Back to default interval */
+		    ds->gui_timer_interval = 0;
+		} else {
+		    /* Sleeping interval */
+		    ds->gui_timer_interval = 500;
+		}
+	    }
             break;
         default:
             break;
Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.410
--- vl.c	10 Mar 2008 19:34:27 -0000	1.410
+++ vl.c	11 Mar 2008 11:05:09 -0000
@@ -7208,7 +7200,11 @@
 {
     DisplayState *ds = opaque;
     ds->dpy_refresh(ds);
-    qemu_mod_timer(ds->gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock));
+    qemu_mod_timer(ds->gui_timer,
+        (ds->gui_timer_interval ?
+	    ds->gui_timer_interval :
+	    GUI_REFRESH_INTERVAL)
+	+ qemu_get_clock(rt_clock));
 }
 
 struct vm_change_state_entry {

             reply	other threads:[~2008-03-11 11:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-11 11:12 Samuel Thibault [this message]
2008-03-11 11:21 ` [Qemu-devel] Re: [PATCH] Slowdown SDL while minimized Samuel Thibault
2008-03-11 23:56 ` [Qemu-devel] " Anders
2008-03-12  0:49   ` Samuel Thibault

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=20080311111251.GA5831@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.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).