Skip to contentSkip to conversation

Remove compile time depencencies on libdrm_intel.

RFC Superseded [email protected] 2 participants 9 messages May 25, 2016 Library code

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Remove compile time depencencies on libdrm_intel.

From: Robert Foss <[email protected]>

Changes since v1:
- Replaced the automake flags HAVE_VC4/NOUVEAU/INTEL with HAVE_LIBDRM_XXX.
- Move conditionals from Makefile.sources to Arduino.mk/Makefile.am.
- Removed duplicated i915_drm.h symbols from intel_drm_stubs.h.
- Replaced igt_require with igt_require_f to communicate stubs being the cause of failure.
- Rename intel_drm_stubs to intel_bufmgr.
- Moved intel_bufmgr to lib/stubs/drm.
- Remove header inclusion changes in favor for inclusion of stubs in lib/stubs/drm using build scripts.
- Rebased on trunk.

Robert Foss (7):
configure.ac: Test for libdrm_intel and build for it if present. configure.ac: Harmonize HAVE_XXX flag for all drm platforms to
HAVE_LIBDRM_XXX.
benchmarks/Makefile: Don't build benchmarks that depend on
libdrm_intel.
tools/Makefile: Don't build tools that depend on libdrm_intel. tools/Makefile: Format whitespace.
demos/Makefile: Don't build tools that depend on libdrm_intel. lib/stubs: Add stubs for intel_bufmgr.

 benchmarks/Android.mk        |   6 +
 benchmarks/Makefile.am       |   5 +-
 benchmarks/Makefile.sources  |  14 +-
 configure.ac                 |  22 ++-
 demos/Android.mk             |   5 +-
 demos/Makefile.am            |   8 +-
 demos/Makefile.sources       |   7 +
 lib/Makefile.am              |   9 +-
 lib/stubs/drm/intel_bufmgr.c | 275 +++++++++++++++++++++++++++
 lib/stubs/drm/intel_bufmgr.h | 430 +++++++++++++++++++++++++++++++++++++++++++
 tests/Makefile.am            |   4 +-
 tools/Android.mk             |   8 +
 tools/Makefile.am            |   8 +
 tools/Makefile.sources       |  73 ++++----
 14 files changed, 818 insertions(+), 56 deletions(-)
 create mode 100644 demos/Makefile.sources
 create mode 100644 lib/stubs/drm/intel_bufmgr.c
 create mode 100644 lib/stubs/drm/intel_bufmgr.h
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

RFC 1/7 configure.ac: Test for libdrm_intel and build for it if present.

From: Robert Foss <[email protected]>

Test for libdrm_intel and build for it if present.
Also expose the HAVE_INTEL #define to allow code to be conditionally compiled.

---
 configure.ac | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
configure.ac +13 -1
index 11b1d46..48d81c5 100644
@@ -100,7 +100,7 @@ if test "x$GCC" = "xyes"; then
 fi
 AC_SUBST(ASSEMBLER_WARN_CFLAGS)
 
-PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.64 libdrm])
+PKG_CHECK_MODULES(DRM, [libdrm])
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 
 case "$target_cpu" in
@@ -150,6 +150,18 @@ PKG_CHECK_MODULES(GLIB, glib-2.0)
 # -----------------------------------------------------------------------------
 #			Configuration options
 # -----------------------------------------------------------------------------
+AC_ARG_ENABLE(intel, AS_HELP_STRING([--disable-intel],
+	      [Enable building of intel specific parts (default: auto)]),
+	      [INTEL=$enableval], [INTEL=auto])
+if test "x$INTEL" = xauto; then
+	PKG_CHECK_EXISTS([libdrm_intel >= 2.4.64], [INTEL=yes], [INTEL=no])
+fi
+if test "x$INTEL" = xyes; then
+	PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.64])
+	AC_DEFINE(HAVE_LIBDRM_INTEL, 1, [Have intel support])
+fi
+AM_CONDITIONAL(HAVE_LIBDRM_INTEL, [test "x$INTEL" = xyes])
+
 # for dma-buf tests
 AC_ARG_ENABLE(nouveau, AS_HELP_STRING([--disable-nouveau],
 	      [Enable use of nouveau API for prime tests (default: auto)]),
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [RFC i-g-t 1/7] configure.ac: Test for libdrm_intel and build for it if present.

Quoted 25 lines · Le 25/05/2016 à 20:18, [email protected] a écrit :

From: Robert Foss <[email protected]>

Test for libdrm_intel and build for it if present.
Also expose the HAVE_INTEL #define to allow code to be conditionally compiled.

---
 configure.ac | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
configure.ac +1 -1
index 11b1d46..48d81c5 100644
@@ -100,7 +100,7 @@ if test "x$GCC" = "xyes"; then
 fi
 AC_SUBST(ASSEMBLER_WARN_CFLAGS)
 
-PKG_CHECK_MODULES(DRM, [libdrm_intel >= 2.4.64 libdrm])
+PKG_CHECK_MODULES(DRM, [libdrm])
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 
 case "$target_cpu" in

configure.ac PKG_CHECK_MODULES(GLIB, glib-2.0) · line 157

Quoted 8 lines
configure.ac +5 -0
@@ -150,6 +150,18 @@ PKG_CHECK_MODULES(GLIB, glib-2.0)
 # -----------------------------------------------------------------------------
 #			Configuration options
 # -----------------------------------------------------------------------------
+AC_ARG_ENABLE(intel, AS_HELP_STRING([--disable-intel],
+	      [Enable building of intel specific parts (default: auto)]),
+	      [INTEL=$enableval], [INTEL=auto])
+if test "x$INTEL" = xauto; then
+	PKG_CHECK_EXISTS([libdrm_intel >= 2.4.64], [INTEL=yes], [INTEL=no])
                          ^^^^^^^^^^^^^^^^^^^^^^

configure.ac PKG_CHECK_MODULES(GLIB, glib-2.0) · line 160

Quoted 3 lines
configure.ac +3 -0
+fi
+if test "x$INTEL" = xyes; then
+	PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.64])
                                      ^^^^^^^^^^^^^^^^^^^^^^

configure.ac PKG_CHECK_MODULES(GLIB, glib-2.0) · line 164

Quoted 4 lines
configure.ac +4 -0
+	AC_DEFINE(HAVE_LIBDRM_INTEL, 1, [Have intel support])
+fi
+AM_CONDITIONAL(HAVE_LIBDRM_INTEL, [test "x$INTEL" = xyes])
+

I suggest to factor that out into a variable, much like
https://cgit.freedesktop.org/xorg/xserver/tree/configure.ac#n780

This should also be applied in your libpciaccess patch.

Cheers,

Rémi
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

RFC 2/7 configure.ac: Harmonize HAVE_XXX flag for all drm platforms to HAVE_LIBDRM_XXX.

In reply to [email protected]

From: Robert Foss <[email protected]>

Replace the automake flag HAVE_XXX for VC4/NOUVEAU with HAVE_LIBDRM_XXX in order for the flags to be more descriptive and also follow the same convention as HAVE_LIBDRM_INTEL.

---
 configure.ac      | 8 ++++----
 lib/Makefile.am   | 2 +-
 tests/Makefile.am | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
configure.ac +4 -4
index 48d81c5..e27698b 100644
@@ -171,9 +171,9 @@ if test "x$NOUVEAU" = xauto; then
 fi
 if test "x$NOUVEAU" = xyes; then
 	PKG_CHECK_MODULES(DRM_NOUVEAU, [libdrm_nouveau >= 2.4.33])
-	AC_DEFINE(HAVE_NOUVEAU, 1, [Have nouveau support])
+	AC_DEFINE(HAVE_LIBDRM_NOUVEAU, 1, [Have nouveau support])
 fi
-AM_CONDITIONAL(HAVE_NOUVEAU, [test "x$NOUVEAU" = xyes])
+AM_CONDITIONAL(HAVE_LIBDRM_NOUVEAU, [test "x$NOUVEAU" = xyes])
 
 AC_ARG_ENABLE(vc4, AS_HELP_STRING([--disable-vc4],
 	      [Enable building of vc4 tests (default: auto)]),
@@ -183,9 +183,9 @@ if test "x$VC4" = xauto; then
 fi
 if test "x$VC4" = xyes; then
 	PKG_CHECK_MODULES(DRM_VC4, [libdrm_vc4])
-	AC_DEFINE(HAVE_VC4, 1, [Have vc4 support])
+	AC_DEFINE(HAVE_LIBDRM_VC4, 1, [Have vc4 support])
 fi
-AM_CONDITIONAL(HAVE_VC4, [test "x$VC4" = xyes])
+AM_CONDITIONAL(HAVE_LIBDRM_VC4, [test "x$VC4" = xyes])
 
 # Define a configure option for the shader debugger
 AC_ARG_ENABLE(shader-debugger, AS_HELP_STRING([--enable-shader-debugger],
lib/Makefile.am +1 -1
index d2f2e16..d2ae98d 100644
@@ -8,7 +8,7 @@ include Makefile.sources
 noinst_LTLIBRARIES = libintel_tools.la
 noinst_HEADERS = check-ndebug.h
 
-if HAVE_VC4
+if HAVE_LIBDRM_VC4
     libintel_tools_la_SOURCES += 	\
         igt_vc4.c			\
         igt_vc4.h
tests/Makefile.am +2 -2
index c2c2025..737afbe 100644
@@ -1,10 +1,10 @@
 include Makefile.sources
 
-if HAVE_NOUVEAU
+if HAVE_LIBDRM_NOUVEAU
     TESTS_progs_M += $(NOUVEAU_TESTS_M)
 endif
 
-if HAVE_VC4
+if HAVE_LIBDRM_VC4
     TESTS_progs_M += $(VC4_TESTS_M)
 endif
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

RFC 3/7 benchmarks/Makefile: Don't build benchmarks that depend on libdrm_intel.

In reply to [email protected]

From: Robert Foss <[email protected]>

Use the HAS_INTEL automake flag to avoid building benchmarks that won't compile unless libdrm_intel is available in the build system.

---
 benchmarks/Android.mk       |  6 ++++++
 benchmarks/Makefile.am      |  5 ++++-
 benchmarks/Makefile.sources | 14 +++++++++-----
 3 files changed, 19 insertions(+), 6 deletions(-)
benchmarks/Android.mk +6 -0
index 207a177..08b6816 100644
@@ -34,4 +34,10 @@ endef
 
 benchmark_list := $(benchmarks_PROGRAMS)
 
+ifeq ($(HAVE_LIBDRM_INTEL),true)
+    benchmark_list += $(LIBDRM_INTEL_BENCHMARKS)
+endif
+
+
+
 $(foreach item,$(benchmark_list),$(eval $(call add_benchmark,$(item))))
benchmarks/Makefile.am +4 -1
index 49d2f64..7400dd0 100644
@@ -1,6 +1,9 @@
-
 include Makefile.sources
 
+if HAVE_LIBDRM_INTEL
+	benchmarks_PROGRAMS += $(LIBDRM_INTEL_BENCHMARKS)
+endif
+
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
 AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(CAIRO_CFLAGS) $(LIBUNWIND_CFLAGS) \
 	    $(WERROR_CFLAGS)
benchmarks/Makefile.sources +9 -5
index bc4f2b5..a2742f3 100644
@@ -1,10 +1,7 @@
 benchmarksdir=$(libexecdir)/intel-gpu-tools/benchmarks
 
+
 benchmarks_PROGRAMS =			\
-	intel_upload_blit_large         \
-	intel_upload_blit_large_gtt     \
-	intel_upload_blit_large_map     \
-	intel_upload_blit_small		\
 	gem_blt				\
 	gem_create			\
 	gem_exec_ctx			\
@@ -17,6 +14,13 @@ benchmarks_PROGRAMS =			\
 	gem_prw				\
 	gem_set_domain			\
 	gem_syslatency			\
-	gem_userptr_benchmark		\
 	kms_vblank			\
 	$(NULL)
+
+LIBDRM_INTEL_BENCHMARKS =		\
+	intel_upload_blit_large		\
+	intel_upload_blit_large_gtt	\
+	intel_upload_blit_large_map	\
+	intel_upload_blit_small		\
+	gem_userptr_benchmark		\
+	$(NULL)
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

RFC 4/7 tools/Makefile: Don't build tools that depend on libdrm_intel.

In reply to [email protected]

From: Robert Foss <[email protected]>

Use the HAS_INTEL automake flag to avoid building tools that won't compile unless libdrm_intel is available in the build system.

---
 tools/Android.mk       |  8 ++++++++
 tools/Makefile.am      |  8 ++++++++
 tools/Makefile.sources | 16 ++++++----------
 3 files changed, 22 insertions(+), 10 deletions(-)
tools/Android.mk +8 -0
index 5f64184..7c99432 100644
@@ -67,6 +67,14 @@ ifneq ("${ANDROID_HAS_CAIRO}", "1")
     skip_tools_list += intel_residency
 endif
 
+ifeq ($(HAVE_LIBDRM_INTEL),true)
+    bin_PROGRAMS += $(LIBDRM_INTEL_BIN)
+
+    intel_dump_decode_SOURCES =	intel_dump_decode.c
+    intel_error_decode_SOURCES = intel_error_decode.c
+    intel_error_decode_LDFLAGS = -lz
+endif
+
 tools_list := $(filter-out $(skip_tools_list),$(bin_PROGRAMS))
 
 $(foreach item,$(tools_list),$(eval $(call add_tool,$(item))))
tools/Makefile.am +8 -0
index 5f45144..bf2511d 100644
@@ -1,5 +1,13 @@
 include Makefile.sources
 
+if HAVE_LIBDRM_INTEL
+	bin_PROGRAMS += $(LIBDRM_INTEL_BIN)
+
+	intel_dump_decode_SOURCES = intel_dump_decode.c
+	intel_error_decode_SOURCES = intel_error_decode.c
+	intel_error_decode_LDFLAGS = -lz
+endif
+
 SUBDIRS = null_state_gen registers
 
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
tools/Makefile.sources +6 -10
index 5d5958d..07d8d9b 100644
@@ -13,11 +13,8 @@ bin_PROGRAMS = 				\
 	intel_bios_reader 		\
 	intel_display_crc		\
 	intel_display_poller		\
-	intel_dump_decode 		\
-	intel_error_decode 		\
 	intel_forcewaked		\
 	intel_gpu_frequency		\
-	intel_framebuffer_dump 		\
 	intel_firmware_decode		\
 	intel_gpu_time 			\
 	intel_gpu_top 			\
@@ -27,7 +24,6 @@ bin_PROGRAMS = 				\
 	intel_lid			\
 	intel_opregion_decode		\
 	intel_panel_fitter		\
-	intel_perf_counters		\
 	intel_reg_checker 		\
 	intel_residency			\
 	intel_stepping 			\
@@ -35,8 +31,12 @@ bin_PROGRAMS = 				\
 
 dist_bin_SCRIPTS = intel_gpu_abrt
 
-intel_dump_decode_SOURCES = 	\
-	intel_dump_decode.c
+LIBDRM_INTEL_BIN =		\
+	intel_dump_decode	\
+	intel_error_decode	\
+	intel_framebuffer_dump	\
+	intel_perf_counters	\
+	$(NULL)
 
 intel_reg_SOURCES =		\
 	intel_reg.c		\
@@ -44,10 +44,6 @@ intel_reg_SOURCES =		\
 	intel_reg_spec.c	\
 	intel_reg_spec.h
 
-intel_error_decode_SOURCES =	\
-	intel_error_decode.c
-intel_error_decode_LDFLAGS = -lz
-
 intel_bios_reader_SOURCES =	\
 	intel_bios_reader.c	\
 	intel_bios.h
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

RFC 5/7 tools/Makefile: Format whitespace.

In reply to [email protected]

From: Robert Foss <[email protected]>

Harmonize tabs/spaces etc.

---
 tools/Makefile.sources | 57 +++++++++++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 28 deletions(-)
tools/Makefile.sources +29 -28
index 07d8d9b..7ed5fe5 100644
@@ -1,33 +1,34 @@
-noinst_PROGRAMS = \
-	hsw_compute_wrpll \
-	skl_compute_wrpll \
-	skl_ddb_allocation \
+noinst_PROGRAMS =		\
+	hsw_compute_wrpll	\
+	skl_compute_wrpll	\
+	skl_ddb_allocation	\
 	$(NULL)
 
-bin_PROGRAMS = 				\
-	igt_stats			\
-	intel_audio_dump 		\
-	intel_reg			\
-	intel_backlight 		\
-	intel_bios_dumper 		\
-	intel_bios_reader 		\
-	intel_display_crc		\
-	intel_display_poller		\
-	intel_forcewaked		\
-	intel_gpu_frequency		\
-	intel_firmware_decode		\
-	intel_gpu_time 			\
-	intel_gpu_top 			\
-	intel_gtt 			\
-	intel_infoframes		\
-	intel_l3_parity			\
-	intel_lid			\
-	intel_opregion_decode		\
-	intel_panel_fitter		\
-	intel_reg_checker 		\
-	intel_residency			\
-	intel_stepping 			\
-	intel_watermark
+bin_PROGRAMS =			\
+	igt_stats		\
+	intel_audio_dump	\
+	intel_reg		\
+	intel_backlight		\
+	intel_bios_dumper	\
+	intel_bios_reader	\
+	intel_display_crc	\
+	intel_display_poller	\
+	intel_forcewaked	\
+	intel_gpu_frequency	\
+	intel_firmware_decode	\
+	intel_gpu_time		\
+	intel_gpu_top		\
+	intel_gtt		\
+	intel_infoframes	\
+	intel_l3_parity		\
+	intel_lid		\
+	intel_opregion_decode	\
+	intel_panel_fitter	\
+	intel_reg_checker	\
+	intel_residency		\
+	intel_stepping		\
+	intel_watermark		\
+	$(NULL)
 
 dist_bin_SCRIPTS = intel_gpu_abrt
 
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

RFC 6/7 demos/Makefile: Don't build tools that depend on libdrm_intel.

In reply to [email protected]

From: Robert Foss <[email protected]>

Use the HAS_INTEL automake flag to avoid building tools that won't compile unless libdrm_intel is available in the build system.

---
 demos/Android.mk       | 5 ++++-
 demos/Makefile.am      | 8 +++++---
 demos/Makefile.sources | 7 +++++++
 3 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 demos/Makefile.sources
demos/Android.mk +4 -1
index 7d06c9a..add2414 100644
@@ -4,8 +4,11 @@ LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := intel_sprite_on.c
+LOCAL_SRC_FILES :=
 
+ifeq ($(HAVE_LIBDRM_INTEL),true)
+    LOCAL_SRC_FILES += $(LIBDRM_INTEL_BIN)
+endif
 
 LOCAL_CFLAGS += -DHAVE_TERMIOS_H
 LOCAL_CFLAGS += -DANDROID -UNDEBUG
demos/Makefile.am +5 -3
index f5725f4..48eb6c2 100644
@@ -1,6 +1,8 @@
-bin_PROGRAMS = 				\
-	intel_sprite_on			\
-	$(NULL)
+include Makefile.sources
+
+if HAVE_LIBDRM_INTEL
+	bin_PROGRAMS += $(LIBDRM_INTEL_BIN)
+endif
 
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
 AM_CFLAGS = $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(CWARNFLAGS) \
demos/Makefile.sources new file +7 -0
new file mode 100644
index 0000000..302f6d9
@@ -0,0 +1,7 @@
+bin_PROGRAMS =			\
+	$(NULL)
+
+HAVE_LIBDRM_INTEL_BIN =		\
+	intel_sprite_on		\
+	$(NULL)
+
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

RFC 7/7 lib/stubs: Add stubs for intel_bufmgr.

In reply to [email protected]

From: Robert Foss <[email protected]>

This patch provides stubs for functionality otherwise provided by intel_bufmgr.

The stubbed functions all fail with a call to igt_require_f(false,""). Defines and enums have been copied from libdrm_intel.

Due to the stubbed tests failing with an igt_require_f() call, these stubs are not well suited for non-tests, since tools/benchmarks/etc 'skipping' execution is unhelpful.

---
 lib/Makefile.am              |   7 +
 lib/stubs/drm/intel_bufmgr.c | 275 +++++++++++++++++++++++++++
 lib/stubs/drm/intel_bufmgr.h | 430 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 712 insertions(+)
 create mode 100644 lib/stubs/drm/intel_bufmgr.c
 create mode 100644 lib/stubs/drm/intel_bufmgr.h
lib/Makefile.am +7 -0
index d2ae98d..3e12f25 100644
@@ -14,6 +14,13 @@ if HAVE_LIBDRM_VC4
         igt_vc4.h
 endif
 
+if HAVE_LIBDRM_INTEL
+else
+    libintel_tools_la_SOURCES += 	\
+        stubs/drm/intel_bufmgr.c	\
+        stubs/drm/intel_bufmgr.h
+endif
+
 AM_CPPFLAGS = -I$(top_srcdir)
 AM_CFLAGS = $(CWARNFLAGS) $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(LIBUNWIND_CFLAGS) $(DEBUG_CFLAGS) \
 	    -DIGT_SRCDIR=\""$(abs_top_srcdir)/tests"\" \
lib/stubs/drm/intel_bufmgr.c new file +275 -0

275 lines not on this page · raw message

lib/stubs/drm/intel_bufmgr.h new file +430 -0

430 lines not on this page · raw message

Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx