[gnome-session] Check for GLES support when determining if session is accelerated
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] Check for GLES support when determining if session is accelerated
- Date: Sat, 9 Apr 2016 04:08:40 +0000 (UTC)
commit f144cd28e7cc2425c9df8e8c44ef70041f2d6404
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Apr 3 19:44:20 2016 -0700
Check for GLES support when determining if session is accelerated
Connect the new GLES helper to the code that determines if the session
is accelerated.
https://bugzilla.gnome.org/show_bug.cgi?id=686806
tools/gnome-session-check-accelerated.c | 47 +++++++++++++++++++++++--------
1 files changed, 35 insertions(+), 12 deletions(-)
---
diff --git a/tools/gnome-session-check-accelerated.c b/tools/gnome-session-check-accelerated.c
index 43b0f3a..d21744f 100644
--- a/tools/gnome-session-check-accelerated.c
+++ b/tools/gnome-session-check-accelerated.c
@@ -95,10 +95,11 @@ main (int argc, char **argv)
{
GdkDisplay *display = NULL;
int estatus;
- char *child_argv[] = { LIBEXECDIR "/gnome-session-check-accelerated-gl-helper", NULL };
+ char *gl_helper_argv[] = { LIBEXECDIR "/gnome-session-check-accelerated-gl-helper", NULL };
+ char *gles_helper_argv[] = { LIBEXECDIR "/gnome-session-check-accelerated-gles-helper", NULL };
Window rootwin;
glong is_accelerated, is_software_rendering;
- GError *error = NULL;
+ GError *gl_error = NULL, *gles_error = NULL;
/* 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
@@ -152,6 +153,9 @@ main (int argc, char **argv)
/* First indicate that a test is in progress */
is_accelerated = ACCEL_CHECK_RUNNING;
+ is_software_rendering = FALSE;
+ estatus = 1;
+
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
rootwin,
is_accelerated_atom,
@@ -159,20 +163,39 @@ main (int argc, char **argv)
gdk_display_sync (display);
- estatus = 1;
- if (!g_spawn_sync (NULL, (char**)child_argv, NULL, 0,
- NULL, NULL, NULL, NULL, &estatus, &error)) {
- is_accelerated = FALSE;
- is_software_rendering = FALSE;
- g_printerr ("gnome-session-check-accelerated: Failed to run helper: %s\n", error->message);
- g_clear_error (&error);
- } else {
+ /* First, try the GL helper */
+ if (g_spawn_sync (NULL, (char **) gl_helper_argv, NULL, 0,
+ NULL, NULL, NULL, NULL, &estatus, &gl_error)) {
is_accelerated = (WEXITSTATUS(estatus) == HELPER_ACCEL) || (WEXITSTATUS(estatus) ==
HELPER_SOFTWARE_RENDERING);
is_software_rendering = (WEXITSTATUS(estatus) == HELPER_SOFTWARE_RENDERING);
- if (!is_accelerated)
- g_printerr ("gnome-session-check-accelerated: Helper exited with code %d\n",
estatus);
+ if (is_accelerated)
+ goto finish;
+
+ g_printerr ("gnome-session-check-accelerated: GL Helper exited with code %d\n", estatus);
+ }
+
+ /* Then, try the GLES helper */
+ if (g_spawn_sync (NULL, (char **) gles_helper_argv, NULL, 0,
+ NULL, NULL, NULL, NULL, &estatus, &gles_error)) {
+ is_accelerated = (WEXITSTATUS(estatus) == HELPER_ACCEL);
+ if (is_accelerated)
+ goto finish;
+
+ g_printerr ("gnome-session-check-accelerated: GLES Helper exited with code %d\n", estatus);
+ }
+
+ /* Both helpers failed; print their error messages */
+ if (gl_error != NULL) {
+ g_printerr ("gnome-session-check-accelerated: Failed to run GL helper: %s\n",
gl_error->message);
+ g_clear_error (&gl_error);
+ }
+
+ if (gles_error != NULL) {
+ g_printerr ("gnome-session-check-accelerated: Failed to run GLES helper: %s\n",
gles_error->message);
+ g_clear_error (&gles_error);
}
+ finish:
if (is_accelerated) {
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
rootwin,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]