Change priority of wayland init
authorChanggyu Choi <changyu.choi@samsung.com>
Mon, 6 Feb 2023 05:51:57 +0000 (14:51 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Tue, 7 Feb 2023 01:11:06 +0000 (10:11 +0900)
there is a case of accessing the display handle before the wayland init is completed.
  e.g., __splash_screen_create_image()

This patch increases the priority of the __init_wl() call to reduce this problem.

Change-Id: I8b2bdb2e50a218894d6b9e951793e4b5aa4e957a
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/lib/amd_login_monitor.c
src/lib/amd_util.h
src/lib/api/amd_api_util.h
src/lib/request/request_manager.cc
src/modules/cynara-core/cynara_manager.cc
src/modules/wayland-core/src/wayland-core.c

index a0008d75de55b6b321ed9ffc86a18cce7c7813a3..f2051ae1ba459ff38313c995f0e25f2e81ec71db 100644 (file)
@@ -1125,8 +1125,8 @@ int _login_monitor_init(void)
                return -1;
 
        user_list = g_list_append(user_list, user);
-       sid = g_idle_add_full(G_PRIORITY_HIGH, __login_default_user,
-                       NULL, NULL);
+       sid = g_idle_add_full(AMD_PRIORITY_90,
+                       __login_default_user, NULL, NULL);
        if (sid == 0) {
                _E("g_idle_add_full() is failed");
                exit(-1);
index 430362b89efbb7cb2468ad840aa8b25cea02419c..b290f3e9c46584e57418b9be3014b73514172c1c 100644 (file)
@@ -25,8 +25,9 @@
 #include <tzplatform_config.h>
 
 typedef enum {
-       AMD_G_PRIORITY_HIGH = -90,
-       AMD_G_PRIORITY_MID  = -60
+       AMD_PRIORITY_90 = -90,
+       AMD_PRIORITY_80 = -80,
+       AMD_PRIORITY_70 = -70
 } amd_priority_e;
 
 #ifdef __cplusplus
index 3eaa2d57920cb54a5e883ffb629c6e5e43034257..ed399f939bbeffea42f766213f3b4e048b80c958 100644 (file)
@@ -20,8 +20,8 @@
 #include <stdbool.h>
 
 typedef enum {
-       AMD_API_G_PRIORITY_HIGH = -90,
-       AMD_API_G_PRIORITY_MID  = -60
+       AMD_API_PRIORITY_80  = -80,
+       AMD_API_PRIORITY_70  = -70
 } amd_api_priority_e;
 
 #ifdef __cplusplus
index e7b10d186264b49f5943b434b77a1ac68c25d306..acfdc1ca285390d9a87cdfee4962fe602aa7570c 100644 (file)
@@ -183,7 +183,7 @@ void RequestManager::FlushPendingRequests(std::shared_ptr<PendingItem> item) {
   auto& requests = item->GetRequests();
   requests.remove_if([this](RequestPtr& req) -> bool {
         req->UnsetTimer();
-        PushRequest(std::move(req), AMD_G_PRIORITY_MID);
+        PushRequest(std::move(req), AMD_PRIORITY_70);
         return true;
       });
 }
@@ -380,7 +380,7 @@ bool RequestManager::UserInit(uid_t uid) {
 
     if (req->GetTargetUID() == uid) {
       req->UnsetTimer();
-      PushRequest(std::move(req), AMD_G_PRIORITY_MID);
+      PushRequest(std::move(req), AMD_PRIORITY_70);
       return true;
     }
 
index 1470096ec58071237d579795051af97906baddf4..4fa6544721ace7490eec4c4eea5f74e26e173794 100644 (file)
@@ -382,9 +382,9 @@ void CynaraManager::CynaraThread() {
     }
 
     if (IsCpuBoostingHighLevel(request->GetPid())) {
-      g_idle_add_full(AMD_API_G_PRIORITY_HIGH, ResponseCb, response, nullptr);
+      g_idle_add_full(AMD_API_PRIORITY_80, ResponseCb, response, nullptr);
     } else {
-      g_idle_add_full(AMD_API_G_PRIORITY_MID, ResponseCb, response, nullptr);
+      g_idle_add_full(AMD_API_PRIORITY_70, ResponseCb, response, nullptr);
     }
   } while (true);
 
index 97ddce1ba61d679a1d8004d92eeea6cbcbd59c66..41df9ede42777a2b26259fdf8c1da3d1bac0ca74 100644 (file)
@@ -35,7 +35,6 @@
 #define PATH_RUN_WAYLAND "/run/wayland-0"
 #define PATH_RUN_WMREADY "/run/.wm_ready"
 #define PATH_RUN "/run"
-static gint AMD_G_PRIORITY_MID = -60;
 
 struct file_monitor_s {
        bool wl_ready;
@@ -233,7 +232,7 @@ static int __wl_source_init(void)
        g_source_add_poll(__wl_source.gsource, __wl_source.gfd);
        g_source_set_callback(__wl_source.gsource, NULL,
                        __wl_source.display, NULL);
-       g_source_set_priority(__wl_source.gsource, AMD_G_PRIORITY_MID);
+       g_source_set_priority(__wl_source.gsource, AMD_API_PRIORITY_70);
        g_source_attach(__wl_source.gsource, NULL);
 
        return 0;
@@ -271,7 +270,7 @@ static bool __wayland_monitor_cb(const char *event_name, void *data)
        }
 
        if (__file_monitor.wm_ready && __file_monitor.wl_ready) {
-               g_idle_add(__init_wl, NULL);
+               g_idle_add_full(G_PRIORITY_HIGH, __init_wl, NULL, NULL);
                __file_monitor.handle = NULL;
                return false;
        }
@@ -296,7 +295,7 @@ static int __file_monitor_init(void)
        }
 
        if (__file_monitor.wl_ready && __file_monitor.wm_ready) {
-               g_idle_add(__init_wl, NULL);
+               g_idle_add_full(G_PRIORITY_HIGH, __init_wl, NULL, NULL);
                return 0;
        }
 
@@ -330,7 +329,7 @@ EXPORT int AMD_MOD_INIT(void)
 {
        _D("wayland core init");
 
-       g_idle_add(__idle_cb, NULL);
+       g_idle_add_full(G_PRIORITY_HIGH, __idle_cb, NULL, NULL);
 
        return 0;
 }