[gnome-settings-daemon] remote-display: if llvmpipe was detected, disable animations



commit 14db1624b5c693a93b3b50f2cc07df93cf0d10e1
Author: Frederic Crozat <fcrozat suse com>
Date:   Wed Jul 17 16:47:05 2013 +0200

    remote-display: if llvmpipe was detected, disable animations
    
    If _GNOME_IS_SOFTWARE_RENDERING X Atom is detected on root window,
    disable animations.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704402

 .../remote-display/gsd-remote-display-manager.c    |   39 ++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/plugins/remote-display/gsd-remote-display-manager.c 
b/plugins/remote-display/gsd-remote-display-manager.c
index c4e1c03..a54fb7c 100644
--- a/plugins/remote-display/gsd-remote-display-manager.c
+++ b/plugins/remote-display/gsd-remote-display-manager.c
@@ -34,6 +34,7 @@
 #include <glib/gi18n.h>
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
+#include <X11/Xatom.h>
 
 #include "gnome-settings-bus.h"
 #include "gnome-settings-profile.h"
@@ -158,6 +159,35 @@ gsd_display_has_extension (const gchar *ext)
                                ext, &op, &event, &error);
 }
 
+static gboolean
+gsd_display_has_llvmpipe (void)
+{
+        glong is_software_rendering_atom;
+        Atom type;
+        gint format;
+        gulong nitems;
+        gulong bytes_after;
+        guchar *data;
+        GdkDisplay *display;
+
+        display = gdk_display_get_default ();
+        is_software_rendering_atom = gdk_x11_get_xatom_by_name_for_display (display, 
"_GNOME_IS_SOFTWARE_RENDERING");
+        gdk_x11_display_error_trap_push (display);
+        XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),  gdk_x11_get_default_root_xwindow (),
+                            is_software_rendering_atom,
+                            0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems,
+                            &bytes_after, &data);
+        gdk_x11_display_error_trap_pop_ignored (display);
+
+        if (type == XA_CARDINAL) {
+               glong *is_accelerated_ptr = (glong*) data;
+
+               return (*is_accelerated_ptr == 1);
+        }
+
+        return FALSE;
+}
+
 gboolean
 gsd_remote_display_manager_start (GsdRemoteDisplayManager *manager,
                                  GError               **error)
@@ -188,6 +218,15 @@ gsd_remote_display_manager_start (GsdRemoteDisplayManager *manager,
                goto out;
        }
 
+       /* disable animations if running under llvmpipe */
+       if (gsd_display_has_llvmpipe ()) {
+               g_debug ("Disabling animations because llvmpipe was detected");
+               g_settings_set_boolean (manager->priv->desktop_settings,
+                                       "enable-animations",
+                                       FALSE);
+               goto out;
+       }
+
        /* Monitor Vino's usage */
        manager->priv->vino_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
                                                         "org.gnome.Vino",


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