From nobody Thu Nov 6 10:18:27 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 1540817522770377.30657999752793; Mon, 29 Oct 2018 05:52:02 -0700 (PDT) Received: from localhost ([::1]:45350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gH71Q-0003Td-G0 for importer@patchew.org; Mon, 29 Oct 2018 08:51:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gH6wq-0007wE-54 for qemu-devel@nongnu.org; Mon, 29 Oct 2018 08:47:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gH6wj-0005MI-S6 for qemu-devel@nongnu.org; Mon, 29 Oct 2018 08:47:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19987) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gH6wj-0005Ir-Ge for qemu-devel@nongnu.org; Mon, 29 Oct 2018 08:47:05 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A567731233F1; Mon, 29 Oct 2018 12:47:04 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8362106225E; Mon, 29 Oct 2018 12:47:03 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 21118B3E01; Mon, 29 Oct 2018 13:47:03 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 29 Oct 2018 13:47:02 +0100 Message-Id: <20181029124703.11123-2-kraxel@redhat.com> In-Reply-To: <20181029124703.11123-1-kraxel@redhat.com> References: <20181029124703.11123-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 29 Oct 2018 12:47:04 +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] [PULL 1/2] qxl: store channel id in qxl->id 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: spice-devel@lists.freedesktop.org, Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" See qemu_spice_add_display_interface(), the console index is also used as channel id. So put that into the qxl->id field too. In typical use cases (one primary qxl-vga device, optionally one or more secondary qxl devices, no non-qxl display devices) this doesn't change anything. With this in place the qxl->id can not be used any more to figure whenever a given device is primary (with vga compat mode) or secondary. So add a bool to track this. Cc: spice-devel@lists.freedesktop.org Signed-off-by: Gerd Hoffmann Message-id: 20181012114540.27829-1-kraxel@redhat.com --- hw/display/qxl.h | 1 + hw/display/qxl.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/display/qxl.h b/hw/display/qxl.h index dd9c0522b7..6f9d1f21fa 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -34,6 +34,7 @@ typedef struct PCIQXLDevice { PortioList vga_port_list; SimpleSpiceDisplay ssd; int id; + bool have_vga; uint32_t debug; uint32_t guestdebug; uint32_t cmdlog; diff --git a/hw/display/qxl.c b/hw/display/qxl.c index f608abc769..9087db5dee 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -848,7 +848,7 @@ static int interface_get_cursor_command(QXLInstance *si= n, struct QXLCommandExt * qxl->guest_primary.commands++; qxl_track_command(qxl, ext); qxl_log_command(qxl, "csr", ext); - if (qxl->id =3D=3D 0) { + if (qxl->have_vga) { qxl_render_cursor(qxl, ext); } trace_qxl_ring_cursor_get(qxl->id, qxl_mode_to_string(qxl->mode)); @@ -1255,7 +1255,7 @@ static void qxl_soft_reset(PCIQXLDevice *d) d->current_async =3D QXL_UNDEFINED_IO; qemu_mutex_unlock(&d->async_lock); =20 - if (d->id =3D=3D 0) { + if (d->have_vga) { qxl_enter_vga_mode(d); } else { d->mode =3D QXL_MODE_UNDEFINED; @@ -2139,7 +2139,7 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Err= or **errp) =20 memory_region_init_io(&qxl->io_bar, OBJECT(qxl), &qxl_io_ops, qxl, "qxl-ioports", io_size); - if (qxl->id =3D=3D 0) { + if (qxl->have_vga) { vga_dirty_log_start(&qxl->vga); } memory_region_set_flush_coalesced(&qxl->io_bar); @@ -2171,7 +2171,7 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Err= or **errp) =20 /* print pci bar details */ dprint(qxl, 1, "ram/%s: %" PRId64 " MB [region 0]\n", - qxl->id =3D=3D 0 ? "pri" : "sec", qxl->vga.vram_size / MiB); + qxl->have_vga ? "pri" : "sec", qxl->vga.vram_size / MiB); dprint(qxl, 1, "vram/32: %" PRIx64 " MB [region 1]\n", qxl->vram32_size / MiB); dprint(qxl, 1, "vram/64: %" PRIx64 " MB %s\n", @@ -2199,7 +2199,6 @@ static void qxl_realize_primary(PCIDevice *dev, Error= **errp) VGACommonState *vga =3D &qxl->vga; Error *local_err =3D NULL; =20 - qxl->id =3D 0; qxl_init_ramsize(qxl); vga->vbe_size =3D qxl->vgamem_size; vga->vram_size_mb =3D qxl->vga.vram_size / MiB; @@ -2210,8 +2209,15 @@ static void qxl_realize_primary(PCIDevice *dev, Erro= r **errp) vga, "vga"); portio_list_set_flush_coalesced(&qxl->vga_port_list); portio_list_add(&qxl->vga_port_list, pci_address_space_io(dev), 0x3b0); + qxl->have_vga =3D true; =20 vga->con =3D graphic_console_init(DEVICE(dev), 0, &qxl_ops, qxl); + qxl->id =3D qemu_console_get_index(vga->con); /* =3D=3D channel_id */ + if (qxl->id !=3D 0) { + error_setg(errp, "primary qxl-vga device must be console 0 " + "(first display device on the command line)"); + return; + } =20 qxl_realize_common(qxl, &local_err); if (local_err) { @@ -2226,15 +2232,14 @@ static void qxl_realize_primary(PCIDevice *dev, Err= or **errp) =20 static void qxl_realize_secondary(PCIDevice *dev, Error **errp) { - static int device_id =3D 1; PCIQXLDevice *qxl =3D PCI_QXL(dev); =20 - qxl->id =3D device_id++; qxl_init_ramsize(qxl); memory_region_init_ram(&qxl->vga.vram, OBJECT(dev), "qxl.vgavram", qxl->vga.vram_size, &error_fatal); qxl->vga.vram_ptr =3D memory_region_get_ram_ptr(&qxl->vga.vram); qxl->vga.con =3D graphic_console_init(DEVICE(dev), 0, &qxl_ops, qxl); + qxl->id =3D qemu_console_get_index(qxl->vga.con); /* =3D=3D channel_id= */ =20 qxl_realize_common(qxl, errp); } --=20 2.9.3