summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2016-10-19 13:31:20 +0200
committerBastien Nocera <hadess@hadess.net>2016-10-20 19:57:54 +0200
commita3aeacf39b463f489686cd05478761f943bf146d (patch)
tree15a9b080311f8a0e15d0ca19fc9f19d21a68087f /tools
parent6e474f979da2f6502f820ec652da11bc683ff344 (diff)
downloadgnome-session-a3aeacf39b463f489686cd05478761f943bf146d.tar.gz
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
Diffstat (limited to 'tools')
-rw-r--r--tools/gnome-session-check-accelerated.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/gnome-session-check-accelerated.c b/tools/gnome-session-check-accelerated.c
index a54a34ba..97e8dc0e 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;