Merge ~vanvugt/ubuntu/+source/mutter:fix-lp1847551 into ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/master

Proposed by Daniel van Vugt on 2019-10-22
Status: Rejected
Rejected by: Iain Lane on 2019-10-23
Proposed branch: ~vanvugt/ubuntu/+source/mutter:fix-lp1847551
Merge into: ~ubuntu-desktop/ubuntu/+source/mutter:ubuntu/master
Diff against target: 168 lines (+146/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/fix-gamma-1cc249fe+1b470979.patch (+138/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Iain Lane 2019-10-22 Disapprove on 2019-10-23
Pierre Equoy 2019-10-22 Pending
Review via email: mp+374507@code.launchpad.net

Commit message

Add fix-gamma-1cc249fe+1b470979.patch (LP: #1847551)

to fix broken night light and colour profiles.

Description of the change

Tested. Works.

To post a comment you must log in.
Iain Lane (laney) wrote :

Thanks, but since Marco (probably prompted by discussing this bug, so it wasn't wasted) proposed taking the whole gnome-3-34 branch up until yesterday, which will include this same fix we won't need a separate upload.

review: Disapprove
Daniel van Vugt (vanvugt) wrote :

Yes I mentioned 2 days ago I was hesitant to create this merge proposal because Marco would usually do that :)

Marco Trevisan (TreviƱo) (3v1n0) wrote :

Sorry, I should have had replied to the comment on IRC but I think I read it when you were already off.

Anyways, we'll get more fixes all together :)

Daniel van Vugt (vanvugt) wrote :

No problem. This was only 10-15 minutes work.

Unmerged commits

a6c00be... by Daniel van Vugt on 2019-10-22

Add fix-gamma-1cc249fe+1b470979.patch (LP: #1847551)

to fix broken night light and colour profiles.

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 06847be..2d01ec3 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+mutter (3.34.1-1ubuntu2) UNRELEASED; urgency=medium
7+
8+ * Add patch fix-gamma-1cc249fe+1b470979.patch to fix broken night light
9+ and colour profiles (LP: #1847551)
10+
11+ -- Daniel van Vugt <daniel.van.vugt@canonical.com> Tue, 22 Oct 2019 17:47:58 +0800
12+
13 mutter (3.34.1-1ubuntu1) eoan; urgency=medium
14
15 * Merge with debian. Remaining changes:
16diff --git a/debian/patches/fix-gamma-1cc249fe+1b470979.patch b/debian/patches/fix-gamma-1cc249fe+1b470979.patch
17new file mode 100644
18index 0000000..6b149a4
19--- /dev/null
20+++ b/debian/patches/fix-gamma-1cc249fe+1b470979.patch
21@@ -0,0 +1,138 @@
22+Description: Fix broken night light and colour profiles in mutter 3.34.1
23+Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
24+Origin: upstream commits 1cc249fe+1b470979
25+Bug: https://gitlab.gnome.org/GNOME/mutter/issues/851
26+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1847551
27+Forwarded: not-needed
28+Last-Update: 2019-10-22
29+
30+diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c
31+index 3610df903..da99a58cd 100644
32+--- a/src/backends/native/meta-kms-crtc.c
33++++ b/src/backends/native/meta-kms-crtc.c
34+@@ -143,14 +143,26 @@ meta_kms_crtc_update_state (MetaKmsCrtc *crtc)
35+ drmModeFreeCrtc (drm_crtc);
36+ }
37+
38++static void
39++clear_gamma_state (MetaKmsCrtc *crtc)
40++{
41++ crtc->current_state.gamma.size = 0;
42++ g_clear_pointer (&crtc->current_state.gamma.red, g_free);
43++ g_clear_pointer (&crtc->current_state.gamma.green, g_free);
44++ g_clear_pointer (&crtc->current_state.gamma.blue, g_free);
45++}
46++
47+ void
48+ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc,
49+ MetaKmsUpdate *update)
50+ {
51++ gboolean is_gamma_valid;
52+ GList *mode_sets;
53+ GList *crtc_gammas;
54+ GList *l;
55+
56++ is_gamma_valid = TRUE;
57++
58+ mode_sets = meta_kms_update_get_mode_sets (update);
59+ for (l = mode_sets; l; l = l->next)
60+ {
61+@@ -178,6 +190,8 @@ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc,
62+ crtc->current_state.drm_mode = (drmModeModeInfo) { 0 };
63+ }
64+
65++ is_gamma_valid = FALSE;
66++
67+ break;
68+ }
69+
70+@@ -196,8 +210,36 @@ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc,
71+ g_memdup (gamma->green, gamma->size * sizeof (uint16_t));
72+ crtc->current_state.gamma.blue =
73+ g_memdup (gamma->blue, gamma->size * sizeof (uint16_t));
74++
75++ is_gamma_valid = TRUE;
76+ break;
77+ }
78++
79++ if (!is_gamma_valid)
80++ {
81++ if (crtc->current_state.is_drm_mode_valid)
82++ {
83++ MetaKmsImplDevice *impl_device;
84++ drmModeCrtc *drm_crtc;
85++
86++ impl_device = meta_kms_device_get_impl_device (crtc->device);
87++ drm_crtc = drmModeGetCrtc (meta_kms_impl_device_get_fd (impl_device),
88++ crtc->id);
89++ if (drm_crtc)
90++ {
91++ read_gamma_state (crtc, impl_device, drm_crtc);
92++ drmModeFreeCrtc (drm_crtc);
93++ }
94++ else
95++ {
96++ clear_gamma_state (crtc);
97++ }
98++ }
99++ else
100++ {
101++ clear_gamma_state (crtc);
102++ }
103++ }
104+ }
105+
106+ MetaKmsCrtc *
107+@@ -220,9 +262,7 @@ meta_kms_crtc_finalize (GObject *object)
108+ {
109+ MetaKmsCrtc *crtc = META_KMS_CRTC (object);
110+
111+- g_clear_pointer (&crtc->current_state.gamma.red, g_free);
112+- g_clear_pointer (&crtc->current_state.gamma.green, g_free);
113+- g_clear_pointer (&crtc->current_state.gamma.blue, g_free);
114++ clear_gamma_state (crtc);
115+
116+ G_OBJECT_CLASS (meta_kms_crtc_parent_class)->finalize (object);
117+ }
118+diff --git a/src/backends/native/meta-kms-update-private.h b/src/backends/native/meta-kms-update-private.h
119+index 88e2590af..df7737c9b 100644
120+--- a/src/backends/native/meta-kms-update-private.h
121++++ b/src/backends/native/meta-kms-update-private.h
122+@@ -110,6 +110,4 @@ GList * meta_kms_update_get_connector_properties (MetaKmsUpdate *update);
123+
124+ GList * meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update);
125+
126+-gboolean meta_kms_update_has_mode_set (MetaKmsUpdate *update);
127+-
128+ #endif /* META_KMS_UPDATE_PRIVATE_H */
129+diff --git a/src/backends/native/meta-kms-update.c b/src/backends/native/meta-kms-update.c
130+index 2a4a05c3e..c946aa7a2 100644
131+--- a/src/backends/native/meta-kms-update.c
132++++ b/src/backends/native/meta-kms-update.c
133+@@ -282,12 +282,6 @@ meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update)
134+ return update->crtc_gammas;
135+ }
136+
137+-gboolean
138+-meta_kms_update_has_mode_set (MetaKmsUpdate *update)
139+-{
140+- return !!update->mode_sets;
141+-}
142+-
143+ void
144+ meta_kms_update_seal (MetaKmsUpdate *update)
145+ {
146+diff --git a/src/backends/native/meta-kms.c b/src/backends/native/meta-kms.c
147+index 9485bb4e8..804a1adda 100644
148+--- a/src/backends/native/meta-kms.c
149++++ b/src/backends/native/meta-kms.c
150+@@ -211,8 +211,7 @@ meta_kms_update_process_in_impl (MetaKmsImpl *impl,
151+
152+ ret = meta_kms_impl_process_update (impl, update, error);
153+
154+- if (meta_kms_update_has_mode_set (update))
155+- meta_kms_predict_states_in_impl (meta_kms_impl_get_kms (impl), update);
156++ meta_kms_predict_states_in_impl (meta_kms_impl_get_kms (impl), update);
157+
158+ return ret;
159+ }
160diff --git a/debian/patches/series b/debian/patches/series
161index 8590a4e..e12ca3f 100644
162--- a/debian/patches/series
163+++ b/debian/patches/series
164@@ -4,3 +4,4 @@ meson-add-back-default_driver-option.patch
165 x11-Add-support-for-fractional-scaling-using-Randr.patch
166 debian/synaptics-support.patch
167 debian/tests-Tag-closed-transient-no-input-tests-as-flaky.patch
168+fix-gamma-1cc249fe+1b470979.patch

Subscribers

People subscribed via source and target branches