From nobody Tue Nov 26 19:57:59 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=1567201458; cv=none; d=zoho.com; s=zohoarc; b=a8FOWkna8SZ69xeboaLvLYFNK+gwvpk9A7AkwgiGvKM+thAe5Ooau8l+6mdJmmI37BOarWnUIxuVcHsO7EUq3XJQY2Xus11ztEDJD2UAQ1yPHn7M6kppPc/L855/BXla0pbNi6o/nb6x5odOcuuQme1HhU6ZJPABebrVrHvkcH8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567201458; 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:ARC-Authentication-Results; bh=KfptEOwZuAs+6Z8qeMEyNWGOYj3ufO63lmWSun5jHEM=; b=RX+AJUbYcpGGMyANoVVEMCRNImstIt7e6NAdgTlX7QUbajLBqTDFwMHAFlfEl1WbEKeHIO/aMKfl//sIPZsUFbbqIQMvz44Km/12QTlQa9zb2jfgaWIZ4FIfGxAusZZggzSyYJGhP+JLA32vFADP0WhDt+0gm8pl2g1OOizd76c= 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 1567201458063127.1230280890336; Fri, 30 Aug 2019 14:44:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9734518AF93B; Fri, 30 Aug 2019 21:44:16 +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 749B85C207; Fri, 30 Aug 2019 21:44:16 +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 401F424F31; Fri, 30 Aug 2019 21:44:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7ULhnKJ005568 for ; Fri, 30 Aug 2019 17:43:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id A6D2F19D7A; Fri, 30 Aug 2019 21:43:49 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A14A719C6A for ; Fri, 30 Aug 2019 21:43:46 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (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 B09AA64467 for ; Fri, 30 Aug 2019 21:43:45 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id y26so9278934qto.4 for ; Fri, 30 Aug 2019 14:43:45 -0700 (PDT) Received: from localhost.localdomain ([191.17.58.35]) by smtp.gmail.com with ESMTPSA id y25sm2970689qtf.83.2019.08.30.14.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2019 14:43:44 -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=pkVVkEViVxcCmzqD+4+OiqdN2FwLY6+gEqrwyMlwn+U=; b=tkWGE/ocDsGprl/3u8K8Wlp6XyakuAfahTIQL++7BJoKvdMg0skK6XaGr9uT4jDBPe JnDkkJ63kK2iwbZ387RVy3GgtH9IgtWEU5idQXt8pe++Z/Wy39RfEbRNanoMg2a9uQ5p obNpCtPQB0zIsizVxbZz48chFPHW8e9vWlZXMXpRFg9HMtkSZzCVVoEJJiCJn8/PljYD rLEL/tgewIn0czSi3lqk0ZAkCRbXTGhw/7QbCsFLBV/gpgT8XAQ3Iim+CC4+OSTak/sc Q5YsjQ6Gkims+Y3I54P1X+EbTFsgKrQ/NsV4UhTwZ0UlAQ5sqJPwGkoKoT5fHRAre7gA dkoQ== 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=pkVVkEViVxcCmzqD+4+OiqdN2FwLY6+gEqrwyMlwn+U=; b=Enlq1Itey/roqovc3dkW+1En3Xlzp80x7+W1fhpJ5KBb+EIWFg0liqMXm338R4dhe8 dMMzP9mAiGlqdIXkdpVbh/4l7PrYS4J0Em52Wd9kWd8daBoPAkkRl9ZA0tkTRJnusUAn OuzOpfXqNwiogYbWHqOHPvNn46ycLrJLyzfrRln62Zrm/KZF8GqRIin5BiQYvtv21uTp bKSJxkZ2DM8qLEU7/en6BT/+492B5EDtLVzgBbwBtFZrCR35bmGSLngFzzy1Hv/7MEIK Q1f8rYoYbMpXYL0N70keDZA6lqco+pixxJmaIo4iFr9LuurOV9/mAt0c89tqHKODqOJz aNvw== X-Gm-Message-State: APjAAAVZTvbRl24mWga9W0iBSgrNHbz9Zx8mtjIEUzLkgnj5X8aBSTKc 0dh8cym+3wdNT/WtxRPYZEE3fQba X-Google-Smtp-Source: APXvYqxq2azjnJJir1sGXFY5ogUs9qB5TBy0ukDtT+bVxxNMZ5feD1pxnjRXF3eseFJdhPbR1WsfTw== X-Received: by 2002:a0c:df12:: with SMTP id g18mr11324000qvl.34.1567201424675; Fri, 30 Aug 2019 14:43:44 -0700 (PDT) From: jcfaracco@gmail.com To: libvir-list@redhat.com Date: Fri, 30 Aug 2019 18:40:55 -0300 Message-Id: <20190830214101.8759-4-jcfaracco@gmail.com> In-Reply-To: <20190830214101.8759-1-jcfaracco@gmail.com> References: <20190830214101.8759-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.39]); Fri, 30 Aug 2019 21:43:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 30 Aug 2019 21:43:45 +0000 (UTC) for IP:'209.85.160.195' DOMAIN:'mail-qt1-f195.google.com' HELO:'mail-qt1-f195.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.099 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.160.195 mail-qt1-f195.google.com 209.85.160.195 mail-qt1-f195.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Julio Faracco Subject: [libvirt] [PATCH v2 03/10] conf: Adding resolution property for model element 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Fri, 30 Aug 2019 21:44:17 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Julio Faracco New element 'resolution' with parameters 'x' and 'y' were added to support this settings for VGA, QXL, Virtio and Bochs XMLs. A new structure was created as Acceleration element has. It is easy to parse this property. Example: Signed-off-by: Julio Faracco --- src/conf/domain_conf.c | 75 ++++++++++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 5 +++ src/conf/virconftypes.h | 3 ++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b7a342bb91..9db8fd9697 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15311,6 +15311,53 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) return def; } =20 +static virDomainVideoResolutionDefPtr +virDomainVideoResolutionDefParseXML(xmlNodePtr node) +{ + xmlNodePtr cur; + virDomainVideoResolutionDefPtr def; + VIR_AUTOFREE(char *) x =3D NULL; + VIR_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) { @@ -15389,6 +15436,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) @@ -15463,6 +15511,17 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xm= lopt, } } =20 + if (def->res) { + if (def->type !=3D VIR_DOMAIN_VIDEO_TYPE_VGA && + def->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL && + def->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && + def->type !=3D VIR_DOMAIN_VIDEO_TYPE_BOCHS) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("model resolution is not supported")); + goto error; + } + } + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0) goto error; =20 @@ -26443,6 +26502,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, @@ -26486,11 +26557,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 33cef5b75c..a164f26d57 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1407,6 +1407,10 @@ struct _virDomainVideoAccelDef { int accel3d; /* enum virTristateBool */ }; =20 +struct _virDomainVideoResolutionDef { + unsigned int x; + unsigned int y; +}; =20 struct _virDomainVideoDriverDef { virDomainVideoVGAConf vgaconf; @@ -1422,6 +1426,7 @@ struct _virDomainVideoDef { bool primary; virDomainVideoAccelDefPtr accel; virDomainVideoDriverDefPtr driver; + virDomainVideoResolutionDefPtr res; 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 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list