From nobody Tue Apr 30 19:39:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1571287066; cv=none; d=zoho.com; s=zohoarc; b=iqRFWYcT2TtoNa7MoIPWnIQs9zebD4ZOfCUMjepy2RW2nodtnDiDRa/FO2KkEIHA31FpCEjxXoyphyhZGJwNHvNnFPANioMXeid0CElr+ZkLyTizvcSfYOocxjoS98qL2K6+1204CfqTxuW1wgeWAWcpTn0dh9RPcManytF9+WQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571287066; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BNn9NfqJ9ZXJ1LelMRDeBFSY/6kk4S1Llcu8utiD/Rc=; b=C6mbAvWFILkOmZjoRiNZQKuAOjiCx4Y6U1WsRMOvChDlva0ywAUu+zWEO9SEh0nIPN8VrCO/4u8IaeJw4TQF1CijDFT1wekKJ6OaW1FL97CvrOQmqYViQqSkxz+E+1WnVGVBeq4c/fPJ/TylfC764puD9xFhX5aXWpUADjwIhtQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571287066062229.83901714991384; Wed, 16 Oct 2019 21:37:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 19AC93090FD1; Thu, 17 Oct 2019 04:37:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9E2845DA32; Thu, 17 Oct 2019 04:37:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 68FB64A486; Thu, 17 Oct 2019 04:37:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9H4V0sE005894 for ; Thu, 17 Oct 2019 00:31:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id E6AE060C5D; Thu, 17 Oct 2019 04:31:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E4C960BE1; Thu, 17 Oct 2019 04:30:58 +0000 (UTC) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29AD7300C22F; Thu, 17 Oct 2019 04:30:57 +0000 (UTC) Received: by mail-qk1-f174.google.com with SMTP id p10so665970qkg.8; Wed, 16 Oct 2019 21:30:57 -0700 (PDT) Received: from localhost.localdomain ([2804:431:c7cb:b2eb:4438:8ed0:10c8:ea71]) by smtp.gmail.com with ESMTPSA id l129sm636219qkd.84.2019.10.16.21.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 21:30:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lwVIrkCBEqepxcMuVWn/lkT0v/TwH5RKjZrGZBXNqsc=; b=qjUlxPOhlUMhQHA2zTBUDsvnoMuK0hrgTf9jBRbTCDjpTQ9ut/hr8+BHvp4lC8Wd/t CkvFCvm4vK3BnCvJ/SoiShz4mbDxx6XxTfn8Xk6L7CRFPZs1xek0EGkHkvgD+jD8N9B0 czXUeC9VX2BiM3hgByiJoaHWrw+lU1naD1pfJhIYX5KjYZu56fwzy36jDoe/RlY0jSg9 CQzcUhOYkiPaI5f3V4La6faQccorB7SH9cioCkdyd9ZD+XbI+lCBQGEwqkxB3RR6v1Vi AzSCTOlYOCEHGi4oQ0XxYT7DTcMqtAGB4SKTOeNP6NDX5aO7qnMOHzHL/m1+ainC5GiC W5IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lwVIrkCBEqepxcMuVWn/lkT0v/TwH5RKjZrGZBXNqsc=; b=kuxHVf1eXDAWauc2OBsma+XeSQtXIWxiQhBetUF90lPO8D6wN18SulNj0SLTdzUaB5 fFrmwhTj7NkeBtfMMyqVayKaBQbH38/5zVxEUtmBA8y/J8FAshpogdfRWEr597VZbISq uwjXyMDPK5sYQ8JFuOSA3A/Wyfnio1h+kW7XsD3PswevuEBEK00I+w8FL+utrfCG1aCi v+ATFmWTtt/ZYHWQ4z/I6bJWuNej7YGcbcmt6jChyI0b2qJGj2SGRGe4rC5EBWsv/1Q8 e+OrDYGl5TUHTnCw8+urCKoxzdoUr8VTIo+XPk468ZoCqSjv310++tLV4tTsM2c07byv sAWA== X-Gm-Message-State: APjAAAXVX2AIV96UgbQxYaAL8Xk0TrAPCdcpoB9Ga1MkwadwyOirlR4d cv5ngCV+Irl7WW5cPaZwfNSY2FjN X-Google-Smtp-Source: APXvYqwv6paxQWXcaBtXwqJAbRvXRJxEm0aoi9AYGp1c8K0rTkfu+ElbJAeB8B3BUI2+hpQYO/HKnQ== X-Received: by 2002:a37:353:: with SMTP id 80mr1410590qkd.439.1571286655703; Wed, 16 Oct 2019 21:30:55 -0700 (PDT) From: jcfaracco@gmail.com To: libvir-list@redhat.com Date: Thu, 17 Oct 2019 01:30:31 -0300 Message-Id: <20191017043032.17123-2-jcfaracco@gmail.com> In-Reply-To: <20191017043032.17123-1-jcfaracco@gmail.com> References: <20191017043032.17123-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 17 Oct 2019 04:30:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 17 Oct 2019 04:30:57 +0000 (UTC) for IP:'209.85.222.174' DOMAIN:'mail-qk1-f174.google.com' HELO:'mail-qk1-f174.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.1 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.222.174 mail-qk1-f174.google.com 209.85.222.174 mail-qk1-f174.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Julio Faracco Subject: [libvirt] [PATCH v4 1/2] conf: Add 'x' and 'y' resolution into video XML definition X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 17 Oct 2019 04:37:44 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Julio Faracco This commit adds resolution element with parameters 'x' and 'y' into video XML domain group definition. Both, properties were added into an element called 'resolution' and it was added inside 'model' element. They are set as optional. This element does not follow QEMU properties 'xres' and 'yres' format. Both HTML documentation and schema were changed too. This commit includes a simple test case to cover resolution for QEMU video models. The new XML format for resolution looks like: Signed-off-by: Julio Faracco Reviewed-by: Cole Robinson --- docs/formatdomain.html.in | 5 +- docs/schemas/domaincommon.rng | 10 +++ src/conf/domain_conf.c | 63 ++++++++++++++++++- src/conf/domain_conf.h | 5 ++ src/conf/virconftypes.h | 3 + .../video-qxl-resolution.args | 32 ++++++++++ .../qemuxml2argvdata/video-qxl-resolution.xml | 40 ++++++++++++ tests/qemuxml2argvtest.c | 4 ++ .../video-qxl-resolution.xml | 40 ++++++++++++ tests/qemuxml2xmltest.c | 1 + 10 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/video-qxl-resolution.args create mode 100644 tests/qemuxml2argvdata/video-qxl-resolution.xml create mode 100644 tests/qemuxml2xmloutdata/video-qxl-resolution.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 500f114f41..962766b792 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7077,7 +7077,10 @@ qemu-kvm -net nic,model=3D? /dev/null vgamem (since 1.2.11) = to set the size of VGA framebuffer for fallback mode of QXL device. Attribute vram64 (since 1.3.3= ) - extends secondary bar and makes it addressable as 64bit memory. + extends secondary bar and makes it addressable as 64bit memory. = For + resolution settings, there are x and y + (since 5.9.0) optional attributes t= o set + minimum resolution for model.

=20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ead5a25068..e06f892da3 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3656,6 +3656,16 @@ + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2e6a113de3..88e93f6fb8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15345,6 +15345,52 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) return def; } =20 +static virDomainVideoResolutionDefPtr +virDomainVideoResolutionDefParseXML(xmlNodePtr node) +{ + xmlNodePtr cur; + virDomainVideoResolutionDefPtr def; + g_autofree char *x =3D NULL; + g_autofree char *y =3D NULL; + + cur =3D node->children; + while (cur !=3D NULL) { + if (cur->type =3D=3D XML_ELEMENT_NODE) { + if (!x && !y && + virXMLNodeNameEqual(cur, "resolution")) { + x =3D virXMLPropString(cur, "x"); + y =3D virXMLPropString(cur, "y"); + } + } + cur =3D cur->next; + } + + if (!x || !y) + return NULL; + + if (VIR_ALLOC(def) < 0) + goto cleanup; + + if (x) { + if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("cannot parse video x-resolution '%s'"), x); + goto cleanup; + } + } + + if (y) { + if (virStrToLong_uip(y, NULL, 10, &def->y) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("cannot parse video y-resolution '%s'"), y); + goto cleanup; + } + } + + cleanup: + return def; +} + static virDomainVideoDriverDefPtr virDomainVideoDriverDefParseXML(xmlNodePtr node) { @@ -15424,6 +15470,7 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xml= opt, } =20 def->accel =3D virDomainVideoAccelDefParseXML(cur); + def->res =3D virDomainVideoResolutionDefParseXML(cur); } if (virXMLNodeNameEqual(cur, "driver")) { if (virDomainVirtioOptionsParseXML(cur, &def->virtio) < 0) @@ -26515,6 +26562,18 @@ virDomainVideoAccelDefFormat(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } =20 +static void +virDomainVideoResolutionDefFormat(virBufferPtr buf, + virDomainVideoResolutionDefPtr def) +{ + virBufferAddLit(buf, "x && def->y) { + virBufferAsprintf(buf, " x=3D'%u' y=3D'%u'", + def->x, def->y); + } + virBufferAddLit(buf, "/>\n"); +} + static int virDomainVideoDefFormat(virBufferPtr buf, virDomainVideoDefPtr def, @@ -26562,11 +26621,13 @@ virDomainVideoDefFormat(virBufferPtr buf, virBufferAsprintf(buf, " heads=3D'%u'", def->heads); if (def->primary) virBufferAddLit(buf, " primary=3D'yes'"); - if (def->accel) { + if (def->accel || def->res) { virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); if (def->accel) virDomainVideoAccelDefFormat(buf, def->accel); + if (def->res) + virDomainVideoResolutionDefFormat(buf, def->res); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); } else { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index edac6250e4..b33e5334f4 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1421,6 +1421,10 @@ struct _virDomainVideoAccelDef { char *rendernode; }; =20 +struct _virDomainVideoResolutionDef { + unsigned int x; + unsigned int y; +}; =20 struct _virDomainVideoDriverDef { virDomainVideoVGAConf vgaconf; @@ -1438,6 +1442,7 @@ struct _virDomainVideoDef { unsigned int heads; bool primary; virDomainVideoAccelDefPtr accel; + virDomainVideoResolutionDefPtr res; virDomainVideoDriverDefPtr driver; virDomainDeviceInfo info; virDomainVirtioOptionsPtr virtio; diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h index a15cfb5f9e..462842f324 100644 --- a/src/conf/virconftypes.h +++ b/src/conf/virconftypes.h @@ -324,6 +324,9 @@ typedef virDomainVcpuDef *virDomainVcpuDefPtr; typedef struct _virDomainVideoAccelDef virDomainVideoAccelDef; typedef virDomainVideoAccelDef *virDomainVideoAccelDefPtr; =20 +typedef struct _virDomainVideoResolutionDef virDomainVideoResolutionDef; +typedef virDomainVideoResolutionDef *virDomainVideoResolutionDefPtr; + typedef struct _virDomainVideoDef virDomainVideoDef; typedef virDomainVideoDef *virDomainVideoDefPtr; =20 diff --git a/tests/qemuxml2argvdata/video-qxl-resolution.args b/tests/qemux= ml2argvdata/video-qxl-resolution.args new file mode 100644 index 0000000000..1dbcd660f1 --- /dev/null +++ b/tests/qemuxml2argvdata/video-qxl-resolution.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size=3D67108864,vgame= m_mb=3D8,\ +bus=3Dpci.0,addr=3D0x2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/video-qxl-resolution.xml b/tests/qemuxm= l2argvdata/video-qxl-resolution.xml new file mode 100644 index 0000000000..6ba2817002 --- /dev/null +++ b/tests/qemuxml2argvdata/video-qxl-resolution.xml @@ -0,0 +1,40 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + +
+ + +
+ + + + +