forked from QubesOS/qubes-core-libvirt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0014-libxl-add-support-for-xengt-video-device.patch
169 lines (162 loc) · 6.38 KB
/
0014-libxl-add-support-for-xengt-video-device.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
From d83ee492f5fd0263773f4c31ba06740abef82393 Mon Sep 17 00:00:00 2001
From: Ivan Kardykov <kardykov@tabit.pro>
Date: Sat, 19 Nov 2022 23:40:29 +0100
Subject: [PATCH] libxl: add support for xengt video device
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add ability to configure xengt video device with options.
Signed-off-by: Ivan Kardykov <kardykov@tabit.pro>
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
src/conf/domain_conf.c | 29 +++++++++++++++++++++++++++++
src/conf/domain_conf.h | 4 ++++
src/conf/schemas/domaincommon.rng | 20 ++++++++++++++++++++
src/libxl/libxl_conf.c | 9 +++++++++
src/libxl/libxl_domain.c | 1 +
5 files changed, 63 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6b15766804..e7cfddf11c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -859,6 +859,7 @@ VIR_ENUM_IMPL(virDomainVideo,
"cirrus",
"vmvga",
"xen",
+ "xengt",
"vbox",
"qxl",
"parallels",
@@ -12606,6 +12607,7 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
switch (type) {
case VIR_DOMAIN_VIDEO_TYPE_VGA:
case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
+ case VIR_DOMAIN_VIDEO_TYPE_XENGT:
case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
if (def->virtType == VIR_DOMAIN_VIRT_VBOX)
return 8 * 1024;
@@ -12731,6 +12733,9 @@ virDomainVideoDefParseXML(virDomainXMLOption *xmlopt,
g_autofree char *ram = NULL;
g_autofree char *vgamem = NULL;
g_autofree char *primary = NULL;
+ g_autofree char *low_gm_sz = NULL;
+ g_autofree char *high_gm_sz = NULL;
+ g_autofree char *fence_sz = NULL;
if (!(def = virDomainVideoDefNew(xmlopt)))
return NULL;
@@ -12799,6 +12804,30 @@ virDomainVideoDefParseXML(virDomainXMLOption *xmlopt,
}
}
+ if ((heads = virXPathString("string(./model/@low_gm_sz)", ctxt))) {
+ if (virStrToLong_uip(heads, NULL, 10, &def->low_gm_sz) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse video low_gm_sz '%s'"), heads);
+ return NULL;
+ }
+ }
+
+ if ((heads = virXPathString("string(./model/@high_gm_sz)", ctxt))) {
+ if (virStrToLong_uip(heads, NULL, 10, &def->high_gm_sz) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse video high_gm_sz '%s'"), heads);
+ return NULL;
+ }
+ }
+
+ if ((heads = virXPathString("string(./model/@fence_sz)", ctxt))) {
+ if (virStrToLong_uip(heads, NULL, 10, &def->fence_sz) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot parse video fence_sz '%s'"), heads);
+ return NULL;
+ }
+ }
+
if ((heads = virXPathString("string(./model/@heads)", ctxt))) {
if (virStrToLong_uip(heads, NULL, 10, &def->heads) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 566c4beeb4..07937bad34 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1741,6 +1741,7 @@ typedef enum {
VIR_DOMAIN_VIDEO_TYPE_CIRRUS,
VIR_DOMAIN_VIDEO_TYPE_VMVGA,
VIR_DOMAIN_VIDEO_TYPE_XEN,
+ VIR_DOMAIN_VIDEO_TYPE_XENGT,
VIR_DOMAIN_VIDEO_TYPE_VBOX,
VIR_DOMAIN_VIDEO_TYPE_QXL,
VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in containers */
@@ -1789,6 +1790,9 @@ struct _virDomainVideoDef {
unsigned int vram64; /* kibibytes (multiples of 1024) */
unsigned int vgamem; /* kibibytes (multiples of 1024) */
unsigned int heads;
+ unsigned int low_gm_sz;
+ unsigned int high_gm_sz;
+ unsigned int fence_sz;
bool primary;
virDomainVideoAccelDef *accel;
virDomainVideoResolutionDef *res;
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index 7e674d6a6e..735125c14a 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -4465,6 +4465,26 @@
</attribute>
</optional>
</group>
+ <group>
+ <attribute name="type">
+ <value>xengt</value>
+ </attribute>
+ <optional>
+ <attribute name="low_gm_sz">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="high_gm_sz">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="fence_sz">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ </group>
</choice>
<optional>
<attribute name="vram">
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 017c5ee590..85abe92e3c 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -2434,6 +2434,15 @@ libxlMakeVideo(virDomainDef *def, libxl_domain_config *d_config)
return -1;
}
break;
+ case VIR_DOMAIN_VIDEO_TYPE_XENGT:
+ b_info->u.hvm.vga.kind = LIBXL_VGA_INTERFACE_TYPE_XENGT;
+ if (def->videos[0]->low_gm_sz)
+ b_info->u.hvm.vgt_low_gm_sz = def->videos[0]->low_gm_sz;
+ if (def->videos[0]->high_gm_sz)
+ b_info->u.hvm.vgt_high_gm_sz = def->videos[0]->high_gm_sz;
+ if (def->videos[0]->fence_sz)
+ b_info->u.hvm.vgt_fence_sz = def->videos[0]->fence_sz;
+ break;
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index ad27c4ef8b..8620efc4f0 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -189,6 +189,7 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDef *dev,
dev->data.video->vram = 8 * 1024;
}
break;
+ case VIR_DOMAIN_VIDEO_TYPE_XENGT:
case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
if (dev->data.video->vram == 0) {
if (dm_type == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN)
--
2.37.3