[gnome-boxes/release-gnome-3-32-2: 1/5] libvirt-machine: Add acceleration_3d property



commit 73dc85e5c24d326e73ff4e6925d55b500033b465
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu Sep 5 16:23:26 2019 +0200

    libvirt-machine: Add acceleration_3d property
    
    So we can verify which machines support it.

 src/libvirt-machine.vala | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 0f1b8290..79fd53d7 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -49,6 +49,42 @@
 
     public bool run_in_bg { get; set; } // If true, machine will never be paused automatically by Boxes.
 
+    private bool _acceleration_3d;
+    public bool acceleration_3d {
+        get {
+            return _acceleration_3d;
+        }
+
+        set {
+            _acceleration_3d = value;
+
+            GLib.List<GVirConfig.DomainDevice> devices = null;
+            foreach (var device in domain_config.get_devices ()) {
+                if (device is GVirConfig.DomainGraphicsSpice) {
+                    var graphics_device = VMConfigurator.create_graphics_device (_acceleration_3d);
+
+                    devices.prepend (graphics_device);
+                } else if (device is GVirConfig.DomainVideo) {
+                    var video_device = device as GVirConfig.DomainVideo;
+                    video_device.set_accel3d (_acceleration_3d);
+
+                    devices.prepend (video_device);
+                } else {
+                    devices.prepend (device);
+                }
+            }
+
+            devices.reverse ();
+            domain_config.set_devices (devices);
+
+            try {
+                domain.set_config (domain_config);
+            } catch (GLib.Error error) {
+                warning ("Failed to disable 3D Acceleration");
+            }
+        }
+    }
+
     public override bool is_local {
         get {
             // If the URI is prefixed by "qemu" or "qemu+unix" and the domain is "system" of "session" then 
it is local.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]