[gnome-shell/wip/hadess/add-nvidia-other-gpu-support: 3/4] shell: Prime the GPUs property cache for switcheroo-control
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/hadess/add-nvidia-other-gpu-support: 3/4] shell: Prime the GPUs property cache for switcheroo-control
- Date: Wed, 4 Dec 2019 18:07:47 +0000 (UTC)
commit 2a992e15a1de694c21745800de05b0f69394e454
Author: Bastien Nocera <hadess hadess net>
Date: Tue Dec 3 22:32:23 2019 +0100
shell: Prime the GPUs property cache for switcheroo-control
See: https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/781
src/shell-global.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index 4b331d63cc..504ac05946 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -121,6 +121,30 @@ G_DEFINE_TYPE(ShellGlobal, shell_global, G_TYPE_OBJECT);
static guint shell_global_signals [LAST_SIGNAL] = { 0 };
+static void
+got_switcheroo_control_gpus_property_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ ShellGlobal *global;
+ GError *error = NULL;
+ GVariant *gpus;
+
+ gpus = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object),
+ res, &error);
+ if (!gpus)
+ {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_debug ("Could not get GPUs property from switcheroo-control: %s", error->message);
+ g_clear_error (&error);
+ return;
+ }
+
+ global = user_data;
+ shell_net_hadess_switcheroo_control_set_gpus (SHELL_NET_HADESS_SWITCHEROO_CONTROL
(global->switcheroo_control),
+ gpus);
+}
+
static void
switcheroo_control_ready_cb (GObject *source_object,
GAsyncResult *res,
@@ -142,6 +166,21 @@ switcheroo_control_ready_cb (GObject *source_object,
global = user_data;
global->switcheroo_control = G_DBUS_PROXY (control);
g_debug ("Got switcheroo-control proxy successfully");
+
+ g_dbus_connection_call (g_dbus_proxy_get_connection (global->switcheroo_control),
+ g_dbus_proxy_get_name (global->switcheroo_control),
+ g_dbus_proxy_get_object_path (global->switcheroo_control),
+ "org.freedesktop.DBus.Properties",
+ "Get",
+ g_variant_new ("(ss)",
+ g_dbus_proxy_get_interface_name (global->switcheroo_control),
+ "GPUs"),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ global->switcheroo_cancellable,
+ got_switcheroo_control_gpus_property_cb,
+ user_data);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]