On 11/24/2014 03:03 PM, Peter Krempa wrote:
On 11/20/14 20:21, Pavel Hrdina wrote:
Add attribute to set vgamem_mb parameter of QXL device for QEMU. This
value sets the size of VGA framebuffer for QXL device. Default value in
QEMU is 8MB so reuse it also in libvirt to not break things.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1076098

Signed-off-by: Pavel Hrdina <phrd...@redhat.com>
---
  docs/formatdomain.html.in                          |  4 +++-
  docs/schemas/domaincommon.rng                      |  5 +++++
  src/conf/domain_conf.c                             | 26 ++++++++++++++++++++++
  src/conf/domain_conf.h                             |  1 +
  src/qemu/qemu_command.c                            | 22 ++++++++++++++++--
  src/qemu/qemu_domain.c                             | 18 +++++++++++++++
  .../qemuxml2argv-graphics-spice-compression.xml    |  4 ++--
  .../qemuxml2argv-graphics-spice-qxl-vga.xml        |  4 ++--
  .../qemuxml2argv-graphics-spice.xml                |  4 ++--
  .../qemuxml2argv-pcihole64-q35.xml                 |  2 +-
  tests/qemuxml2argvdata/qemuxml2argv-q35.xml        |  2 +-
  .../qemuxml2argv-serial-spiceport.xml              |  2 +-
  .../qemuxml2argv-video-qxl-device-vgamem.args      |  4 ++--
  .../qemuxml2argv-video-qxl-sec-device-vgamem.args  |  6 ++---
  tests/qemuxml2argvtest.c                           |  6 +++--
  tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml    |  2 +-
  16 files changed, 92 insertions(+), 20 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 4e6b919..444e681 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4704,7 +4704,9 @@ qemu-kvm -net nic,model=? /dev/null
            only and specifies the size of the primary bar, while the optional
            attribute <code>vram</code> specifies the secondary bar size.
            If "ram" or "vram" are not supplied a default value is used. The ram
-          should also be rounded to power of two as vram.
+          should also be rounded to power of two as vram. There is also 
optional
+          attribute <code>vgamem</code> (<span class="since">since 
1.2.11</span>)

qemu only

+          to set the size of VGA framebuffer for fallback mode of QXL device.
          </p>
        </dd>


...

diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b6ea6e4..c89afc2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1278,6 +1278,7 @@ struct _virDomainVideoDef {
      int type;
      unsigned int ram;  /* kibibytes (multiples of 1024) */
      unsigned int vram; /* kibibytes (multiples of 1024) */
+    unsigned int vgamem; /* kibibytes (multiples of 1024) */

They are now also powers of two, aren't they? also "multiples of 1024"
in that case means "at least 1024". We should state that in the comment
also in the previous patch that changes the meaning of the two above.


This has nothing in common with this patch series as the "multiples of
1024" only claims the same as kibibytes that the value is bytes
multiple by 1024 and not by 1000.

      unsigned int heads;
      bool primary;
      virDomainVideoAccelDefPtr accel;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ac36567..5c0ca75 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5031,6 +5031,12 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def,
              /* QEMU accepts bytes for vram_size. */
              virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024);
          }
+
+        if ((primary && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) ||
+            (!primary && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGAMEM))) {
+            /* QEMU accepts mibibytes for vgamem_mb. */

mebibytes

+            virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vgamem / 1024);
+        }
      } else if (video->vram &&
          ((video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
            virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) ||

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 01bf39b..0dc3ed2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1176,6 +1176,24 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
          goto cleanup;
      }

+    if (dev->type == VIR_DOMAIN_DEVICE_VIDEO &&
+        dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
+        if (dev->data.video->vgamem) {
+            if (dev->data.video->vgamem % 1024) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("value for 'vgamem' must be multiple of 
1024"));
+                goto cleanup;
+            }
+            if (dev->data.video->vgamem != 
VIR_ROUND_UP_POWER_OF_TWO(dev->data.video->vgamem)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("value for 'vgamem' must be power of two"));
+                goto cleanup;
+            }


Again, these two checks together form a condition "at least 1024 &&
power of two"

+        } else {
+            dev->data.video->vgamem = 8 * 1024;
+        }
+    }
+
      ret = 0;

   cleanup:

Peter


For the rest I'll send v4, thanks.

Pavel

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to