Changed getenv() for TPL_WAIT_VBLANK to be called from main thread. 25/232025/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Mon, 27 Apr 2020 09:45:03 +0000 (18:45 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Mon, 27 Apr 2020 09:45:03 +0000 (18:45 +0900)
Change-Id: I9e5143492d35ed7e6c1722af3c0b7888ff918aa8
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index f8151935f33c584060b7f2cc0365456062a3d75c..79bcb91ab7012ded760905f60e6723d7f48be897 100755 (executable)
@@ -42,6 +42,7 @@ struct _twe_thread_context {
 
        int ref_cnt;
 
+       tpl_bool_t use_wait_vblank;
        twe_tdm_source *tdm_source;
        twe_del_source *tdm_del_source;
 
@@ -216,12 +217,9 @@ _twe_thread_loop(gpointer data)
 {
        twe_thread_context *ctx = data;
 
-       char *env = NULL;
-
        g_mutex_lock(&ctx->thread_mutex);
 
-       env = getenv("TPL_WAIT_VBLANK");
-       if (env == NULL || atoi(env)) {
+       if (ctx->use_wait_vblank) {
                twe_tdm_source *tdm_source = _twe_thread_tdm_source_create();
 
                if (tdm_source) {
@@ -506,6 +504,7 @@ twe_thread*
 twe_thread_create(void)
 {
        twe_thread *thread = NULL;
+       char *env = NULL;
 
        thread = calloc(1, sizeof(twe_thread));
        if (!thread) {
@@ -531,6 +530,13 @@ twe_thread_create(void)
                g_mutex_init(&_twe_ctx->thread_mutex);
                g_cond_init(&_twe_ctx->thread_cond);
 
+               _twe_ctx->use_wait_vblank = TPL_TRUE;
+
+               env = getenv("TPL_WAIT_VBLANK");
+               if (env && !atoi(env)) {
+                       _twe_ctx->use_wait_vblank = TPL_FALSE;
+               }
+
                g_mutex_lock(&_twe_ctx->thread_mutex);
                _twe_ctx->twe_thread = g_thread_new("twe_thread", _twe_thread_loop,
                                                                                        _twe_ctx);