1
0
Fork 0

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>
This commit is contained in:
Jonas Ådahl 2022-08-09 22:56:04 +02:00 committed by Marge Bot
parent 2a87eb6226
commit 5b251bd8a7
2 changed files with 19 additions and 3 deletions

View file

@ -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,

View file

@ -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 */