From patchwork Tue Sep 10 10:06:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 273821 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 7FC632C00CA for ; Tue, 10 Sep 2013 20:07:52 +1000 (EST) Received: from localhost ([::1]:56790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJKrO-0005Sg-Hc for incoming@patchwork.ozlabs.org; Tue, 10 Sep 2013 06:07:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJKq4-0003ua-Ew for qemu-devel@nongnu.org; Tue, 10 Sep 2013 06:06:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJKpu-0004Oq-JS for qemu-devel@nongnu.org; Tue, 10 Sep 2013 06:06:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26861) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJKpu-0004OB-AJ for qemu-devel@nongnu.org; Tue, 10 Sep 2013 06:06:18 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8AA6HAb004357 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Sep 2013 06:06:17 -0400 Received: from nilsson.home.kraxel.org (vpn1-4-143.ams2.redhat.com [10.36.4.143]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8AA6GmH021186; Tue, 10 Sep 2013 06:06:17 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 3F32F80709; Tue, 10 Sep 2013 12:06:16 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 10 Sep 2013 12:06:12 +0200 Message-Id: <1378807572-27902-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1378807572-27902-1-git-send-email-kraxel@redhat.com> References: <1378807572-27902-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 3/3] qxl: fix local renderer 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 The local spice renderer assumes the primary surface is located at the start of the "ram" bar. This used to be a requirement in qxl hardware revision 1. In revision 2+ this is relaxed. Nevertheless guest drivers continued to use the traditional location, for historical and backward compatibility reasons. The qxl kms driver doesn't though as it depends on qxl revision 4+ anyway. Result is that local rendering is hosed for recent linux guests, you'll get pixel garbage with non-spice ui (gtk, sdl, vnc) and when doing screendumps. Fix that by doing a proper mapping of the guest-specified memory location. https://bugzilla.redhat.com/show_bug.cgi?id=948717 Signed-off-by: Gerd Hoffmann --- hw/display/qxl-render.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c index 269b1a7..d34b0c4 100644 --- a/hw/display/qxl-render.c +++ b/hw/display/qxl-render.c @@ -31,10 +31,6 @@ static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect) if (is_buffer_shared(surface)) { return; } - if (!qxl->guest_primary.data) { - trace_qxl_render_blit_guest_primary_initialized(); - qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram); - } trace_qxl_render_blit(qxl->guest_primary.qxl_stride, rect->left, rect->right, rect->top, rect->bottom); src = qxl->guest_primary.data; @@ -104,7 +100,12 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl) if (qxl->guest_primary.resized) { qxl->guest_primary.resized = 0; - qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram); + qxl->guest_primary.data = qxl_phys2virt(qxl, + qxl->guest_primary.surface.mem, + MEMSLOT_GROUP_GUEST); + if (!qxl->guest_primary.data) { + return; + } qxl_set_rect_to_surface(qxl, &qxl->dirty[0]); qxl->num_dirty_rects = 1; trace_qxl_render_guest_primary_resized( @@ -128,6 +129,10 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl) } dpy_gfx_replace_surface(vga->con, surface); } + + if (!qxl->guest_primary.data) { + return; + } for (i = 0; i < qxl->num_dirty_rects; i++) { if (qemu_spice_rect_is_empty(qxl->dirty+i)) { break;