summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-10-28 14:50:05 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-10-28 22:58:36 +0900
commit973eaedf51a8ab0f9881c1fb900850dd8475bbf7 (patch)
treecfdaae6c7a0da526c63ad82463d294d81d303778
parentecc3e2fa516d937f65a24ec45c9fa62d8c9b491d (diff)
improve responsivness of timer sleeping threads for vsync with prctl
prctl allows us on some platforms to request a thread be woken up more agressively e.g. due to a timeout bu setting timerslack. since we use a dedicated thread just for vsync events, this is a very good idea to ask the kernel to be as exact as possible for this thread as it only wakes up once per frame (or should only) and accuracy is important. so use this. also improve prctl checks to be more explicit in configure.ac and use these ifdefs in ecore exe too where prctl is used as well. @feature
-rw-r--r--configure.ac2
-rw-r--r--m4/efl_check_funcs.m411
-rw-r--r--src/lib/ecore/ecore_anim.c7
-rw-r--r--src/lib/ecore/ecore_exe_posix.c10
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_vsync.c7
5 files changed, 31 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 1a850808f8..4e61cc5d40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1029,7 +1029,7 @@ EFL_CHECK_GCC_BUILTIN([bswap64], [HAVE_BSWAP64])
1029 1029
1030AC_CHECK_FUNCS([fchmod]) 1030AC_CHECK_FUNCS([fchmod])
1031 1031
1032EFL_CHECK_FUNCS([EINA], [dlopen dladdr iconv shm_open splice setxattr getpagesize]) 1032EFL_CHECK_FUNCS([EINA], [dlopen dladdr iconv shm_open splice setxattr getpagesize prctl])
1033 1033
1034enable_log="no" 1034enable_log="no"
1035if test "x${efl_func_fnmatch}" = "xyes" && test "x${want_log}" = "xyes" ; then 1035if test "x${efl_func_fnmatch}" = "xyes" && test "x${want_log}" = "xyes" ; then
diff --git a/m4/efl_check_funcs.m4 b/m4/efl_check_funcs.m4
index 39fb5ee5ad..b44f20bc55 100644
--- a/m4/efl_check_funcs.m4
+++ b/m4/efl_check_funcs.m4
@@ -288,6 +288,17 @@ sz = getpagesize();
288]]) 288]])
289]) 289])
290 290
291dnl _EFL_CHECK_FUNC_PRCTL is for internal use
292dnl _EFL_CHECK_FUNC_PRCTL(EFL, VARIABLE)
293AC_DEFUN([_EFL_CHECK_FUNC_PRCTL],
294[EFL_FIND_LIB_FOR_CODE([$1], [], [$2], [[
295#include <sys/prctl.h>
296]],
297[[
298prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
299]])
300])
301
291dnl Macro that checks function availability 302dnl Macro that checks function availability
292dnl 303dnl
293dnl EFL_CHECK_FUNC(EFL, FUNCTION) 304dnl EFL_CHECK_FUNC(EFL, FUNCTION)
diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c
index c069c96118..66432868d5 100644
--- a/src/lib/ecore/ecore_anim.c
+++ b/src/lib/ecore/ecore_anim.c
@@ -30,6 +30,10 @@
30 30
31#endif /* ! _WIN32 */ 31#endif /* ! _WIN32 */
32 32
33#ifdef HAVE_PRCTL
34# include <sys/prctl.h>
35#endif
36
33#include "Ecore.h" 37#include "Ecore.h"
34#include "ecore_private.h" 38#include "ecore_private.h"
35 39
@@ -109,6 +113,9 @@ _timer_tick_core(void *data EINA_UNUSED, Ecore_Thread *thread)
109 int ret; 113 int ret;
110 114
111 eina_thread_name_set(eina_thread_self(), "Eanimator-timer"); 115 eina_thread_name_set(eina_thread_self(), "Eanimator-timer");
116#ifdef HAVE_PRCTL
117 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
118#endif
112 while (!ecore_thread_check(thread)) 119 while (!ecore_thread_check(thread))
113 { 120 {
114 DBG("------- timer_event_is_busy=%i", timer_event_is_busy); 121 DBG("------- timer_event_is_busy=%i", timer_event_is_busy);
diff --git a/src/lib/ecore/ecore_exe_posix.c b/src/lib/ecore/ecore_exe_posix.c
index 5ad60f9010..14c7d6963f 100644
--- a/src/lib/ecore/ecore_exe_posix.c
+++ b/src/lib/ecore/ecore_exe_posix.c
@@ -13,7 +13,7 @@
13#include <sys/time.h> 13#include <sys/time.h>
14#include <sys/resource.h> 14#include <sys/resource.h>
15 15
16#ifdef HAVE_SYS_PRCTL_H 16#ifdef HAVE_PRCTL
17# include <sys/prctl.h> 17# include <sys/prctl.h>
18#endif 18#endif
19 19
@@ -1017,11 +1017,11 @@ _ecore_exe_exec_it(const char *exe_cmd,
1017 } 1017 }
1018 } 1018 }
1019 1019
1020#ifdef HAVE_SYS_PRCTL_H 1020#ifdef HAVE_PRCTL
1021 if ((flags & ECORE_EXE_TERM_WITH_PARENT)) 1021 if ((flags & ECORE_EXE_TERM_WITH_PARENT))
1022 { 1022 {
1023 prctl(PR_SET_PDEATHSIG, SIGTERM); 1023 prctl(PR_SET_PDEATHSIG, SIGTERM);
1024 } 1024 }
1025#endif 1025#endif
1026 1026
1027 if (!(flags & ECORE_EXE_NOT_LEADER)) setsid(); 1027 if (!(flags & ECORE_EXE_NOT_LEADER)) setsid();
diff --git a/src/lib/ecore_x/xlib/ecore_x_vsync.c b/src/lib/ecore_x/xlib/ecore_x_vsync.c
index 436645e63c..ee43406ab5 100644
--- a/src/lib/ecore_x/xlib/ecore_x_vsync.c
+++ b/src/lib/ecore_x/xlib/ecore_x_vsync.c
@@ -17,6 +17,10 @@
17#include <sys/select.h> 17#include <sys/select.h>
18#include <fcntl.h> 18#include <fcntl.h>
19 19
20#ifdef HAVE_PRCTL
21# include <sys/prctl.h>
22#endif
23
20#define ECORE_X_VSYNC_DRM 1 24#define ECORE_X_VSYNC_DRM 1
21 25
22static Ecore_X_Window vsync_root = 0; 26static Ecore_X_Window vsync_root = 0;
@@ -286,6 +290,9 @@ _drm_tick_core(void *data EINA_UNUSED, Ecore_Thread *thread)
286 int tick = 0; 290 int tick = 0;
287 291
288 eina_thread_name_set(eina_thread_self(), "Eanimator-vsync"); 292 eina_thread_name_set(eina_thread_self(), "Eanimator-vsync");
293#ifdef HAVE_PRCTL
294 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
295#endif
289 while (!ecore_thread_check(thread)) 296 while (!ecore_thread_check(thread))
290 { 297 {
291 DBG("------- drm_event_is_busy=%i", drm_event_is_busy); 298 DBG("------- drm_event_is_busy=%i", drm_event_is_busy);