diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2020-05-21 18:00:47 +0100 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2020-05-23 09:34:57 +0100 |
commit | a555fbf7693338d8b545d89f87a45852958a2166 (patch) | |
tree | 5c6151c6b2ab755a5d595ff42416277655158108 | |
parent | 859faad17b51162d50acc5d78beb482d9a031e01 (diff) | |
download | efl-a555fbf7693338d8b545d89f87a45852958a2166.tar.gz |
ecore thread - feedback threads should not be background threads...
if try_no_queue is used - its a thread that clearly wantt to be out of
the queue to run on its own so probably wants to wake up accurately
and thus not be a backgroun rpriority task but and urgent one. ensure
we set up priority accordingly as we didn't before. this should fix
scheduling when under load for vsync
@fix
-rw-r--r-- | src/lib/ecore/ecore_thread.c | 3 | ||||
-rw-r--r-- | src/lib/eina/eina_thread.c | 40 |
2 files changed, 38 insertions, 5 deletions
diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c index 05ab26cdea..f38c7880c1 100644 --- a/src/lib/ecore/ecore_thread.c +++ b/src/lib/ecore/ecore_thread.c @@ -40,6 +40,7 @@ # define PHE(x, y) eina_thread_equal(x, y) # define PHS() eina_thread_self() # define PHC(x, f, d) eina_thread_create(&(x), EINA_THREAD_BACKGROUND, -1, (void *)f, d) +# define PHC2(x, f, d)eina_thread_create(&(x), EINA_THREAD_URGENT, -1, (void *)f, d) # define PHJ(x) eina_thread_join(x) typedef struct _Ecore_Pthread_Worker Ecore_Pthread_Worker; @@ -953,7 +954,7 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, eina_threads_init(); retry_direct: - if (PHC(t, _ecore_direct_worker, worker)) + if (PHC2(t, _ecore_direct_worker, worker)) { SLKL(_ecore_pending_job_threads_mutex); _ecore_thread_count_no_queue++; diff --git a/src/lib/eina/eina_thread.c b/src/lib/eina/eina_thread.c index c1a1ef0d22..c2bb041f24 100644 --- a/src/lib/eina/eina_thread.c +++ b/src/lib/eina/eina_thread.c @@ -141,11 +141,43 @@ _eina_internal_call(void *context) EINA_THREAD_CLEANUP_PUSH(free, c); - if (c->prio == EINA_THREAD_BACKGROUND || - c->prio == EINA_THREAD_IDLE) - eina_sched_prio_drop(); - self = pthread_self(); + + if (c->prio == EINA_THREAD_IDLE) + { + struct sched_param params; + int min; + + min = sched_get_priority_min(SCHED_IDLE); + params.sched_priority = min; + pthread_setschedparam(self, SCHED_IDLE, ¶ms); + } + else if (c->prio == EINA_THREAD_BACKGROUND) + { + struct sched_param params; + int min, max; + + min = sched_get_priority_min(SCHED_BATCH); + max = sched_get_priority_max(SCHED_BATCH); + params.sched_priority = (max - min) / 2; + pthread_setschedparam(self, SCHED_BATCH, ¶ms); + } +// do nothing for normal +// else if (c->prio == EINA_THREAD_NORMAL) +// { +// } + else if (c->prio == EINA_THREAD_URGENT) + { + struct sched_param params; + int max, pol; + + pthread_getschedparam(self, &pol, ¶ms); + max = sched_get_priority_max(pol); + params.sched_priority += 5; + if (params.sched_priority > max) params.sched_priority = max; + pthread_setschedparam(self, pol, ¶ms); + } + _eina_debug_thread_add(&self); EINA_THREAD_CLEANUP_PUSH(_eina_debug_thread_del, &self); r = c->func((void*) c->data, eina_thread_self()); |