All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Slowdown SDL while minimized
@ 2008-03-11 11:12 Samuel Thibault
  2008-03-11 11:21 ` [Qemu-devel] " Samuel Thibault
  2008-03-11 23:56 ` [Qemu-devel] " Anders
  0 siblings, 2 replies; 4+ messages in thread
From: Samuel Thibault @ 2008-03-11 11:12 UTC (permalink / raw
  To: qemu-devel

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 {

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

* [Qemu-devel] Re: [PATCH] Slowdown SDL while minimized
  2008-03-11 11:12 [Qemu-devel] [PATCH] Slowdown SDL while minimized Samuel Thibault
@ 2008-03-11 11:21 ` Samuel Thibault
  2008-03-11 23:56 ` [Qemu-devel] " Anders
  1 sibling, 0 replies; 4+ messages in thread
From: Samuel Thibault @ 2008-03-11 11:21 UTC (permalink / raw
  To: qemu-devel

BTW, it would be good for power consumption to provide a virtual HPET
to the guest, and reprogram the host timer as appropriate.  10ms sleeps
kill kitten ;)

Samuel

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

* Re: [Qemu-devel] [PATCH] Slowdown SDL while minimized
  2008-03-11 11:12 [Qemu-devel] [PATCH] Slowdown SDL while minimized Samuel Thibault
  2008-03-11 11:21 ` [Qemu-devel] " Samuel Thibault
@ 2008-03-11 23:56 ` Anders
  2008-03-12  0:49   ` Samuel Thibault
  1 sibling, 1 reply; 4+ messages in thread
From: Anders @ 2008-03-11 23:56 UTC (permalink / raw
  To: qemu-devel

Samuel Thibault wrote:
> 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.
>   

Is there any need to update at all, if the canvas is not visible? How 
about some infrastructure for pausing the update completely? I think 
that could also be used for VNC displays, when no client is connected.

Anders.

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

* Re: [Qemu-devel] [PATCH] Slowdown SDL while minimized
  2008-03-11 23:56 ` [Qemu-devel] " Anders
@ 2008-03-12  0:49   ` Samuel Thibault
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Thibault @ 2008-03-12  0:49 UTC (permalink / raw
  To: qemu-devel

Anders, le Wed 12 Mar 2008 00:56:42 +0100, a écrit :
> Samuel Thibault wrote:
> >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.
> >  
> 
> Is there any need to update at all, if the canvas is not visible?

Indeed not. We however still need to have a look at the SDL queue, to
detect the un-minimize event.

> How about some infrastructure for pausing the update completely? I
> think that could also be used for VNC displays, when no client is
> connected.

Actually in Xen it goes even further: when the client hasn't sent an
update request since a long time, the VNC server assumes the client is
minimized, and in pratice that is the case.

Samuel

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

end of thread, other threads:[~2008-03-12  0:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-11 11:12 [Qemu-devel] [PATCH] Slowdown SDL while minimized Samuel Thibault
2008-03-11 11:21 ` [Qemu-devel] " Samuel Thibault
2008-03-11 23:56 ` [Qemu-devel] " Anders
2008-03-12  0:49   ` Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.