ecore_evas: fix to notify mainthread just once 90/251290/2 submit/tizen/20210113.093459
authorWonki Kim <wonki_.kim@samsung.com>
Tue, 5 Jan 2021 05:21:57 +0000 (14:21 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Tue, 12 Jan 2021 10:55:17 +0000 (19:55 +0900)
in tizen, there is an indivisual thread for getting vsync signal.
and the thread notifies the main thread every single time it gets vsync signal.

so that main thread has a possibility to handle multiple times of thread callbacks
(notify handler) when main thread can't iterate within about 16ms
which is an interval of the vsync signal.

this patch fixes the vsync logic not to notify the main thread
when the previous vsync is not handled.

Change-Id: I650a6213f7935f00600496aaac398858f5e9ebf2

src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_vsync.c

index 41ac36d..cbcb60e 100644 (file)
@@ -76,9 +76,14 @@ _tdm_send_time(double t)
         *tim = t;
         DBG("tdm send time  @%1.5f   ... send %1.8f\n", ecore_time_get(), t);
         eina_spinlock_take(&tick_queue_lock);
-        tick_queue_count++;
+        if (tick_queue_count == 0)
+        {
+           tick_queue_count++;
+           ecore_thread_feedback(tdm_thread, tim);
+        } else {
+           free(tim);
+        }
         eina_spinlock_release(&tick_queue_lock);
-        ecore_thread_feedback(tdm_thread, tim);
      }
    traceTaskEnd();
 }
@@ -245,7 +250,6 @@ _tdm_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void
 
    eina_spinlock_take(&tick_queue_lock);
    tick_queued = tick_queue_count;
-   tick_queue_count--;
    eina_spinlock_release(&tick_queue_lock);
    DBG("notify.... %3.3f %i", *((double *)msg), tdm_event_is_busy);
 
@@ -269,6 +273,12 @@ _tdm_tick_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void
              DBG("skip this vsync for schedule queued %d\n", tick_queued);
           }
      }
+
+   eina_spinlock_take(&tick_queue_lock);
+   tick_queue_count--;
+   if (tick_queue_count < 0) tick_queue_count = 0;
+   eina_spinlock_release(&tick_queue_lock);
+
    free(msg);
    traceTaskEnd();
 }