From e4b2b141d90a8bb6cabf664d02d361d117da08ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 10 May 2023 22:28:50 +0200 Subject: [PATCH] seat/impl: Trace libinput dispatching and event processing Part-of: --- src/backends/native/meta-seat-impl.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c index f72fdb27d..5715c7ee3 100644 --- a/src/backends/native/meta-seat-impl.c +++ b/src/backends/native/meta-seat-impl.c @@ -241,7 +241,11 @@ meta_seat_impl_clear_repeat_source (MetaSeatImpl *seat_impl) static void dispatch_libinput (MetaSeatImpl *seat_impl) { + COGL_TRACE_BEGIN (MetaSeatImplDispatchLibinput, + "MetaSeatImpl (dispatch libinput)"); libinput_dispatch (seat_impl->libinput); + COGL_TRACE_END (MetaSeatImplDispatchLibinput); + process_events (seat_impl); } @@ -2686,10 +2690,13 @@ process_events (MetaSeatImpl *seat_impl) { struct libinput_event *event; + COGL_TRACE_BEGIN_SCOPED (MetaSeatImplProcessEvents, + "MetaSeatImpl (process events)"); + while ((event = libinput_get_event (seat_impl->libinput))) { - process_event(seat_impl, event); - libinput_event_destroy(event); + process_event (seat_impl, event); + libinput_event_destroy (event); } } @@ -2844,10 +2851,21 @@ static gpointer input_thread (MetaSeatImpl *seat_impl) { MetaSeatImplPrivate *priv = meta_seat_impl_get_instance_private (seat_impl); +#ifdef HAVE_PROFILER + MetaBackend *backend = meta_seat_native_get_backend (seat_impl->seat_native); + MetaContext *context = meta_backend_get_context (backend); + MetaProfiler *profiler = meta_context_get_profiler (context); +#endif struct xkb_keymap *xkb_keymap; g_main_context_push_thread_default (seat_impl->input_context); +#ifdef HAVE_PROFILER + meta_profiler_register_thread (profiler, + seat_impl->input_context, + "Mutter Input Thread"); +#endif + priv->device_files = g_hash_table_new_full (NULL, NULL, NULL, @@ -2901,6 +2919,10 @@ input_thread (MetaSeatImpl *seat_impl) g_main_loop_run (seat_impl->input_loop); g_main_loop_unref (seat_impl->input_loop); +#ifdef HAVE_PROFILER + meta_profiler_unregister_thread (profiler, seat_impl->input_context); +#endif + g_main_context_pop_thread_default (seat_impl->input_context); return NULL;