[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 02/11] add DisplayState->idle
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 02/11] add DisplayState->idle |
Date: |
Mon, 11 Aug 2008 14:32:41 +0200 |
From: Samuel Thibault <address@hidden>
From: Samuel Thibault <address@hidden>
Add idle field to DisplayState struct, so drivers can figure
the display is idle and take advantage of that.
The xen framebuffer driver will use this to communicate the
idle state to the guest, so it knows it can stop doing updates
to a virtual display which is invisible anyway.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
console.h | 1 +
sdl.c | 2 ++
vl.c | 2 ++
vnc.c | 3 +++
4 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/console.h b/console.h
index e852dd1..3afa0a1 100644
--- a/console.h
+++ b/console.h
@@ -80,6 +80,7 @@ struct DisplayState {
void *opaque;
struct QEMUTimer *gui_timer;
uint64_t gui_timer_interval;
+ int idle;
void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
void (*dpy_resize)(struct DisplayState *s, int w, int h);
diff --git a/sdl.c b/sdl.c
index 84a9d6d..15427c5 100644
--- a/sdl.c
+++ b/sdl.c
@@ -524,9 +524,11 @@ static void sdl_refresh(DisplayState *ds)
if (ev->active.gain) {
/* Back to default interval */
ds->gui_timer_interval = 0;
+ ds->idle = 0;
} else {
/* Sleeping interval */
ds->gui_timer_interval = 500;
+ ds->idle = 1;
}
}
break;
diff --git a/vl.c b/vl.c
index 56de905..f92ea2e 100644
--- a/vl.c
+++ b/vl.c
@@ -5941,6 +5941,8 @@ static void dumb_display_init(DisplayState *ds)
ds->dpy_update = dumb_update;
ds->dpy_resize = dumb_resize;
ds->dpy_refresh = dumb_refresh;
+ ds->gui_timer_interval = 500;
+ ds->idle = 1;
}
/***********************************************************/
diff --git a/vnc.c b/vnc.c
index 2d17044..0d55a78 100644
--- a/vnc.c
+++ b/vnc.c
@@ -660,6 +660,7 @@ static int vnc_client_io_error(VncState *vs, int ret, int
last_errno)
qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL);
closesocket(vs->csock);
vs->csock = -1;
+ vs->ds->idle = 1;
buffer_reset(&vs->input);
buffer_reset(&vs->output);
vs->need_update = 0;
@@ -1920,6 +1921,7 @@ static int protocol_version(VncState *vs, uint8_t
*version, size_t len)
static void vnc_connect(VncState *vs)
{
VNC_DEBUG("New client on socket %d\n", vs->csock);
+ vs->ds->idle = 0;
socket_set_nonblock(vs->csock);
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
vnc_write(vs, "RFB 003.008\n", 12);
@@ -1959,6 +1961,7 @@ void vnc_display_init(DisplayState *ds)
exit(1);
ds->opaque = vs;
+ ds->idle = 1;
vnc_state = vs;
vs->display = NULL;
vs->password = NULL;
--
1.5.5.1
- [Qemu-devel] [PATCH 00/11] merge some xen bits into qemu, Gerd Hoffmann, 2008/08/11
- [Qemu-devel] [PATCH 04/11] move GUI_REFRESH_INTERVAL define from vl.c to console.h, Gerd Hoffmann, 2008/08/11
- [Qemu-devel] [PATCH 03/11] add container_of() macro to osdep.h, Gerd Hoffmann, 2008/08/11
- [Qemu-devel] [PATCH 05/11] xen: groundwork for xen support, Gerd Hoffmann, 2008/08/11
- [Qemu-devel] [PATCH 02/11] add DisplayState->idle,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 06/11] xen: backend driver core, Gerd Hoffmann, 2008/08/11
- [Qemu-devel] [PATCH 07/11] xen: add console backend driver., Gerd Hoffmann, 2008/08/11
- [Qemu-devel] [PATCH 11/11] xen: blk & nic configuration via cmd line., Gerd Hoffmann, 2008/08/11
- [Qemu-devel] [PATCH 10/11] xen: add net backend driver., Gerd Hoffmann, 2008/08/11
- [Qemu-devel] [PATCH 09/11] xen: add block device backend driver., Gerd Hoffmann, 2008/08/11
- [Qemu-devel] [PATCH 08/11] xen: add framebuffer backend driver, Gerd Hoffmann, 2008/08/11