From nobody Wed Nov 5 18:32:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537353219030590.189746549472; Wed, 19 Sep 2018 03:33:39 -0700 (PDT) Received: from localhost ([::1]:44663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2ZnS-0000n4-Pd for importer@patchew.org; Wed, 19 Sep 2018 06:33:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2ZlC-0007YK-9y for qemu-devel@nongnu.org; Wed, 19 Sep 2018 06:31:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2Zl8-0008A3-Sm for qemu-devel@nongnu.org; Wed, 19 Sep 2018 06:31:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44594) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2Zl8-00082b-KM for qemu-devel@nongnu.org; Wed, 19 Sep 2018 06:31:02 -0400 Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 33D1AC05006D for ; Wed, 19 Sep 2018 10:31:01 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-56.phx2.redhat.com [10.3.116.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 884B988EB3; Wed, 19 Sep 2018 10:30:58 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 673229B31F; Wed, 19 Sep 2018 12:30:57 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 19 Sep 2018 12:30:57 +0200 Message-Id: <20180919103057.9666-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 19 Sep 2018 10:31:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] qxl: use guest_monitor_config for local renderer. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When processing monitor config from guest store head0 width and height for single-head configurations. Use these when creating the DisplaySurface in the local renderer. This fixes a rendering issue with wayland. Wayland rounds up the framebuffer width and height to a multiple of 64, so with odd resolutions (800x600 for example) the framebuffer is larger than the actual screen. The monitor config has the actual screen size though. This fixes guest display for anything using the local renderer (non-spice UI, screendump monitor command). Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/display/qxl.h | 2 ++ hw/display/qxl-render.c | 18 ++++++++++-------- hw/display/qxl.c | 12 ++++++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/hw/display/qxl.h b/hw/display/qxl.h index 6eacba080d..dd9c0522b7 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -78,6 +78,8 @@ typedef struct PCIQXLDevice { QXLPHYSICAL guest_cursor; =20 QXLPHYSICAL guest_monitors_config; + uint32_t guest_head0_width; + uint32_t guest_head0_height; =20 QemuMutex track_lock; =20 diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c index c62b9a5e75..6debe8fc11 100644 --- a/hw/display/qxl-render.c +++ b/hw/display/qxl-render.c @@ -98,6 +98,8 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice = *qxl) { VGACommonState *vga =3D &qxl->vga; DisplaySurface *surface; + int width =3D qxl->guest_head0_width ?: qxl->guest_primary.surface.wid= th; + int height =3D qxl->guest_head0_height ?: qxl->guest_primary.surface.h= eight; int i; =20 if (qxl->guest_primary.resized) { @@ -111,8 +113,8 @@ static void qxl_render_update_area_unlocked(PCIQXLDevic= e *qxl) qxl_set_rect_to_surface(qxl, &qxl->dirty[0]); qxl->num_dirty_rects =3D 1; trace_qxl_render_guest_primary_resized( - qxl->guest_primary.surface.width, - qxl->guest_primary.surface.height, + width, + height, qxl->guest_primary.qxl_stride, qxl->guest_primary.bytes_pp, qxl->guest_primary.bits_pp); @@ -120,15 +122,15 @@ static void qxl_render_update_area_unlocked(PCIQXLDev= ice *qxl) pixman_format_code_t format =3D qemu_default_pixman_format(qxl->guest_primary.bits_pp, tru= e); surface =3D qemu_create_displaysurface_from - (qxl->guest_primary.surface.width, - qxl->guest_primary.surface.height, + (width, + height, format, qxl->guest_primary.abs_stride, qxl->guest_primary.data); } else { surface =3D qemu_create_displaysurface - (qxl->guest_primary.surface.width, - qxl->guest_primary.surface.height); + (width, + height); } dpy_gfx_replace_surface(vga->con, surface); } @@ -144,8 +146,8 @@ static void qxl_render_update_area_unlocked(PCIQXLDevic= e *qxl) qxl->dirty[i].top < 0 || qxl->dirty[i].left > qxl->dirty[i].right || qxl->dirty[i].top > qxl->dirty[i].bottom || - qxl->dirty[i].right > qxl->guest_primary.surface.width || - qxl->dirty[i].bottom > qxl->guest_primary.surface.height) { + qxl->dirty[i].right > width || + qxl->dirty[i].bottom > height) { continue; } qxl_blit(qxl, qxl->dirty+i); diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 8e9135d9c6..747986478f 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -259,6 +259,8 @@ static void qxl_spice_destroy_surfaces(PCIQXLDevice *qx= l, qxl_async_io async) =20 static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay) { + QXLMonitorsConfig *cfg; + trace_qxl_spice_monitors_config(qxl->id); if (replay) { /* @@ -286,6 +288,16 @@ static void qxl_spice_monitors_config_async(PCIQXLDevi= ce *qxl, int replay) (uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO, QXL_IO_MONITORS_CONFIG_ASYNC)); } + + cfg =3D qxl_phys2virt(qxl, qxl->guest_monitors_config, MEMSLOT_GROUP_G= UEST); + if (cfg->count =3D=3D 1) { + qxl->guest_primary.resized =3D 1; + qxl->guest_head0_width =3D cfg->heads[0].width; + qxl->guest_head0_height =3D cfg->heads[0].height; + } else { + qxl->guest_head0_width =3D 0; + qxl->guest_head0_height =3D 0; + } } =20 void qxl_spice_reset_image_cache(PCIQXLDevice *qxl) --=20 2.9.3