Re: [Mesa-dev] [PATCH v3] threads, configure.ac, meson.build: define and use HAVE_TIMESPEC_GET

2017-11-16 Thread Kyriazis, George
The problem that I’m seeing with timespec_get is that centos6 does not have it.

I’ve put some changes out for review that actually remove timespec_get() in 
favor of using a variation of os_time_get_nano().  It’s good to always use the 
same time functions, and not have multiple ways of doing similar things.

Thoughts?

George


> On Nov 16, 2017, at 8:57 AM, Emil Velikov  wrote:
> 
> On 15 November 2017 at 20:58, Nicolai Hähnle  wrote:
>> From: Nicolai Hähnle 
>> 
>> Tested with Travis and Appveyor.
>> 
>> v2: add HAVE_TIMESPEC_GET for non-Windows Scons builds
>> v3: use check_functions in Scons (Eric)
>> 
>> Cc: Rob Herring 
>> Cc: Alexander von Gluck IV 
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674
>> Fixes: f1a364878431 ("threads: update for late C11 changes")
>> Reviewed-by: Eric Engestrom  (v2)
>> Reviewed-by: Dylan Baker  (v2)
>> Reviewed-by: Jon Turney  (v2)
> 
> Thank you Nicolai, you're a star.
> 
> Reviewed-by: Emil Velikov 
> 
> -Emil
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] threads, configure.ac, meson.build: define and use HAVE_TIMESPEC_GET

2017-11-16 Thread Emil Velikov
On 15 November 2017 at 20:58, Nicolai Hähnle  wrote:
> From: Nicolai Hähnle 
>
> Tested with Travis and Appveyor.
>
> v2: add HAVE_TIMESPEC_GET for non-Windows Scons builds
> v3: use check_functions in Scons (Eric)
>
> Cc: Rob Herring 
> Cc: Alexander von Gluck IV 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674
> Fixes: f1a364878431 ("threads: update for late C11 changes")
> Reviewed-by: Eric Engestrom  (v2)
> Reviewed-by: Dylan Baker  (v2)
> Reviewed-by: Jon Turney  (v2)

Thank you Nicolai, you're a star.

Reviewed-by: Emil Velikov 

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] threads, configure.ac, meson.build: define and use HAVE_TIMESPEC_GET

2017-11-15 Thread Eric Engestrom
On Wednesday, 2017-11-15 20:59:18 +, Nicolai Hähnle wrote:
> From: Nicolai Hähnle 
> 
> Tested with Travis and Appveyor.
> 
> v2: add HAVE_TIMESPEC_GET for non-Windows Scons builds
> v3: use check_functions in Scons (Eric)
> 
> Cc: Rob Herring 
> Cc: Alexander von Gluck IV 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674
> Fixes: f1a364878431 ("threads: update for late C11 changes")
> Reviewed-by: Eric Engestrom  (v2)

You can update that r-b to apply to this revision too :)

> Reviewed-by: Dylan Baker  (v2)
> Reviewed-by: Jon Turney  (v2)
> ---
>  configure.ac| 1 +
>  include/c11/threads_posix.h | 2 +-
>  meson.build | 2 +-
>  scons/gallium.py| 3 +++
>  4 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 411c4f6b3e0..a7ae920ab9c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -841,20 +841,21 @@ if test "x$enable_asm" = xyes; then
>  AC_MSG_RESULT([no, platform not supported])
>  ;;
>  esac
>  fi
>  
>  AC_HEADER_MAJOR
>  AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
>  AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
>  AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
>  AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
> +AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"])
>  
>  AC_MSG_CHECKING([whether strtod has locale support])
>  AC_LINK_IFELSE([AC_LANG_SOURCE([[
>  #define _GNU_SOURCE
>  #include 
>  #include 
>  #ifdef HAVE_XLOCALE_H
>  #include 
>  #endif
>  int main() {
> diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
> index 7bf6a0f6ef6..45cb6075e6e 100644
> --- a/include/c11/threads_posix.h
> +++ b/include/c11/threads_posix.h
> @@ -375,21 +375,21 @@ tss_get(tss_t key)
>  // 7.25.6.4
>  static inline int
>  tss_set(tss_t key, void *val)
>  {
>  return (pthread_setspecific(key, val) == 0) ? thrd_success : thrd_error;
>  }
>  
>  
>  /* 7.25.7 Time functions */
>  // 7.25.6.1
> -#if 0
> +#ifndef HAVE_TIMESPEC_GET
>  static inline int
>  timespec_get(struct timespec *ts, int base)
>  {
>  if (!ts) return 0;
>  if (base == TIME_UTC) {
>  clock_gettime(CLOCK_REALTIME, ts);
>  return base;
>  }
>  return 0;
>  }
> diff --git a/meson.build b/meson.build
> index 314d15ac461..25a5cd658d1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -527,21 +527,21 @@ if cc.has_header_symbol('sys/sysmacros.h', 'major')
>  elif cc.has_header_symbol('sys/mkdev.h', 'major')
>pre_args += '-DMAJOR_IN_MKDEV'
>  endif
>  
>  foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h']
>if cc.has_header(h)
>  pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
>endif
>  endforeach
>  
> -foreach f : ['strtof', 'mkostemp', 'posix_memalign']
> +foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get']
>if cc.has_function(f)
>  pre_args += '-DHAVE_@0@'.format(f.to_upper())
>endif
>  endforeach
>  
>  # strtod locale support
>  if cc.links('''
>  #define _GNU_SOURCE
>  #include 
>  #include 
> diff --git a/scons/gallium.py b/scons/gallium.py
> index 94022df1808..ef3b2ee81ae 100755
> --- a/scons/gallium.py
> +++ b/scons/gallium.py
> @@ -348,20 +348,23 @@ def generate(env):
>  'GLX_DIRECT_RENDERING',
>  'GLX_INDIRECT_RENDERING',
>  ]
>  
>  if check_header(env, 'xlocale.h'):
>  cppdefines += ['HAVE_XLOCALE_H']
>  
>  if check_functions(env, ['strtod_l', 'strtof_l']):
>  cppdefines += ['HAVE_STRTOD_L']
>  
> +if check_functions(env, ['timespec_get']):
> +cppdefines += ['HAVE_TIMESPEC_GET']
> +
>  if platform == 'windows':
>  cppdefines += [
>  'WIN32',
>  '_WINDOWS',
>  #'_UNICODE',
>  #'UNICODE',
>  # http://msdn.microsoft.com/en-us/library/aa383745.aspx
>  ('_WIN32_WINNT', '0x0601'),
>  ('WINVER', '0x0601'),
>  ]
> -- 
> 2.11.0
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3] threads, configure.ac, meson.build: define and use HAVE_TIMESPEC_GET

2017-11-15 Thread Dylan Baker
This should make scons work correctly on every platform, so:
Reviewed-by: Dylan Baker 

Quoting Nicolai Hähnle (2017-11-15 12:58:12)
> From: Nicolai Hähnle 
> 
> Tested with Travis and Appveyor.
> 
> v2: add HAVE_TIMESPEC_GET for non-Windows Scons builds
> v3: use check_functions in Scons (Eric)
> 
> Cc: Rob Herring 
> Cc: Alexander von Gluck IV 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674
> Fixes: f1a364878431 ("threads: update for late C11 changes")
> Reviewed-by: Eric Engestrom  (v2)
> Reviewed-by: Dylan Baker  (v2)
> Reviewed-by: Jon Turney  (v2)
> ---
>  configure.ac| 1 +
>  include/c11/threads_posix.h | 2 +-
>  meson.build | 2 +-
>  scons/gallium.py| 3 +++
>  4 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 411c4f6b3e0..a7ae920ab9c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -841,20 +841,21 @@ if test "x$enable_asm" = xyes; then
>  AC_MSG_RESULT([no, platform not supported])
>  ;;
>  esac
>  fi
>  
>  AC_HEADER_MAJOR
>  AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
>  AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
>  AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
>  AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
> +AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"])
>  
>  AC_MSG_CHECKING([whether strtod has locale support])
>  AC_LINK_IFELSE([AC_LANG_SOURCE([[
>  #define _GNU_SOURCE
>  #include 
>  #include 
>  #ifdef HAVE_XLOCALE_H
>  #include 
>  #endif
>  int main() {
> diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
> index 7bf6a0f6ef6..45cb6075e6e 100644
> --- a/include/c11/threads_posix.h
> +++ b/include/c11/threads_posix.h
> @@ -375,21 +375,21 @@ tss_get(tss_t key)
>  // 7.25.6.4
>  static inline int
>  tss_set(tss_t key, void *val)
>  {
>  return (pthread_setspecific(key, val) == 0) ? thrd_success : thrd_error;
>  }
>  
>  
>  /* 7.25.7 Time functions */
>  // 7.25.6.1
> -#if 0
> +#ifndef HAVE_TIMESPEC_GET
>  static inline int
>  timespec_get(struct timespec *ts, int base)
>  {
>  if (!ts) return 0;
>  if (base == TIME_UTC) {
>  clock_gettime(CLOCK_REALTIME, ts);
>  return base;
>  }
>  return 0;
>  }
> diff --git a/meson.build b/meson.build
> index 314d15ac461..25a5cd658d1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -527,21 +527,21 @@ if cc.has_header_symbol('sys/sysmacros.h', 'major')
>  elif cc.has_header_symbol('sys/mkdev.h', 'major')
>pre_args += '-DMAJOR_IN_MKDEV'
>  endif
>  
>  foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h']
>if cc.has_header(h)
>  pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
>endif
>  endforeach
>  
> -foreach f : ['strtof', 'mkostemp', 'posix_memalign']
> +foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get']
>if cc.has_function(f)
>  pre_args += '-DHAVE_@0@'.format(f.to_upper())
>endif
>  endforeach
>  
>  # strtod locale support
>  if cc.links('''
>  #define _GNU_SOURCE
>  #include 
>  #include 
> diff --git a/scons/gallium.py b/scons/gallium.py
> index 94022df1808..ef3b2ee81ae 100755
> --- a/scons/gallium.py
> +++ b/scons/gallium.py
> @@ -348,20 +348,23 @@ def generate(env):
>  'GLX_DIRECT_RENDERING',
>  'GLX_INDIRECT_RENDERING',
>  ]
>  
>  if check_header(env, 'xlocale.h'):
>  cppdefines += ['HAVE_XLOCALE_H']
>  
>  if check_functions(env, ['strtod_l', 'strtof_l']):
>  cppdefines += ['HAVE_STRTOD_L']
>  
> +if check_functions(env, ['timespec_get']):
> +cppdefines += ['HAVE_TIMESPEC_GET']
> +
>  if platform == 'windows':
>  cppdefines += [
>  'WIN32',
>  '_WINDOWS',
>  #'_UNICODE',
>  #'UNICODE',
>  # http://msdn.microsoft.com/en-us/library/aa383745.aspx
>  ('_WIN32_WINNT', '0x0601'),
>  ('WINVER', '0x0601'),
>  ]
> -- 
> 2.11.0
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


signature.asc
Description: signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v3] threads, configure.ac, meson.build: define and use HAVE_TIMESPEC_GET

2017-11-15 Thread Nicolai Hähnle
From: Nicolai Hähnle 

Tested with Travis and Appveyor.

v2: add HAVE_TIMESPEC_GET for non-Windows Scons builds
v3: use check_functions in Scons (Eric)

Cc: Rob Herring 
Cc: Alexander von Gluck IV 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674
Fixes: f1a364878431 ("threads: update for late C11 changes")
Reviewed-by: Eric Engestrom  (v2)
Reviewed-by: Dylan Baker  (v2)
Reviewed-by: Jon Turney  (v2)
---
 configure.ac| 1 +
 include/c11/threads_posix.h | 2 +-
 meson.build | 2 +-
 scons/gallium.py| 3 +++
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 411c4f6b3e0..a7ae920ab9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -841,20 +841,21 @@ if test "x$enable_asm" = xyes; then
 AC_MSG_RESULT([no, platform not supported])
 ;;
 esac
 fi
 
 AC_HEADER_MAJOR
 AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
 AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
 AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
 AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
+AC_CHECK_FUNC([timespec_get], [DEFINES="$DEFINES -DHAVE_TIMESPEC_GET"])
 
 AC_MSG_CHECKING([whether strtod has locale support])
 AC_LINK_IFELSE([AC_LANG_SOURCE([[
 #define _GNU_SOURCE
 #include 
 #include 
 #ifdef HAVE_XLOCALE_H
 #include 
 #endif
 int main() {
diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 7bf6a0f6ef6..45cb6075e6e 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -375,21 +375,21 @@ tss_get(tss_t key)
 // 7.25.6.4
 static inline int
 tss_set(tss_t key, void *val)
 {
 return (pthread_setspecific(key, val) == 0) ? thrd_success : thrd_error;
 }
 
 
 /* 7.25.7 Time functions */
 // 7.25.6.1
-#if 0
+#ifndef HAVE_TIMESPEC_GET
 static inline int
 timespec_get(struct timespec *ts, int base)
 {
 if (!ts) return 0;
 if (base == TIME_UTC) {
 clock_gettime(CLOCK_REALTIME, ts);
 return base;
 }
 return 0;
 }
diff --git a/meson.build b/meson.build
index 314d15ac461..25a5cd658d1 100644
--- a/meson.build
+++ b/meson.build
@@ -527,21 +527,21 @@ if cc.has_header_symbol('sys/sysmacros.h', 'major')
 elif cc.has_header_symbol('sys/mkdev.h', 'major')
   pre_args += '-DMAJOR_IN_MKDEV'
 endif
 
 foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h']
   if cc.has_header(h)
 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
   endif
 endforeach
 
-foreach f : ['strtof', 'mkostemp', 'posix_memalign']
+foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get']
   if cc.has_function(f)
 pre_args += '-DHAVE_@0@'.format(f.to_upper())
   endif
 endforeach
 
 # strtod locale support
 if cc.links('''
 #define _GNU_SOURCE
 #include 
 #include 
diff --git a/scons/gallium.py b/scons/gallium.py
index 94022df1808..ef3b2ee81ae 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -348,20 +348,23 @@ def generate(env):
 'GLX_DIRECT_RENDERING',
 'GLX_INDIRECT_RENDERING',
 ]
 
 if check_header(env, 'xlocale.h'):
 cppdefines += ['HAVE_XLOCALE_H']
 
 if check_functions(env, ['strtod_l', 'strtof_l']):
 cppdefines += ['HAVE_STRTOD_L']
 
+if check_functions(env, ['timespec_get']):
+cppdefines += ['HAVE_TIMESPEC_GET']
+
 if platform == 'windows':
 cppdefines += [
 'WIN32',
 '_WINDOWS',
 #'_UNICODE',
 #'UNICODE',
 # http://msdn.microsoft.com/en-us/library/aa383745.aspx
 ('_WIN32_WINNT', '0x0601'),
 ('WINVER', '0x0601'),
 ]
-- 
2.11.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev