From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] Fix and simplify gui timer logic.
Date: Fri, 4 Jun 2010 15:44:34 +0200 [thread overview]
Message-ID: <1275659074-4516-1-git-send-email-kraxel@redhat.com> (raw)
Kill nographic timer. Have a global gui_timer instead. Have the gui
timer enabled unconditionally. We need a timer running anyway for mmio
flush, so the whole have-gui-timer-only-when-needed logic is pretty
pointless. It also simplifies displaylisteners coming and going at
runtime, we don't need to care about the timer then as it runs anyway.
Don't allocate the timer twice in case we have two display listeners.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
console.h | 1 -
vl.c | 37 +++++++++++--------------------------
2 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/console.h b/console.h
index 264a396..cdf8dee 100644
--- a/console.h
+++ b/console.h
@@ -173,7 +173,6 @@ struct DisplayAllocator {
struct DisplayState {
struct DisplaySurface *surface;
void *opaque;
- struct QEMUTimer *gui_timer;
struct DisplayAllocator* allocator;
QLIST_HEAD(, DisplayChangeListener) listeners;
diff --git a/vl.c b/vl.c
index f66f420..670705c 100644
--- a/vl.c
+++ b/vl.c
@@ -236,7 +236,7 @@ int nb_numa_nodes;
uint64_t node_mem[MAX_NODES];
uint64_t node_cpumask[MAX_NODES];
-static QEMUTimer *nographic_timer;
+static QEMUTimer *gui_timer;
uint8_t qemu_uuid[16];
@@ -1633,22 +1633,17 @@ static void gui_update(void *opaque)
DisplayChangeListener *dcl;
qemu_flush_coalesced_mmio_buffer();
- dpy_refresh(ds);
- QLIST_FOREACH(dcl, &ds->listeners, next) {
- if (dcl->gui_timer_interval &&
- dcl->gui_timer_interval < interval)
- interval = dcl->gui_timer_interval;
+ if (ds != NULL && !QLIST_EMPTY(&ds->listeners)) {
+ dpy_refresh(ds);
+ QLIST_FOREACH(dcl, &ds->listeners, next) {
+ if (dcl->gui_timer_interval &&
+ dcl->gui_timer_interval < interval)
+ interval = dcl->gui_timer_interval;
+ }
}
- qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock(rt_clock));
-}
-
-static void nographic_update(void *opaque)
-{
- uint64_t interval = GUI_REFRESH_INTERVAL;
- qemu_flush_coalesced_mmio_buffer();
- qemu_mod_timer(nographic_timer, interval + qemu_get_clock(rt_clock));
+ qemu_mod_timer(gui_timer, interval + qemu_get_clock(rt_clock));
}
struct vm_change_state_entry {
@@ -2577,7 +2572,6 @@ int main(int argc, char **argv, char **envp)
const char *kernel_filename, *kernel_cmdline;
char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */
DisplayState *ds;
- DisplayChangeListener *dcl;
int cyls, heads, secs, translation;
QemuOpts *hda_opts = NULL, *opts;
int optind;
@@ -3817,17 +3811,8 @@ int main(int argc, char **argv, char **envp)
}
dpy_resize(ds);
- QLIST_FOREACH(dcl, &ds->listeners, next) {
- if (dcl->dpy_refresh != NULL) {
- ds->gui_timer = qemu_new_timer(rt_clock, gui_update, ds);
- qemu_mod_timer(ds->gui_timer, qemu_get_clock(rt_clock));
- }
- }
-
- if (display_type == DT_NOGRAPHIC || display_type == DT_VNC) {
- nographic_timer = qemu_new_timer(rt_clock, nographic_update, NULL);
- qemu_mod_timer(nographic_timer, qemu_get_clock(rt_clock));
- }
+ gui_timer = qemu_new_timer(rt_clock, gui_update, ds);
+ qemu_mod_timer(gui_timer, qemu_get_clock(rt_clock));
text_consoles_set_display(ds);
--
1.6.6.1
next reply other threads:[~2010-06-04 13:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-04 13:44 Gerd Hoffmann [this message]
2010-06-04 13:55 ` [Qemu-devel] Re: [PATCH] Fix and simplify gui timer logic Gerd Hoffmann
2010-06-07 16:12 ` [Qemu-devel] " Paul Brook
2010-06-08 9:26 ` Gerd Hoffmann
2010-06-08 11:50 ` Paul Brook
2010-06-08 13:18 ` Gerd Hoffmann
2010-06-14 17:06 ` Anthony Liguori
2010-06-14 22:52 ` Paul Brook
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=1275659074-4516-1-git-send-email-kraxel@redhat.com \
--to=kraxel@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).