summaryrefslogtreecommitdiff
path: root/mate-session
diff options
context:
space:
mode:
Diffstat (limited to 'mate-session')
-rw-r--r--mate-session/gsm-manager.c23
-rw-r--r--mate-session/gsm-manager.h3
-rw-r--r--mate-session/main.c56
-rw-r--r--mate-session/org.gnome.SessionManager.xml12
4 files changed, 94 insertions, 0 deletions
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c
index f9bdda0..c9c4e29 100644
--- a/mate-session/gsm-manager.c
+++ b/mate-session/gsm-manager.c
@@ -144,6 +144,8 @@ typedef struct {
GSettings *settings_lockdown;
GSettings *settings_screensaver;
+ const char *renderer;
+
DBusGProxy *bus_proxy;
DBusGConnection *connection;
gboolean dbus_disconnected : 1;
@@ -152,6 +154,7 @@ typedef struct {
enum {
PROP_0,
PROP_CLIENT_STORE,
+ PROP_RENDERER,
PROP_FAILSAFE
};
@@ -1676,6 +1679,15 @@ gsm_manager_start (GsmManager *manager)
start_phase (manager);
}
+void
+_gsm_manager_set_renderer (GsmManager *manager,
+ const char *renderer)
+{
+ GsmManagerPrivate *priv;
+ priv = gsm_manager_get_instance_private (manager);
+ priv->renderer = renderer;
+}
+
static gboolean
_app_has_app_id (const char *id,
GsmApp *app,
@@ -2529,6 +2541,9 @@ gsm_manager_get_property (GObject *object,
case PROP_CLIENT_STORE:
g_value_set_object (value, priv->clients);
break;
+ case PROP_RENDERER:
+ g_value_set_string (value, priv->renderer);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2734,6 +2749,14 @@ gsm_manager_class_init (GsmManagerClass *klass)
GSM_TYPE_STORE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class,
+ PROP_RENDERER,
+ g_param_spec_string ("renderer",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READABLE));
+
dbus_g_object_type_install_info (GSM_TYPE_MANAGER, &dbus_glib_gsm_manager_object_info);
dbus_g_error_domain_register (GSM_MANAGER_ERROR, NULL, GSM_MANAGER_TYPE_ERROR);
}
diff --git a/mate-session/gsm-manager.h b/mate-session/gsm-manager.h
index 73e637e..0c07a2f 100644
--- a/mate-session/gsm-manager.h
+++ b/mate-session/gsm-manager.h
@@ -179,6 +179,9 @@ gboolean gsm_manager_is_session_running (GsmManager *mana
gboolean *running,
GError **error);
+void _gsm_manager_set_renderer (GsmManager *manager,
+ const char *renderer);
+
G_END_DECLS
#endif /* __GSM_MANAGER_H */
diff --git a/mate-session/main.c b/mate-session/main.c
index cb1cbe7..4522aff 100644
--- a/mate-session/main.c
+++ b/mate-session/main.c
@@ -82,6 +82,8 @@
static gboolean failsafe = FALSE;
static gboolean show_version = FALSE;
static gboolean debug = FALSE;
+static gboolean disable_acceleration_check = FALSE;
+static char *gl_renderer = NULL;
static gboolean
initialize_gsettings (void)
@@ -569,6 +571,25 @@ static void set_overlay_scroll (void)
g_object_unref (settings);
}
+static gboolean
+check_gl (GError **error)
+{
+ int status;
+ char *argv[] = { LIBEXECDIR "/mate-session-check-accelerated", NULL };
+
+ if (getenv ("DISPLAY") == NULL) {
+ /* Not connected to X11, someone else will take care of checking GL */
+ return TRUE;
+ }
+
+ if (!g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL, &gl_renderer, NULL,
+ &status, error)) {
+ return FALSE;
+ }
+
+ return g_spawn_check_exit_status (status, error);
+}
+
int main(int argc, char** argv)
{
struct sigaction sa;
@@ -581,12 +602,14 @@ int main(int argc, char** argv)
GSettings* accessibility_settings;
MdmSignalHandler* signal_handler;
static char** override_autostart_dirs = NULL;
+ gboolean gl_failed = FALSE;
static GOptionEntry entries[] = {
{"autostart", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &override_autostart_dirs, N_("Override standard autostart directories"), NULL},
{"debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL},
{"failsafe", 'f', 0, G_OPTION_ARG_NONE, &failsafe, N_("Do not load user-specified applications"), NULL},
{"version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL},
+ { "disable-acceleration-check", 0, 0, G_OPTION_ARG_NONE, &disable_acceleration_check, N_("Disable hardware acceleration check"), NULL },
{NULL, 0, 0, 0, NULL, NULL, NULL }
};
@@ -638,6 +661,33 @@ int main(int argc, char** argv)
mdm_log_set_debug(debug);
+ if (disable_acceleration_check) {
+ g_debug ("hardware acceleration check is disabled");
+ } else {
+ /* Check GL, if it doesn't work out then force software fallback */
+ if (!check_gl (&error)) {
+ gl_failed = TRUE;
+
+ g_debug ("hardware acceleration check failed: %s",
+ error? error->message : "");
+ g_clear_error (&error);
+ if (g_getenv ("LIBGL_ALWAYS_SOFTWARE") == NULL) {
+ g_setenv ("LIBGL_ALWAYS_SOFTWARE", "1", TRUE);
+ if (!check_gl (&error)) {
+ g_warning ("software acceleration check failed: %s",
+ error? error->message : "");
+ g_clear_error (&error);
+ } else {
+ gl_failed = FALSE;
+ }
+ }
+ }
+ }
+
+ if (gl_failed) {
+ g_warning ("gl_failed!");
+ }
+
if (g_getenv ("XDG_CURRENT_DESKTOP") == NULL)
gsm_util_setenv ("XDG_CURRENT_DESKTOP", "MATE");
@@ -703,6 +753,7 @@ int main(int argc, char** argv)
}
gsm_xsmp_server_start(xsmp_server);
+ _gsm_manager_set_renderer (manager, gl_renderer);
gsm_manager_start(manager);
gtk_main();
@@ -718,6 +769,11 @@ int main(int argc, char** argv)
g_object_unref(manager);
}
+ if (gl_renderer != NULL)
+ {
+ g_free (gl_renderer);
+ }
+
if (client_store != NULL)
{
g_object_unref(client_store);
diff --git a/mate-session/org.gnome.SessionManager.xml b/mate-session/org.gnome.SessionManager.xml
index 190f372..47deb6b 100644
--- a/mate-session/org.gnome.SessionManager.xml
+++ b/mate-session/org.gnome.SessionManager.xml
@@ -403,5 +403,17 @@
</doc:doc>
</signal>
+ <!-- Properties -->
+
+ <property name="Renderer" type="s" access="read">
+ <doc:doc>
+ <doc:description>
+ <doc:para>The renderer for the session that has been loaded.
+ At the moment this supports GL and GLES, and is only used for the
+ X session.</doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
</interface>
</node>