[mutter] color-device: Add API to set test efivar path
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] color-device: Add API to set test efivar path
- Date: Thu, 1 Sep 2022 21:38:58 +0000 (UTC)
commit 5b251bd8a745607b6163ffbd61ca693285b3b313
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Aug 9 22:56:04 2022 +0200
color-device: Add API to set test efivar path
This will be used by tests to set the special efivar calibration
profile.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2568>
src/backends/meta-color-device.c | 19 ++++++++++++++++---
src/backends/meta-color-device.h | 3 +++
2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-color-device.c b/src/backends/meta-color-device.c
index 108efeaafb..4641616a1e 100644
--- a/src/backends/meta-color-device.c
+++ b/src/backends/meta-color-device.c
@@ -77,6 +77,8 @@ struct _MetaColorDevice
G_DEFINE_TYPE (MetaColorDevice, meta_color_device,
G_TYPE_OBJECT)
+static const char *efivar_test_path = NULL;
+
/*
* Generate a colord DeviceId according to
* `device-and-profiling-naming-spec.txt`.
@@ -1023,6 +1025,12 @@ on_efi_panel_color_info_loaded (GObject *source_object,
create_device_profile_from_edid (color_device, g_steal_pointer (&task));
}
+void
+meta_set_color_efivar_test_path (const char *path)
+{
+ efivar_test_path = path;
+}
+
void
meta_color_device_generate_profile (MetaColorDevice *color_device,
const char *file_path,
@@ -1042,12 +1050,17 @@ meta_color_device_generate_profile (MetaColorDevice *color_device,
g_task_set_task_data (task, data,
(GDestroyNotify) generate_profile_data_free);
- if (meta_monitor_is_laptop_panel (color_device->monitor) &&
- meta_monitor_supports_color_transform (color_device->monitor))
+ if ((meta_monitor_is_laptop_panel (color_device->monitor) &&
+ meta_monitor_supports_color_transform (color_device->monitor)) ||
+ efivar_test_path)
{
g_autoptr (GFile) file = NULL;
- file = g_file_new_for_path (EFI_PANEL_COLOR_INFO_PATH);
+ if (efivar_test_path)
+ file = g_file_new_for_path (efivar_test_path);
+ else
+ file = g_file_new_for_path (EFI_PANEL_COLOR_INFO_PATH);
+
g_file_load_contents_async (file,
cancellable,
on_efi_panel_color_info_loaded,
diff --git a/src/backends/meta-color-device.h b/src/backends/meta-color-device.h
index bbf2cea6d7..33eb376ab1 100644
--- a/src/backends/meta-color-device.h
+++ b/src/backends/meta-color-device.h
@@ -65,4 +65,7 @@ gboolean meta_color_device_is_ready (MetaColorDevice *color_device);
void meta_color_device_update (MetaColorDevice *color_device,
unsigned int temperature);
+META_EXPORT_TEST
+void meta_set_color_efivar_test_path (const char *path);
+
#endif /* META_COLOR_DEVICE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]