diff --git a/hw/display/vga.c b/hw/display/vga.c
index 21a108d..0053b0f 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -648,7 +648,7 @@ void vbe_ioport_write_data(void
*opaque, uint32_t addr, uint32_t val)
}
break;
case VBE_DISPI_INDEX_XRES:
- if ((val <= VBE_DISPI_MAX_XRES)
&& ((val & 7) == 0)) {
+ if ((val <= VBE_DISPI_MAX_XRES)
&& ((val & 1) == 0)) {
s->vbe_regs[s->vbe_index] = val;
}
break;
diff --git a/ui/vnc.c b/ui/vnc.c
index dfc7459..2a2bb90 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -911,26 +911,30 @@ static int
vnc_update_client(VncState *vs, int has_dirty)
for (y = 0; y < height; y++) {
int x;
int last_x = -1;
- for (x = 0; x < width / 16; x++) {
- if (test_and_clear_bit(x,
vs->dirty[y])) {
+ for (x = 0; x < width; x += 16) {
+ if (test_and_clear_bit(x/16,
vs->dirty[y])) {
if (last_x == -1) {
last_x = x;
}
} else {
if (last_x != -1) {
- int h =
find_and_clear_dirty_height(vs, y, last_x, x,
-
height);
+ int h =
find_and_clear_dirty_height(vs, y, last_x/16,
+
x/16, height);
- n += vnc_job_add_rect(job,
last_x * 16, y,
- (x -
last_x) * 16, h);
+ n += vnc_job_add_rect(job,
last_x, y,
+ (x -
last_x), h);
}
last_x = -1;
}
}
if (last_x != -1) {
- int h = find_and_clear_dirty_height(vs,
y, last_x, x, height);
- n += vnc_job_add_rect(job, last_x * 16,
y,
- (x - last_x) *
16, h);
+ int h = find_and_clear_dirty_height(vs,
y, last_x/16, x/16,
+
height);
+ if (x > width) {
+ x = width;
+ }
+ n += vnc_job_add_rect(job, last_x, y,
+ (x - last_x), h);
}
}
@@ -1861,7 +1865,7 @@ static void
framebuffer_update_request(VncState *vs, int
incremental,
int w, int h)
{
int i;
- const size_t width =
surface_width(vs->vd->ds) / 16;
+ const size_t width =
(surface_width(vs->vd->ds)+15) / 16;
const size_t height =
surface_height(vs->vd->ds);
if (y_position > height) {
@@ -2686,10 +2690,6 @@ static int
vnc_refresh_server_surface(VncDisplay *vd)
* Check and copy modified bits from guest to
server surface.
* Update server dirty map.
*/
- cmp_bytes = 64;
- if (cmp_bytes > vnc_server_fb_stride(vd)) {
- cmp_bytes = vnc_server_fb_stride(vd);
- }
if (vd->guest.format != VNC_SERVER_FB_FORMAT) {
int width =
pixman_image_get_width(vd->server);
tmpbuf =
qemu_pixman_linebuf_create(VNC_SERVER_FB_FORMAT, width);
@@ -2710,8 +2710,12 @@ static int
vnc_refresh_server_surface(VncDisplay *vd)
}
server_ptr = server_row;
- for (x = 0; x + 15 < width;
+ cmp_bytes = 64;
+ for (x = 0; x < width;
x += 16, guest_ptr += cmp_bytes,
server_ptr += cmp_bytes) {
+ if (width - x < 16) {
+ cmp_bytes = 4 * (width - x);
+ }
if (!test_and_clear_bit((x / 16),
vd->guest.dirty[y]))
continue;
if (memcmp(server_ptr, guest_ptr,
cmp_bytes) == 0)
--
1.7.10.4