From patchwork Tue Jun 18 10:17:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 252222 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BFACA2C0096 for ; Tue, 18 Jun 2013 20:17:51 +1000 (EST) Received: from localhost ([::1]:57823 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uosyz-0004sn-JC for incoming@patchwork.ozlabs.org; Tue, 18 Jun 2013 06:17:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UosyW-0004nD-0r for qemu-devel@nongnu.org; Tue, 18 Jun 2013 06:17:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UosyT-0000F4-DC for qemu-devel@nongnu.org; Tue, 18 Jun 2013 06:17:19 -0400 Received: from mail-ve0-x22d.google.com ([2607:f8b0:400c:c01::22d]:47618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UosyT-0000Ew-61 for qemu-devel@nongnu.org; Tue, 18 Jun 2013 06:17:17 -0400 Received: by mail-ve0-f173.google.com with SMTP id jw11so2974416veb.32 for ; Tue, 18 Jun 2013 03:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=K2BqSTyU5XzQZ4aI7p4XraGKkcUigfWFd+EXRP2T88w=; b=zS4Pa9nitJs6MGrtOsdX4qXfe37kqajJWyHyXbz5tWTDpAFOef0MbdNBC7wVGcMVm7 90Sm/G1bhhVGsSQ4+dqIbciLyIvz3tObVwMq5lQ4CH4sTkCeljO3hpK+F1odxi7FMRmZ PuNaYVkVIbPZEPmt2m+obKNGE++VlWViXzNdJRA3+N1DDujH1jdTTz6BMMrF3CO1ZYYO lbAIiknn5Mv97EP4ATFXwH7BMhWvmFWsHP5svpPYB4W+lPyx8ALm/TG0xqfvVV8hYtZ4 mSyhY/OZV4BJNUECrEw0gfx3zB0USqMJ2j8oyFmnopjE6VxfHRll4MzsXtBgkb+5HTMk oRAg== MIME-Version: 1.0 X-Received: by 10.52.0.52 with SMTP id 20mr1338948vdb.22.1371550636543; Tue, 18 Jun 2013 03:17:16 -0700 (PDT) Received: by 10.52.232.74 with HTTP; Tue, 18 Jun 2013 03:17:16 -0700 (PDT) In-Reply-To: <518C8B16.4060108@suse.de> References: <518C8B16.4060108@suse.de> Date: Tue, 18 Jun 2013 11:17:16 +0100 Message-ID: From: Frediano Ziglio To: =?UTF-8?Q?Andreas_F=C3=A4rber?= X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400c:c01::22d Cc: Peter Maydell , Anthony Liguori , xen-devel@lists.xensource.com, Fabio Fantoni , Stefano Stabellini , qemu-devel , Alon Levy , Gerd Hoffmann Subject: Re: [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 1366x768 resolution. The resolution width is not multiple of 16 causing some problems. QEMU VGA emulation requires width resolution to be multiple of 8. VNC implementation requires width resolution to be multiple of 16. Signed-off-by: Frediano Ziglio Tested-by: Fabio Fantoni --- hw/display/vga.c | 2 +- ui/vnc.c | 34 +++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) Updates: - rebased - fixed style problems - fixed typos in comment Attached patch for last vgabios in order to get some new resolutions. Still had no time to test deeply. + (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) 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,