From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 3/5] Fix and simplify gui timer logic.
Date: Tue, 15 Jun 2010 12:05:45 +0200 [thread overview]
Message-ID: <1276596347-9410-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1276596347-9410-1-git-send-email-kraxel@redhat.com>
Kill the nographic and gui timers. Add a single periodic_timer to
replace them. We have a timer running anyway, so so the gui/nographic
separation is pretty pointless, we can just drive everything we need
from the single periodic timer.
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 | 40 ++++++++++++----------------------------
2 files changed, 12 insertions(+), 29 deletions(-)
diff --git a/console.h b/console.h
index 3f77661..f866987 100644
--- a/console.h
+++ b/console.h
@@ -174,7 +174,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 34aa388..8fc63c7 100644
--- a/vl.c
+++ b/vl.c
@@ -227,7 +227,7 @@ int nb_numa_nodes;
uint64_t node_mem[MAX_NODES];
uint64_t node_cpumask[MAX_NODES];
-static QEMUTimer *nographic_timer;
+static QEMUTimer *periodic_timer;
uint8_t qemu_uuid[16];
@@ -1041,29 +1041,24 @@ static QEMUMachine *find_default_machine(void)
/***********************************************************/
/* main execution loop */
-static void gui_update(void *opaque)
+static void periodic_update(void *opaque)
{
uint64_t interval = GUI_REFRESH_INTERVAL;
DisplayState *ds = 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(periodic_timer, interval + qemu_get_clock(rt_clock));
}
struct vm_change_state_entry {
@@ -1807,7 +1802,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;
@@ -2924,18 +2918,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));
- break;
- }
- }
-
- 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));
- }
+ periodic_timer = qemu_new_timer(rt_clock, periodic_update, ds);
+ qemu_mod_timer(periodic_timer, qemu_get_clock(rt_clock));
text_consoles_set_display(ds);
--
1.6.5.2
next prev parent reply other threads:[~2010-06-15 10:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-15 10:05 [Qemu-devel] [PATCH 0/5] fbdev display driver + misc bits Gerd Hoffmann
2010-06-15 10:05 ` [Qemu-devel] [PATCH 1/5] QLIST-ify display change listeners Gerd Hoffmann
2010-06-15 10:05 ` [Qemu-devel] [PATCH 2/5] add unregister_displaychangelistener Gerd Hoffmann
2010-06-15 10:05 ` Gerd Hoffmann [this message]
2010-06-15 10:05 ` [Qemu-devel] [PATCH 4/5] add pflib: PixelFormat conversion library Gerd Hoffmann
2010-06-15 10:05 ` [Qemu-devel] [PATCH 5/5] linux fbdev display driver Gerd Hoffmann
2010-06-16 12:44 ` [Qemu-devel] " Stefano Stabellini
2010-06-16 16:22 ` Julian Pidancet
2010-06-17 10:43 ` Gerd Hoffmann
2010-06-17 14:29 ` Julian Pidancet
2010-06-17 16:25 ` Julian Pidancet
2010-06-18 7:32 ` Gerd Hoffmann
2010-06-18 12:00 ` Julian Pidancet
2010-06-24 18:38 ` [Qemu-devel] [PATCH 0/5] fbdev display driver + misc bits Julian Pidancet
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=1276596347-9410-4-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).