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

Proposed by Daniel van Vugt
Status: Rejected
Rejected by: Iain Lane
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 Disapprove
Pierre Equoy 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.
Revision history for this message
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
Revision history for this message
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 :)

Revision history for this message
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 :)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

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

Unmerged commits

a6c00be... by Daniel van Vugt

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

Subscribers

People subscribed via source and target branches