[gnome-boxes/virtio-gpu-and-virgl: 11/11] vm-configurator: Enable virtio-gpu and virgil to new VMs
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/virtio-gpu-and-virgl: 11/11] vm-configurator: Enable virtio-gpu and virgil to new VMs
- Date: Fri, 14 Dec 2018 15:47:04 +0000 (UTC)
commit a50b713e6a3f984e66cad10369ff9779407edac1
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Feb 26 01:57:49 2016 +0100
vm-configurator: Enable virtio-gpu and virgil to new VMs
We can query osinfo-db to verify whether the guest OS supports the
virtio-gpu device. If it does, we can also enable 3D acceleration
using OpenGL.
Based on a patch from Marc-André Lureau <marcandre lureau gmail com>.
Rebased-by: Felipe Borges <felipeborges gnome org>
Fixes #83
src/vm-configurator.vala | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 9e8e24ef..acc233f7 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -82,7 +82,9 @@ public static Domain create_domain_config (InstallerMedia install_media, string
set_target_media_config (domain, target_path, install_media);
install_media.setup_domain_config (domain);
- var graphics = create_graphics_device ();
+ bool accel3d;
+ set_video_config (domain, install_media, out accel3d);
+ var graphics = create_graphics_device (accel3d);
domain.add_device (graphics);
// SPICE agent channel. This is needed for features like copy&paste between host and guest etc to
work.
@@ -102,7 +104,6 @@ public static Domain create_domain_config (InstallerMedia install_media, string
add_smartcard_support (domain);
#endif
- set_video_config (domain, install_media);
set_sound_config (domain, install_media);
set_tablet_config (domain, install_media);
set_mouse_config (domain, install_media);
@@ -274,12 +275,18 @@ public static async void update_existing_domain (Domain domain,
GLib.List<GVirConfig.DomainDevice> devices = null;
DomainInterface iface = null;
DomainGraphicsSpice graphics = null;
+ bool accel3d = false;
DomainChannel channel_webdav = null;
foreach (var device in domain.get_devices ()) {
if (device is DomainInterface)
iface = device as DomainInterface;
else if (device is DomainGraphicsSpice)
graphics = device as DomainGraphicsSpice;
+ else if (device is DomainVideo) {
+ var model = (device as DomainVideo).get_model ();
+ accel3d = (model == DomainVideoModel.VIRTIO);
+ devices.prepend (device);
+ }
else if (device is DomainChannel) {
var device_channel = device as DomainChannel;
if (device_channel.get_target_name () == WEBDAV_CHANNEL_URI)
@@ -303,7 +310,7 @@ else if (device is DomainChannel) {
}
if (graphics != null)
- devices.prepend (create_graphics_device ());
+ devices.prepend (create_graphics_device (accel3d));
if (channel_webdav == null)
devices.prepend (create_webdav_channel ());
@@ -373,9 +380,16 @@ private static void set_os_config (Domain domain, InstallerMedia install_media,
domain.set_os (os);
}
- private static void set_video_config (Domain domain, InstallerMedia install_media) {
+ private static void set_video_config (Domain domain, InstallerMedia install_media, out bool accel3d) {
var video = new DomainVideo ();
- video.set_model (DomainVideoModel.VIRTIO);
+ video.set_model (DomainVideoModel.QXL);
+
+ var device = find_device_by_prop (install_media.supported_devices, DEVICE_PROP_NAME,
"virtio1.0-gpu");
+ accel3d = (device != null);
+ if (accel3d) {
+ video.set_model (DomainVideoModel.VIRTIO);
+ video.set_accel3d (accel3d);
+ }
domain.add_device (video);
}
@@ -615,9 +629,10 @@ public static DomainInterface create_network_interface (Domain domain, bool brid
return iface;
}
- public static DomainGraphicsSpice create_graphics_device () {
+ public static DomainGraphicsSpice create_graphics_device (bool accel3d = false) {
var graphics = new DomainGraphicsSpice ();
graphics.set_autoport (false);
+ graphics.set_gl (accel3d);
graphics.set_image_compression (DomainGraphicsSpiceImageCompression.OFF);
return graphics;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]