From nobody Thu Nov 6 20:28:33 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487715906516985.9542666691539; Tue, 21 Feb 2017 14:25:06 -0800 (PST) Received: from localhost ([::1]:48878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgIrp-0003eR-4m for importer@patchew.org; Tue, 21 Feb 2017 17:25:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgIiK-0002qj-E2 for qemu-devel@nongnu.org; Tue, 21 Feb 2017 17:15:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgIiI-0004T1-Ol for qemu-devel@nongnu.org; Tue, 21 Feb 2017 17:15:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42900) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgIiI-0004SQ-Hf for qemu-devel@nongnu.org; Tue, 21 Feb 2017 17:15:14 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8C607FB63 for ; Tue, 21 Feb 2017 22:15:14 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-47.ams2.redhat.com [10.36.116.47]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LMFDmH024920; Tue, 21 Feb 2017 17:15:14 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 88E7F80FCD; Tue, 21 Feb 2017 23:15:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 21 Feb 2017 23:14:57 +0100 Message-Id: <1487715299-21102-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1487715299-21102-1-git-send-email-kraxel@redhat.com> References: <1487715299-21102-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 21 Feb 2017 22:15:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 7/9] qxl: use graphic_* variables. 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If graphic_* variables are set (via -g switch), pass on that information to the guest so the driver can use it. Also move up qxl_crc32() function so we don't need a forward declaration. Additionally guest driver updates are needed so the guest driver will actually pick this up, which will probably land in linux kernel 4.12. Signed-off-by: Gerd Hoffmann --- hw/display/qxl.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index af4c0ca..37c84a8 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -304,6 +304,16 @@ void qxl_spice_reset_cursor(PCIQXLDevice *qxl) qxl->ssd.cursor =3D cursor_builtin_hidden(); } =20 +static uint32_t qxl_crc32(const uint8_t *p, unsigned len) +{ + /* + * zlib xors the seed with 0xffffffff, and xors the result + * again with 0xffffffff; Both are not done with linux's crc32, + * which we want to be compatible with, so undo that. + */ + return crc32(0xffffffff, p, len) ^ 0xffffffff; +} + static ram_addr_t qxl_rom_size(void) { #define QXL_REQUIRED_SZ (sizeof(QXLRom) + sizeof(QXLModes) + sizeof(qxl_mo= des)) @@ -368,6 +378,18 @@ static void init_qxl_rom(PCIQXLDevice *d) rom->num_pages =3D cpu_to_le32(num_pages); rom->ram_header_offset =3D cpu_to_le32(d->vga.vram_size - ram_header_= size); =20 + if (graphic_width && graphic_height) { + /* needs linux kernel 4.12+ to work */ + rom->client_monitors_config.count =3D 1; + rom->client_monitors_config.heads[0].left =3D 0; + rom->client_monitors_config.heads[0].top =3D 0; + rom->client_monitors_config.heads[0].right =3D cpu_to_le32(graphic= _width); + rom->client_monitors_config.heads[0].bottom =3D cpu_to_le32(graphi= c_height); + rom->client_monitors_config_crc =3D qxl_crc32( + (const uint8_t *)&rom->client_monitors_config, + sizeof(rom->client_monitors_config)); + } + d->shadow_rom =3D *rom; d->rom =3D rom; d->modes =3D modes; @@ -981,16 +1003,6 @@ static void interface_set_client_capabilities(QXLInst= ance *sin, qxl_send_events(qxl, QXL_INTERRUPT_CLIENT); } =20 -static uint32_t qxl_crc32(const uint8_t *p, unsigned len) -{ - /* - * zlib xors the seed with 0xffffffff, and xors the result - * again with 0xffffffff; Both are not done with linux's crc32, - * which we want to be compatible with, so undo that. - */ - return crc32(0xffffffff, p, len) ^ 0xffffffff; -} - static bool qxl_rom_monitors_config_changed(QXLRom *rom, VDAgentMonitorsConfig *monitors_config, unsigned int max_outputs) --=20 1.8.3.1