From 297a19681840df18f4ab8cd97d29260c380658c7 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 7 Dec 2022 19:38:36 +0900 Subject: [PATCH] e_comp_wl: add log of gap idle_exiter between prepare callback of wayland event loop if the job of main thread has much time or does not get CPU scheduling, the synchronous call (ex: wl_display roundtrip) is blocked until the job is done. it is the regular operation of a synchronous call but sometimes it has too much time. this patch is for debugging it. Change-Id: Ife0d9f0ad32807fd892c7b2f991d966427c0c72c --- src/bin/e_comp_wl.c | 28 ++++++++++++++++++++++++++++ src/bin/e_comp_wl.h | 3 +++ 2 files changed, 31 insertions(+) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index f945667..fcadd0a 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -12,6 +12,8 @@ #define COMPOSITOR_VERSION 4 +#define E_COM_WL_PREPARE_GAP_LOG_TIME 2000 + EINTERN int E_EVENT_WAYLAND_GLOBAL_ADD = -1; #include "session-recovery-server-protocol.h" @@ -251,6 +253,14 @@ _e_comp_wl_focus_check(void) } static Eina_Bool +_e_comp_wl_cb_idle_exiter(void *data EINA_UNUSED) +{ + e_comp_wl->idle_exiter_timestamp = ecore_time_get() * 1000; + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool _e_comp_wl_cb_read(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED) { /* dispatch pending wayland events */ @@ -262,6 +272,20 @@ _e_comp_wl_cb_read(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED) static void _e_comp_wl_cb_prepare(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED) { + double gap_time; + + if (e_comp_wl->idle_exiter_timestamp > 0.0) + { + gap_time = (ecore_time_get() * 1000) - e_comp_wl->idle_exiter_timestamp; + if (gap_time > E_COM_WL_PREPARE_GAP_LOG_TIME) + { + ELOGF("E_COMP", "gap between idle_exiter with cb_prepare is %lfms", + NULL, gap_time); + } + } + + e_comp_wl->idle_exiter_timestamp = 0.0; + /* flush pending client events */ wl_display_flush_clients(e_comp_wl->wl.disp); } @@ -4394,6 +4418,8 @@ e_comp_wl_init(void) E_EVENT_WAYLAND_GLOBAL_ADD = ecore_event_type_new(); + e_comp_wl->idle_exiter = ecore_idle_exiter_add(_e_comp_wl_cb_idle_exiter, NULL); + TRACE_DS_END(); return EINA_TRUE; } @@ -4408,6 +4434,8 @@ e_comp_wl_deferred_job(void) EINTERN void e_comp_wl_shutdown(void) { + ecore_idle_exiter_del(e_comp_wl->idle_exiter); + e_comp_wl_subsurfaces_shutdown(); /* free handlers */ E_FREE_LIST(handlers, ecore_event_handler_del); diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index 3fda11c..3ca5174 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -354,6 +354,9 @@ struct _E_Comp_Wl_Data void *drag_offer; E_Comp_Wl_Evas_Gl *evas_gl; + + double idle_exiter_timestamp; + Ecore_Idle_Exiter *idle_exiter; }; struct _E_Comp_Wl_Client_Data -- 2.7.4