1 | Index: ioemu/vnc.c |
---|
2 | =================================================================== |
---|
3 | --- ioemu.orig/vnc.c 2007-05-03 09:56:31.000000000 +0100 |
---|
4 | +++ ioemu/vnc.c 2007-05-03 10:07:55.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; |
---|
11 | |
---|
12 | h += y; |
---|
13 | + if (w != 1024) |
---|
14 | + mask = ((1ULL << (w / 16)) - 1) << (x / 16); |
---|
15 | + else |
---|
16 | + mask = ~(0ULL); |
---|
17 | |
---|
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 | } |
---|
23 | |
---|
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); |
---|
30 | |
---|
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; |
---|
36 | |
---|
37 | + qemu_mod_timer(vs->timer, now + VNC_REFRESH_INTERVAL); |
---|
38 | + |
---|
39 | vnc_set_bits(width_mask, (vs->width / 16), VNC_DIRTY_WORDS); |
---|
40 | |
---|
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; |
---|
45 | |
---|
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 | } |
---|
54 | |
---|
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 | - } |
---|
60 | |
---|
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 | } |
---|
71 | |
---|
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 | } |
---|
80 | |
---|
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 | } |
---|
89 | |
---|
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 2007-05-03 10:07:54.000000000 +0100 |
---|
94 | +++ ioemu/vl.c 2007-05-03 10:07:55.000000000 +0100 |
---|
95 | @@ -5195,10 +5195,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 | } |
---|