From 55bfd020d8d9de40977832c4762728090df2bee3 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Fri, 18 Jan 2013 20:36:36 +0200 Subject: [PATCH] qemu: Support ram bar size for qxl devices Adds a "ram" attribute globally to the video.model element, that changes the resulting qemu command line only if video.type == "qxl". That attribute gets a default value of 64*1024. The schema is unchanged for other video element types. The resulting qemu command line change is the addition of -global qxl-vga.ram_size=*1024 or -global qxl.ram_size=*1024 For the main and secondary qxl devices respectively. The default for the qxl ram bar is 64*1024 kilobytes (the same as the default qxl vram bar size). --- docs/formatdomain.html.in | 6 +- docs/schemas/domaincommon.rng | 34 +++++++---- src/conf/domain_conf.c | 24 +++++++- src/conf/domain_conf.h | 5 +- src/qemu/qemu_command.c | 57 +++++++++++++------ ...muxml2argv-graphics-spice-compression.args | 6 +- ...emuxml2argv-graphics-spice-compression.xml | 4 +- .../qemuxml2argv-graphics-spice-qxl-vga.args | 3 +- .../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 +- .../qemuxml2argv-graphics-spice.args | 3 +- .../qemuxml2argv-graphics-spice.xml | 4 +- ...xml2argv-video-device-pciaddr-default.args | 6 +- 12 files changed, 110 insertions(+), 46 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index bb0b199c17..7ad8aea790 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3565,7 +3565,11 @@ qemu-kvm -net nic,model=? /dev/null video device in domain xml is the primary one, but the optional attribute primary (since 1.0.2) with value 'yes' can be used to mark the primary in cases of mutiple - video device. The non-primary must be type of "qxl". + video device. The non-primary must be type of "qxl". The optional + attribute ram (since + 1.0.2) is allowed for "qxl" type only and specifies + the size of the primary bar, while vram specifies the + secondary bar size. If "ram" is not supplied a default value is used.
model
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 67ae864b39..7f3320e45f 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2251,22 +2251,34 @@ - - - vga - cirrus - vmvga - xen - vbox - qxl - - + + + + vga + cirrus + vmvga + xen + vbox + + + + + qxl + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ad6a14a4e7..edbd450eb3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7391,6 +7391,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node, char *type = NULL; char *heads = NULL; char *vram = NULL; + char *ram = NULL; char *primary = NULL; if (VIR_ALLOC(def) < 0) { @@ -7401,9 +7402,10 @@ virDomainVideoDefParseXML(const xmlNodePtr node, cur = node->children; while (cur != NULL) { if (cur->type == XML_ELEMENT_NODE) { - if (!type && !vram && !heads && + if (!type && !vram && !ram && !heads && xmlStrEqual(cur->name, BAD_CAST "model")) { type = virXMLPropString(cur, "type"); + ram = virXMLPropString(cur, "ram"); vram = virXMLPropString(cur, "vram"); heads = virXMLPropString(cur, "heads"); @@ -7431,9 +7433,24 @@ virDomainVideoDefParseXML(const xmlNodePtr node, } } + if (ram) { + if (def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("ram attribute only supported for type of qxl")); + goto error; + } + if (virStrToLong_ui(ram, NULL, 10, &def->ram) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("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) { if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_XML_ERROR, _("cannot parse video ram '%s'"), vram); goto error; } @@ -7455,6 +7472,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node, goto error; VIR_FREE(type); + VIR_FREE(ram); VIR_FREE(vram); VIR_FREE(heads); @@ -13384,6 +13402,8 @@ virDomainVideoDefFormat(virBufferPtr buf, virBufferAddLit(buf, "