]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fill out default vram in DeviceDefPostParse
authorJán Tomko <jtomko@redhat.com>
Wed, 11 May 2016 10:39:52 +0000 (12:39 +0200)
committerCole Robinson <crobinso@redhat.com>
Mon, 16 May 2016 13:20:11 +0000 (09:20 -0400)
Move filling out the default video (v)ram to DeviceDefPostParse.

This means it can be removed from virDomainVideoDefParseXML
and qemuParseCommandLine. Also, we no longer need to special case
VIR_DOMAIN_VIRT_XEN, since the per-driver callback gets called
before the generic one.

(cherry picked from commit 538012c8a30230065d1bfe09892279dd8b89193f)

src/conf/domain_conf.c
src/qemu/qemu_parse_command.c

index 5baf29735add803d41fafdf816e181de9a66f208..f433f18367d588fba03b19a42dabe465c6c4b499 100644 (file)
@@ -4149,6 +4149,12 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
 
     if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) {
         virDomainVideoDefPtr video = dev->data.video;
+        /* Fill out (V)RAM if the driver-specific callback did not do so */
+        if (video->ram == 0 && video->type == VIR_DOMAIN_VIDEO_TYPE_QXL)
+            video->ram = virDomainVideoDefaultRAM(def, video->type);
+        if (video->vram == 0)
+            video->vram = virDomainVideoDefaultRAM(def, video->type);
+
         video->ram = VIR_ROUND_UP_POWER_OF_TWO(video->ram);
         video->vram = VIR_ROUND_UP_POWER_OF_TWO(video->vram);
     }
@@ -11948,10 +11954,6 @@ unsigned int
 virDomainVideoDefaultRAM(const virDomainDef *def,
                          const virDomainVideoType type)
 {
-    /* Defer setting default vram to the Xen drivers */
-    if (def->virtType == VIR_DOMAIN_VIRT_XEN)
-        return 0;
-
     switch (type) {
     case VIR_DOMAIN_VIDEO_TYPE_VGA:
     case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
@@ -12130,8 +12132,6 @@ virDomainVideoDefParseXML(xmlNodePtr node,
                            _("cannot parse video ram '%s'"), ram);
             goto error;
         }
-    } else if (def->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
-        def->ram = virDomainVideoDefaultRAM(dom, def->type);
     }
 
     if (vram) {
@@ -12140,8 +12140,6 @@ virDomainVideoDefParseXML(xmlNodePtr node,
                            _("cannot parse video vram '%s'"), vram);
             goto error;
         }
-    } else {
-        def->vram = virDomainVideoDefaultRAM(dom, def->type);
     }
 
     if (vram64) {
@@ -18593,7 +18591,6 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def)
                        _("cannot determine default video type"));
         goto cleanup;
     }
-    video->vram = virDomainVideoDefaultRAM(def, video->type);
     video->heads = 1;
     if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0)
         goto cleanup;
index 45b64a6eaf19b739a6566b8c144055fd340feda0..074a7c4bed86ebd4e7fae967433cee69868fa756 100644 (file)
@@ -2584,9 +2584,7 @@ qemuParseCommandLine(virCapsPtr caps,
             vid->type = VIR_DOMAIN_VIDEO_TYPE_XEN;
         else
             vid->type = video;
-        vid->vram = virDomainVideoDefaultRAM(def, vid->type);
         if (vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
-            vid->ram = virDomainVideoDefaultRAM(def, vid->type);
             vid->vgamem = QEMU_QXL_VGAMEM_DEFAULT;
         } else {
             vid->ram = 0;