7dd64181d0
vlc depends on gcc-4.9+: https://mailman.videolan.org/pipermail/vlc-devel/2016-September/109452.html Added fix for stack-protector detection. Disabled all new optional dependencies for now, subsequent patches will enable dependencies with buildroot packages present. Removed gles1 configure option after http://git.videolan.org/?p=vlc.git;a=commitdiff;h=6c4bb081844c51a9a1b1cdb44fc5f42e5a879327 Renamed mmal configure options after http://git.videolan.org/?p=vlc.git;a=commitdiff;h=bdb1d86acfb0d0068e57281b6fbfc52345960d29 http://git.videolan.org/?p=vlc.git;a=commitdiff;h=1d2b56c68bbc3287e17f6140bdf8c8c3efe08fdc Renamed avahi configure option after http://git.videolan.org/?p=vlc.git;a=commitdiff;h=55280fa62cb68b71767778c56250352b4840b69a Removed directfb support after being dropped upstream: http://git.videolan.org/?p=vlc.git;a=commitdiff;h=8e1a0e876615da31321203090daa7c8699b6406d Renamed matroska configure option after http://git.videolan.org/?p=vlc.git;a=commitdiff;h=156ceb73e2f46618a6cffb081e71e368a315ec3e Replaced qt4 support with qt5: http://git.videolan.org/?p=vlc.git;a=commitdiff;h=1c221a77d92935866e897254c07e1d12a4b95ae0 Removed sdl support: http://git.videolan.org/?p=vlc.git;a=commitdiff;h=4b8a2755fe8c0e3e1e9c52483b22c26e24fd5527 Removed --enable-xcb in BR2_PACKAGE_XCB_UTIL_KEYSYMS block, it is already present in the BR2_PACKAGE_LIBXCB block. Rebased patches - 0001-Disable-building-of-statically-linked-vlc-binary.patch - 0007-Don-t-assume-strerror_l-is-available.patch - 0009-x264-drop-148-build-support-and-fix-10bit-support.patch also renamed from 0013 Removed patches - 0002-configure.ac-add-check-for-libgcrypt-config-program.patch not needed anymore after upstream commit http://git.videolan.org/?p=vlc.git;a=commitdiff;h=f94ac7241f33b6896a8e12ae4e3e43d9fd7fb6cc - 0004-Drop-error-implicit-function-declaration-compile-fla.patch - 0006-Don-t-assume-X11-is-available-when-Qt5-is-used.patch removed, qt4 is not supported anymore - 0008-fix-fallback-code-and-add-required-realtime-library-.patch - 0009-Changes-for-ffmpeg-3.0.patch - 0010-Fix-build-when-using-C99-and-C-11.patch - 0011-compat-fix-static_assert.patch - 0012-Fix-build-with-libupnp-above-1.6.23.patch New patches - 0002-lua-Define-LUA_COMPAT_APIINTCASTS-for-Lua-5.3.0-comp.patch to fix lua-5.3 support - 0004-qt-fix-build-against-Qt-5.11.patch - 0006-Fix-build-error-using-uClibc-by-adding-sys-types.h.patch - 0008-posix-remove-ancient-run-time-fallback-to-real-time-.patch - 0010-Add-support-for-freerdp2.patch fixes support for freerdp >= 2.0 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> [Thomas: use Git formatted patches.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
188 lines
5.5 KiB
Diff
188 lines
5.5 KiB
Diff
From 5d561e1e2dcde3c9fca4d925f12447009d0d4a4c Mon Sep 17 00:00:00 2001
|
||
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
|
||
Date: Wed, 18 Apr 2018 17:23:57 +0300
|
||
Subject: [PATCH] posix: remove ancient run-time fallback to real-time clock
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
posix: remove ancient run-time fallback to real-time clock
|
||
|
||
For hysterical raisins, GNU/Linux and possibly some other OSes still
|
||
report that monotonic clock must be checked at run-time, although I
|
||
doubt that VLC or even current glibc would run on such old kernel.
|
||
|
||
Drop that to simplify and avoid the systematic one-time init check.
|
||
|
||
Downloaded from upstream commit to fix build error on m68k:
|
||
|
||
posix/thread.c:79:5: warning: #warning Monotonic clock not available. Expect timing issues. [-Wcpp]
|
||
# warning Monotonic clock not available. Expect timing issues.
|
||
^~~~~~~
|
||
posix/thread.c: In function ‘vlc_clock_setup_once’:
|
||
posix/thread.c:88:18: error: lvalue required as left operand of assignment
|
||
vlc_clock_id = (val < 0) ? CLOCK_REALTIME : CLOCK_MONOTONIC;
|
||
|
||
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
|
||
---
|
||
src/posix/thread.c | 96 +++++++-----------------------------------------------
|
||
1 file changed, 11 insertions(+), 85 deletions(-)
|
||
|
||
diff --git a/src/posix/thread.c b/src/posix/thread.c
|
||
index dab8b71f97..8878941913 100644
|
||
--- a/src/posix/thread.c
|
||
+++ b/src/posix/thread.c
|
||
@@ -51,62 +51,16 @@
|
||
# include <sys/pset.h>
|
||
#endif
|
||
|
||
-#if !defined (_POSIX_TIMERS)
|
||
-# define _POSIX_TIMERS (-1)
|
||
-#endif
|
||
-#if !defined (_POSIX_CLOCK_SELECTION)
|
||
-/* Clock selection was defined in 2001 and became mandatory in 2008. */
|
||
-# define _POSIX_CLOCK_SELECTION (-1)
|
||
-#endif
|
||
-#if !defined (_POSIX_MONOTONIC_CLOCK)
|
||
-# define _POSIX_MONOTONIC_CLOCK (-1)
|
||
-#endif
|
||
-
|
||
-#if (_POSIX_TIMERS > 0)
|
||
static unsigned vlc_clock_prec;
|
||
|
||
-# if (_POSIX_MONOTONIC_CLOCK > 0) && (_POSIX_CLOCK_SELECTION > 0)
|
||
-/* Compile-time POSIX monotonic clock support */
|
||
-# define vlc_clock_id (CLOCK_MONOTONIC)
|
||
-
|
||
-# elif (_POSIX_MONOTONIC_CLOCK == 0) && (_POSIX_CLOCK_SELECTION > 0)
|
||
-/* Run-time POSIX monotonic clock support (see clock_setup() below) */
|
||
-static clockid_t vlc_clock_id;
|
||
-
|
||
-# else
|
||
-/* No POSIX monotonic clock support */
|
||
-# define vlc_clock_id (CLOCK_REALTIME)
|
||
-# warning Monotonic clock not available. Expect timing issues.
|
||
-
|
||
-# endif /* _POSIX_MONOTONIC_CLOKC */
|
||
-
|
||
static void vlc_clock_setup_once (void)
|
||
{
|
||
-# if (_POSIX_MONOTONIC_CLOCK == 0)
|
||
- long val = sysconf (_SC_MONOTONIC_CLOCK);
|
||
- assert (val != 0);
|
||
- vlc_clock_id = (val < 0) ? CLOCK_REALTIME : CLOCK_MONOTONIC;
|
||
-# endif
|
||
-
|
||
struct timespec res;
|
||
- if (unlikely(clock_getres (vlc_clock_id, &res) != 0 || res.tv_sec != 0))
|
||
+ if (unlikely(clock_getres(CLOCK_MONOTONIC, &res) != 0 || res.tv_sec != 0))
|
||
abort ();
|
||
vlc_clock_prec = (res.tv_nsec + 500) / 1000;
|
||
}
|
||
|
||
-static pthread_once_t vlc_clock_once = PTHREAD_ONCE_INIT;
|
||
-
|
||
-# define vlc_clock_setup() \
|
||
- pthread_once(&vlc_clock_once, vlc_clock_setup_once)
|
||
-
|
||
-#else /* _POSIX_TIMERS */
|
||
-
|
||
-# include <sys/time.h> /* gettimeofday() */
|
||
-
|
||
-# define vlc_clock_setup() (void)0
|
||
-# warning Monotonic clock not available. Expect timing issues.
|
||
-#endif /* _POSIX_TIMERS */
|
||
-
|
||
static struct timespec mtime_to_ts (mtime_t date)
|
||
{
|
||
lldiv_t d = lldiv (date, CLOCK_FREQ);
|
||
@@ -233,14 +187,11 @@ void vlc_cond_init (vlc_cond_t *p_condvar)
|
||
{
|
||
pthread_condattr_t attr;
|
||
|
||
- if (unlikely(pthread_condattr_init (&attr)))
|
||
- abort ();
|
||
-#if (_POSIX_CLOCK_SELECTION > 0)
|
||
- vlc_clock_setup ();
|
||
- pthread_condattr_setclock (&attr, vlc_clock_id);
|
||
-#endif
|
||
- if (unlikely(pthread_cond_init (p_condvar, &attr)))
|
||
+ if (unlikely(pthread_condattr_init (&attr))
|
||
+ || unlikely(pthread_condattr_setclock(&attr, CLOCK_MONOTONIC))
|
||
+ || unlikely(pthread_cond_init (p_condvar, &attr)))
|
||
abort ();
|
||
+
|
||
pthread_condattr_destroy (&attr);
|
||
}
|
||
|
||
@@ -625,44 +576,27 @@ void vlc_control_cancel (int cmd, ...)
|
||
|
||
mtime_t mdate (void)
|
||
{
|
||
-#if (_POSIX_TIMERS > 0)
|
||
struct timespec ts;
|
||
|
||
- vlc_clock_setup ();
|
||
- if (unlikely(clock_gettime (vlc_clock_id, &ts) != 0))
|
||
+ if (unlikely(clock_gettime(CLOCK_MONOTONIC, &ts) != 0))
|
||
abort ();
|
||
|
||
return (INT64_C(1000000) * ts.tv_sec) + (ts.tv_nsec / 1000);
|
||
-
|
||
-#else
|
||
- struct timeval tv;
|
||
-
|
||
- if (unlikely(gettimeofday (&tv, NULL) != 0))
|
||
- abort ();
|
||
- return (INT64_C(1000000) * tv.tv_sec) + tv.tv_usec;
|
||
-
|
||
-#endif
|
||
}
|
||
|
||
#undef mwait
|
||
void mwait (mtime_t deadline)
|
||
{
|
||
-#if (_POSIX_CLOCK_SELECTION > 0)
|
||
- vlc_clock_setup ();
|
||
+ static pthread_once_t vlc_clock_once = PTHREAD_ONCE_INIT;
|
||
+
|
||
/* If the deadline is already elapsed, or within the clock precision,
|
||
* do not even bother the system timer. */
|
||
+ pthread_once(&vlc_clock_once, vlc_clock_setup_once);
|
||
deadline -= vlc_clock_prec;
|
||
|
||
struct timespec ts = mtime_to_ts (deadline);
|
||
|
||
- while (clock_nanosleep (vlc_clock_id, TIMER_ABSTIME, &ts, NULL) == EINTR);
|
||
-
|
||
-#else
|
||
- deadline -= mdate ();
|
||
- if (deadline > 0)
|
||
- msleep (deadline);
|
||
-
|
||
-#endif
|
||
+ while (clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL) == EINTR);
|
||
}
|
||
|
||
#undef msleep
|
||
@@ -670,15 +604,7 @@ void msleep (mtime_t delay)
|
||
{
|
||
struct timespec ts = mtime_to_ts (delay);
|
||
|
||
-#if (_POSIX_CLOCK_SELECTION > 0)
|
||
- vlc_clock_setup ();
|
||
- while (clock_nanosleep (vlc_clock_id, 0, &ts, &ts) == EINTR);
|
||
-
|
||
-#else
|
||
- while (nanosleep (&ts, &ts) == -1)
|
||
- assert (errno == EINTR);
|
||
-
|
||
-#endif
|
||
+ while (clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts) == EINTR);
|
||
}
|
||
|
||
unsigned vlc_GetCPUCount(void)
|
||
--
|
||
2.14.4
|
||
|