qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [RFC PATCH-for-9.0] hw/display/qxl: Directly use VGACommonState::vram_size
Date: Fri, 24 Nov 2023 20:22:16 +0100	[thread overview]
Message-ID: <20231124192216.96413-1-philmd@linaro.org> (raw)

PCIQXLDevice::vram_size seems to be some shadow of
VGACommonState::vram_size. Just use the latter.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
RFC: I don't understand this field otherwise.
---
 hw/display/qxl.h |  1 -
 hw/display/qxl.c | 17 ++++++++---------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index fdac14edad..47463bd485 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -102,7 +102,6 @@ struct PCIQXLDevice {
     uint16_t           max_outputs;
 
     /* vram pci bar */
-    uint64_t           vram_size;
     MemoryRegion       vram_bar;
     uint64_t           vram32_size;
     MemoryRegion       vram32_bar;
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 7bb00d68f5..0e1c4efc0c 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2067,20 +2067,19 @@ static void qxl_init_ramsize(PCIQXLDevice *qxl)
 
     /* vram (surfaces, 64bit, bar 4+5) */
     if (qxl->vram_size_mb != -1) {
-        qxl->vram_size = (uint64_t)qxl->vram_size_mb * MiB;
+        qxl->vga.vram_size = (uint64_t)qxl->vram_size_mb * MiB;
     }
-    if (qxl->vram_size < qxl->vram32_size) {
-        qxl->vram_size = qxl->vram32_size;
+    if (qxl->vga.vram_size < qxl->vram32_size) {
+        qxl->vga.vram_size = qxl->vram32_size;
     }
 
     if (qxl->revision == 1) {
         qxl->vram32_size = 4096;
-        qxl->vram_size = 4096;
+        qxl->vga.vram_size = 4096;
     }
     qxl->vgamem_size = pow2ceil(qxl->vgamem_size);
     qxl->vga.vram_size = pow2ceil(qxl->vga.vram_size);
     qxl->vram32_size = pow2ceil(qxl->vram32_size);
-    qxl->vram_size = pow2ceil(qxl->vram_size);
 }
 
 static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
@@ -2135,7 +2134,7 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
 
     qxl->guest_surfaces.cmds = g_new0(QXLPHYSICAL, qxl->ssd.num_surfaces);
     memory_region_init_ram(&qxl->vram_bar, OBJECT(qxl), "qxl.vram",
-                           qxl->vram_size, &error_fatal);
+                           qxl->vga.vram_size, &error_fatal);
     memory_region_init_alias(&qxl->vram32_bar, OBJECT(qxl), "qxl.vram32",
                              &qxl->vram_bar, 0, qxl->vram32_size);
 
@@ -2159,7 +2158,7 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
     pci_register_bar(&qxl->pci, QXL_VRAM_RANGE_INDEX,
                      PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->vram32_bar);
 
-    if (qxl->vram32_size < qxl->vram_size) {
+    if (qxl->vram32_size < qxl->vga.vram_size) {
         /*
          * Make the 64bit vram bar show up only in case it is
          * configured to be larger than the 32bit vram bar.
@@ -2177,8 +2176,8 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
     dprint(qxl, 1, "vram/32: %" PRIx64 " MB [region 1]\n",
            qxl->vram32_size / MiB);
     dprint(qxl, 1, "vram/64: %" PRIx64 " MB %s\n",
-           qxl->vram_size / MiB,
-           qxl->vram32_size < qxl->vram_size ? "[region 4]" : "[unmapped]");
+           qxl->vga.vram_size / MiB,
+           qxl->vram32_size < qxl->vga.vram_size ? "[region 4]" : "[unmapped]");
 
     qxl->ssd.qxl.base.sif = &qxl_interface.base;
     if (qemu_spice_add_display_interface(&qxl->ssd.qxl, qxl->vga.con) != 0) {
-- 
2.41.0



             reply	other threads:[~2023-11-24 19:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 19:22 Philippe Mathieu-Daudé [this message]
2023-12-13 17:37 ` [RFC PATCH-for-9.0] hw/display/qxl: Directly use VGACommonState::vram_size Philippe Mathieu-Daudé
2024-01-04 16:45 ` Philippe Mathieu-Daudé
2024-01-09 14:48   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231124192216.96413-1-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).