Commit bcfad70fb0189ba4aca8661e46de95e7149009c6
1 parent
5b08fc10
add DisplayState->idle (Samuel Thibault)
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 <kraxel@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5056 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
4 changed files
with
8 additions
and
0 deletions
console.h
@@ -80,6 +80,7 @@ struct DisplayState { | @@ -80,6 +80,7 @@ struct DisplayState { | ||
80 | void *opaque; | 80 | void *opaque; |
81 | struct QEMUTimer *gui_timer; | 81 | struct QEMUTimer *gui_timer; |
82 | uint64_t gui_timer_interval; | 82 | uint64_t gui_timer_interval; |
83 | + int idle; | ||
83 | 84 | ||
84 | void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); | 85 | void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); |
85 | void (*dpy_resize)(struct DisplayState *s, int w, int h); | 86 | void (*dpy_resize)(struct DisplayState *s, int w, int h); |
sdl.c
@@ -524,9 +524,11 @@ static void sdl_refresh(DisplayState *ds) | @@ -524,9 +524,11 @@ static void sdl_refresh(DisplayState *ds) | ||
524 | if (ev->active.gain) { | 524 | if (ev->active.gain) { |
525 | /* Back to default interval */ | 525 | /* Back to default interval */ |
526 | ds->gui_timer_interval = 0; | 526 | ds->gui_timer_interval = 0; |
527 | + ds->idle = 0; | ||
527 | } else { | 528 | } else { |
528 | /* Sleeping interval */ | 529 | /* Sleeping interval */ |
529 | ds->gui_timer_interval = 500; | 530 | ds->gui_timer_interval = 500; |
531 | + ds->idle = 1; | ||
530 | } | 532 | } |
531 | } | 533 | } |
532 | break; | 534 | break; |
vl.c
@@ -5976,6 +5976,8 @@ static void dumb_display_init(DisplayState *ds) | @@ -5976,6 +5976,8 @@ static void dumb_display_init(DisplayState *ds) | ||
5976 | ds->dpy_update = dumb_update; | 5976 | ds->dpy_update = dumb_update; |
5977 | ds->dpy_resize = dumb_resize; | 5977 | ds->dpy_resize = dumb_resize; |
5978 | ds->dpy_refresh = dumb_refresh; | 5978 | ds->dpy_refresh = dumb_refresh; |
5979 | + ds->gui_timer_interval = 500; | ||
5980 | + ds->idle = 1; | ||
5979 | } | 5981 | } |
5980 | 5982 | ||
5981 | /***********************************************************/ | 5983 | /***********************************************************/ |
vnc.c
@@ -660,6 +660,7 @@ static int vnc_client_io_error(VncState *vs, int ret, int last_errno) | @@ -660,6 +660,7 @@ static int vnc_client_io_error(VncState *vs, int ret, int last_errno) | ||
660 | qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL); | 660 | qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL); |
661 | closesocket(vs->csock); | 661 | closesocket(vs->csock); |
662 | vs->csock = -1; | 662 | vs->csock = -1; |
663 | + vs->ds->idle = 1; | ||
663 | buffer_reset(&vs->input); | 664 | buffer_reset(&vs->input); |
664 | buffer_reset(&vs->output); | 665 | buffer_reset(&vs->output); |
665 | vs->need_update = 0; | 666 | vs->need_update = 0; |
@@ -1920,6 +1921,7 @@ static int protocol_version(VncState *vs, uint8_t *version, size_t len) | @@ -1920,6 +1921,7 @@ static int protocol_version(VncState *vs, uint8_t *version, size_t len) | ||
1920 | static void vnc_connect(VncState *vs) | 1921 | static void vnc_connect(VncState *vs) |
1921 | { | 1922 | { |
1922 | VNC_DEBUG("New client on socket %d\n", vs->csock); | 1923 | VNC_DEBUG("New client on socket %d\n", vs->csock); |
1924 | + vs->ds->idle = 0; | ||
1923 | socket_set_nonblock(vs->csock); | 1925 | socket_set_nonblock(vs->csock); |
1924 | qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); | 1926 | qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); |
1925 | vnc_write(vs, "RFB 003.008\n", 12); | 1927 | vnc_write(vs, "RFB 003.008\n", 12); |
@@ -1959,6 +1961,7 @@ void vnc_display_init(DisplayState *ds) | @@ -1959,6 +1961,7 @@ void vnc_display_init(DisplayState *ds) | ||
1959 | exit(1); | 1961 | exit(1); |
1960 | 1962 | ||
1961 | ds->opaque = vs; | 1963 | ds->opaque = vs; |
1964 | + ds->idle = 1; | ||
1962 | vnc_state = vs; | 1965 | vnc_state = vs; |
1963 | vs->display = NULL; | 1966 | vs->display = NULL; |
1964 | vs->password = NULL; | 1967 | vs->password = NULL; |