ia64/xen-unstable

view tools/ioemu/patches/vnc-cleanup @ 11569:317e8516d464

[qemu patches] Update patches for changeset 11561:c742b2ae920c.

Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author Christian Limpach <Christian.Limpach@xensource.com>
date Thu Sep 21 19:28:35 2006 +0100 (2006-09-21)
parents a7dcafb540be
children 623a07dda15c
line source
1 Index: ioemu/vnc.c
2 ===================================================================
3 --- ioemu.orig/vnc.c 2006-09-21 18:54:22.000000000 +0100
4 +++ ioemu/vnc.c 2006-09-21 19:05:39.000000000 +0100
5 @@ -143,13 +143,16 @@
6 static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
7 {
8 VncState *vs = ds->opaque;
9 - int i;
10 + uint64_t mask;
12 h += y;
13 + if (w != 1024)
14 + mask = ((1ULL << (w / 16)) - 1) << (x / 16);
15 + else
16 + mask = ~(0ULL);
18 for (; y < h; y++)
19 - for (i = 0; i < w; i += 16)
20 - vnc_set_bit(vs->dirty_row[y], (x + i) / 16);
21 + vs->dirty_row[y] |= mask;
22 }
24 static void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h,
25 @@ -373,6 +376,7 @@
26 static void vnc_update_client(void *opaque)
27 {
28 VncState *vs = opaque;
29 + int64_t now = qemu_get_clock(rt_clock);
31 if (vs->need_update && vs->csock != -1) {
32 int y;
33 @@ -383,6 +387,8 @@
34 int saved_offset;
35 int has_dirty = 0;
37 + qemu_mod_timer(vs->timer, now + VNC_REFRESH_INTERVAL);
38 +
39 vnc_set_bits(width_mask, (vs->width / 16), VNC_DIRTY_WORDS);
41 /* Walk through the dirty map and eliminate tiles that
42 @@ -390,7 +396,7 @@
43 row = vs->ds->data;
44 old_row = vs->old_data;
46 - for (y = 0; y < vs->height; y++) {
47 + for (y = 0; y < vs->ds->height; y++) {
48 if (vnc_and_bits(vs->dirty_row[y], width_mask, VNC_DIRTY_WORDS)) {
49 int x;
50 char *ptr, *old_ptr;
51 @@ -415,10 +421,8 @@
52 old_row += vs->ds->linesize;
53 }
55 - if (!has_dirty) {
56 - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);
57 + if (!has_dirty)
58 return;
59 - }
61 /* Count rectangles */
62 n_rectangles = 0;
63 @@ -454,17 +458,13 @@
64 vs->output.buffer[saved_offset] = (n_rectangles >> 8) & 0xFF;
65 vs->output.buffer[saved_offset + 1] = n_rectangles & 0xFF;
66 vnc_flush(vs);
67 -
68 }
69 - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);
70 }
72 static void vnc_timer_init(VncState *vs)
73 {
74 - if (vs->timer == NULL) {
75 + if (vs->timer == NULL)
76 vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs);
77 - qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock));
78 - }
79 }
81 static void vnc_dpy_refresh(DisplayState *ds)
82 @@ -736,6 +736,8 @@
83 old_row += vs->ds->linesize;
84 }
85 }
86 +
87 + qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock));
88 }
90 static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings)
91 Index: ioemu/vl.c
92 ===================================================================
93 --- ioemu.orig/vl.c 2006-09-21 18:55:38.000000000 +0100
94 +++ ioemu/vl.c 2006-09-21 19:00:48.000000000 +0100
95 @@ -5120,10 +5120,10 @@
96 /* XXX: better handling of removal */
97 for(ioh = first_io_handler; ioh != NULL; ioh = ioh_next) {
98 ioh_next = ioh->next;
99 - if (FD_ISSET(ioh->fd, &rfds)) {
100 + if (ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) {
101 ioh->fd_read(ioh->opaque);
102 }
103 - if (FD_ISSET(ioh->fd, &wfds)) {
104 + if (ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) {
105 ioh->fd_write(ioh->opaque);
106 }
107 }