kms: Use MetaThread source helpers directly

No need to have thin meta_kms_* wrappers, just use the meta_thread_*
functions directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
This commit is contained in:
Jonas Ådahl 2021-05-27 08:33:56 +02:00
parent 2e025eea0e
commit 229904cb4b
4 changed files with 16 additions and 47 deletions

View File

@ -761,8 +761,8 @@ schedule_retry_page_flip (MetaKmsImplDeviceSimple *impl_device_simple,
MetaKms *kms = meta_kms_device_get_kms (device);
GSource *source;
source = meta_kms_add_source_in_impl (kms, retry_page_flips,
impl_device_simple, NULL);
source = meta_thread_add_source_in_impl (META_THREAD (kms), retry_page_flips,
impl_device_simple, NULL);
g_source_set_ready_time (source, retry_time_us);
impl_device_simple->retry_page_flips_source = source;
@ -884,10 +884,10 @@ mode_set_fallback (MetaKmsImplDeviceSimple *impl_device_simple,
{
GSource *source;
source = meta_kms_add_source_in_impl (kms,
mode_set_fallback_feedback_idle,
impl_device_simple,
NULL);
source = meta_thread_add_source_in_impl (META_THREAD (kms),
mode_set_fallback_feedback_idle,
impl_device_simple,
NULL);
impl_device_simple->mode_set_fallback_feedback_source = source;
}
@ -947,10 +947,10 @@ dispatch_page_flip (MetaKmsImplDevice *impl_device,
meta_kms_page_flip_data_make_symbolic (page_flip_data);
source = meta_kms_add_source_in_impl (kms,
symbolic_page_flip_idle,
page_flip_data,
NULL);
source = meta_thread_add_source_in_impl (META_THREAD (kms),
symbolic_page_flip_idle,
page_flip_data,
NULL);
g_source_set_ready_time (source, 0);
g_source_unref (source);

View File

@ -856,11 +856,13 @@ ensure_device_file (MetaKmsImplDevice *impl_device,
if (!(priv->flags & META_KMS_DEVICE_FLAG_NO_MODE_SETTING))
{
MetaKms *kms = meta_kms_impl_get_kms (priv->impl);
priv->fd_source =
meta_kms_register_fd_in_impl (meta_kms_impl_get_kms (priv->impl),
meta_device_file_get_fd (device_file),
kms_event_dispatch_in_impl,
impl_device);
meta_thread_register_fd_in_impl (META_THREAD (kms),
meta_device_file_get_fd (device_file),
kms_event_dispatch_in_impl,
impl_device);
}
return TRUE;

View File

@ -43,16 +43,6 @@ gpointer meta_kms_run_impl_task_sync (MetaKms *kms,
gpointer user_data,
GError **error);
GSource * meta_kms_add_source_in_impl (MetaKms *kms,
GSourceFunc func,
gpointer user_data,
GDestroyNotify user_data_destroy);
GSource * meta_kms_register_fd_in_impl (MetaKms *kms,
int fd,
MetaThreadTaskFunc dispatch,
gpointer user_data);
META_EXPORT_TEST
MetaKmsResourceChanges meta_kms_update_states_sync (MetaKms *kms,
GUdevDevice *udev_device);

View File

@ -239,29 +239,6 @@ meta_kms_run_impl_task_sync (MetaKms *kms,
return meta_thread_run_impl_task_sync (thread, func, user_data, error);
}
GSource *
meta_kms_add_source_in_impl (MetaKms *kms,
GSourceFunc func,
gpointer user_data,
GDestroyNotify user_data_destroy)
{
MetaThread *thread = META_THREAD (kms);
return meta_thread_add_source_in_impl (thread, func,
user_data, user_data_destroy);
}
GSource *
meta_kms_register_fd_in_impl (MetaKms *kms,
int fd,
MetaThreadTaskFunc dispatch,
gpointer user_data)
{
MetaThread *thread = META_THREAD (kms);
return meta_thread_register_fd_in_impl (thread, fd, dispatch, user_data);
}
gboolean
meta_kms_in_impl_task (MetaKms *kms)
{