[igt-dev] [PATCH i-g-t] igt: Make LibUdev mandatory

Antonio Argenziano antonio.argenziano at intel.com
Mon Jan 29 19:51:21 UTC 2018


Since more essential components use libUdev, make its dependency
mandatory.

Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Petri Latvala <petri.latvala at intel.com>
---
 configure.ac                   |  9 +--------
 lib/igt_aux.c                  | 14 +-------------
 lib/igt_kms.c                  |  6 +-----
 lib/igt_kms.h                  |  2 --
 meson.build                    |  7 +------
 tests/testdisplay_hotplug.c    | 12 ------------
 tools/Makefile.am              |  2 --
 tools/intel_l3_parity.c        |  7 -------
 tools/intel_l3_parity.h        |  5 -----
 tools/intel_l3_udev_listener.c |  2 --
 10 files changed, 4 insertions(+), 62 deletions(-)

diff --git a/configure.ac b/configure.ac
index e13a3b74..1a6f5cb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,11 +176,7 @@ PKG_CHECK_MODULES(XRANDR, xrandr >= 1.3, AC_DEFINE(HAVE_XRANDR, 1, [Have libXran
 
 # for testdisplay
 PKG_CHECK_MODULES(CAIRO, [cairo >= 1.12.0])
-PKG_CHECK_MODULES(LIBUDEV, [libudev], [udev=yes], [udev=no])
-AM_CONDITIONAL(HAVE_UDEV, [test "x$udev" = xyes])
-if test x"$udev" = xyes; then
-	AC_DEFINE(HAVE_UDEV,1,[Enable udev-based monitor hotplug detection])
-fi
+PKG_CHECK_MODULES(LIBUDEV, [libudev])
 PKG_CHECK_MODULES(GLIB, [glib-2.0], [glib=yes], [glib=no])
 if test x"$glib" = xyes; then
 	AC_DEFINE(HAVE_GLIB,1,[Enable glib support])
@@ -210,9 +206,6 @@ if test "x$enable_chamelium" = xyes; then
 	fi
 	PKG_CHECK_MODULES(PIXMAN, pixman-1, [],
 			  [AC_MSG_ERROR([Failed to find pixman, required by chamelium.])])
-	if test x"$udev" != xyes; then
-		AC_MSG_ERROR([Failed to find udev, required by chamelium.])
-	fi
 	if test x"$glib" != xyes; then
 		AC_MSG_ERROR([Failed to find glib, required by chamelium.])
 	fi
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 8ca0b60d..b9cf58ed 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -50,6 +50,7 @@
 #include <assert.h>
 
 #include <proc/readproc.h>
+#include <libudev.h>
 
 #include "drmtest.h"
 #include "i915_drm.h"
@@ -425,8 +426,6 @@ void igt_stop_shrink_helper(void)
 	igt_stop_helper(&shrink_helper);
 }
 
-#ifdef HAVE_UDEV
-#include <libudev.h>
 
 static struct igt_helper_process hang_detector;
 static void __attribute__((noreturn))
@@ -506,17 +505,6 @@ void igt_stop_hang_detector(void)
 {
 	igt_stop_helper(&hang_detector);
 }
-#else
-void igt_fork_hang_detector(int fd)
-{
-	if (igt_only_list_subtests())
-		return;
-}
-
-void igt_stop_hang_detector(void)
-{
-}
-#endif
 
 /**
  * igt_check_boolean_env_var:
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index eb57f4a9..c237fdb7 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -39,9 +39,8 @@
 #elif HAVE_SYS_KD_H
 #include <sys/kd.h>
 #endif
-#ifdef HAVE_UDEV
+
 #include <libudev.h>
-#endif
 #include <poll.h>
 #include <errno.h>
 #include <time.h>
@@ -3558,8 +3557,6 @@ void igt_reset_connectors(void)
 			      "detect");
 }
 
-#ifdef HAVE_UDEV
-
 /**
  * igt_watch_hotplug:
  *
@@ -3663,7 +3660,6 @@ void igt_cleanup_hotplug(struct udev_monitor *mon)
 	mon = NULL;
 	udev_unref(udev);
 }
-#endif
 
 /**
  * kmstest_get_vbl_flag:
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index b7521039..c3f82d34 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -658,12 +658,10 @@ uint32_t kmstest_get_vbl_flag(uint32_t pipe_id);
 const unsigned char* igt_kms_get_base_edid(void);
 const unsigned char* igt_kms_get_alt_edid(void);
 
-#ifdef HAVE_UDEV
 struct udev_monitor *igt_watch_hotplug(void);
 bool igt_hotplug_detected(struct udev_monitor *mon,
 			  int timeout_secs);
 void igt_flush_hotplugs(struct udev_monitor *mon);
 void igt_cleanup_hotplug(struct udev_monitor *mon);
-#endif
 
 #endif /* __IGT_KMS_H__ */
diff --git a/meson.build b/meson.build
index 9036feb1..ddfbbcb8 100644
--- a/meson.build
+++ b/meson.build
@@ -48,12 +48,7 @@ if valgrind.found()
 endif
 
 cairo = dependency('cairo', version : '>1.12.0', required : false)
-
-libudev = dependency('libudev', required : false)
-if libudev.found()
-	config.set('HAVE_UDEV', 1)
-endif
-
+libudev = dependency('libudev', required : true)
 glib = dependency('glib-2.0', required : false)
 if glib.found()
 	config.set('HAVE_GLIB', 1)
diff --git a/tests/testdisplay_hotplug.c b/tests/testdisplay_hotplug.c
index ca1d849d..581d987e 100644
--- a/tests/testdisplay_hotplug.c
+++ b/tests/testdisplay_hotplug.c
@@ -32,7 +32,6 @@
 #include "config.h"
 
 
-#ifdef HAVE_UDEV
 #include <libudev.h>
 static struct udev_monitor *uevent_monitor;
 static struct udev *udev;
@@ -125,14 +124,3 @@ void testdisplay_cleanup_hotplug(void)
 	if (udev)
 		udev_unref(udev);
 }
-#else
-gboolean testdisplay_setup_hotplug(void)
-{
-	igt_warn("no hotplug support on this platform\n");
-	return TRUE;
-}
-
-void testdisplay_cleanup_hotplug(void)
-{
-}
-#endif
diff --git a/tools/Makefile.am b/tools/Makefile.am
index dcf282ea..8de2a231 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -7,11 +7,9 @@ bin_PROGRAMS += $(LIBDRM_INTEL_BIN)
 intel_error_decode_LDFLAGS = -lz
 endif
 
-if HAVE_UDEV
 bin_PROGRAMS += intel_dp_compliance
 intel_dp_compliance_CFLAGS = $(AM_CFLAGS)
 intel_dp_compliance_LDADD = $(top_builddir)/lib/libintel_tools.la
-endif
 
 SUBDIRS = null_state_gen registers
 
diff --git a/tools/intel_l3_parity.c b/tools/intel_l3_parity.c
index 9df4fc24..d1a9bc44 100644
--- a/tools/intel_l3_parity.c
+++ b/tools/intel_l3_parity.c
@@ -39,10 +39,8 @@
 #include "igt_sysfs.h"
 #include "drmtest.h"
 #include "config.h"
-#ifdef HAVE_UDEV
 #include <libudev.h>
 #include <syslog.h>
-#endif
 #include "intel_l3_parity.h"
 
 static unsigned int devid;
@@ -318,10 +316,6 @@ int main(int argc, char *argv[])
 
 	/* Daemon doesn't work like the other commands */
 	if (action == 'L') {
-#ifndef HAVE_UDEV
-		fprintf(stderr, "Daemon requires udev support. Please reconfigure.\n");
-		exit(EXIT_FAILURE);
-#else
 		struct l3_parity par;
 		struct l3_location loc;
 		if (daemonize) {
@@ -332,7 +326,6 @@ int main(int argc, char *argv[])
 		assert(l3_uevent_setup(&par) == 0);
 		assert(l3_listen(&par, daemonize == 1, &loc) == 0);
 		exit(EXIT_SUCCESS);
-#endif
 	}
 
 	if (action == 'l')
diff --git a/tools/intel_l3_parity.h b/tools/intel_l3_parity.h
index 759c4f4b..275c9b4b 100644
--- a/tools/intel_l3_parity.h
+++ b/tools/intel_l3_parity.h
@@ -18,14 +18,9 @@ struct l3_location {
 	uint8_t subbank;
 };
 
-#ifdef HAVE_UDEV
 int l3_uevent_setup(struct l3_parity *par);
 /* Listens (blocks) for an l3 parity event. Returns the location of the error. */
 int l3_listen(struct l3_parity *par, bool daemon, struct l3_location *loc);
 #define l3_uevent_teardown(par) {}
-#else
-#define l3_uevent_setup(par, daemon, loc) -1
-#define l3_listen(par) -1
-#endif
 
 #endif
diff --git a/tools/intel_l3_udev_listener.c b/tools/intel_l3_udev_listener.c
index 94d931e5..ff62f407 100644
--- a/tools/intel_l3_udev_listener.c
+++ b/tools/intel_l3_udev_listener.c
@@ -23,7 +23,6 @@
 
 #include "config.h"
 
-#ifdef HAVE_UDEV
 #include <libudev.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -123,4 +122,3 @@ again:
 
 	return 0;
 }
-#endif
-- 
2.14.2



More information about the igt-dev mailing list