Commit bcfad70fb0189ba4aca8661e46de95e7149009c6

Authored by aliguori
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
console.h
... ... @@ -80,6 +80,7 @@ struct DisplayState {
80 80 void *opaque;
81 81 struct QEMUTimer *gui_timer;
82 82 uint64_t gui_timer_interval;
  83 + int idle;
83 84  
84 85 void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
85 86 void (*dpy_resize)(struct DisplayState *s, int w, int h);
... ...
... ... @@ -524,9 +524,11 @@ static void sdl_refresh(DisplayState *ds)
524 524 if (ev->active.gain) {
525 525 /* Back to default interval */
526 526 ds->gui_timer_interval = 0;
  527 + ds->idle = 0;
527 528 } else {
528 529 /* Sleeping interval */
529 530 ds->gui_timer_interval = 500;
  531 + ds->idle = 1;
530 532 }
531 533 }
532 534 break;
... ...
... ... @@ -5976,6 +5976,8 @@ static void dumb_display_init(DisplayState *ds)
5976 5976 ds->dpy_update = dumb_update;
5977 5977 ds->dpy_resize = dumb_resize;
5978 5978 ds->dpy_refresh = dumb_refresh;
  5979 + ds->gui_timer_interval = 500;
  5980 + ds->idle = 1;
5979 5981 }
5980 5982  
5981 5983 /***********************************************************/
... ...
... ... @@ -660,6 +660,7 @@ static int vnc_client_io_error(VncState *vs, int ret, int last_errno)
660 660 qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL);
661 661 closesocket(vs->csock);
662 662 vs->csock = -1;
  663 + vs->ds->idle = 1;
663 664 buffer_reset(&vs->input);
664 665 buffer_reset(&vs->output);
665 666 vs->need_update = 0;
... ... @@ -1920,6 +1921,7 @@ static int protocol_version(VncState *vs, uint8_t *version, size_t len)
1920 1921 static void vnc_connect(VncState *vs)
1921 1922 {
1922 1923 VNC_DEBUG("New client on socket %d\n", vs->csock);
  1924 + vs->ds->idle = 0;
1923 1925 socket_set_nonblock(vs->csock);
1924 1926 qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
1925 1927 vnc_write(vs, "RFB 003.008\n", 12);
... ... @@ -1959,6 +1961,7 @@ void vnc_display_init(DisplayState *ds)
1959 1961 exit(1);
1960 1962  
1961 1963 ds->opaque = vs;
  1964 + ds->idle = 1;
1962 1965 vnc_state = vs;
1963 1966 vs->display = NULL;
1964 1967 vs->password = NULL;
... ...