bhyve: add support for setting fbuf resolution

The resolution of the VNC framebuffer can now be set via the resolution
definition introduced in 5.9.0.

Also, add "gop" to the list of model types  the <resolution/>
sub-element is valid for.

Signed-off-by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Fabian Freyer 2020-05-06 13:35:53 +00:00 committed by Roman Bogorodskiy
parent cdd31d72ed
commit 2968e5ff3a
13 changed files with 129 additions and 1 deletions

View File

@ -20,6 +20,11 @@ v6.8.0 (unreleased)
attribute of the device's ``<source>`` element can be used to disable the
filtering and allow all guest writes to the configuration space.
* bhyve: Support setting the framebuffer resolution
Libvirt can now set the framebuffer's "w" and "h" parameters
using the ``resolution`` element.
* **Improvements**
* qemu: Allow migration over UNIX sockets

View File

@ -5822,7 +5822,8 @@ A video device.
:since:`Since 5.9.0` , the ``model`` element may also have an optional
``resolution`` sub-element. The ``resolution`` element has attributes ``x``
and ``y`` to set the minimum resolution for the video device. This
sub-element is valid for model types "vga", "qxl", "bochs", and "virtio".
sub-element is valid for model types "vga", "qxl", "bochs", "gop",
and "virtio".
``acceleration``
Configure if video acceleration should be enabled.

View File

@ -468,6 +468,9 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def,
return -1;
}
if (video->res)
virBufferAsprintf(&opt, ",w=%d,h=%d", video->res->x, video->res->y);
if (video->driver)
virBufferAsprintf(&opt, ",vga=%s",
virDomainVideoVGAConfTypeToString(video->driver->vgaconf));

View File

@ -621,6 +621,26 @@ bhyveParsePCIFbuf(virDomainDefPtr def,
if (virStrToLong_i(param, NULL, 10, &graphics->data.vnc.port))
goto error;
}
if (STRPREFIX(param, "w=")) {
param += strlen("w=");
if (video->res == NULL)
video->res = g_new0(virDomainVideoResolutionDef, 1);
if (virStrToLong_uip(param, NULL, 10, &video->res->x))
goto error;
}
if (STRPREFIX(param, "h=")) {
param += strlen("h=");
if (video->res == NULL)
video->res = g_new0(virDomainVideoResolutionDef, 1);
if (virStrToLong_uip(param, NULL, 10, &video->res->y))
goto error;
}
}
cleanup:

View File

@ -0,0 +1,10 @@
/usr/sbin/bhyve \
-c 1 \
-m 214 \
-u \
-H \
-P \
-s 0:0,hostbridge \
-l bootrom,/path/to/test.fd \
-s 2:0,fbuf,tcp=127.0.0.1:5904,w=1920,h=1080 \
-s 1,lpc bhyve

View File

@ -0,0 +1,24 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type>hvm</type>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<graphics type='vnc' port='5904' autoport='no' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='default' heads='1'>
<resolution x='1920' y='1080'/>
</model>
</video>
</devices>
</domain>

View File

@ -186,6 +186,7 @@ mymain(void)
DO_TEST("vnc-vga-on");
DO_TEST("vnc-vga-off");
DO_TEST("vnc-vga-io");
DO_TEST("vnc-resolution");
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);

View File

@ -0,0 +1,10 @@
/usr/sbin/bhyve \
-c 1 \
-m 214 \
-u \
-H \
-P \
-s 0:0,hostbridge \
-l bootrom,/path/to/test.fd \
-s 1:0,lpc \
-s 2:0,fbuf,tcp=127.0.0.1:5904,w=1920,h=1080 bhyve

View File

@ -0,0 +1 @@
dummy

View File

@ -0,0 +1,20 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
<loader readonly="yes" type="pflash">/path/to/test.fd</loader>
</os>
<devices>
<video>
<model type='gop' heads='1' primary='yes'>
<resolution x="1920" y="1080"/>
</model>
</video>
<graphics type='vnc' port='5904'>
<listen type='address' address='127.0.0.1'/>
</graphics>
</devices>
</domain>

View File

@ -197,6 +197,7 @@ mymain(void)
DO_TEST("vnc-vgaconf-off");
DO_TEST("vnc-vgaconf-io");
DO_TEST("vnc-autoport");
DO_TEST("vnc-resolution");
DO_TEST("cputopology");
DO_TEST_FAILURE("cputopology-nvcpu-mismatch");
DO_TEST("commandline");

View File

@ -0,0 +1,31 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64'>hvm</type>
<loader readonly='yes' type='pflash'>/path/to/test.fd</loader>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<controller type='pci' index='0' model='pci-root'/>
<controller type='isa' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</controller>
<graphics type='vnc' port='5904' autoport='no' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='gop' heads='1' primary='yes'>
<resolution x='1920' y='1080'/>
</model>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
</devices>
</domain>

View File

@ -106,6 +106,7 @@ mymain(void)
DO_TEST_DIFFERENT("vnc-vgaconf-off");
DO_TEST_DIFFERENT("vnc-vgaconf-io");
DO_TEST_DIFFERENT("vnc-autoport");
DO_TEST_DIFFERENT("vnc-resolution");
DO_TEST_DIFFERENT("commandline");
DO_TEST_DIFFERENT("msrs");
DO_TEST_DIFFERENT("sound");