[gnome-session] tools: Don't read cached info about 1st GPU when 2nd one is requested



commit a3aeacf39b463f489686cd05478761f943bf146d
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Oct 19 13:31:20 2016 +0200

    tools: Don't read cached info about 1st GPU when 2nd one is requested
    
    This avoids both GPUs having the name of the first one when running the
    Details settings panel under X.org.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773216

 tools/gnome-session-check-accelerated.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/tools/gnome-session-check-accelerated.c b/tools/gnome-session-check-accelerated.c
index a54a34b..97e8dc0 100644
--- a/tools/gnome-session-check-accelerated.c
+++ b/tools/gnome-session-check-accelerated.c
@@ -112,6 +112,19 @@ get_gtk_gles_renderer (void)
         return renderer;
 }
 
+static gboolean
+is_discrete_gpu_check (void)
+{
+       const char *dri_prime;
+
+       dri_prime = g_getenv ("DRI_PRIME");
+       if (!dri_prime)
+               return FALSE;
+       if (*dri_prime != '1')
+               return FALSE;
+       return TRUE;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -128,9 +141,11 @@ main (int argc, char **argv)
 
         /* gnome-session-check-accelerated gets run before X is started in the wayland
          * case, and it currently requires X. Until we have that working, just always
-         * assume wayland will work
+         * assume wayland will work.
+         * Also make sure that we don't read cached information about the first GPU
+         * when requesting information about the second.
          */
-        if (g_strcmp0 (g_getenv ("XDG_SESSION_TYPE"), "x11") != 0) {
+        if (is_discrete_gpu_check () || g_strcmp0 (g_getenv ("XDG_SESSION_TYPE"), "x11") != 0) {
                 renderer_string = get_gtk_gles_renderer ();
                 g_print ("%s", renderer_string);
                 return 0;


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