Merge ~albertomilone/ubuntu/+source/gdm3/+git/gdm3:lp1778011 into ~ubuntu-desktop/ubuntu/+source/gdm3:ubuntu/master

Proposed by Alberto Milone on 2018-07-30
Status: Merged
Merged at revision: eb0dac1244b935edba502b2c4b1396d1497dca0c
Proposed branch: ~albertomilone/ubuntu/+source/gdm3/+git/gdm3:lp1778011
Merge into: ~ubuntu-desktop/ubuntu/+source/gdm3:ubuntu/master
Diff against target: 84 lines (+33/-18)
2 files modified
debian/changelog (+8/-0)
debian/patches/ubuntu_nvidia_prime.patch (+25/-18)
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) (community) Approve on 2018-07-30
Ubuntu Desktop 2018-07-30 Pending
Review via email: mp+351810@code.launchpad.net

Commit message

ubuntu_nvidia_prime.patch: run scripts for Prime before and after Gdm sessions (LP: #1778011).

Description of the change

The original patch called the script only when the X session ended (on_x_server_finished). For some reason that didn't really happen when closing an X session in Gdm 3. Calling the script in gdm_session_close() seems to be much more reliable.

To post a comment you must log in.
Marco Trevisan (Treviño) (3v1n0) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 305efcb..0106726 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+gdm3 (3.28.2-3ubuntu2) UNRELEASED; urgency=medium
7+
8+ [ Alberto Milone ]
9+ * ubuntu_nvidia_prime.patch:
10+ - Run scripts for Prime before and after Gdm sessions (LP: #1778011).
11+
12+ -- Alberto Milone <alberto.milone@canonical.com> Mon, 30 Jul 2018 18:31:17 +0200
13+
14 gdm3 (3.28.2-3ubuntu1) cosmic; urgency=medium
15
16 * Merge with Debian. Remaining changes:
17diff --git a/debian/patches/ubuntu_nvidia_prime.patch b/debian/patches/ubuntu_nvidia_prime.patch
18index 64b36f0..27fcf5f 100644
19--- a/debian/patches/ubuntu_nvidia_prime.patch
20+++ b/debian/patches/ubuntu_nvidia_prime.patch
21@@ -1,15 +1,17 @@
22 From: Tim Lunn <tim@feathertop.org>
23 Date: Sat, 22 Mar 2014 00:23:12 +0100
24-Subject: Add hook to run prime-offload (as root) move Prime helpers into the
25- gdm-x-session wrapper
26+Subject: Add hooks to run prime scripts (as root) before and after a
27+ gdm-session
28
29+This allows enabling and disabling the dGPU on log out.
30 ---
31 common/gdm-common.c | 2 +-
32- daemon/gdm-x-session.c | 10 ++++++++++
33+ daemon/gdm-session.c | 6 ++++++
34+ daemon/gdm-x-session.c | 5 +++++
35 data/Makefile.am | 28 ++++++++++++++++++++++++++--
36 data/Prime | 6 ++++++
37 data/PrimeOff | 6 ++++++
38- 5 files changed, 49 insertions(+), 3 deletions(-)
39+ 6 files changed, 50 insertions(+), 3 deletions(-)
40 create mode 100644 data/Prime
41 create mode 100644 data/PrimeOff
42
43@@ -26,23 +28,28 @@ index c44fa99..a9902c3 100644
44 display_name,
45 display_hostname,
46 display_x11_authority_file);
47+diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
48+index 19d26c9..e390130 100644
49+--- a/daemon/gdm-session.c
50++++ b/daemon/gdm-session.c
51+@@ -2865,6 +2865,12 @@ gdm_session_close (GdmSession *self)
52+
53+ g_list_free_full (self->priv->outside_connections, g_object_unref);
54+ self->priv->outside_connections = NULL;
55++
56++ /* Run PrimeOff after the session is closed */
57++ gdm_run_script (GDMCONFDIR "/PrimeOff", "root",
58++ NULL,
59++ NULL,
60++ NULL);
61+ }
62+
63+ void
64 diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c
65-index 3b2fcef..08ac5ab 100644
66+index 3b2fcef..9a57300 100644
67 --- a/daemon/gdm-x-session.c
68 +++ b/daemon/gdm-x-session.c
69-@@ -172,6 +172,11 @@ on_x_server_finished (GSubprocess *subprocess,
70- if (cancelled) {
71- goto out;
72- }
73-+ gdm_run_script (GDMCONFDIR "/PrimeOff", "root",
74-+ state->display_name,
75-+ NULL, /* hostname */
76-+ state->auth_file);
77-+
78-
79- if (g_subprocess_get_if_exited (subprocess)) {
80- int exit_status;
81-@@ -614,6 +619,11 @@ spawn_session (State *state,
82+@@ -614,6 +614,11 @@ spawn_session (State *state,
83
84 g_debug ("Running X session");
85

Subscribers

People subscribed via source and target branches

to all changes: