From patchwork Fri Mar 15 18:14:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 228133 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 56B702C0098 for ; Sat, 16 Mar 2013 05:14:58 +1100 (EST) Received: from localhost ([::1]:44876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGZ9c-00072c-Fd for incoming@patchwork.ozlabs.org; Fri, 15 Mar 2013 14:14:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGZ9G-00071f-FU for qemu-devel@nongnu.org; Fri, 15 Mar 2013 14:14:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGZ9E-0005X3-Lq for qemu-devel@nongnu.org; Fri, 15 Mar 2013 14:14:34 -0400 Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]:35404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGZ9E-0005Vi-BK for qemu-devel@nongnu.org; Fri, 15 Mar 2013 14:14:32 -0400 Received: by mail-we0-f169.google.com with SMTP id t11so3541317wey.0 for ; Fri, 15 Mar 2013 11:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=et2Y1bC8l+tsZYD4Ef2U+ryBZYEKlFDNWQ36xDfIfO4=; b=0wNSl7ndWHorJpQ/OalZsm/X2LaVXJCZMi9jnX0c3Z10E9u1kBwxU3sy5NqvDEUOyL r3UXZ0jPlS4KuWkwjZ/ltP6Vj1Bh8fQB8uzDDKH64VGp1Lzo659/Q9/be9kz9M+wMGW5 abn9RlOP9zPf9HuauOoOEpxNQwkmpvCAwrkQlL8HaWEkGkxMCgRw8h+ldFcVWOCQYZC1 ukMCsZPDG2j6IEOJmmREyGpP1nCMwx/qTtfdvtn4igYlcjMeRV7U2JmEGnJLU1W9T25n buYwsxvKiR3Npc6sPCbweS3FnLuHflDoEYUK6APJU+wLfXCKhyjDNNBfc4VVuZllQ5kZ NVHA== MIME-Version: 1.0 X-Received: by 10.180.98.232 with SMTP id el8mr4834461wib.22.1363371270702; Fri, 15 Mar 2013 11:14:30 -0700 (PDT) Received: by 10.180.97.200 with HTTP; Fri, 15 Mar 2013 11:14:30 -0700 (PDT) Date: Fri, 15 Mar 2013 18:14:30 +0000 Message-ID: From: Frediano Ziglio To: Anthony Liguori , Stefano Stabellini , Fabio Fantoni X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::229 Cc: xen-devel@lists.xensource.com, qemu-devel Subject: [Qemu-devel] [RFC PATCH] vga: Start supporting resolution not multiple of 16 correctly. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Modern notebook support 136x768 resolution. The resolution width is not multiple of 16 causing some problems. Qemu VGA emulation require width resolution to be multiple of 8. VNC implementation require width resolution to be multiple of 16. This patch remove these limits. Was tested with a Windows machine with standard vga and 1366x768 as resolution. I had to update vgabios as version in qemu (pc-bios/vgabios-stdvga.bin) is quite old. I also had to add some patches on top of VGABIOS 0.7a to add some new resolutions. I have some doubt about this patch - are other UI (sdl, cocoa, qxl) happy if resolution is not multiple of 16 ? - scanline is computed exactly without any alignment (so 1366 8 bit is 1366 bytes) while getting vesa information from a laptop it seems to use some kind of alignment (if became 0x580 which is 1408 bytes). Perhaps should I change either VGABIOS and Qemu to make this alignment? Signed-off-by: Frediano Ziglio --- hw/vga.c | 2 +- ui/vnc.c | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) } @@ -1771,7 +1772,7 @@ static void framebuffer_update_request(VncState *vs, int incremental, int w, int h) { int i; - const size_t width = ds_get_width(vs->ds) / 16; + const size_t width = (ds_get_width(vs->ds)+15) / 16; if (y_position > ds_get_height(vs->ds)) y_position = ds_get_height(vs->ds); @@ -2595,10 +2596,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); @@ -2619,8 +2616,10 @@ 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) diff --git a/hw/vga.c b/hw/vga.c index 1caf23d..d229f06 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -651,7 +651,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 ff4e2ae..328d14d 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -907,26 +907,27 @@ 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, + 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); }