parent
126c434635
commit
72416b7bbd
218
0001-monitor-manager-Add-NightLightSupported-property-to-.patch
Normal file
218
0001-monitor-manager-Add-NightLightSupported-property-to-.patch
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
From f21c8614daeb70a021c128b97c000a92652cf6f8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
||||||
|
Date: Thu, 24 Feb 2022 12:32:27 +0100
|
||||||
|
Subject: [PATCH] monitor-manager: Add NightLightSupported property to
|
||||||
|
DisplayConfig
|
||||||
|
|
||||||
|
This checks whether it's possible to set a CRTC GAMMA_LUT, which is what
|
||||||
|
is necessary to implement night light.
|
||||||
|
---
|
||||||
|
src/backends/meta-monitor-manager.c | 76 ++++++++++++++++---
|
||||||
|
.../native/meta-monitor-manager-native.c | 25 ++++--
|
||||||
|
.../x11/meta-monitor-manager-xrandr.c | 9 ++-
|
||||||
|
src/org.gnome.Mutter.DisplayConfig.xml | 7 ++
|
||||||
|
4 files changed, 99 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
|
||||||
|
index 75146950c3..0f30b3de25 100644
|
||||||
|
--- a/src/backends/meta-monitor-manager.c
|
||||||
|
+++ b/src/backends/meta-monitor-manager.c
|
||||||
|
@@ -952,6 +952,59 @@ update_panel_orientation_managed (MetaMonitorManager *manager)
|
||||||
|
handle_orientation_change (orientation_manager, manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+meta_monitor_manager_get_crtc_gamma (MetaMonitorManager *manager,
|
||||||
|
+ MetaCrtc *crtc,
|
||||||
|
+ size_t *size,
|
||||||
|
+ unsigned short **red,
|
||||||
|
+ unsigned short **green,
|
||||||
|
+ unsigned short **blue)
|
||||||
|
+{
|
||||||
|
+ MetaMonitorManagerClass *klass = META_MONITOR_MANAGER_GET_CLASS (manager);
|
||||||
|
+
|
||||||
|
+ if (klass->get_crtc_gamma)
|
||||||
|
+ {
|
||||||
|
+ klass->get_crtc_gamma (manager, crtc, size, red, green, blue);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if (size)
|
||||||
|
+ *size = 0;
|
||||||
|
+ if (red)
|
||||||
|
+ *red = NULL;
|
||||||
|
+ if (green)
|
||||||
|
+ *green = NULL;
|
||||||
|
+ if (blue)
|
||||||
|
+ *blue = NULL;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static gboolean
|
||||||
|
+is_night_light_supported (MetaMonitorManager *manager)
|
||||||
|
+{
|
||||||
|
+ GList *l;
|
||||||
|
+
|
||||||
|
+ for (l = meta_backend_get_gpus (manager->backend); l; l = l->next)
|
||||||
|
+ {
|
||||||
|
+ MetaGpu *gpu = l->data;
|
||||||
|
+ GList *l_crtc;
|
||||||
|
+
|
||||||
|
+ for (l_crtc = meta_gpu_get_crtcs (gpu); l_crtc; l_crtc = l_crtc->next)
|
||||||
|
+ {
|
||||||
|
+ MetaCrtc *crtc = l_crtc->data;
|
||||||
|
+ size_t gamma_lut_size;
|
||||||
|
+
|
||||||
|
+ meta_monitor_manager_get_crtc_gamma (manager, crtc,
|
||||||
|
+ &gamma_lut_size,
|
||||||
|
+ NULL, NULL, NULL);
|
||||||
|
+ if (gamma_lut_size > 0)
|
||||||
|
+ return TRUE;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
meta_monitor_manager_setup (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
@@ -967,7 +1020,6 @@ meta_monitor_manager_setup (MetaMonitorManager *manager)
|
||||||
|
meta_dbus_display_config_set_apply_monitors_config_allowed (manager->display_config,
|
||||||
|
policy->enable_dbus);
|
||||||
|
|
||||||
|
-
|
||||||
|
meta_monitor_manager_read_current_state (manager);
|
||||||
|
|
||||||
|
meta_monitor_manager_ensure_initial_config (manager);
|
||||||
|
@@ -2445,7 +2497,6 @@ meta_monitor_manager_handle_get_crtc_gamma (MetaDBusDisplayConfig *skeleton,
|
||||||
|
guint crtc_id,
|
||||||
|
MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
- MetaMonitorManagerClass *klass;
|
||||||
|
GList *combined_crtcs;
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
gsize size;
|
||||||
|
@@ -2476,14 +2527,8 @@ meta_monitor_manager_handle_get_crtc_gamma (MetaDBusDisplayConfig *skeleton,
|
||||||
|
crtc = g_list_nth_data (combined_crtcs, crtc_id);
|
||||||
|
g_list_free (combined_crtcs);
|
||||||
|
|
||||||
|
- klass = META_MONITOR_MANAGER_GET_CLASS (manager);
|
||||||
|
- if (klass->get_crtc_gamma)
|
||||||
|
- klass->get_crtc_gamma (manager, crtc, &size, &red, &green, &blue);
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- size = 0;
|
||||||
|
- red = green = blue = NULL;
|
||||||
|
- }
|
||||||
|
+ meta_monitor_manager_get_crtc_gamma (manager, crtc,
|
||||||
|
+ &size, &red, &green, &blue);
|
||||||
|
|
||||||
|
red_bytes = g_bytes_new_take (red, size * sizeof (unsigned short));
|
||||||
|
green_bytes = g_bytes_new_take (green, size * sizeof (unsigned short));
|
||||||
|
@@ -3078,6 +3123,16 @@ meta_monitor_manager_is_transform_handled (MetaMonitorManager *manager,
|
||||||
|
return manager_class->is_transform_handled (manager, crtc, transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void
|
||||||
|
+update_night_light_supported (MetaMonitorManager *manager)
|
||||||
|
+{
|
||||||
|
+ gboolean night_light_supported;
|
||||||
|
+
|
||||||
|
+ night_light_supported = is_night_light_supported (manager);
|
||||||
|
+ meta_dbus_display_config_set_night_light_supported (manager->display_config,
|
||||||
|
+ night_light_supported);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void
|
||||||
|
meta_monitor_manager_real_read_current_state (MetaMonitorManager *manager)
|
||||||
|
{
|
||||||
|
@@ -3098,6 +3153,7 @@ meta_monitor_manager_real_read_current_state (MetaMonitorManager *manager)
|
||||||
|
}
|
||||||
|
|
||||||
|
rebuild_monitors (manager);
|
||||||
|
+ update_night_light_supported (manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
diff --git a/src/backends/native/meta-monitor-manager-native.c b/src/backends/native/meta-monitor-manager-native.c
|
||||||
|
index fd5e7784ff..37a50f1d6f 100644
|
||||||
|
--- a/src/backends/native/meta-monitor-manager-native.c
|
||||||
|
+++ b/src/backends/native/meta-monitor-manager-native.c
|
||||||
|
@@ -381,15 +381,30 @@ meta_monitor_manager_native_get_crtc_gamma (MetaMonitorManager *manager,
|
||||||
|
MetaKmsCrtc *kms_crtc;
|
||||||
|
const MetaKmsCrtcState *crtc_state;
|
||||||
|
|
||||||
|
- g_return_if_fail (META_IS_CRTC_KMS (crtc));
|
||||||
|
+ if (!META_IS_CRTC_KMS (crtc))
|
||||||
|
+ {
|
||||||
|
+ if (size)
|
||||||
|
+ *size = 0;
|
||||||
|
+ if (red)
|
||||||
|
+ *red = NULL;
|
||||||
|
+ if (green)
|
||||||
|
+ *green = NULL;
|
||||||
|
+ if (blue)
|
||||||
|
+ *blue = NULL;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (crtc));
|
||||||
|
crtc_state = meta_kms_crtc_get_current_state (kms_crtc);
|
||||||
|
|
||||||
|
- *size = crtc_state->gamma.size;
|
||||||
|
- *red = g_memdup2 (crtc_state->gamma.red, *size * sizeof **red);
|
||||||
|
- *green = g_memdup2 (crtc_state->gamma.green, *size * sizeof **green);
|
||||||
|
- *blue = g_memdup2 (crtc_state->gamma.blue, *size * sizeof **blue);
|
||||||
|
+ if (size)
|
||||||
|
+ *size = crtc_state->gamma.size;
|
||||||
|
+ if (red)
|
||||||
|
+ *red = g_memdup2 (crtc_state->gamma.red, *size * sizeof **red);
|
||||||
|
+ if (green)
|
||||||
|
+ *green = g_memdup2 (crtc_state->gamma.green, *size * sizeof **green);
|
||||||
|
+ if (blue)
|
||||||
|
+ *blue = g_memdup2 (crtc_state->gamma.blue, *size * sizeof **blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
|
||||||
|
index 98eb080b6b..865f4e5800 100644
|
||||||
|
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
|
||||||
|
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
|
||||||
|
@@ -707,9 +707,12 @@ meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager,
|
||||||
|
(XID) meta_crtc_get_id (crtc));
|
||||||
|
|
||||||
|
*size = gamma->size;
|
||||||
|
- *red = g_memdup2 (gamma->red, sizeof (unsigned short) * gamma->size);
|
||||||
|
- *green = g_memdup2 (gamma->green, sizeof (unsigned short) * gamma->size);
|
||||||
|
- *blue = g_memdup2 (gamma->blue, sizeof (unsigned short) * gamma->size);
|
||||||
|
+ if (red)
|
||||||
|
+ *red = g_memdup2 (gamma->red, sizeof (unsigned short) * gamma->size);
|
||||||
|
+ if (green)
|
||||||
|
+ *green = g_memdup2 (gamma->green, sizeof (unsigned short) * gamma->size);
|
||||||
|
+ if (blue)
|
||||||
|
+ *blue = g_memdup2 (gamma->blue, sizeof (unsigned short) * gamma->size);
|
||||||
|
|
||||||
|
XRRFreeGamma (gamma);
|
||||||
|
}
|
||||||
|
diff --git a/src/org.gnome.Mutter.DisplayConfig.xml b/src/org.gnome.Mutter.DisplayConfig.xml
|
||||||
|
index c6859c2c09..5f85c5e271 100644
|
||||||
|
--- a/src/org.gnome.Mutter.DisplayConfig.xml
|
||||||
|
+++ b/src/org.gnome.Mutter.DisplayConfig.xml
|
||||||
|
@@ -297,6 +297,13 @@
|
||||||
|
-->
|
||||||
|
<property name="ApplyMonitorsConfigAllowed" type="b" access="read" />
|
||||||
|
|
||||||
|
+ <!--
|
||||||
|
+ NightLightSupported:
|
||||||
|
+
|
||||||
|
+ Whether night light is supported by this system.
|
||||||
|
+ -->
|
||||||
|
+ <property name="NightLightSupported" type="b" access="read" />
|
||||||
|
+
|
||||||
|
<!--
|
||||||
|
MonitorsChanged:
|
||||||
|
|
||||||
|
--
|
||||||
|
2.37.1
|
||||||
|
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
Name: mutter
|
Name: mutter
|
||||||
Version: 40.9
|
Version: 40.9
|
||||||
Release: 8%{?dist}
|
Release: 9%{?dist}
|
||||||
Summary: Window and compositing manager based on Clutter
|
Summary: Window and compositing manager based on Clutter
|
||||||
|
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
@ -98,6 +98,9 @@ Patch28: 0005-cursor-renderer-native-Add-a-means-to-disable-HW-cur.patch
|
|||||||
# Fix race condition causing stuck pointer grabs (#2090170)
|
# Fix race condition causing stuck pointer grabs (#2090170)
|
||||||
Patch40: 0001-events-Pass-CurrentTime-to-XIAllowEvents-when-unfree.patch
|
Patch40: 0001-events-Pass-CurrentTime-to-XIAllowEvents-when-unfree.patch
|
||||||
|
|
||||||
|
# Backport night light availability property (#2057154)
|
||||||
|
Patch41: 0001-monitor-manager-Add-NightLightSupported-property-to-.patch
|
||||||
|
|
||||||
BuildRequires: chrpath
|
BuildRequires: chrpath
|
||||||
BuildRequires: pango-devel
|
BuildRequires: pango-devel
|
||||||
BuildRequires: startup-notification-devel
|
BuildRequires: startup-notification-devel
|
||||||
@ -244,6 +247,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
|
|||||||
%{_datadir}/mutter-%{mutter_api_version}/tests
|
%{_datadir}/mutter-%{mutter_api_version}/tests
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Aug 16 2022 Jonas Ådahl <jadahl@redhat.com>) - 40.9-9
|
||||||
|
- Backport night light availability property
|
||||||
|
Resolves: #2057154
|
||||||
|
|
||||||
* Mon Jun 27 2022 Jonas Ådahl <jadahl@redhat.com>) - 40.9-8
|
* Mon Jun 27 2022 Jonas Ådahl <jadahl@redhat.com>) - 40.9-8
|
||||||
- Fix race condition causing stuck pointer grabs
|
- Fix race condition causing stuck pointer grabs
|
||||||
Resolves: #2090170
|
Resolves: #2090170
|
||||||
|
Loading…
Reference in New Issue
Block a user