drm: Branch 'master' - 4 commits

[email protected] (Eric Engestr??m) Tue, 20 Mar 2018 14:33:45 +0000 (UTC)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 configure.ac        |    8 +++++++-
 intel/test_decode.c |    4 ++--
 libdrm_macros.h     |    2 +-
 meson.build         |   18 +++++++-----------
 xf86drm.c           |    8 ++++----
 5 files changed, 21 insertions(+), 19 deletions(-)

New commits:
commit 431f1a147e33b3fae7ea78a47d40a6014b682ebd
Author: Eric Engestrom <[email protected]>
Date:   Fri Mar 16 17:10:26 2018 +0000

    meson: replace `if(compiles) have=true` with `have=compiles`
    
    Signed-off-by: Eric Engestrom <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>
    Reviewed-by: Dylan Baker <[email protected]>

diff --git a/meson.build b/meson.build
index b90127aa..100a59fa 100644
--- a/meson.build
+++ b/meson.build
@@ -187,9 +187,8 @@ else
 endif
 dep_m = cc.find_library('m', required : false)
 foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
-  if cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header))
-    config.set10('HAVE_' + header.underscorify().to_upper(), true)
-  endif
+  config.set('HAVE_' + header.underscorify().to_upper(),
+    cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header)))
 endforeach
 if cc.has_header_symbol('sys/sysmacros.h', 'major')
   config.set10('MAJOR_IN_SYSMACROS', true)
commit 07585200e937a528bd9fad3d5850de68823f27fa
Author: Eric Engestrom <[email protected]>
Date:   Fri Mar 16 17:04:50 2018 +0000

    meson,configure: always define UDEV
    
    Signed-off-by: Eric Engestrom <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>
    Reviewed-by: Dylan Baker <[email protected]>

diff --git a/configure.ac b/configure.ac
index 607d8597..0e36336c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -347,6 +347,8 @@ AC_SUBST(PCIACCESS_LIBS)
 
 if test "x$UDEV" = xyes; then
 	AC_DEFINE(UDEV, 1, [Have UDEV support])
+else
+	AC_DEFINE(UDEV, 0)
 fi
 
 AC_CANONICAL_HOST
diff --git a/meson.build b/meson.build
index 826cd915..b90127aa 100644
--- a/meson.build
+++ b/meson.build
@@ -165,9 +165,9 @@ if _libkms != 'false'
   with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system())
 endif
 
+config.set10('UDEV', with_udev)
 if with_udev
   dep_udev = dependency('udev')
-  config.set10('UDEV', true)
 else
   dep_udev = []
 endif
diff --git a/xf86drm.c b/xf86drm.c
index 344326db..9328bf5a 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -293,7 +293,7 @@ static int drmMatchBusID(const char *id1, const char *id2, int pci_domain_ok)
  * If any other failure happened then it will output error mesage using
  * drmMsg() call.
  */
-#if !defined(UDEV)
+#if !UDEV
 static int chown_check_return(const char *path, uid_t owner, gid_t group)
 {
         int rv;
@@ -332,7 +332,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
     int             fd;
     mode_t          devmode = DRM_DEV_MODE, serv_mode;
     gid_t           serv_group;
-#if !defined(UDEV)
+#if !UDEV
     int             isroot  = !geteuid();
     uid_t           user    = DRM_DEV_UID;
     gid_t           group   = DRM_DEV_GID;
@@ -361,7 +361,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
         devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
     }
 
-#if !defined(UDEV)
+#if !UDEV
     if (stat(DRM_DIR_NAME, &st)) {
         if (!isroot)
             return DRM_ERR_NOT_ROOT;
@@ -414,7 +414,7 @@ wait_for_udev:
     if (fd >= 0)
         return fd;
 
-#if !defined(UDEV)
+#if !UDEV
     /* Check if the device node is not what we expect it to be, and recreate it
      * and try again if so.
      */
commit e8d3d885b1362caba4f1e1dfa42d45bac7163124
Author: Eric Engestrom <[email protected]>
Date:   Fri Mar 16 17:07:08 2018 +0000

    meson,configure: always define HAVE_VISIBILITY
    
    Signed-off-by: Eric Engestrom <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>
    Reviewed-by: Dylan Baker <[email protected]>

diff --git a/configure.ac b/configure.ac
index 762ca9f9..607d8597 100644
--- a/configure.ac
+++ b/configure.ac
@@ -535,6 +535,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([
 
 if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
     AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__(("hidden"))])
+else
+    AC_DEFINE(HAVE_VISIBILITY, 0)
 fi
 
 AC_SUBST(WARN_CFLAGS)
diff --git a/libdrm_macros.h b/libdrm_macros.h
index 639d0904..211fab21 100644
--- a/libdrm_macros.h
+++ b/libdrm_macros.h
@@ -23,7 +23,7 @@
 #ifndef LIBDRM_LIBDRM_H
 #define LIBDRM_LIBDRM_H
 
-#if defined(HAVE_VISIBILITY)
+#if HAVE_VISIBILITY
 #  define drm_private __attribute__((visibility("hidden")))
 #else
 #  define drm_private
diff --git a/meson.build b/meson.build
index 50daa1d0..826cd915 100644
--- a/meson.build
+++ b/meson.build
@@ -256,10 +256,9 @@ with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.fo
 # Used for tets
 prog_bash = find_program('bash')
 
-if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
-               name : 'compiler supports __attribute__(("hidden"))')
-  config.set10('HAVE_VISIBILITY', true)
-endif
+config.set10('HAVE_VISIBILITY',
+  cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
+              name : 'compiler supports __attribute__(("hidden"))'))
 
 foreach t : [
              [with_exynos, 'EXYNOS'],
commit 1a44bbae734fa6aa227d2ac621ff7884af1ae8ef
Author: Eric Engestrom <[email protected]>
Date:   Fri Jan 26 17:04:28 2018 +0000

    meson,configure: always define HAVE_OPEN_MEMSTREAM
    
    Signed-off-by: Eric Engestrom <[email protected]>
    Reviewed-by: Emil Velikov <[email protected]>
    Reviewed-by: Dylan Baker <[email protected]>

diff --git a/configure.ac b/configure.ac
index ec5003f6..762ca9f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -189,7 +189,9 @@ AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
                              [AC_MSG_ERROR([Couldn't find clock_gettime])])])
 AC_SUBST([CLOCK_LIB])
 
-AC_CHECK_FUNCS([open_memstream], [HAVE_OPEN_MEMSTREAM=yes])
+AC_CHECK_FUNCS([open_memstream],
+               [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
+               [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
 
 dnl Use lots of warning flags with with gcc and compatible compilers
 
diff --git a/intel/test_decode.c b/intel/test_decode.c
index b4eddcd1..68f777b0 100644
--- a/intel/test_decode.c
+++ b/intel/test_decode.c
@@ -91,7 +91,7 @@ compare_batch(struct drm_intel_decode *ctx, const char *batch_filename)
 {
 	FILE *out = NULL;
 	void *ptr, *ref_ptr, *batch_ptr;
-#ifdef HAVE_OPEN_MEMSTREAM
+#if HAVE_OPEN_MEMSTREAM
 	size_t size;
 #endif
 	size_t ref_size, batch_size;
@@ -109,7 +109,7 @@ compare_batch(struct drm_intel_decode *ctx, const char *batch_filename)
 	 * figure out how to output to a file in a safe and sane way
 	 * inside of an automake project's test infrastructure.
 	 */
-#ifdef HAVE_OPEN_MEMSTREAM
+#if HAVE_OPEN_MEMSTREAM
 	out = open_memstream((char **)&ptr, &size);
 #else
 	fprintf(stderr, "platform lacks open_memstream, skipping.\n");
diff --git a/meson.build b/meson.build
index 2a6c4680..50daa1d0 100644
--- a/meson.build
+++ b/meson.build
@@ -196,9 +196,7 @@ if cc.has_header_symbol('sys/sysmacros.h', 'major')
 elif cc.has_header_symbol('sys/mkdev.h', 'major')
   config.set10('MAJOR_IN_MKDEV', true)
 endif
-if cc.has_function('open_memstream')
-  config.set10('HAVE_OPEN_MEMSTREAM', true)
-endif
+config.set10('HAVE_OPEN_MEMSTREAM', cc.has_function('open_memstream'))
 
 warn_c_args = []
 foreach a : ['-Wall', '-Wextra', '-Wsign-compare', '-Werror=undef',

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--