[gnome-boxes/gnome-3-32] Revert "libvirt-machine/properties: Add "3D Acceleration" option"
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/gnome-3-32] Revert "libvirt-machine/properties: Add "3D Acceleration" option"
- Date: Tue, 11 Jun 2019 07:19:46 +0000 (UTC)
commit cbc70494d19a7d621882cfaf2e95e1996e553f22
Author: Felipe Borges <felipeborges gnome org>
Date: Tue Jun 11 07:18:47 2019 +0000
Revert "libvirt-machine/properties: Add "3D Acceleration" option"
This reverts commit 3ccadf3e716f2fcf4ff5bf2ef6cc286fa14264ac.
> There have been following string additions to module 'gnome-boxes.gnome-3-32':
>
> + "3D Acceleration"
This violated the string freeze.
src/box-config.vala | 5 ++
src/libvirt-machine-properties.vala | 27 -----------
src/libvirt-machine.vala | 92 ++++++++++++++++++++++---------------
3 files changed, 59 insertions(+), 65 deletions(-)
---
diff --git a/src/box-config.vala b/src/box-config.vala
index 15843b55..6710c17b 100644
--- a/src/box-config.vala
+++ b/src/box-config.vala
@@ -37,6 +37,11 @@
set { keyfile.set_string_list (group, "categories", value); }
}
+ public bool tweaked_accel3d {
+ get { return get_boolean (group, "tweaked-accel3d", false); }
+ set { keyfile.set_boolean (group, "tweaked-accel3d", value); }
+ }
+
public int64 access_last_time { set; get; }
public int64 access_first_time { set; get; }
public int64 access_total_time { set; get; } // in seconds
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index b34b4fbb..6d1bee9d 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -116,8 +116,6 @@ public string collect_logs () {
add_string_property (ref list, _("Display URL"), machine.display.uri);
}
- add_3d_acceleration_property (ref list);
-
break;
case PropertiesPage.SYSTEM:
@@ -679,29 +677,4 @@ private void add_run_in_bg_property (ref List<Boxes.Property> list) {
return property;
}
-
- private void add_3d_acceleration_property (ref List<Boxes.Property> list) {
- var toggle = new Gtk.Switch ();
- toggle.halign = Gtk.Align.START;
- var property = add_property (ref list, _("3D Acceleration"), toggle);
-
- machine.bind_property ("acceleration-3d", toggle, "active",
- BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
-
- machine.supports_accel3d.begin ((source, result) => {
- try {
- if (!machine.supports_accel3d.end (result)) {
- property.label.destroy ();
- property.widget.destroy ();
- }
- } catch (GLib.Error error) {
- warning (error.message);
- }
- });
-
- toggle.notify["active"].connect (() => {
- property.reboot_required = machine.is_on;
- });
-
- }
}
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 3b19dbac..0f1b8290 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -49,42 +49,6 @@
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.
@@ -281,7 +245,6 @@ else if (force_stopped) {
saved_properties = {
BoxConfig.SavedProperty () { name = "run-in-bg", default_value = false },
- BoxConfig.SavedProperty () { name = "acceleration-3d", default_value = false },
};
this.config.save_properties (this, saved_properties);
@@ -653,6 +616,59 @@ else if (state == MachineState.SLEEPING) {
}
}
}
+
+ /* Some users might have issues with 3D acceleration due to various setups
+ * with different video drivers in the host. So we should offer an option
+ * to run these VMs without 3D acceleration.
+ */
+ if (!config.tweaked_accel3d && yield supports_accel3d ()) {
+ Boxes.Notification notification = null;
+
+ Notification.OKFunc disable_accel3d = () => {
+ notification = null;
+
+ 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 (false);
+
+ devices.prepend (graphics_device);
+ } else if (device is GVirConfig.DomainVideo) {
+ var video_device = device as GVirConfig.DomainVideo;
+
+ video_device.set_accel3d (false);
+ devices.prepend (device);
+ } else {
+ devices.prepend (device);
+ }
+ }
+
+ devices.reverse ();
+ domain_config.set_devices (devices);
+
+ try {
+ domain.set_config (domain_config);
+ config.tweaked_accel3d = true;
+ } catch (GLib.Error error) {
+ debug ("Failed to disable 3d acceleration!\n");
+ }
+
+ force_shutdown ();
+ };
+
+ Notification.DismissFunc dismiss_notification = () => {
+ notification = null;
+
+ config.tweaked_accel3d = true;
+ };
+
+ var message = _("Experiencing graphics problems?");
+ notification = window.notificationbar.display_for_action (message,
+ _("Disable 3D acceleration"),
+ (owned) disable_accel3d,
+ (owned) dismiss_notification,
+ -1);
+ }
}
public override void restart () {
@@ -760,7 +776,7 @@ public override async void clone () {
}
}
- public async bool supports_accel3d () {
+ private async bool supports_accel3d () {
var os = yield get_os ();
if (os == null)
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]