[gnome-shell] Revert "plugin: Don't query for swap_events support directly"



commit 66f5e4b44def333b0f3116d0d1ca3b479968d850
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Tue Jun 24 17:37:23 2014 +0200

    Revert "plugin: Don't query for swap_events support directly"
    
    This reverts commit e23c2ffecc61c088f10480c890077488d2d9c5f5.
    
    The patch was intended as a cleanup but accidently removed the setting of the
    event base, breaking the swap event handling.
    
    With the event base setting removing the other code isn't much of a cleanup so
    just revert it.

 src/gnome-shell-plugin.c |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-shell-plugin.c b/src/gnome-shell-plugin.c
index 3c99c75..2432310 100644
--- a/src/gnome-shell-plugin.c
+++ b/src/gnome-shell-plugin.c
@@ -164,6 +164,45 @@ gnome_shell_plugin_init (GnomeShellPlugin *shell_plugin)
 {
 }
 
+static gboolean
+gnome_shell_plugin_has_swap_event (GnomeShellPlugin *shell_plugin)
+{
+  MetaPlugin *plugin = META_PLUGIN (shell_plugin);
+  CoglDisplay *cogl_display =
+    cogl_context_get_display (shell_plugin->cogl_context);
+  CoglRenderer *renderer = cogl_display_get_renderer (cogl_display);
+  const char * (* query_extensions_string) (Display *dpy, int screen);
+  Bool (* query_extension) (Display *dpy, int *error, int *event);
+  MetaScreen *screen;
+  MetaDisplay *display;
+  Display *xdisplay;
+  const char *glx_extensions;
+
+  /* We will only get swap events if Cogl is using GLX */
+  if (cogl_renderer_get_winsys_id (renderer) != COGL_WINSYS_ID_GLX)
+    return FALSE;
+
+  screen = meta_plugin_get_screen (plugin);
+  display = meta_screen_get_display (screen);
+
+  xdisplay = meta_display_get_xdisplay (display);
+
+  query_extensions_string =
+    (void *) cogl_get_proc_address ("glXQueryExtensionsString");
+  query_extension =
+    (void *) cogl_get_proc_address ("glXQueryExtension");
+
+  query_extension (xdisplay,
+                   &shell_plugin->glx_error_base,
+                   &shell_plugin->glx_event_base);
+
+  glx_extensions =
+    query_extensions_string (xdisplay,
+                             meta_screen_get_screen_number (screen));
+
+  return strstr (glx_extensions, "GLX_INTEL_swap_event") != NULL;
+}
+
 static void
 gnome_shell_plugin_start (MetaPlugin *plugin)
 {
@@ -176,7 +215,8 @@ gnome_shell_plugin_start (MetaPlugin *plugin)
   backend = clutter_get_default_backend ();
   shell_plugin->cogl_context = clutter_backend_get_cogl_context (backend);
 
-  shell_plugin->have_swap_event = clutter_feature_available (CLUTTER_FEATURE_SWAP_EVENTS);
+  shell_plugin->have_swap_event =
+    gnome_shell_plugin_has_swap_event (shell_plugin);
 
   shell_perf_log_define_event (shell_perf_log_get_default (),
                                "glx.swapComplete",


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