Skip to contentSkip to conversation

Allow building igt without graphics dependencies

PATCH New Ryszard Knop 1 participant 20 messages Aug 9, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Allow building igt without graphics dependencies

This patchset allows building igt without cairo and pixman, making its tools conveniently available in compute-only environments for debugging purposes. Building tests, overlays and some graphics-dependent tools is not available in this scenario, but most of the interesting stuff is in there.

The new graphics=<enabled/disabled> build-time setting decides whenever igt requires cairo and pixman. Disabling those dependencies prevents transitive dependencies on a large number of graphics-related libraries (X11, etc).

Unfortunately, previous 2 patchsets did not get reviewed - resending for easier testing.

v2:
- Merge the header cleanup patchset into this one
- Rebase onto current master

#1 lore raw

PATCH v2 1/19 lib: Remove unused headers

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 lib/drmtest.c                        | 18 ------------------
 lib/i915/gem_mman.c                  |  1 -
 lib/i915/gem_scheduler.c             |  1 -
 lib/i915/i915_blt.c                  |  4 ----
 lib/i915/intel_memory_region.c       |  7 -------
 lib/i915/perf.c                      |  1 -
 lib/i915/perf_data_reader.c          |  2 --
 lib/igt.h                            | 13 +++++++------
 lib/igt_alsa.c                       |  4 ----
 lib/igt_audio.c                      |  2 --
 lib/igt_aux.c                        | 15 ---------------
 lib/igt_chamelium.c                  |  1 -
 lib/igt_chamelium_stream.c           |  2 --
 lib/igt_core.c                       | 11 -----------
 lib/igt_debugfs.c                    |  3 ---
 lib/igt_device.c                     |  1 -
 lib/igt_device_scan.c                |  1 -
 lib/igt_drm_fdinfo.c                 |  1 -
 lib/igt_dummyload.c                  |  1 -
 lib/igt_edid.c                       |  2 --
 lib/igt_eld.c                        |  4 ----
 lib/igt_frame.c                      |  2 --
 lib/igt_gt.c                         |  5 -----
 lib/igt_infoframe.c                  |  2 --
 lib/igt_kms.c                        |  3 ---
 lib/igt_msm.c                        |  3 ---
 lib/igt_nouveau.c                    |  1 -
 lib/igt_os.c                         |  4 ----
 lib/igt_panfrost.c                   |  9 +--------
 lib/igt_params.c                     |  1 -
 lib/igt_pm.c                         |  1 -
 lib/igt_primes.c                     |  1 -
 lib/igt_rapl.c                       |  1 -
 lib/igt_sysfs.c                      |  5 -----
 lib/igt_thread.c                     |  2 --
 lib/igt_v3d.c                        |  8 --------
 lib/igt_vc4.c                        |  7 -------
 lib/igt_x86.c                        |  1 -
 lib/instdone.c                       |  1 -
 lib/intel_allocator_msgchannel.c     |  1 -
 lib/intel_allocator_random.c         |  2 --
 lib/intel_allocator_reloc.c          |  2 --
 lib/intel_allocator_simple.c         |  3 ---
 lib/intel_batchbuffer.c              |  3 ---
 lib/intel_chipset.c                  |  7 -------
 lib/intel_device_info.c              |  2 --
 lib/intel_iosf.c                     |  3 ---
 lib/intel_mmio.c                     |  7 -------
 lib/intel_reg_map.c                  |  3 ---
 lib/ioctl_wrappers.c                 | 15 ---------------
 lib/media_fill.c                     |  1 -
 lib/media_spin.c                     |  1 -
 lib/nouveau/cea0b5.c                 |  2 --
 lib/rendercopy_gen6.c                | 11 -----------
 lib/rendercopy_gen7.c                | 11 -----------
 lib/rendercopy_gen8.c                | 13 -------------
 lib/rendercopy_gen9.c                | 13 -------------
 lib/rendercopy_i830.c                |  9 ---------
 lib/rendercopy_i915.c                |  9 ---------
 lib/sw_sync.c                        |  3 ---
 lib/tests/igt_assert.c               |  3 ---
 lib/tests/igt_audio.c                |  2 --
 lib/tests/igt_conflicting_args.c     |  2 --
 lib/tests/igt_describe.c             |  1 -
 lib/tests/igt_dynamic_subtests.c     |  1 -
 lib/tests/igt_edid.c                 |  2 --
 lib/tests/igt_exit_handler.c         |  1 -
 lib/tests/igt_fork.c                 |  1 -
 lib/tests/igt_fork_helper.c          |  1 -
 lib/tests/igt_invalid_subtest_name.c |  1 -
 lib/tests/igt_segfault.c             |  3 ---
 lib/tests/igt_simulation.c           |  3 ---
 lib/veboxcopy_gen12.c                |  1 -
 73 files changed, 8 insertions(+), 287 deletions(-)
lib/drmtest.c +0 -18
index 16e80bdf..7acea58b 100644
@@ -26,42 +26,24 @@
  *
  */
 
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
 #include <stdio.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <string.h>
-#include <sys/mman.h>
-#include <signal.h>
-#include <pciaccess.h>
-#include <stdlib.h>
 #include <unistd.h>
-#include <sys/wait.h>
 #include <sys/types.h>
-#include <sys/syscall.h>
-#include <sys/utsname.h>
-#include <termios.h>
 #include <pthread.h>
 
 #include "drmtest.h"
 #include "i915_drm.h"
 #include "i915/gem.h"
-#include "intel_chipset.h"
-#include "intel_io.h"
 #include "igt_debugfs.h"
 #include "igt_device.h"
-#include "igt_gt.h"
 #include "igt_kmod.h"
 #include "igt_params.h"
-#include "igt_sysfs.h"
 #include "igt_device_scan.h"
 #include "version.h"
 #include "config.h"
-#include "intel_reg.h"
-#include "ioctl_wrappers.h"
 #include "igt_dummyload.h"
 
 /**
lib/i915/gem_mman.c +0 -1
index aa9ac6f3..ec9feccf 100644
@@ -27,7 +27,6 @@
 #include <errno.h>
 
 #include "igt_core.h"
-#include "igt_gt.h"
 #include "igt_device.h"
 #include "ioctl_wrappers.h"
 #include "intel_chipset.h"
lib/i915/gem_scheduler.c +0 -1
index 0087df90..e80c775a 100644
@@ -28,7 +28,6 @@
 #include "igt_core.h"
 #include "ioctl_wrappers.h"
 
-#include "i915/i915_drm_local.h"
 #include "i915/gem_scheduler.h"
 #include "i915/gem_submission.h"
 
lib/i915/i915_blt.c +0 -4
index 8d46e51f..d2d13a53 100644
@@ -3,12 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
 #include <malloc.h>
 #include <cairo.h>
-#include "drm.h"
 #include "igt.h"
 #include "gem_create.h"
 #include "i915_blt.h"
lib/i915/intel_memory_region.c +0 -7
index 93a18982..d4071db2 100644
@@ -21,12 +21,9 @@
  * IN THE SOFTWARE.
  */
 
-#include <linux/limits.h>
 #include <signal.h>
 #include <sys/ioctl.h>
-#include <sys/time.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <pthread.h>
 
@@ -36,12 +33,8 @@
 #include "ioctl_wrappers.h"
 #include "igt_aux.h"
 #include "igt_dummyload.h"
-#include "igt_gt.h"
-#include "igt_params.h"
-#include "igt_sysfs.h"
 #include "intel_chipset.h"
 #include "igt_collection.h"
-#include "igt_device.h"
 #include "gem_mman.h"
 
 #include "i915/intel_memory_region.h"
lib/i915/perf.c +0 -1
index d88835ff..ebb038c6 100644
@@ -30,7 +30,6 @@
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/sysmacros.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include <i915_drm.h>
lib/i915/perf_data_reader.c +0 -2
index e69189ac..d73a7e31 100644
@@ -26,9 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/mman.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <unistd.h>
 
 #include <i915_drm.h>
 
lib/igt.h +7 -6
index 96a368e1..869515e8 100644
@@ -39,12 +39,6 @@
 #include "igt_params.h"
 #include "igt_pm.h"
 #include "igt_stats.h"
-#ifdef HAVE_CHAMELIUM
-#include "igt_alsa.h"
-#include "igt_audio.h"
-#include "igt_chamelium.h"
-#include "igt_chamelium_stream.h"
-#endif
 #include "instdone.h"
 #include "intel_batchbuffer.h"
 #include "intel_chipset.h"
@@ -56,4 +50,11 @@
 #include "i915/gem_mman.h"
 #include "i915/gem_engine_topology.h"
 
+#ifdef HAVE_CHAMELIUM
+#include "igt_alsa.h"
+#include "igt_audio.h"
+#include "igt_chamelium.h"
+#include "igt_chamelium_stream.h"
+#endif
+
 #endif /* IGT_H */
lib/igt_alsa.c +0 -4
index e1836be7..67ac7c37 100644
@@ -24,10 +24,6 @@
  *  Paul Kocialkowski <[email protected]>
  */
 
-#include "config.h"
-
-#include <limits.h>
-
 #include "igt_alsa.h"
 #include "igt_aux.h"
 #include "igt_core.h"
lib/igt_audio.c +0 -2
index e0b1bafe..ec020e95 100644
@@ -24,8 +24,6 @@
  *  Paul Kocialkowski <[email protected]>
  */
 
-#include "config.h"
-
 #include <errno.h>
 #include <fcntl.h>
 #include <gsl/gsl_fft_real.h>
lib/igt_aux.c +0 -15
index d80a1935..c222ddac 100644
@@ -37,17 +37,12 @@
 #include <string.h>
 #include <sys/mman.h>
 #include <signal.h>
-#include <pciaccess.h>
 #include <stdlib.h>
 #include <time.h>
 #include <unistd.h>
 #include <sys/poll.h>
 #include <sys/wait.h>
 #include <sys/resource.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <sys/utsname.h>
 #include <termios.h>
 #include <assert.h>
 #include <grp.h>
@@ -56,24 +51,14 @@
 #include <libudev.h>
 
 #include "drmtest.h"
-#include "i915_drm.h"
-#include "intel_chipset.h"
 #include "igt_aux.h"
 #include "igt_debugfs.h"
-#include "igt_gt.h"
 #include "igt_params.h"
 #include "igt_rand.h"
 #include "igt_sysfs.h"
 #include "config.h"
-#include "intel_reg.h"
 #include "ioctl_wrappers.h"
-#include "igt_kms.h"
 #include "igt_stats.h"
-#include "igt_sysfs.h"
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>   /* for dirname() */
-#endif
 
 /**
  * SECTION:igt_aux
lib/igt_chamelium.c +0 -1
index 7b790064..e6fc3d61 100644
@@ -28,7 +28,6 @@
 
 #include <stdbool.h>
 #include <string.h>
-#include <errno.h>
 #include <math.h>
 #include <xmlrpc-c/base.h>
 #include <xmlrpc-c/client.h>
lib/igt_chamelium_stream.c +0 -2
index a8cd19e5..58f30d97 100644
@@ -23,8 +23,6 @@
  * Authors: Simon Ser <[email protected]>
  */
 
-#include "config.h"
-
 #include <arpa/inet.h>
 #include <errno.h>
 #include <netdb.h>
lib/igt_core.c +0 -11
index e7425326..73a8b22c 100644
@@ -32,10 +32,7 @@
 #include <stdio.h>
 #include <assert.h>
 #include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <string.h>
-#include <sys/mman.h>
 #include <signal.h>
 #include <pciaccess.h>
 #include <getopt.h>
@@ -48,7 +45,6 @@
 #endif
 #include <pthread.h>
 #include <sys/utsname.h>
-#include <termios.h>
 #include <errno.h>
 #include <time.h>
 #include <ctype.h>
@@ -61,8 +57,6 @@
 #include "i915/gem_create.h"
 #include "intel_allocator.h"
 #include "intel_batchbuffer.h"
-#include "intel_chipset.h"
-#include "intel_io.h"
 #include "igt_debugfs.h"
 #include "igt_dummyload.h"
 #include "version.h"
@@ -72,7 +66,6 @@
 #include "igt_aux.h"
 #include "igt_sysfs.h"
 #include "igt_sysrq.h"
-#include "igt_rc.h"
 #include "igt_list.h"
 #include "igt_device_scan.h"
 #include "igt_thread.h"
@@ -81,10 +74,6 @@
 #include <libunwind.h>
 #include <elfutils/libdwfl.h>
 
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>   /* for basename() on Solaris */
-#endif
-
 /**
  * SECTION:igt_core
  * @short_description: Core i-g-t testing support
lib/igt_debugfs.c +0 -3
index a56688a5..ca893c12 100644
@@ -26,15 +26,12 @@
 #include <sys/stat.h>
 #include <sys/mount.h>
 #include <sys/sysmacros.h>
-#include <dirent.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <limits.h>
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <i915_drm.h>
 #include <poll.h>
 
 #include "drmtest.h"
lib/igt_device.c +0 -1
index fddfba72..83ae7b21 100644
@@ -21,7 +21,6 @@
  * IN THE SOFTWARE.
  *
  */
-#include <sys/types.h>
 #include <fcntl.h>
 
 #include <sys/stat.h>
lib/igt_device_scan.c +0 -1
index d6fae065..ada14f54 100644
@@ -28,7 +28,6 @@
 #include "intel_chipset.h"
 
 #include <ctype.h>
-#include <dirent.h>
 #include <fcntl.h>
 #include <glib.h>
 #include <libudev.h>
lib/igt_drm_fdinfo.c +0 -1
index 250d9e89..15ad6207 100644
@@ -24,7 +24,6 @@
 
 #include <ctype.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
lib/igt_dummyload.c +0 -1
index dc1bd51e..0c949177 100644
@@ -35,7 +35,6 @@
 #include "i915/gem_engine_topology.h"
 #include "i915/gem_mman.h"
 #include "i915/gem_submission.h"
-#include "igt_aux.h"
 #include "igt_core.h"
 #include "igt_device.h"
 #include "igt_dummyload.h"
lib/igt_edid.c +0 -2
index bff13a0d..cfdb1649 100644
@@ -23,8 +23,6 @@
  * Authors: Simon Ser <[email protected]>
  */
 
-#include "config.h"
-
 #include <assert.h>
 #include <string.h>
 #include <stdint.h>
lib/igt_eld.c +0 -4
index ef6625df..ece2d304 100644
@@ -23,12 +23,8 @@
  * Authors: Simon Ser <[email protected]>
  */
 
-#include "config.h"
-
 #include <dirent.h>
-#include <errno.h>
 #include <glob.h>
-#include <stdint.h>
 #include <stdio.h>
 #include <string.h>
 
lib/igt_frame.c +0 -2
index 45523a79..2a41b9c6 100644
@@ -24,8 +24,6 @@
  *  Paul Kocialkowski <[email protected]>
  */
 
-#include "config.h"
-
 #include <fcntl.h>
 #include <pixman.h>
 #include <cairo.h>
lib/igt_gt.c +0 -5
index d4a825e6..85f9561e 100644
@@ -26,14 +26,10 @@
 #include <strings.h>
 #include <signal.h>
 #include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <fcntl.h>
 
 #include "drmtest.h"
 #include "i915/gem.h"
-#include "i915/gem_engine_topology.h"
 #include "igt_aux.h"
 #include "igt_core.h"
 #include "igt_gt.h"
@@ -41,7 +37,6 @@
 #include "igt_sysfs.h"
 #include "igt_debugfs.h"
 #include "ioctl_wrappers.h"
-#include "intel_reg.h"
 #include "intel_chipset.h"
 #include "igt_dummyload.h"
 
lib/igt_infoframe.c +0 -2
index 2e14fe70..618b33e4 100644
@@ -23,8 +23,6 @@
  * Authors: Simon Ser <[email protected]>
  */
 
-#include "config.h"
-
 #include <string.h>
 
 #include "igt_core.h"
lib/igt_kms.c +0 -3
index 1ba3bd2a..0022ca4d 100644
@@ -34,7 +34,6 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <fcntl.h>
-#include <sys/stat.h>
 #include <string.h>
 #include <stdlib.h>
 #ifdef HAVE_LINUX_KD_H
@@ -54,11 +53,9 @@
 #include "igt_kms.h"
 #include "igt_aux.h"
 #include "igt_edid.h"
-#include "intel_chipset.h"
 #include "igt_debugfs.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
-#include "sw_sync.h"
 #ifdef HAVE_CHAMELIUM
 #include "igt_chamelium.h"
 #endif
lib/igt_msm.c +0 -3
index e9cf588f..6841d1e0 100644
@@ -26,13 +26,10 @@
 #include <signal.h>
 #include <errno.h>
 #include <sys/mman.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
-#include <fcntl.h>
 
 #include "drmtest.h"
-#include "igt_aux.h"
 #include "igt_core.h"
 #include "igt_msm.h"
 #include "ioctl_wrappers.h"
lib/igt_nouveau.c +0 -1
index fdf6020a..0a1326e9 100644
@@ -32,7 +32,6 @@
 #include "igt_nouveau.h"
 
 #include "nouveau/nvif/push.h"
-#include "nouveau/nvhw/class/cla0b5.h"
 #include "nouveau/priv.h"
 
 #define PASCAL_DMA_COPY_A                                                            (0x0000C0B5)
lib/igt_os.c +0 -4
index bdd5d933..74d06181 100644
@@ -34,11 +34,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
-#include <err.h>
-#include <assert.h>
-#include <sys/ioctl.h>
 #include <fcntl.h>
-#include <sys/stat.h>
 #include <sys/mman.h>
 #ifdef HAVE_STRUCT_SYSINFO_TOTALRAM
 #include <sys/sysinfo.h>
lib/igt_panfrost.c +1 -8
index f63611b9..e331ed82 100644
@@ -22,22 +22,15 @@
  * IN THE SOFTWARE.
  */
 
-#include <assert.h>
 #include <string.h>
-#include <signal.h>
+#include <stddef.h>
 #include <errno.h>
 #include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
 
 #include "drmtest.h"
-#include "igt_aux.h"
 #include "igt_core.h"
 #include "igt_panfrost.h"
 #include "ioctl_wrappers.h"
-#include "intel_reg.h"
 #include "intel_chipset.h"
 #include "panfrost_drm.h"
 #include "panfrost-job.h"
lib/igt_params.c +0 -1
index 3dad317a..f3a985c5 100644
@@ -27,7 +27,6 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <sys/ioctl.h>
-#include <sys/stat.h>
 
 #include <i915_drm.h>
 
lib/igt_pm.c +0 -1
index 6ebbad33..d453b5e6 100644
@@ -34,7 +34,6 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/sysmacros.h>
-#include <sys/types.h>
 #include <dirent.h>
 
 #include "drmtest.h"
lib/igt_primes.c +0 -1
index 3941bb21..10671d31 100644
@@ -24,7 +24,6 @@
 #include "igt_primes.h"
 
 #include <stdlib.h>
-#include <stdbool.h>
 #include <string.h>
 #include <math.h>
 
lib/igt_rapl.c +0 -1
index 03e49226..fb1b75c1 100644
@@ -1,4 +1,3 @@
-#include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <locale.h>
lib/igt_sysfs.c +0 -5
index 40c9a2e3..857773e8 100644
@@ -25,7 +25,6 @@
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/sysmacros.h>
-#include <sys/mount.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -34,14 +33,10 @@
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <i915_drm.h>
 #include <dirent.h>
-#include <unistd.h>
-#include <fcntl.h>
 
 #include "igt_core.h"
 #include "igt_sysfs.h"
-#include "igt_device.h"
 #include "igt_io.h"
 
 /**
lib/igt_thread.c +0 -2
index 5bdda410..06ea72b3 100644
@@ -22,8 +22,6 @@
  */
 
 #include <pthread.h>
-#include <stdlib.h>
-#include <stdatomic.h>
 
 #include "igt_core.h"
 #include "igt_thread.h"
lib/igt_v3d.c +0 -8
index 619c072c..88ec75f6 100644
@@ -21,22 +21,14 @@
  * IN THE SOFTWARE.
  */
 
-#include <assert.h>
 #include <string.h>
-#include <signal.h>
 #include <errno.h>
 #include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
 
 #include "drmtest.h"
-#include "igt_aux.h"
 #include "igt_core.h"
 #include "igt_v3d.h"
 #include "ioctl_wrappers.h"
-#include "intel_reg.h"
 #include "intel_chipset.h"
 #include "v3d_drm.h"
 
lib/igt_vc4.c +0 -7
index 4415fa32..e3f76765 100644
@@ -23,21 +23,14 @@
 
 #include <assert.h>
 #include <string.h>
-#include <signal.h>
 #include <errno.h>
 #include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
 
 #include "drmtest.h"
-#include "igt_aux.h"
 #include "igt_core.h"
 #include "igt_fb.h"
 #include "igt_vc4.h"
 #include "ioctl_wrappers.h"
-#include "intel_reg.h"
 #include "intel_chipset.h"
 #include "vc4_drm.h"
 #include "vc4_packet.h"
lib/igt_x86.c +0 -1
index 6ac700df..4dce3be5 100644
@@ -38,7 +38,6 @@
 #include "igt_x86.h"
 #include "igt_aux.h"
 
-#include <stdint.h>
 #include <stdio.h>
 #include <string.h>
 
lib/instdone.c +0 -1
index a83f8836..d3d8d8e7 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#include <assert.h>
 #include "instdone.h"
 
 #include "intel_chipset.h"
lib/intel_allocator_msgchannel.c +0 -1
index cd0f0a5d..d1f6486c 100644
@@ -6,7 +6,6 @@
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/msg.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include "igt.h"
 #include "intel_allocator_msgchannel.h"
lib/intel_allocator_random.c +0 -2
index d22f8176..9ed92383 100644
@@ -3,10 +3,8 @@
  * Copyright © 2021 Intel Corporation
  */
 
-#include <sys/ioctl.h>
 #include <stdlib.h>
 #include "igt.h"
-#include "igt_x86.h"
 #include "igt_rand.h"
 #include "intel_allocator.h"
 
lib/intel_allocator_reloc.c +0 -2
index ee3ad43f..bf4d9c43 100644
@@ -3,10 +3,8 @@
  * Copyright © 2021 Intel Corporation
  */
 
-#include <sys/ioctl.h>
 #include <stdlib.h>
 #include "igt.h"
-#include "igt_x86.h"
 #include "igt_rand.h"
 #include "intel_allocator.h"
 
lib/intel_allocator_simple.c +0 -3
index 8d5105f1..22828ae5 100644
@@ -3,10 +3,7 @@
  * Copyright © 2021 Intel Corporation
  */
 
-#include <sys/ioctl.h>
 #include <stdlib.h>
-#include "igt.h"
-#include "igt_x86.h"
 #include "intel_allocator.h"
 #include "intel_bufops.h"
 #include "igt_map.h"
lib/intel_batchbuffer.c +0 -3
index ef1b5947..dcb06afc 100644
@@ -26,14 +26,11 @@
  **************************************************************************/
 
 #include <inttypes.h>
-#include <poll.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <assert.h>
 #include <search.h>
 
-#include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
 #include "intel_batchbuffer.h"
lib/intel_chipset.c +0 -7
index efb6f177..438961c1 100644
@@ -25,17 +25,10 @@
  *
  */
 
-#include <unistd.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <errno.h>
 #include <err.h>
-#include <assert.h>
 #include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
 #include "i915_drm.h"
 
 #include "drmtest.h"
lib/intel_device_info.c +0 -2
index ebfcea73..09721e57 100644
@@ -2,8 +2,6 @@
 #include "i915_pciids.h"
 #include "i915_pciids_local.h"
 
-#include <strings.h> /* ffs() */
-
 static const struct intel_device_info intel_generic_info = {
 	.graphics_ver = 0,
 	.display_ver = 0,
lib/intel_iosf.c +0 -3
index 40525b06..3e0a33de 100644
@@ -1,7 +1,4 @@
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <err.h>
 #include <errno.h>
 
 #include "intel_io.h"
lib/intel_mmio.c +0 -7
index 10b07aab..29ae898b 100644
@@ -28,16 +28,9 @@
 
 #include <unistd.h>
 #include <fcntl.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <string.h>
-#include <errno.h>
-#include <err.h>
-#include <assert.h>
-#include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
 
lib/intel_reg_map.c +0 -3
index 0e2ee06c..882ae16d 100644
@@ -26,9 +26,6 @@
  */
 
 #include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <sys/types.h>
 
 #include "intel_io.h"
 #include "intel_chipset.h"
lib/ioctl_wrappers.c +0 -15
index 09eb3ce7..dfb32686 100644
@@ -26,25 +26,12 @@
  *
  */
 
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
 #include <stdio.h>
 #include <fcntl.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <string.h>
 #include <sys/mman.h>
-#include <signal.h>
-#include <pciaccess.h>
-#include <getopt.h>
-#include <stdlib.h>
 #include <unistd.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <sys/utsname.h>
-#include <termios.h>
 #include <errno.h>
 
 #include "drmtest.h"
@@ -52,8 +39,6 @@
 #include "i915/gem_create.h"
 #include "intel_batchbuffer.h"
 #include "intel_chipset.h"
-#include "intel_io.h"
-#include "igt_debugfs.h"
 #include "igt_sysfs.h"
 #include "igt_x86.h"
 #include "config.h"
lib/media_fill.c +0 -1
index d758f1f5..b910f8a9 100644
@@ -30,7 +30,6 @@
 #include "intel_reg.h"
 #include "drmtest.h"
 #include "gpu_cmds.h"
-#include <assert.h>
 
 static const uint32_t gen7_media_kernel[][4] = {
 	{ 0x00400001, 0x20200231, 0x00000020, 0x00000000 },
lib/media_spin.c +0 -1
index d2345d15..7bbee0f2 100644
@@ -26,7 +26,6 @@
 
 #include <i915_drm.h>
 #include "intel_reg.h"
-#include "drmtest.h"
 #include "intel_batchbuffer.h"
 #include "intel_chipset.h"
 #include "media_spin.h"
lib/nouveau/cea0b5.c +0 -2
index 0986a3f8..2df80b05 100644
@@ -22,8 +22,6 @@
 
 #include <inttypes.h>
 
-#include <nouveau_drm.h>
-
 #include "igt.h"
 #include "igt_nouveau.h"
 
lib/rendercopy_gen6.c +0 -11
index e941257e..940f5638 100644
@@ -1,15 +1,5 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include "drm.h"
 #include "i915_drm.h"
 #include "drmtest.h"
 #include "intel_bufops.h"
@@ -17,7 +7,6 @@
 #include "intel_io.h"
 #include "rendercopy.h"
 #include "gen6_render.h"
-#include "intel_reg.h"
 
 #define VERTEX_SIZE (3*4)
 
lib/rendercopy_gen7.c +0 -11
index 267f6f80..903de9f2 100644
@@ -1,15 +1,5 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include "drm.h"
 #include "i915_drm.h"
 #include "drmtest.h"
 #include "intel_bufops.h"
@@ -18,7 +8,6 @@
 #include "intel_chipset.h"
 #include "rendercopy.h"
 #include "gen7_render.h"
-#include "intel_reg.h"
 
 #if DEBUG_RENDERCPY
 static void dump_batch(struct intel_bb *ibb)
lib/rendercopy_gen8.c +0 -13
index ba7897fb..948e721b 100644
@@ -1,26 +1,13 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 
-#include <drm.h>
 #include <i915_drm.h>
 
-#include "drmtest.h"
 #include "intel_bufops.h"
 #include "intel_batchbuffer.h"
 #include "intel_chipset.h"
-#include "intel_io.h"
 #include "rendercopy.h"
 #include "gen8_render.h"
-#include "intel_reg.h"
 #include "igt_aux.h"
 
 #define VERTEX_SIZE (3*4)
lib/rendercopy_gen9.c +0 -13
index ae0f775a..9d55613e 100644
@@ -1,24 +1,11 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <getopt.h>
 
-#include <drm.h>
 #include <i915_drm.h>
 
-#include "drmtest.h"
 #include "intel_aux_pgtable.h"
 #include "intel_bufops.h"
 #include "intel_batchbuffer.h"
-#include "intel_io.h"
 #include "rendercopy.h"
 #include "gen9_render.h"
 #include "intel_reg.h"
lib/rendercopy_i830.c +0 -9
index 4c427149..1f621872 100644
@@ -1,14 +1,5 @@
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include "drm.h"
 #include "i915_drm.h"
 #include "drmtest.h"
 #include "intel_bufops.h"
lib/rendercopy_i915.c +0 -9
index 3e421301..4adddee6 100644
@@ -1,14 +1,5 @@
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include "drm.h"
 #include "i915_drm.h"
 #include "drmtest.h"
 #include "intel_bufops.h"
lib/sw_sync.c +0 -3
index 6c762c8b..cbadff4b 100644
@@ -24,9 +24,6 @@
  *    Robert Foss <[email protected]>
  */
 
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
 #include <fcntl.h>
 #include <poll.h>
 #include <stdbool.h>
lib/tests/igt_assert.c +0 -3
index 3523a464..9d794655 100644
@@ -22,7 +22,6 @@
  *
  */
 
-#include <errno.h>
 #include <float.h>
 #include <limits.h>
 #include <math.h>
@@ -30,8 +29,6 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
 
 #include "igt_core.h"
 #include "drmtest.h"
lib/tests/igt_audio.c +0 -2
index c0727673..64649772 100644
@@ -23,8 +23,6 @@
  * Author: Simon Ser <[email protected]>
  */
 
-#include "config.h"
-
 #include <stdlib.h>
 
 #include "igt_core.h"
lib/tests/igt_conflicting_args.c +0 -2
index b5fe2d78..073d5717 100644
@@ -27,8 +27,6 @@
  */
 
 #include <signal.h>
-#include <sys/wait.h>
-#include <errno.h>
 
 #include "drmtest.h"
 #include "igt_core.h"
lib/tests/igt_describe.c +0 -1
index d71e051e..1b35a353 100644
@@ -23,7 +23,6 @@
 
 #include <sys/wait.h>
 #include <string.h>
-#include <stdlib.h>
 
 #include "drmtest.h"
 #include "igt_tests_common.h"
lib/tests/igt_dynamic_subtests.c +0 -1
index b18cfae6..a1840317 100644
@@ -21,7 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <errno.h>
 #include <sys/wait.h>
 
 #include "igt_core.h"
lib/tests/igt_edid.c +0 -2
index 8474d29e..0bfead87 100644
@@ -23,8 +23,6 @@
  * Authors: Simon Ser <[email protected]>
  */
 
-#include "config.h"
-
 #include <stdbool.h>
 
 #include "igt_core.h"
lib/tests/igt_exit_handler.c +0 -1
index 892a7f14..1e00e8ec 100644
@@ -23,7 +23,6 @@
 
 #include <unistd.h>
 #include <fcntl.h>
-#include <sys/types.h>
 #include <sys/wait.h>
 #include "igt_core.h"
 #include "drmtest.h"
lib/tests/igt_fork.c +0 -1
index d19d0945..d9d0e316 100644
@@ -23,7 +23,6 @@
  */
 
 #include <errno.h>
-#include <stdint.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/types.h>
lib/tests/igt_fork_helper.c +0 -1
index b4cf27eb..57584e18 100644
@@ -25,7 +25,6 @@
  *
  */
 
-#include "drmtest.h"
 #include "igt_aux.h"
 
 int main(int argc, char **argv)
lib/tests/igt_invalid_subtest_name.c +0 -1
index b790482c..2891e7eb 100644
@@ -21,7 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <errno.h>
 #include <sys/wait.h>
 
 #include "igt_core.h"
lib/tests/igt_segfault.c +0 -3
index 56efa912..8c00a0c1 100644
@@ -35,10 +35,7 @@
  */
 
 #include <signal.h>
-#include <stdlib.h>
-#include <sys/wait.h>
 #include <sys/types.h>
-#include <errno.h>
 
 #include "drmtest.h"
 #include "igt_core.h"
lib/tests/igt_simulation.c +0 -3
index 9a2cf2aa..bad917c1 100644
@@ -26,11 +26,8 @@
  */
 
 #include <stdlib.h>
-#include <sys/wait.h>
 #include <sys/types.h>
-#include <errno.h>
 
-#include "drmtest.h"
 #include "igt_core.h"
 
 #include "igt_tests_common.h"
lib/veboxcopy_gen12.c +0 -1
index aa90939b..38878e49 100644
@@ -20,7 +20,6 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
-#include <drm.h>
 
 #include "igt.h"
 #include "intel_aux_pgtable.h"
Signature · 1 line
2.37.1
#2 lore raw

PATCH v2 2/19 assembler: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 assembler/brw_disasm.c  | 3 ---
 assembler/brw_eu_util.c | 1 -
 assembler/disasm-main.c | 1 -
 assembler/gen8_disasm.c | 3 ---
 4 files changed, 8 deletions(-)
assembler/brw_disasm.c +0 -3
index 4dec829f..a804c655 100644
@@ -21,10 +21,7 @@
  */
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <getopt.h>
-#include <unistd.h>
 #include <stdarg.h>
 
 #include "brw_compat.h"
assembler/brw_eu_util.c +0 -1
index f9126abf..2014b093 100644
@@ -30,7 +30,6 @@
   */
 
 
-#include "brw_context.h"
 #include "brw_defines.h"
 #include "brw_eu.h"
 
assembler/disasm-main.c +0 -1
index b3655568..a5969bbb 100644
@@ -24,7 +24,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <getopt.h>
-#include <unistd.h>
 
 #include "gen4asm.h"
 #include "brw_eu.h"
assembler/gen8_disasm.c +0 -3
index 99b062ea..8ffe947a 100644
@@ -21,10 +21,7 @@
  */
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#include <getopt.h>
-#include <unistd.h>
 #include <stdarg.h>
 
 #include "brw_context.h"
Signature · 1 line
2.37.1
#3 lore raw

PATCH v2 3/19 benchmarks: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 benchmarks/gem_blt.c                     | 5 -----
 benchmarks/gem_busy.c                    | 5 -----
 benchmarks/gem_create.c                  | 6 ------
 benchmarks/gem_exec_ctx.c                | 7 -------
 benchmarks/gem_exec_fault.c              | 7 -------
 benchmarks/gem_exec_nop.c                | 8 --------
 benchmarks/gem_exec_reloc.c              | 6 ------
 benchmarks/gem_exec_trace.c              | 5 -----
 benchmarks/gem_exec_tracer.c             | 6 ------
 benchmarks/gem_latency.c                 | 7 -------
 benchmarks/gem_prw.c                     | 7 -------
 benchmarks/gem_set_domain.c              | 8 --------
 benchmarks/gem_syslatency.c              | 6 ------
 benchmarks/gem_userptr_benchmark.c       | 8 --------
 benchmarks/gem_wsim.c                    | 6 ------
 benchmarks/intel_upload_blit_large.c     | 6 ------
 benchmarks/intel_upload_blit_large_gtt.c | 5 -----
 benchmarks/intel_upload_blit_large_map.c | 5 -----
 benchmarks/intel_upload_blit_small.c     | 4 ----
 benchmarks/kms_vblank.c                  | 5 -----
 benchmarks/prime_lookup.c                | 6 ------
 benchmarks/vgem_mmap.c                   | 5 -----
 22 files changed, 133 deletions(-)
benchmarks/gem_blt.c +0 -5
index bd8264b4..111e2e72 100644
@@ -31,12 +31,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
 #include <math.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
benchmarks/gem_busy.c +0 -5
index 514e3387..22523f14 100644
@@ -30,13 +30,9 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/poll.h>
 #include <sys/ioctl.h>
-#include <sys/time.h>
 #include <time.h>
 
 #include "drm.h"
@@ -44,7 +40,6 @@
 #include "drmtest.h"
 #include "intel_chipset.h"
 #include "intel_reg.h"
-#include "igt_stats.h"
 #include "i915/gem_create.h"
 #include "i915/gem_mman.h"
 
benchmarks/gem_create.c +0 -6
index 7808f43a..ef9251a9 100644
@@ -30,15 +30,9 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
-#include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
 #include "igt_aux.h"
benchmarks/gem_exec_ctx.c +0 -7
index b0c62e4c..58032b85 100644
@@ -30,20 +30,13 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
 #include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
-#include "intel_io.h"
 #include "intel_reg.h"
-#include "igt_stats.h"
 #include "ioctl_wrappers.h"
 
 enum mode { NOP, CREATE, SWITCH, DEFAULT };
benchmarks/gem_exec_fault.c +0 -7
index e0484071..03a7fcb1 100644
@@ -32,19 +32,12 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
-#include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
 #include "i915/gem_submission.h"
-#include "igt_stats.h"
 #include "intel_allocator.h"
 #include "intel_io.h"
 #include "intel_reg.h"
benchmarks/gem_exec_nop.c +0 -8
index 9f8634a7..583f3470 100644
@@ -30,19 +30,11 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
-#include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
-#include "igt_stats.h"
-#include "intel_io.h"
 #include "intel_reg.h"
 #include "ioctl_wrappers.h"
 
benchmarks/gem_exec_reloc.c +0 -6
index dadc064f..912775b9 100644
@@ -30,17 +30,11 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
-#include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
 #include "i915/gem_mman.h"
-#include "igt_debugfs.h"
 #include "intel_reg.h"
 #include "ioctl_wrappers.h"
 
benchmarks/gem_exec_trace.c +0 -5
index 4263ccb0..2a970491 100644
@@ -31,10 +31,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 #include <assert.h>
@@ -42,8 +39,6 @@
 #include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
-#include "igt_stats.h"
-#include "intel_io.h"
 #include "ioctl_wrappers.h"
 
 enum {
benchmarks/gem_exec_tracer.c +0 -6
index e6973991..70bbc9bf 100644
@@ -25,22 +25,16 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
-#include <stdbool.h>
 #include <stdarg.h>
 #include <fcntl.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
 #include <errno.h>
-#include <sys/mman.h>
 #include <dlfcn.h>
 #include <i915_drm.h>
 #include <pthread.h>
 
-#include "intel_aub.h"
-#include "intel_chipset.h"
-
 static int (*libc_close)(int fd);
 static int (*libc_ioctl)(int fd, unsigned long request, void *argp);
 
benchmarks/gem_latency.c +0 -7
index cc8b3de5..7edc33e9 100644
@@ -32,17 +32,10 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <limits.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
 #include <sys/poll.h>
 #include <sys/resource.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 #include "igt.h"
 #include "igt_device.h"
benchmarks/gem_prw.c +0 -7
index c6f3e066..ae00c022 100644
@@ -30,18 +30,11 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
-#include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
-#include "igt_aux.h"
 #include "igt_stats.h"
 #include "ioctl_wrappers.h"
 
benchmarks/gem_set_domain.c +0 -8
index c92beea4..373aaf0e 100644
@@ -29,19 +29,11 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
-#include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
-#include "igt_aux.h"
 #include "ioctl_wrappers.h"
 
 static double elapsed(const struct timespec *start,
benchmarks/gem_syslatency.c +0 -6
index 035ee934..2fe85ee0 100644
@@ -30,19 +30,13 @@
 #include <string.h>
 #include <fcntl.h>
 #include <ftw.h>
-#include <inttypes.h>
 #include <pthread.h>
 #include <sched.h>
 #include <signal.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 #include <limits.h>
-#include "drm.h"
-
-#include <linux/unistd.h>
 
 #include "i915/gem_create.h"
 #include "i915/gem_ring.h"
benchmarks/gem_userptr_benchmark.c +0 -8
index 3b589432..3ea24d5c 100644
@@ -35,21 +35,13 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <assert.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/mman.h>
 #include <signal.h>
 
-#include "drm.h"
-#include "i915_drm.h"
-
 #include "drmtest.h"
-#include "intel_batchbuffer.h"
-#include "intel_chipset.h"
 #include "ioctl_wrappers.h"
 #include "igt_aux.h"
 
benchmarks/gem_wsim.c +0 -6
index 2d601358..412cfc13 100644
@@ -29,16 +29,12 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
 #include <poll.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/wait.h>
 #include <time.h>
-#include <assert.h>
 #include <limits.h>
 #include <pthread.h>
 #include <math.h>
@@ -50,10 +46,8 @@
 #include "intel_reg.h"
 #include "ioctl_wrappers.h"
 
-#include "intel_io.h"
 #include "igt_aux.h"
 #include "igt_rand.h"
-#include "igt_perf.h"
 #include "sw_sync.h"
 
 #include "i915/gem_create.h"
benchmarks/intel_upload_blit_large.c +0 -6
index 12bbae3d..23c48223 100644
@@ -45,17 +45,11 @@
  */
 
 #include "igt.h"
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
-#include <drm.h>
 #include <i915_drm.h>
 
 #define OBJECT_WIDTH	1280
benchmarks/intel_upload_blit_large_gtt.c +0 -5
index 0b704b57..8fd82b9e 100644
@@ -45,14 +45,9 @@
  */
 
 #include "igt.h"
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
 #define OBJECT_WIDTH	1280
benchmarks/intel_upload_blit_large_map.c +0 -5
index ae05434f..11f19469 100644
@@ -48,14 +48,9 @@
  */
 
 #include "igt.h"
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
 #define OBJECT_WIDTH	1280
benchmarks/intel_upload_blit_small.c +0 -4
index 7e3346eb..91034a6b 100644
@@ -44,11 +44,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
 /* Happens to be 128k, the size of the VBOs used by i965's Mesa driver. */
benchmarks/kms_vblank.c +0 -5
index f32cc9e3..d7050fbc 100644
@@ -30,13 +30,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
 #include <time.h>
-#include <sys/stat.h>
 #include <sys/time.h>
-#include <sys/wait.h>
 
 #include <drm.h>
 #include <xf86drm.h>
benchmarks/prime_lookup.c +0 -6
index 9c885367..3523a4f1 100644
@@ -27,16 +27,10 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/resource.h>
 #include <sys/time.h>
 #include <time.h>
 
-#include "drm.h"
 #include "drmtest.h"
 #include "i915/gem_create.h"
 #include "igt_rand.h"
benchmarks/vgem_mmap.c +0 -5
index 7e4e459e..3deed448 100644
@@ -27,11 +27,6 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
Signature · 1 line
2.37.1
#4 lore raw

PATCH v2 4/19 overlay: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 overlay/config.c          | 2 --
 overlay/gem-interrupts.c  | 1 -
 overlay/gpu-top.c         | 5 -----
 overlay/kms/kms-overlay.c | 2 --
 overlay/overlay.c         | 2 --
 overlay/power.c           | 3 ---
 overlay/rc6.c             | 1 -
 overlay/x11/dri2.c        | 1 -
 overlay/x11/position.c    | 3 ---
 overlay/x11/x11-overlay.c | 2 --
 overlay/x11/x11-window.c  | 2 --
 11 files changed, 24 deletions(-)
overlay/config.c +0 -2
index b6bd8dc3..30c6c1c7 100644
@@ -22,7 +22,6 @@
  *
  */
 
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <stdlib.h>
@@ -31,7 +30,6 @@
 #include <ctype.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <errno.h>
 
 #include "overlay.h"
 
overlay/gem-interrupts.c +0 -1
index be73b693..d1de17db 100644
@@ -22,7 +22,6 @@
  *
  */
 
-#include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
overlay/gpu-top.c +0 -5
index 32123abd..c073df3f 100644
@@ -23,13 +23,8 @@
  */
 
 #include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <assert.h>
 
 #include "igt_perf.h"
 
overlay/kms/kms-overlay.c +0 -2
index cfb3d5ae..4c936c55 100644
@@ -22,7 +22,6 @@
  *
  */
 
-#include <sys/types.h>
 #include <sys/mman.h>
 #include <cairo.h>
 #include <stdio.h>
@@ -38,7 +37,6 @@
 #include <xf86drmMode.h>
 #include <i915_drm.h>
 #include "../overlay.h"
-//#include "rgb2yuv.h"
 
 #ifndef ALIGN
 #define ALIGN(i,m)	(((i) + (m) - 1) & ~((m) - 1))
overlay/overlay.c +0 -2
index fdc62091..dc36af1d 100644
@@ -23,7 +23,6 @@
  */
 
 #include <sys/types.h>
-#include <sys/mman.h>
 #include <cairo.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -39,7 +38,6 @@
 
 #include "overlay.h"
 #include "chart.h"
-#include "config.h"
 #include "cpu-top.h"
 #include "debugfs.h"
 #include "gem-interrupts.h"
overlay/power.c +0 -3
index 76fafea9..1027b28a 100644
@@ -24,11 +24,9 @@
 
 #include <stdint.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <time.h>
 #include <errno.h>
 #include <ctype.h>
 #include <locale.h>
@@ -37,7 +35,6 @@
 #include "igt_perf.h"
 
 #include "power.h"
-#include "debugfs.h"
 
 static int
 filename_to_buf(const char *filename, char *buf, unsigned int bufsize)
overlay/rc6.c +0 -1
index 69f95f28..33553428 100644
@@ -24,7 +24,6 @@
 
 #include <sys/stat.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
overlay/x11/dri2.c +0 -1
index 6c9e90d6..7459f31a 100644
@@ -30,7 +30,6 @@
  *   Kristian Høgsberg ([email protected])
  */
 
-#include <stdio.h>
 #include <X11/Xlibint.h>
 #include <X11/extensions/Xext.h>
 #include <X11/extensions/extutil.h>
overlay/x11/position.c +0 -3
index 9e3db370..e18934d2 100644
@@ -22,15 +22,12 @@
  *
  */
 
-#include "config.h"
-
 #include <X11/Xlib.h>
 #ifdef HAVE_XRANDR
 #include <X11/extensions/Xrandr.h>
 #endif
 #include <string.h>
 #include <stdio.h>
-#include <stdlib.h>
 
 #include "position.h"
 #include "../overlay.h"
overlay/x11/x11-overlay.c +0 -2
index ac6b5f39..f14fc2d9 100644
@@ -24,10 +24,8 @@
 
 #include <X11/Xlib.h>
 #include <X11/extensions/Xvlib.h>
-#include <sys/types.h>
 #include <sys/mman.h>
 #include <cairo.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
overlay/x11/x11-window.c +0 -2
index 6bdc48c2..3d2ed065 100644
@@ -25,11 +25,9 @@
 #include <X11/Xlib.h>
 #include <cairo.h>
 #include <cairo-xlib.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
-#include <unistd.h>
 
 #include "../overlay.h"
 #include "position.h"
Signature · 1 line
2.37.1
#5 lore raw

PATCH v2 5/19 runner: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 runner/job_list.c          | 2 --
 runner/resultgen.c         | 1 -
 runner/results.c           | 2 --
 runner/resume.c            | 2 --
 runner/runner.c            | 1 -
 runner/runner_json_tests.c | 1 -
 runner/settings.c          | 1 -
 7 files changed, 10 deletions(-)
runner/job_list.c +0 -2
index 520a98da..3d6ef002 100644
@@ -1,12 +1,10 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <linux/limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include "job_list.h"
runner/resultgen.c +0 -1
index 6ecf325b..1d92d303 100644
@@ -5,7 +5,6 @@
 #include <string.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include <json.h>
runner/results.c +0 -2
index 3eb7cb15..31510a05 100644
@@ -1,8 +1,6 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 
 #include "resultgen.h"
 
runner/resume.c +0 -2
index eb8074e3..10cf253c 100644
@@ -2,8 +2,6 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 
 #include "settings.h"
 #include "job_list.h"
runner/runner.c +0 -1
index 4855ad64..62c2671c 100644
@@ -1,5 +1,4 @@
 #include <stdio.h>
-#include <string.h>
 
 #include "settings.h"
 #include "job_list.h"
runner/runner_json_tests.c +0 -1
index 7253c906..6b94bc1e 100644
@@ -1,5 +1,4 @@
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 
 #include <json.h>
runner/settings.c +0 -1
index bb63a9f4..313a0c95 100644
@@ -10,7 +10,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/utsname.h>
 #include <unistd.h>
Signature · 1 line
2.37.1
#6 lore raw

PATCH v2 6/19 tests/amdgpu: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 tests/amdgpu/amd_abm.c    | 2 --
 tests/amdgpu/amd_assr.c   | 2 --
 tests/amdgpu/amd_dp_dsc.c | 1 -
 tests/amdgpu/amd_ilr.c    | 4 ----
 tests/amdgpu/amd_info.c   | 2 --
 5 files changed, 11 deletions(-)
tests/amdgpu/amd_abm.c +0 -2
index 9400ed80..815de85b 100644
@@ -20,7 +20,6 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include "igt.h"
 #include "drmtest.h"
 #include "igt_kms.h"
 #include <limits.h>
@@ -30,7 +29,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <time.h>
 
 #define DEBUGFS_CURRENT_BACKLIGHT_PWM "amdgpu_current_backlight_pwm"
 #define DEBUGFS_TARGET_BACKLIGHT_PWM "amdgpu_target_backlight_pwm"
tests/amdgpu/amd_assr.c +0 -2
index 80cbbe8e..79510732 100644
@@ -24,8 +24,6 @@
 #include "igt_sysfs.h"
 #include <dirent.h>
 #include <fcntl.h>
-#include <limits.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 
 IGT_TEST_DESCRIPTION("Check if ASSR is enabled on eDP links that support "
tests/amdgpu/amd_dp_dsc.c +0 -1
index 8a18df3b..b818a3bc 100644
@@ -22,7 +22,6 @@
 
 #include "igt.h"
 #include "igt_amd.h"
-#include "sw_sync.h"
 #include <fcntl.h>
 #include <signal.h>
 
tests/amdgpu/amd_ilr.c +0 -4
index 50ca93a1..27376ea1 100644
@@ -22,11 +22,7 @@
 
 #include "igt.h"
 #include "igt_amd.h"
-#include "igt_sysfs.h"
 #include <dirent.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 
 #define MULTIPLIER_TO_LR 270000
tests/amdgpu/amd_info.c +0 -2
index d6aea827..b53b4dc0 100644
@@ -21,8 +21,6 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include "config.h"
-
 #include "igt.h"
 
 #include <amdgpu.h>
Signature · 1 line
2.37.1
#7 lore raw

PATCH v2 7/19 tests/vc4*: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 tests/vc4_create_bo.c    | 5 -----
 tests/vc4_dmabuf_poll.c  | 5 -----
 tests/vc4_label_bo.c     | 6 ------
 tests/vc4_lookup_fail.c  | 5 -----
 tests/vc4_purgeable_bo.c | 5 -----
 tests/vc4_tiling.c       | 7 -------
 tests/vc4_wait_bo.c      | 4 ----
 tests/vc4_wait_seqno.c   | 6 ------
 8 files changed, 43 deletions(-)
tests/vc4_create_bo.c +0 -5
index 99d180a8..dc5d565d 100644
@@ -24,14 +24,9 @@
 #include "igt.h"
 #include "igt_vc4.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include "vc4_drm.h"
 
 igt_main
tests/vc4_dmabuf_poll.c +0 -5
index 260e30c3..9027a352 100644
@@ -24,14 +24,9 @@
 #include "igt.h"
 #include "igt_vc4.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <poll.h>
 #include "vc4_drm.h"
 
tests/vc4_label_bo.c +0 -6
index 7510f87d..e77c0a35 100644
@@ -24,15 +24,9 @@
 #include "igt.h"
 #include "igt_vc4.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <poll.h>
 #include "vc4_drm.h"
 
 static void
tests/vc4_lookup_fail.c +0 -5
index f0234ee5..0b200514 100644
@@ -24,14 +24,9 @@
 #include "igt.h"
 #include <assert.h>
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include "vc4_drm.h"
 #include "vc4_packet.h"
 
tests/vc4_purgeable_bo.c +0 -5
index d9f7547f..e0a01d42 100644
@@ -26,13 +26,8 @@
 #include <unistd.h>
 #include <signal.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include "vc4_drm.h"
 
 struct igt_vc4_bo {
tests/vc4_tiling.c +0 -7
index b96fe4ad..06e8e64e 100644
@@ -24,15 +24,8 @@
 #include "igt.h"
 #include "igt_vc4.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <poll.h>
 #include "vc4_drm.h"
 
 igt_main
tests/vc4_wait_bo.c +0 -4
index 65a085a3..eba5a2b5 100644
@@ -24,13 +24,9 @@
 #include "igt.h"
 #include "igt_vc4.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "vc4_drm.h"
 
tests/vc4_wait_seqno.c +0 -6
index bcc263cb..08b85f5b 100644
@@ -23,14 +23,8 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include "vc4_drm.h"
 
 igt_main
Signature · 1 line
2.37.1
#8 lore raw

PATCH v2 8/19 tests/v3d*: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 tests/v3d_get_bo_offset.c | 7 -------
 tests/v3d_get_param.c     | 7 -------
 tests/v3d_mmap.c          | 9 ---------
 3 files changed, 23 deletions(-)
tests/v3d_get_bo_offset.c +0 -7
index 0923dc85..3b32a203 100644
@@ -24,17 +24,10 @@
 #include "igt.h"
 #include "igt_v3d.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <poll.h>
 #include "v3d_drm.h"
-#include "igt_v3d.h"
 
 igt_main
 {
tests/v3d_get_param.c +0 -7
index 76563406..5759f41a 100644
@@ -24,17 +24,10 @@
 #include "igt.h"
 #include "igt_v3d.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <poll.h>
 #include "v3d_drm.h"
-#include "igt_v3d.h"
 
 igt_main
 {
tests/v3d_mmap.c +0 -9
index a6fe7e5a..d8d9a03e 100644
@@ -22,19 +22,10 @@
  */
 
 #include "igt.h"
-#include "igt_v3d.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <poll.h>
 #include "v3d_drm.h"
-#include "igt_v3d.h"
 
 igt_main
 {
Signature · 1 line
2.37.1
#9 lore raw

PATCH v2 9/19 tests/panfrost*: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 tests/panfrost_gem_new.c   | 5 -----
 tests/panfrost_get_param.c | 6 ------
 tests/panfrost_prime.c     | 5 -----
 tests/panfrost_submit.c    | 4 ----
 4 files changed, 20 deletions(-)
tests/panfrost_gem_new.c +0 -5
index 940525ff..7e753f82 100644
@@ -25,14 +25,9 @@
 #include "igt.h"
 #include "igt_panfrost.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include "panfrost_drm.h"
 
 igt_main
tests/panfrost_get_param.c +0 -6
index 11c2632b..943d62eb 100644
@@ -25,15 +25,9 @@
 #include "igt.h"
 #include "igt_panfrost.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <poll.h>
 #include "panfrost_drm.h"
 
 igt_main
tests/panfrost_prime.c +0 -5
index 40ba036b..02eb6507 100644
@@ -25,14 +25,9 @@
 #include "igt.h"
 #include "igt_panfrost.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include "panfrost_drm.h"
 
 static bool igt_has_dumb(int fd)
tests/panfrost_submit.c +0 -4
index 4747d295..fb7c0e58 100644
@@ -26,14 +26,10 @@
 #include "igt_panfrost.h"
 #include "igt_syncobj.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include "panfrost-job.h"
 #include "panfrost_drm.h"
 
Signature · 1 line
2.37.1
#10 lore raw

PATCH v2 10/19 tests/kms*: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 tests/kms_addfb_basic.c        | 4 ----
 tests/kms_atomic.c             | 2 --
 tests/kms_atomic_transition.c  | 1 -
 tests/kms_bw.c                 | 1 -
 tests/kms_chamelium.c          | 2 --
 tests/kms_content_protection.c | 1 -
 tests/kms_cursor_edge_walk.c   | 1 -
 tests/kms_dither.c             | 2 --
 tests/kms_dp_aux_dev.c         | 4 ----
 tests/kms_flip_event_leak.c    | 3 ---
 tests/kms_getfb.c              | 6 ------
 tests/kms_hdmi_inject.c        | 2 --
 tests/kms_hdr.c                | 2 --
 tests/kms_lease.c              | 6 ------
 tests/kms_panel_fitting.c      | 1 -
 tests/kms_pipe_crc_basic.c     | 1 -
 tests/kms_plane.c              | 1 -
 tests/kms_plane_lowres.c       | 2 --
 tests/kms_plane_multiple.c     | 1 -
 tests/kms_plane_scaling.c      | 1 -
 tests/kms_prime.c              | 2 --
 tests/kms_prop_blob.c          | 2 --
 tests/kms_properties.c         | 2 --
 tests/kms_rmfb.c               | 2 --
 tests/kms_sequence.c           | 3 ---
 tests/kms_setmode.c            | 2 --
 tests/kms_vblank.c             | 3 ---
 tests/kms_writeback.c          | 1 -
 28 files changed, 61 deletions(-)
tests/kms_addfb_basic.c +0 -4
index 6b2323a9..3e72c575 100644
@@ -27,14 +27,10 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include "drm.h"
 #include "drm_fourcc.h"
 
tests/kms_atomic.c +0 -2
index 253829f2..07b6b2ee 100644
@@ -32,8 +32,6 @@
  */
 
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <stdint.h>
 #include <string.h>
 #include <errno.h>
tests/kms_atomic_transition.c +0 -1
index 10b21c92..0f31eece 100644
@@ -30,7 +30,6 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
-#include <time.h>
 #include <poll.h>
 
 #ifndef DRM_CAP_CURSOR_WIDTH
tests/kms_bw.c +0 -1
index 7bb1332e..b4307142 100644
@@ -22,7 +22,6 @@
 
 #include "drm_mode.h"
 #include "igt.h"
-#include "drm.h"
 #include <stdio.h>
 #include <xf86drmMode.h>
 
tests/kms_chamelium.c +0 -2
index d97b439a..aec82b1c 100644
@@ -24,9 +24,7 @@
  *    Lyude Paul <[email protected]>
  */
 
-#include "config.h"
 #include "igt.h"
-#include "igt_vc4.h"
 #include "igt_edid.h"
 #include "igt_eld.h"
 #include "igt_infoframe.h"
tests/kms_content_protection.c +0 -1
index 3041f1cd..5964a6d7 100644
@@ -24,7 +24,6 @@
 
 #include <poll.h>
 #include <fcntl.h>
-#include <sys/epoll.h>
 #include <sys/stat.h>
 #include <libudev.h>
 #include "igt.h"
tests/kms_cursor_edge_walk.c +0 -1
index b75fc216..4ed3e1d0 100644
@@ -24,7 +24,6 @@
 
 #include "igt.h"
 #include <errno.h>
-#include <limits.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
tests/kms_dither.c +0 -2
index 43a25e20..72b0762b 100644
@@ -26,8 +26,6 @@
  */
 
 #include "igt.h"
-#include <fcntl.h>
-#include <termios.h>
 #include <unistd.h>
 
 IGT_TEST_DESCRIPTION("Test Dithering block status");
tests/kms_dp_aux_dev.c +0 -4
index d3249fa3..e1b26b5b 100644
@@ -22,10 +22,6 @@
  *
  */
 
-#include "config.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <dirent.h>
 
tests/kms_flip_event_leak.c +0 -3
index ac201293..90c6c547 100644
@@ -23,9 +23,6 @@
  */
 
 #include "igt.h"
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
 #include <string.h>
 
 #include "igt_device.h"
tests/kms_getfb.c +0 -6
index 2e4552a0..58620c84 100644
@@ -30,18 +30,12 @@
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 
 #include "drm.h"
 #include "drm_fourcc.h"
-#include "i915/gem_create.h"
-#include "igt_device.h"
 
 IGT_TEST_DESCRIPTION("Tests GETFB and GETFB2 ioctls.");
 
tests/kms_hdmi_inject.c +0 -2
index abae0ab4..051c9b4e 100644
@@ -22,8 +22,6 @@
  *
  */
 
-#include "config.h"
-
 #include <dirent.h>
 
 #include "igt.h"
tests/kms_hdr.c +0 -2
index e2650f51..1054c7a1 100644
@@ -21,8 +21,6 @@
  */
 
 #include "igt.h"
-#include <fcntl.h>
-#include <termios.h>
 #include <unistd.h>
 #include "igt_edid.h"
 
tests/kms_lease.c +0 -6
index 0bf102a6..b5b6ea2e 100644
@@ -34,14 +34,8 @@
 #include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <time.h>
-#include <sys/poll.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/wait.h>
 
-#include <libudev.h>
-
 #include <drm.h>
 #include "igt_device.h"
 
tests/kms_panel_fitting.c +0 -1
index 478c16bd..9d8c3769 100644
@@ -23,7 +23,6 @@
  */
 
 #include "igt.h"
-#include <math.h>
 #include <sys/stat.h>
 
 IGT_TEST_DESCRIPTION("Test display panel fitting");
tests/kms_pipe_crc_basic.c +0 -1
index 2ff40f72..2f3f5380 100644
@@ -25,7 +25,6 @@
 #include "igt.h"
 #include "igt_sysfs.h"
 #include <errno.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
tests/kms_plane.c +0 -1
index c885a813..169363ec 100644
@@ -26,7 +26,6 @@
 
 #include "igt.h"
 #include "igt_vec.h"
-#include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
tests/kms_plane_lowres.c +0 -2
index f37dbd16..907f3856 100644
@@ -24,11 +24,9 @@
 
 #include "igt.h"
 #include "drmtest.h"
-#include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
-#include <time.h>
 
 IGT_TEST_DESCRIPTION("Test atomic mode setting with a plane by switching between high and low resolutions");
 
tests/kms_plane_multiple.c +0 -1
index 1679f7ce..edbb5e25 100644
@@ -24,7 +24,6 @@
 
 #include "igt.h"
 #include "drmtest.h"
-#include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
tests/kms_plane_scaling.c +0 -1
index fc8250b5..ce448d5a 100644
@@ -24,7 +24,6 @@
 
 #include "igt.h"
 #include "igt_vec.h"
-#include <math.h>
 
 IGT_TEST_DESCRIPTION("Test display plane scaling");
 
tests/kms_prime.c +0 -2
index 3df690e0..93e08c38 100644
@@ -27,8 +27,6 @@
 #include "igt_sysfs.h"
 #include <fcntl.h>
 
-#include <sys/ioctl.h>
-#include <sys/poll.h>
 #include <time.h>
 
 #define KMS_HELPER "/sys/module/drm_kms_helper/parameters/"
tests/kms_prop_blob.c +0 -2
index 96aa6d8d..b9571bb9 100644
@@ -27,8 +27,6 @@
 
 #include "igt.h"
 #include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
 #include <string.h>
 
 IGT_TEST_DESCRIPTION("Tests behaviour of mass-data 'blob' properties.");
tests/kms_properties.c +0 -2
index dd5a93aa..2fae751e 100644
@@ -25,9 +25,7 @@
 #include "drmtest.h"
 #include <errno.h>
 #include <stdbool.h>
-#include <stdio.h>
 #include <string.h>
-#include <time.h>
 
 struct additional_test {
 	const char *name;
tests/kms_rmfb.c +0 -2
index 7e43e1bd..fcca3bd8 100644
@@ -23,11 +23,9 @@
 
 #include "igt.h"
 #include "drmtest.h"
-#include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
-#include <time.h>
 
 #ifndef DRM_CAP_CURSOR_WIDTH
 #define DRM_CAP_CURSOR_WIDTH 0x8
tests/kms_sequence.c +0 -3
index 1655d7d1..3f7109f0 100644
@@ -31,13 +31,10 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <time.h>
 #include <sys/poll.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/wait.h>
 
 #include <drm.h>
tests/kms_setmode.c +0 -2
index bfa10891..3fb30e45 100644
@@ -20,7 +20,6 @@
  * Authors:
  *    Imre Deak <[email protected]>
  */
-#include "config.h"
 
 #include "igt.h"
 #include <cairo.h>
@@ -28,7 +27,6 @@
 #include <stdint.h>
 #include <unistd.h>
 #include <string.h>
-#include <sys/time.h>
 #include <math.h>
 
 #define MAX_CONNECTORS  10
tests/kms_vblank.c +0 -3
index e65e8522..9f40a67e 100644
@@ -30,13 +30,10 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <time.h>
 #include <sys/poll.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/wait.h>
 
 #include <drm.h>
tests/kms_writeback.c +0 -1
index 9d134585..98bc99bf 100644
@@ -24,7 +24,6 @@
 
 #include <errno.h>
 #include <stdbool.h>
-#include <stdio.h>
 #include <string.h>
 #include <limits.h>
 
Signature · 1 line
2.37.1
#11 lore raw

PATCH v2 11/19 tests/*: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 tests/core_auth.c              | 11 +----------
 tests/core_getclient.c         |  1 -
 tests/core_getstats.c          |  1 -
 tests/core_getversion.c        |  1 -
 tests/core_hotunplug.c         |  3 ---
 tests/core_setmaster_vs_auth.c |  2 --
 tests/debugfs_test.c           |  2 --
 tests/drm_import_export.c      |  7 -------
 tests/drm_read.c               |  7 -------
 tests/dumb_buffer.c            |  4 ----
 tests/fbdev.c                  |  6 ------
 tests/msm/msm_mapping.c        |  1 -
 tests/prime_mmap.c             |  5 -----
 tests/prime_nv_pcopy.c         |  2 --
 tests/prime_nv_test.c          |  1 -
 tests/prime_self_import.c      |  2 --
 tests/syncobj_timeline.c       |  1 -
 tests/syncobj_wait.c           |  1 -
 tests/testdisplay.c            |  6 ------
 tests/testdisplay_hotplug.c    |  2 --
 tests/tools_test.c             |  4 ----
 tests/vgem_slow.c              |  2 --
 22 files changed, 1 insertion(+), 71 deletions(-)
tests/core_auth.c +1 -10
index c9ad3fb9..1dd5f2f8 100644
@@ -28,24 +28,15 @@
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
-#include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <signal.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sched.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/poll.h>
 #include <sys/resource.h>
 #include "drm.h"
 
 #ifndef __linux__
-# include <pthread.h>
+#include <pthread.h>
 #endif
 
 IGT_TEST_DESCRIPTION("Call drmGetMagic() and drmAuthMagic() and see if it behaves.");
tests/core_getclient.c +0 -1
index 40a1c194..7c48851a 100644
@@ -26,7 +26,6 @@
  */
 
 #include "igt.h"
-#include <limits.h>
 #include <sys/ioctl.h>
 #include <stdlib.h>
 #include <errno.h>
tests/core_getstats.c +0 -1
index fde27cdc..76195a31 100644
@@ -26,7 +26,6 @@
  */
 
 #include "igt.h"
-#include <limits.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 
tests/core_getversion.c +0 -1
index f6953b31..118e5835 100644
@@ -27,7 +27,6 @@
 
 #include "igt.h"
 #include <string.h>
-#include <sys/ioctl.h>
 
 IGT_TEST_DESCRIPTION("Tests the DRM_IOCTL_GET_VERSION ioctl and libdrm's "
 		     "drmGetVersion() interface to it.");
tests/core_hotunplug.c +0 -3
index a0d29b79..bf8bc3f2 100644
@@ -26,10 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
-#include <signal.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/core_setmaster_vs_auth.c +0 -2
index 0b4b8613..03446c33 100644
@@ -35,8 +35,6 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
 
 #include "igt_device.h"
tests/debugfs_test.c +0 -2
index 0b4b6e23..e73402ab 100644
@@ -20,13 +20,11 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
-#include "config.h"
 
 #include "i915/gem.h"
 #include "igt.h"
 #include "igt_sysfs.h"
 #include <fcntl.h>
-#include <sys/types.h>
 #include <dirent.h>
 
 IGT_TEST_DESCRIPTION("Read entries from debugfs and sysfs paths.");
tests/drm_import_export.c +0 -7
index 06245e8b..c3c0bc20 100644
@@ -25,20 +25,13 @@
  */
 
 #include "igt.h"
-#include <stdio.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
-#include <stdlib.h>
 #include <string.h>
-#include <drm.h>
-#include <i915_drm.h>
-#include <xf86drm.h>
 #include <intel_bufmgr.h>
 #include <errno.h>
 #include <pthread.h>
 #include <unistd.h>
-#include <sys/syscall.h>
 
 #include "i915/gem.h"
 
tests/drm_read.c +0 -7
index 4a966a23..49af0b77 100644
@@ -31,17 +31,10 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
 #include <string.h>
 #include <signal.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
 #include <sys/poll.h>
 #include <pthread.h>
 #include "drm.h"
tests/dumb_buffer.c +0 -4
index 2c6261bd..e2bfab25 100644
@@ -32,16 +32,12 @@
  */
 
 #include <errno.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <pthread.h>
 #include <signal.h>
 #include <stdatomic.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
 #include <drm.h>
tests/fbdev.c +0 -6
index 794882a6..64c86c08 100644
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#include "config.h"
-
 #include "igt.h"
 
 #include <errno.h>
@@ -31,14 +29,10 @@
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include <linux/fb.h>
 
-#include "igt.h"
-
 #define PANSTEP(panstep_) \
 	((panstep_) ? (panstep_) : 1)
 
tests/msm/msm_mapping.c +0 -1
index 21cdc8e1..88837673 100644
@@ -26,7 +26,6 @@
 #include <glob.h>
 #include <string.h>
 #include <sys/poll.h>
-#include <sys/stat.h>
 
 #include "igt.h"
 #include "igt_msm.h"
tests/prime_mmap.c +0 -5
index d53185ff..0c075214 100644
@@ -34,11 +34,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <pthread.h>
 
 #include "drm.h"
 #include "drmtest.h"
@@ -47,7 +43,6 @@
 #include "i915_drm.h"
 #include "i915/gem_create.h"
 #include "i915/gem_mman.h"
-#include "igt_debugfs.h"
 #include "ioctl_wrappers.h"
 #include "i915/intel_memory_region.h"
 
tests/prime_nv_pcopy.c +0 -2
index e465e5fc..e98e48ee 100644
@@ -22,8 +22,6 @@
 #include <fcntl.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <errno.h>
 
 #include "intel_bufmgr.h"
 #include "nouveau.h"
tests/prime_nv_test.c +0 -1
index 81d142f4..eb647668 100644
@@ -21,7 +21,6 @@
 #include <fcntl.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/ioctl.h>
 
 #include "intel_bufmgr.h"
 #include "nouveau.h"
tests/prime_self_import.c +0 -2
index bf548619..1494b86a 100644
@@ -34,12 +34,10 @@
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <pthread.h>
 
tests/syncobj_timeline.c +0 -1
index 20375cdd..b4858673 100644
@@ -26,7 +26,6 @@
 #include "igt_syncobj.h"
 #include <unistd.h>
 #include <time.h>
-#include <sys/ioctl.h>
 #include <pthread.h>
 #include <signal.h>
 #include "drm.h"
tests/syncobj_wait.c +0 -1
index 669d0adf..19995544 100644
@@ -26,7 +26,6 @@
 #include "igt_syncobj.h"
 #include <unistd.h>
 #include <time.h>
-#include <sys/ioctl.h>
 #include <pthread.h>
 #include <signal.h>
 #include "drm.h"
tests/testdisplay.c +0 -6
index d45a722b..f707444f 100644
@@ -45,23 +45,17 @@
  *  - DP commands (e.g. poweroff)
  * - verify outputs against VBT/physical connectors
  */
-#include "config.h"
 
 #include "igt.h"
 #include <cairo.h>
 #include <errno.h>
 #include <getopt.h>
 #include <libgen.h>
-#include <math.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <strings.h>
 #include <unistd.h>
 #include <termios.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 
 #include "testdisplay.h"
tests/testdisplay_hotplug.c +0 -2
index cd784895..f77554ca 100644
@@ -22,14 +22,12 @@
  */
 
 #include "igt.h"
-#include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 
 #include <sys/stat.h>
 
 #include "testdisplay.h"
-#include "config.h"
 
 
 #include <libudev.h>
tests/tools_test.c +0 -4
index 237f0433..476b2434 100644
@@ -20,12 +20,8 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
-#include "config.h"
 #include "igt.h"
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
 #include <libgen.h>
 #include <unistd.h>
 #include <linux/limits.h>
tests/vgem_slow.c +0 -2
index 58b09e42..91fe6f20 100644
@@ -28,8 +28,6 @@
 
 #include <sys/mman.h>
 #include <sys/poll.h>
-#include <sys/stat.h>
-#include <dirent.h>
 
 IGT_TEST_DESCRIPTION("Extended sanity check of Virtual GEM module (vGEM).");
 
Signature · 1 line
2.37.1
#12 lore raw

PATCH v2 12/19 tools: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 tools/cnl_compute_wrpll.c                     |  1 -
 tools/hsw_compute_wrpll.c                     |  3 ---
 tools/i915-perf/i915_perf_configs.c           |  1 -
 tools/i915-perf/i915_perf_reader.c            |  5 -----
 tools/i915-perf/i915_perf_recorder.c          |  4 ----
 tools/igt_compliance_utils.c                  |  3 ---
 tools/igt_dp_compliance_hotplug.c             |  1 -
 tools/igt_stats.c                             |  3 ---
 tools/intel_audio_dump.c                      |  3 ---
 tools/intel_backlight.c                       |  1 -
 tools/intel_bios_dumper.c                     |  1 -
 tools/intel_display_poller.c                  |  3 ---
 tools/intel_dp_compliance.c                   | 11 -----------
 tools/intel_error_decode.c                    |  3 ---
 tools/intel_firmware_decode.c                 |  3 ---
 tools/intel_forcewaked.c                      |  3 ---
 tools/intel_framebuffer_dump.c                |  3 ---
 tools/intel_gem_info.c                        |  2 --
 tools/intel_gpu_top.c                         |  1 -
 tools/intel_gtt.c                             |  3 ---
 tools/intel_guc_logger.c                      |  4 ----
 tools/intel_gvtg_test.c                       | 15 ---------------
 tools/intel_l3_parity.c                       |  3 ---
 tools/intel_l3_udev_listener.c                |  3 ---
 tools/intel_lid.c                             |  5 -----
 tools/intel_opregion_decode.c                 |  2 --
 tools/intel_panel_fitter.c                    |  2 --
 tools/intel_perf_counters.c                   |  3 ---
 tools/intel_pm_rpm.c                          |  3 ---
 tools/intel_reg.c                             |  1 -
 tools/intel_reg_checker.c                     |  3 ---
 tools/intel_residency.c                       |  1 -
 tools/intel_stepping.c                        |  2 --
 tools/intel_vbt_decode.c                      |  3 +--
 tools/intel_watermark.c                       |  1 -
 tools/lsgpu.c                                 |  3 ---
 tools/msm_dp_compliance.c                     | 11 -----------
 tools/null_state_gen/intel_batchbuffer.c      |  1 -
 tools/null_state_gen/intel_null_state_gen.c   |  1 -
 tools/null_state_gen/intel_renderstate_gen8.c |  1 -
 tools/skl_compute_wrpll.c                     |  2 --
 41 files changed, 1 insertion(+), 127 deletions(-)
tools/cnl_compute_wrpll.c +0 -1
index 9caf69f1..e4fd09e6 100644
@@ -22,7 +22,6 @@
  */
 
 #include <assert.h>
-#include <inttypes.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdbool.h>
tools/hsw_compute_wrpll.c +0 -3
index b1eeb7c7..5a498608 100644
@@ -23,11 +23,8 @@
 
 #include <inttypes.h>
 #include <stdio.h>
-#include <stdbool.h>
 #include <stdint.h>
-#include <stdlib.h>
 
-#include "intel_io.h"
 #include "drmtest.h"
 
 #define LC_FREQ 2700
tools/i915-perf/i915_perf_configs.c +0 -1
index bce3bd0f..5ba06bdc 100644
@@ -33,7 +33,6 @@
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/sysmacros.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 
tools/i915-perf/i915_perf_reader.c +0 -5
index e51f5a5d..83242c4a 100644
@@ -20,23 +20,18 @@
  * SOFTWARE.
  */
 
-#include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <getopt.h>
 #include <inttypes.h>
-#include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <unistd.h>
 
 #include <i915_drm.h>
 
-#include "igt_core.h"
 #include "intel_chipset.h"
 #include "i915/perf.h"
 #include "i915/perf_data_reader.h"
tools/i915-perf/i915_perf_recorder.c +0 -4
index 00195290..f6b7e625 100644
@@ -21,7 +21,6 @@
  */
 
 #include <assert.h>
-#include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <getopt.h>
@@ -35,9 +34,6 @@
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
-#include <sys/sysmacros.h>
-#include <sys/time.h>
-#include <sys/types.h>
 #include <time.h>
 #include <unistd.h>
 
tools/igt_compliance_utils.c +0 -3
index 0faf3fc8..e206740d 100644
@@ -24,13 +24,10 @@
  */
 
 #include "igt.h"
-#include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
 #include <signal.h>
 #include <termios.h>
 #include <libgen.h>
-#include <sys/stat.h>
 
 #include "igt_dp_compliance.h"
 
tools/igt_dp_compliance_hotplug.c +0 -1
index d05e45ca..3e0cf3d5 100644
@@ -24,7 +24,6 @@
  */
 
 #include "igt.h"
-#include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 
tools/igt_stats.c +0 -3
index 105e9bc5..dc4e66ea 100644
@@ -28,10 +28,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <stdint.h>
 #include <string.h>
-#include <errno.h>
-#include <unistd.h>
 
 #include "igt_stats.h"
 
tools/intel_audio_dump.c +0 -3
index 6d11659e..ecd14ad7 100644
@@ -26,11 +26,8 @@
  *
  */
 
-#include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <string.h>
-#include <err.h>
 #include <arpa/inet.h>
 #include "intel_io.h"
 #include "intel_reg.h"
tools/intel_backlight.c +0 -1
index edf06022..f5e8a3b5 100644
@@ -28,7 +28,6 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <string.h>
 
 #include "intel_io.h"
 #include "intel_chipset.h"
tools/intel_bios_dumper.c +0 -1
index 85bea97b..2c5246ee 100644
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdarg.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
tools/intel_display_poller.c +0 -3
index 30d9242c..673a682a 100644
@@ -23,19 +23,16 @@
  */
 
 #include <assert.h>
-#include <fcntl.h>
 #include <getopt.h>
 #include <unistd.h>
 #include <signal.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <err.h>
 #include <string.h>
 #include "intel_chipset.h"
 #include "intel_io.h"
 #include "intel_reg.h"
-#include "igt_debugfs.h"
 #include "drmtest.h"
 #include "igt_aux.h"
 
tools/intel_dp_compliance.c +0 -11
index 2e20d7f0..7390348f 100644
@@ -109,27 +109,16 @@
 #include "igt.h"
 #include <errno.h>
 #include <getopt.h>
-#include <math.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <strings.h>
 #include <unistd.h>
-#include <termios.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/select.h>
-#include <assert.h>
-#include <signal.h>
 #include <fcntl.h>
-#include <time.h>
 
 #include "igt_dp_compliance.h"
 
 #include <stdlib.h>
-#include <signal.h>
 
 /* User Input definitions */
 #define HELP_DESCRIPTION 1
tools/intel_error_decode.c +0 -3
index 90a18a07..bb16110e 100644
@@ -41,7 +41,6 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdarg.h>
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
@@ -54,10 +53,8 @@
 #include <ctype.h>
 
 #include "intel_chipset.h"
-#include "intel_io.h"
 #include "instdone.h"
 #include "intel_reg.h"
-#include "drmtest.h"
 
 static uint32_t
 print_head(unsigned int reg)
tools/intel_firmware_decode.c +0 -3
index 61ce3a53..b750a771 100644
@@ -28,10 +28,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdint.h>
-#include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 
tools/intel_forcewaked.c +0 -3
index 87b26d43..0864357c 100644
@@ -26,9 +26,7 @@
  */
 
 #include <assert.h>
-#include <err.h>
 #include <string.h>
-#include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -36,7 +34,6 @@
 #include <unistd.h>
 #include "intel_io.h"
 #include "intel_chipset.h"
-#include "drmtest.h"
 
 bool daemonized;
 
tools/intel_framebuffer_dump.c +0 -3
index 79c0688b..420167b8 100644
@@ -26,15 +26,12 @@
  * Read back all the KMS framebuffers attached to the CRTC and record as PNG.
  */
 
-#include <stdint.h>
-#include <sys/types.h>
 #include <sys/mman.h>
 #include <errno.h>
 #include <xf86drmMode.h>
 #include <i915_drm.h>
 #include <cairo.h>
 
-#include "intel_io.h"
 #include "drmtest.h"
 
 int main(int argc, char **argv)
tools/intel_gem_info.c +0 -2
index 75444438..3700d20e 100644
@@ -1,8 +1,6 @@
 #include "igt.h"
 #include <sys/ioctl.h>
-#include <fcntl.h>
 #include <errno.h>
-#include <string.h>
 #include <signal.h>
 #include <i915_drm.h>
 
tools/intel_gpu_top.c +0 -1
index 6de8a164..742542e5 100644
@@ -40,7 +40,6 @@
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 #include <termios.h>
 #include <sys/sysmacros.h>
tools/intel_gtt.c +0 -3
index 311694ba..80ba0293 100644
@@ -30,11 +30,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdarg.h>
 #include <pciaccess.h>
-#include <unistd.h>
 
-#include "intel_io.h"
 #include "intel_chipset.h"
 
 #define KB(x) ((x) * 1024)
tools/intel_guc_logger.c +0 -4
index 5f1de8db..ec76eb30 100644
@@ -26,18 +26,14 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <sched.h>
-#include <sys/ioctl.h>
 #include <string.h>
 #include <errno.h>
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/poll.h>
-#include <sys/wait.h>
 #include <sys/types.h>
-#include <sys/syscall.h>
 #include <sys/mman.h>
-#include <assert.h>
 #include <pthread.h>
 
 #include "igt.h"
tools/intel_gvtg_test.c +0 -15
index ad5ee6a6..4ede5f08 100644
@@ -28,31 +28,16 @@
  * TODO:
  * Enable more GVT-g related test cases.
  */
-#include "config.h"
 
 #include "igt.h"
 #include <errno.h>
 #include <getopt.h>
-#include <math.h>
-#include <stdint.h>
-#include <stdbool.h>
 #include <strings.h>
 #include <unistd.h>
-#include <termios.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <string.h>
 #include <stdlib.h>
-#include <signal.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <unistd.h>
 #include <pwd.h>
-#include <limits.h>
 #include <dirent.h>
 
 #define RANDOM(x) (rand() % x)
tools/intel_l3_parity.c +0 -3
index 8225b272..2faac29e 100644
@@ -25,8 +25,6 @@
  *
  */
 
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <assert.h>
 #include <fcntl.h>
 #include <stdio.h>
@@ -39,7 +37,6 @@
 #include "igt_device.h"
 #include "igt_sysfs.h"
 #include "drmtest.h"
-#include "config.h"
 #include <libudev.h>
 #include <syslog.h>
 #include "intel_l3_parity.h"
tools/intel_l3_udev_listener.c +0 -3
index ff62f407..084ed689 100644
@@ -21,13 +21,10 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include "config.h"
-
 #include <libudev.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <assert.h>
 #include <syslog.h>
 #include "i915_drm.h"
tools/intel_lid.c +0 -5
index 2a1d9800..a9b46d5f 100644
@@ -28,14 +28,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdarg.h>
-#include <pciaccess.h>
-#include <err.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <dirent.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 
 #include "intel_io.h"
 #include "intel_reg.h"
tools/intel_opregion_decode.c +0 -2
index b0a503e1..f75c3c4b 100644
@@ -36,9 +36,7 @@
 #include <unistd.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 
-#include "intel_io.h"
 #include "drmtest.h"
 
 #define OPREGION_HEADER_OFFSET		0
tools/intel_panel_fitter.c +0 -2
index c6ee2101..6f65542a 100644
@@ -29,11 +29,9 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <string.h>
 #include "intel_io.h"
 #include "intel_chipset.h"
 #include "intel_reg.h"
-#include "drmtest.h"
 
 int gen;
 
tools/intel_perf_counters.c +0 -3
index d297f2e8..1b85c992 100644
@@ -39,10 +39,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <err.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915_drm.h"
 #include "igt_device.h"
 #include "drmtest.h"
tools/intel_pm_rpm.c +0 -3
index 53ad252d..85ae115a 100644
@@ -22,10 +22,7 @@
  *
  */
 
-#include <errno.h>
 #include <getopt.h>
-#include <glib.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdbool.h>
tools/intel_reg.c +0 -1
index 584a2ccd..6ff34b4e 100644
@@ -29,7 +29,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include "i915/gem_create.h"
tools/intel_reg_checker.c +0 -3
index 2aefabc6..01074a6d 100644
@@ -21,10 +21,7 @@
  */
 
 #include <unistd.h>
-#include <stdlib.h>
 #include <stdio.h>
-#include <err.h>
-#include <string.h>
 #include <stdbool.h>
 #include "intel_io.h"
 #include "intel_chipset.h"
tools/intel_residency.c +0 -1
index 0932e362..1d329e1f 100644
@@ -25,7 +25,6 @@
  */
 
 #include <sys/time.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <inttypes.h>
tools/intel_stepping.c +0 -2
index 7839ef59..88b37856 100644
@@ -28,11 +28,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdarg.h>
 #include <pciaccess.h>
 #include <err.h>
 #include "intel_chipset.h"
-#include "intel_io.h"
 #include "intel_reg.h"
 
 static void
tools/intel_vbt_decode.c +1 -2
index 5494a34b..77bba676 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright � 2006 Intel Corporation
+ * Copyright � 2006 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -36,7 +36,6 @@
 #include <arpa/inet.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 
 #include "igt_aux.h"
 #include "intel_io.h"
tools/intel_watermark.c +0 -1
index 1e235ed3..51e1e8c0 100644
@@ -27,7 +27,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdbool.h>
-#include <err.h>
 #include <string.h>
 #include "intel_io.h"
 #include "intel_chipset.h"
tools/lsgpu.c +0 -3
index da84e205..0a5c114a 100644
@@ -24,9 +24,6 @@
 
 #include "igt_device_scan.h"
 #include "igt.h"
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <errno.h>
 #include <string.h>
 #include <signal.h>
 #include <glib.h>
tools/msm_dp_compliance.c +0 -11
index 6941d385..e7d4524e 100644
@@ -110,27 +110,16 @@
 #include "igt.h"
 #include <errno.h>
 #include <getopt.h>
-#include <math.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <strings.h>
 #include <unistd.h>
-#include <termios.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/select.h>
-#include <assert.h>
-#include <signal.h>
 #include <fcntl.h>
-#include <time.h>
 
 #include "igt_dp_compliance.h"
 
 #include <stdlib.h>
-#include <signal.h>
 
 /* User Input definitions */
 #define HELP_DESCRIPTION 1
tools/null_state_gen/intel_batchbuffer.c +0 -1
index 2ead22e1..7f5de7ad 100644
@@ -31,7 +31,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
 #include <assert.h>
 
 #include "intel_batchbuffer.h"
tools/null_state_gen/intel_null_state_gen.c +0 -1
index 7d5887eb..9cefe183 100644
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <assert.h>
 
 #include "intel_renderstate.h"
 #include "intel_batchbuffer.h"
tools/null_state_gen/intel_renderstate_gen8.c +0 -1
index 17822c44..de2ef06f 100644
@@ -28,7 +28,6 @@
 #include "intel_batchbuffer.h"
 #include <lib/gen8_render.h>
 #include <lib/intel_reg.h>
-#include <string.h>
 
 static void gen8_emit_wm(struct intel_batchbuffer *batch)
 {
tools/skl_compute_wrpll.c +0 -2
index 0e5965cf..65438aed 100644
@@ -23,11 +23,9 @@
 
 #include <assert.h>
 #include <inttypes.h>
-#include <limits.h>
 #include <stdio.h>
 #include <stdbool.h>
 #include <stdint.h>
-#include <stdlib.h>
 #include <string.h>
 
 #include "igt_stats.h"
Signature · 1 line
2.37.1
#13 lore raw

PATCH v2 13/19 tests/i915/*: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 tests/i915/api_intel_bb.c             | 5 -----
 tests/i915/drm_fdinfo.c               | 1 -
 tests/i915/gen3_mixed_blits.c         | 7 -------
 tests/i915/gen3_render_linear_blits.c | 6 ------
 tests/i915/gen3_render_mixed_blits.c  | 7 -------
 tests/i915/gen3_render_tiledx_blits.c | 7 -------
 tests/i915/gen3_render_tiledy_blits.c | 7 -------
 tests/i915/gen7_exec_parse.c          | 2 --
 tests/i915/gen9_exec_parse.c          | 1 -
 tests/i915/i915_hangman.c             | 3 ---
 tests/i915/i915_module_load.c         | 4 ----
 tests/i915/i915_pm_backlight.c        | 1 -
 tests/i915/i915_pm_dc.c               | 1 -
 tests/i915/i915_pm_lpsp.c             | 1 -
 tests/i915/i915_pm_rpm.c              | 4 ----
 tests/i915/i915_pm_rps.c              | 1 -
 tests/i915/i915_pm_sseu.c             | 1 -
 tests/i915/i915_suspend.c             | 6 ------
 tests/i915/kms_dsc.c                  | 8 --------
 tests/i915/kms_fbcon_fbt.c            | 1 -
 tests/i915/kms_fence_pin_leak.c       | 3 ---
 tests/i915/kms_frontbuffer_tracking.c | 1 -
 tests/i915/kms_mmap_write_crc.c       | 2 --
 tests/i915/kms_psr.c                  | 1 -
 tests/i915/kms_psr2_sf.c              | 2 --
 tests/i915/kms_psr2_su.c              | 2 --
 tests/i915/kms_psr_stress_test.c      | 3 ---
 tests/i915/kms_pwrite_crc.c           | 4 ----
 tests/i915/perf.c                     | 3 ---
 tests/i915/perf_pmu.c                 | 6 ------
 tests/i915/sysfs_clients.c            | 4 ----
 tests/i915/sysfs_defaults.c           | 3 ---
 tests/i915/sysfs_heartbeat_interval.c | 5 -----
 tests/i915/sysfs_preempt_timeout.c    | 3 ---
 tests/i915/sysfs_timeslice_duration.c | 3 ---
 35 files changed, 119 deletions(-)
tests/i915/api_intel_bb.c +0 -5
index 1f663d2a..58151c7c 100644
@@ -23,18 +23,13 @@
 
 #include "igt.h"
 #include "igt_crc.h"
-#include "i915/gem.h"
 #include "i915/gem_create.h"
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <cairo.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <glib.h>
 #include <zlib.h>
 #include "intel_bufops.h"
tests/i915/drm_fdinfo.c +0 -1
index 65b8b830..59e8da55 100644
@@ -24,7 +24,6 @@
 
 #include "igt.h"
 #include "igt_core.h"
-#include "igt_device.h"
 #include "igt_drm_fdinfo.h"
 #include "i915/gem.h"
 #include "i915/gem_vm.h"
tests/i915/gen3_mixed_blits.c +0 -7
index 242b9985..5f2ffbeb 100644
@@ -34,16 +34,9 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "i915_reg.h"
tests/i915/gen3_render_linear_blits.c +0 -6
index 9c6b4c70..88294efb 100644
@@ -34,15 +34,9 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "i915_reg.h"
tests/i915/gen3_render_mixed_blits.c +0 -7
index 1393055f..4fdb60c2 100644
@@ -34,16 +34,9 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "i915_reg.h"
tests/i915/gen3_render_tiledx_blits.c +0 -7
index ece86749..d7e6e330 100644
@@ -34,16 +34,9 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "i915_reg.h"
tests/i915/gen3_render_tiledy_blits.c +0 -7
index 30097be6..8a738118 100644
@@ -34,15 +34,8 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include "drm.h"
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/i915/gen7_exec_parse.c +0 -2
index 69b768ed..b7ae3ea6 100644
@@ -27,8 +27,6 @@
 #include <stdio.h>
 #include <errno.h>
 
-#include <drm.h>
-
 #include "igt.h"
 #include "igt_device.h"
 #include "i915/gem.h"
tests/i915/gen9_exec_parse.c +0 -1
index c8743a78..228a3d73 100644
@@ -26,7 +26,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
-#include <stdlib.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/i915/i915_hangman.c +0 -3
index c7d69fdd..7d55a1e0 100644
@@ -26,10 +26,7 @@
  *
  */
 
-#include <limits.h>
 #include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <fcntl.h>
 #include <signal.h>
 
tests/i915/i915_module_load.c +0 -4
index 4c72157c..70b2f4a7 100644
@@ -22,10 +22,6 @@
  */
 #include "igt.h"
 #include <dirent.h>
-#include <sys/utsname.h>
-#include <linux/limits.h>
-#include <signal.h>
-#include <libgen.h>
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
tests/i915/i915_pm_backlight.c +0 -1
index cafae7f7..c30e924d 100644
@@ -27,7 +27,6 @@
 
 #include "igt.h"
 #include <limits.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
tests/i915/i915_pm_dc.c +0 -1
index f664a2a2..78fe096b 100644
@@ -25,7 +25,6 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdbool.h>
-#include <stdio.h>
 #include <string.h>
 #include "igt.h"
 #include "igt_kmod.h"
tests/i915/i915_pm_lpsp.c +0 -1
index 3ad8b260..fc85c9f7 100644
@@ -28,7 +28,6 @@
 #include "igt_kmod.h"
 #include "igt_pm.h"
 #include "igt_sysfs.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
tests/i915/i915_pm_rpm.c +0 -4
index e95875dc..912b9e4d 100644
@@ -25,8 +25,6 @@
  *
  */
 
-#include "config.h"
-
 #include <stdio.h>
 #include <stdint.h>
 #include <stdbool.h>
@@ -38,8 +36,6 @@
 #include <dirent.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <linux/i2c.h>
 #include <linux/i2c-dev.h>
 
tests/i915/i915_pm_rps.c +0 -1
index a45a6905..3c744d75 100644
@@ -34,7 +34,6 @@
 #include <signal.h>
 #include <errno.h>
 #include <time.h>
-#include <sys/wait.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/i915/i915_pm_sseu.c +0 -1
index 1b428c9b..2e2101e4 100644
@@ -27,7 +27,6 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 #include <time.h>
 
 #include "i915_drm.h"
tests/i915/i915_suspend.c +0 -6
index 94935595..a54ff612 100644
@@ -30,13 +30,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/i915/kms_dsc.c +0 -8
index be15238e..b66a5c43 100644
@@ -30,19 +30,11 @@
  *
  */
 #include "igt.h"
-#include "igt_sysfs.h"
-#include <errno.h>
-#include <getopt.h>
-#include <math.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <strings.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <signal.h>
-#include <time.h>
-#include <fcntl.h>
-#include <termios.h>
 
 IGT_TEST_DESCRIPTION("Test to validate display stream compression");
 
tests/i915/kms_fbcon_fbt.c +0 -1
index 98c452c4..ab59883d 100644
@@ -28,7 +28,6 @@
 #include "igt_device.h"
 #include "igt_psr.h"
 #include "igt_sysfs.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 
tests/i915/kms_fence_pin_leak.c +0 -3
index 16eb595f..500258b1 100644
@@ -22,10 +22,7 @@
  *
  */
 
-#include <errno.h>
-#include <limits.h>
 #include <stdbool.h>
-#include <stdio.h>
 #include <string.h>
 
 #include "i915/gem.h"
tests/i915/kms_frontbuffer_tracking.c +0 -1
index 9518c706..5ca614de 100644
@@ -25,7 +25,6 @@
  */
 
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <poll.h>
 #include <pthread.h>
tests/i915/kms_mmap_write_crc.c +0 -2
index a57938b5..33823d2e 100644
@@ -25,9 +25,7 @@
  */
 
 #include <errno.h>
-#include <limits.h>
 #include <stdbool.h>
-#include <stdio.h>
 #include <string.h>
 
 #include "drmtest.h"
tests/i915/kms_psr.c +0 -1
index 480e2cc7..4b52c0ee 100644
@@ -23,7 +23,6 @@
  */
 
 #include "igt.h"
-#include "igt_sysfs.h"
 #include "igt_psr.h"
 #include <errno.h>
 #include <stdbool.h>
tests/i915/kms_psr2_sf.c +0 -2
index 6612587c..a8de28b0 100644
@@ -23,9 +23,7 @@
  */
 
 #include "igt.h"
-#include "igt_sysfs.h"
 #include "igt_psr.h"
-#include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
tests/i915/kms_psr2_su.c +0 -2
index caccf713..41180374 100644
@@ -23,9 +23,7 @@
  */
 
 #include "igt.h"
-#include "igt_sysfs.h"
 #include "igt_psr.h"
-#include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
tests/i915/kms_psr_stress_test.c +0 -3
index daac41d4..444ae074 100644
@@ -1,10 +1,7 @@
 #include "igt.h"
-#include "igt_sysfs.h"
 #include "igt_psr.h"
-#include <errno.h>
 #include <poll.h>
 #include <stdbool.h>
-#include <stdio.h>
 #include <string.h>
 #include <sys/timerfd.h>
 
tests/i915/kms_pwrite_crc.c +0 -4
index 584e6a19..7455b427 100644
@@ -23,10 +23,6 @@
  */
 
 #include "igt.h"
-#include <errno.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <stdio.h>
 #include <string.h>
 
 
tests/i915/perf.c +0 -3
index 5502a3fb..5ddd4f39 100644
@@ -30,13 +30,10 @@
 #include <errno.h>
 #include <signal.h>
 #include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/times.h>
 #include <sys/types.h>
-#include <dirent.h>
 #include <time.h>
 #include <poll.h>
-#include <math.h>
 
 #include "i915/gem.h"
 #include "i915/perf.h"
tests/i915/perf_pmu.c +0 -6
index f363db2b..20a83212 100644
@@ -29,14 +29,8 @@
 #include <inttypes.h>
 #include <errno.h>
 #include <signal.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <sys/types.h>
-#include <dirent.h>
 #include <time.h>
 #include <poll.h>
-#include <sched.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/i915/sysfs_clients.c +0 -4
index ab79ff18..b1d41d89 100644
@@ -5,15 +5,11 @@
 
 #include <ctype.h>
 #include <dirent.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
-#include <limits.h>
 #include <math.h>
 #include <sched.h>
 #include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include "drmtest.h"
tests/i915/sysfs_defaults.c +0 -3
index dda27a0a..6ab73491 100644
@@ -22,11 +22,8 @@
  */
 
 #include <dirent.h>
-#include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include "drmtest.h"
tests/i915/sysfs_heartbeat_interval.c +0 -5
index 8cebf627..60661862 100644
@@ -24,11 +24,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
 #include <unistd.h>
 
 #include "igt_params.h"
@@ -37,7 +33,6 @@
 #include "i915/gem_context.h"
 #include "i915/gem_engine_topology.h"
 #include "intel_allocator.h"
-#include "igt_debugfs.h"
 #include "igt_dummyload.h"
 #include "igt_sysfs.h"
 #include "sw_sync.h"
tests/i915/sysfs_preempt_timeout.c +0 -3
index 51503828..572a0e75 100644
@@ -24,9 +24,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <sched.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include "igt.h"
@@ -35,7 +33,6 @@
 #include "i915/gem.h"
 #include "i915/gem_context.h"
 #include "i915/gem_engine_topology.h"
-#include "igt_debugfs.h"
 #include "igt_dummyload.h"
 #include "igt_sysfs.h"
 #include "intel_allocator.h"
tests/i915/sysfs_timeslice_duration.c +0 -3
index 8a2f1c2f..ef5d7f3d 100644
@@ -24,9 +24,6 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include "igt_params.h"
Signature · 1 line
2.37.1
#14 lore raw

PATCH v2 14/19 tests/i915/gem*: Remove unused headers

In reply to Ryszard Knop

Using CLion's automated code inspection, most unused includes were found and removed. Some warnings remain as CLion is unable to track code usage across certain attributes, but the vast majority of unneeded headers are now gone.

---
 tests/i915/gem_bad_reloc.c                  | 11 +----------
 tests/i915/gem_basic.c                      |  4 ----
 tests/i915/gem_caching.c                    |  7 -------
 tests/i915/gem_ccs.c                        |  5 +----
 tests/i915/gem_close_race.c                 |  6 ------
 tests/i915/gem_concurrent_all.c             |  4 ----
 tests/i915/gem_create.c                     |  7 -------
 tests/i915/gem_cs_tlb.c                     |  5 -----
 tests/i915/gem_ctx_bad_destroy.c            |  2 +-
 tests/i915/gem_ctx_engines.c                |  5 -----
 tests/i915/gem_ctx_exec.c                   |  4 ----
 tests/i915/gem_ctx_freq.c                   |  4 ----
 tests/i915/gem_ctx_persistence.c            |  1 -
 tests/i915/gem_ctx_shared.c                 |  8 --------
 tests/i915/gem_ctx_sseu.c                   |  6 ------
 tests/i915/gem_ctx_switch.c                 |  6 ------
 tests/i915/gem_eio.c                        |  2 --
 tests/i915/gem_evict_alignment.c            |  8 --------
 tests/i915/gem_evict_everything.c           |  9 +--------
 tests/i915/gem_exec_alignment.c             |  3 ---
 tests/i915/gem_exec_await.c                 |  4 ----
 tests/i915/gem_exec_balancer.c              |  1 -
 tests/i915/gem_exec_big.c                   |  7 -------
 tests/i915/gem_exec_capture.c               |  1 -
 tests/i915/gem_exec_create.c                |  7 -------
 tests/i915/gem_exec_endless.c               |  1 -
 tests/i915/gem_exec_fair.c                  |  8 --------
 tests/i915/gem_exec_fence.c                 |  1 -
 tests/i915/gem_exec_latency.c               |  9 ---------
 tests/i915/gem_exec_lut_handle.c            |  6 ------
 tests/i915/gem_exec_nop.c                   |  7 -------
 tests/i915/gem_exec_params.c                |  5 -----
 tests/i915/gem_exec_reloc.c                 |  2 --
 tests/i915/gem_exec_schedule.c              |  3 ---
 tests/i915/gem_fd_exhaustion.c              |  6 +-----
 tests/i915/gem_fence_thrash.c               |  7 -------
 tests/i915/gem_fence_upload.c               |  6 ------
 tests/i915/gem_fenced_exec_thrash.c         |  1 -
 tests/i915/gem_flink_basic.c                |  6 +-----
 tests/i915/gem_gpgpu_fill.c                 |  9 ---------
 tests/i915/gem_gtt_cpu_tlb.c                |  7 -------
 tests/i915/gem_gtt_hog.c                    |  7 -------
 tests/i915/gem_gtt_speed.c                  |  7 -------
 tests/i915/gem_huc_copy.c                   |  7 -------
 tests/i915/gem_linear_blits.c               |  7 -------
 tests/i915/gem_lmem_swapping.c              |  6 ------
 tests/i915/gem_lut_handle.c                 |  5 -----
 tests/i915/gem_madvise.c                    |  4 ----
 tests/i915/gem_media_fill.c                 |  8 --------
 tests/i915/gem_media_vme.c                  |  9 ---------
 tests/i915/gem_mmap.c                       |  4 ----
 tests/i915/gem_mmap_gtt.c                   |  1 -
 tests/i915/gem_mmap_offset.c                |  1 -
 tests/i915/gem_mmap_wc.c                    |  5 -----
 tests/i915/gem_partial_pwrite_pread.c       |  6 ------
 tests/i915/gem_pipe_control_store_loop.c    |  6 ------
 tests/i915/gem_ppgtt.c                      |  7 -------
 tests/i915/gem_pread.c                      |  2 --
 tests/i915/gem_pread_after_blit.c           |  7 -------
 tests/i915/gem_pwrite.c                     |  2 --
 tests/i915/gem_pwrite_snooped.c             | 10 +---------
 tests/i915/gem_read_read_speed.c            |  7 -------
 tests/i915/gem_readwrite.c                  |  4 ----
 tests/i915/gem_reg_read.c                   |  1 -
 tests/i915/gem_render_copy.c                |  9 ---------
 tests/i915/gem_render_copy_redux.c          |  9 ---------
 tests/i915/gem_render_linear_blits.c        | 10 ----------
 tests/i915/gem_render_tiled_blits.c         |  9 ---------
 tests/i915/gem_request_retire.c             | 13 -------------
 tests/i915/gem_reset_stats.c                |  4 ----
 tests/i915/gem_ringfill.c                   |  2 --
 tests/i915/gem_set_tiling_vs_blt.c          |  7 -------
 tests/i915/gem_set_tiling_vs_gtt.c          |  7 -------
 tests/i915/gem_set_tiling_vs_pwrite.c       |  7 -------
 tests/i915/gem_streaming_writes.c           |  9 +--------
 tests/i915/gem_stress.c                     |  8 --------
 tests/i915/gem_sync.c                       |  1 -
 tests/i915/gem_tiled_blits.c                |  7 -------
 tests/i915/gem_tiled_partial_pwrite_pread.c |  6 ------
 tests/i915/gem_tiled_pread_basic.c          |  7 -------
 tests/i915/gem_tiled_pread_pwrite.c         |  8 --------
 tests/i915/gem_tiled_swapping.c             |  7 -------
 tests/i915/gem_tiled_wb.c                   |  5 -----
 tests/i915/gem_tiled_wc.c                   |  4 ----
 tests/i915/gem_tiling_max_stride.c          |  5 -----
 tests/i915/gem_unfence_active_buffers.c     |  8 --------
 tests/i915/gem_unref_active_buffers.c       |  1 -
 tests/i915/gem_userptr_blits.c              |  1 -
 tests/i915/gem_vm_create.c                  |  1 -
 tests/i915/gem_watchdog.c                   |  2 --
 90 files changed, 8 insertions(+), 483 deletions(-)
tests/i915/gem_bad_reloc.c +1 -10
index 478e78a6..6bc321b9 100644
@@ -26,18 +26,9 @@
  */
 
 #include <unistd.h>
-#include <stdlib.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-
-#include "drm.h"
+
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
tests/i915/gem_basic.c +0 -4
index 17ae190c..5b262bf7 100644
@@ -27,13 +27,9 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 
 #include "drm.h"
tests/i915/gem_caching.c +0 -7
index eb0170ab..d0bbf939 100644
@@ -27,15 +27,8 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "igt.h"
tests/i915/gem_ccs.c +1 -4
index 4ecb3e36..c0db9c05 100644
@@ -3,12 +3,9 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#include <errno.h>
 #include <glib.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
 #include <malloc.h>
-#include "drm.h"
+
 #include "igt.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/i915/gem_close_race.c +0 -6
index 938fde8f..ce9d2f22 100644
@@ -31,15 +31,9 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
-#include <sys/syscall.h>
 
 #include "drm.h"
 #include "i915/gem.h"
tests/i915/gem_concurrent_all.c +0 -4
index 25b7daf8..accf2d2a 100644
@@ -39,11 +39,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/wait.h>
 
 #include <drm.h>
tests/i915/gem_create.c +0 -7
index d7d2a017..0ed68d85 100644
@@ -32,15 +32,10 @@
  */
 
 #include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
-#include <getopt.h>
 #include <pthread.h>
 #include <stdatomic.h>
 #include <setjmp.h>
@@ -50,8 +45,6 @@
 #include "drmtest.h"
 #include "ioctl_wrappers.h"
 #include "intel_batchbuffer.h"
-#include "intel_io.h"
-#include "intel_chipset.h"
 #include "igt_aux.h"
 #include "igt_dummyload.h"
 #include "igt_x86.h"
tests/i915/gem_cs_tlb.c +0 -5
index 2117b41e..b2a52ce1 100644
@@ -36,15 +36,10 @@
  */
 
 #include <unistd.h>
-#include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 
 #include <drm.h>
tests/i915/gem_ctx_bad_destroy.c +1 -1
index 50bb9aa0..21882994 100644
@@ -30,7 +30,7 @@
   */
 
 #include "igt.h"
-#include <stdio.h>
+
 #include <string.h>
 #include <errno.h>
 
tests/i915/gem_ctx_engines.c +0 -5
index 4b8e5145..dcd5ec81 100644
@@ -27,13 +27,8 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
 #include <sched.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 
 #include <drm.h>
 
tests/i915/gem_ctx_exec.c +0 -4
index 3d94f01d..61fabfc0 100644
@@ -29,12 +29,8 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
 
tests/i915/gem_ctx_freq.c +0 -4
index a29fe68b..b68571a7 100644
@@ -22,10 +22,7 @@
  *
  */
 
-#include <errno.h>
-#include <fcntl.h>
 #include <sched.h>
-#include <stdlib.h>
 #include <stdint.h>
 #include <unistd.h>
 
@@ -33,7 +30,6 @@
 #include "igt.h"
 #include "igt_perf.h"
 #include "igt_sysfs.h"
-#include "sw_sync.h"
 
 #define SAMPLE_PERIOD (USEC_PER_SEC / 10)
 #define PMU_TOLERANCE 100
tests/i915/gem_ctx_persistence.c +0 -1
index 50196edb..509d51fa 100644
@@ -27,7 +27,6 @@
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include "drmtest.h"
tests/i915/gem_ctx_shared.c +0 -8
index eb3b024f..c363b1f8 100644
@@ -28,14 +28,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
@@ -43,7 +36,6 @@
 #include "i915/gem_vm.h"
 #include "igt.h"
 #include "igt_rand.h"
-#include "igt_vgem.h"
 #include "sw_sync.h"
 #include "sync_file.h"
 
tests/i915/gem_ctx_sseu.c +0 -6
index 7685511f..dd0b4711 100644
@@ -26,20 +26,14 @@
  */
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
 #include <errno.h>
-#include <time.h>
 #include <sys/mman.h>
-#include <sys/wait.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
-#include "igt.h"
 #include "igt_dummyload.h"
 #include "igt_perf.h"
 #include "igt_sysfs.h"
tests/i915/gem_ctx_switch.c +0 -6
index 4e46b763..899cedfc 100644
@@ -31,15 +31,9 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "i915/gem_ring.h"
tests/i915/gem_eio.c +0 -2
index 70e82b81..651df0c4 100644
@@ -30,13 +30,11 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <sched.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/ioctl.h>
 #include <time.h>
 #include <unistd.h>
 
tests/i915/gem_evict_alignment.c +0 -8
index 0b560ab0..82eb82d4 100644
@@ -33,16 +33,8 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/i915/gem_evict_everything.c +1 -8
index 120f8907..93b9038d 100644
@@ -35,14 +35,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-
-#include "drm.h"
+
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
tests/i915/gem_exec_alignment.c +0 -3
index 3e5f9d52..5d354682 100644
@@ -30,14 +30,11 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <signal.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/ioctl.h>
-#include <signal.h>
 #include <sched.h>
 
 #include "drm.h"
tests/i915/gem_exec_await.c +0 -4
index 4935cf39..79672d0d 100644
@@ -22,15 +22,11 @@
  *
  */
 
-#include <sys/ioctl.h>
 #include <sys/signal.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
-#include "igt_rand.h"
-#include "igt_sysfs.h"
-#include "igt_vgem.h"
 
 static double elapsed(const struct timespec *start, const struct timespec *end)
 {
tests/i915/gem_exec_balancer.c +0 -1
index 6e6bf470..a349660c 100644
@@ -30,7 +30,6 @@
 #include "i915/gem.h"
 #include "i915/gem_engine_topology.h"
 #include "i915/gem_create.h"
-#include "i915/gem_vm.h"
 #include "igt.h"
 #include "igt_gt.h"
 #include "igt_perf.h"
tests/i915/gem_exec_big.c +0 -7
index 4619bda8..184c1efc 100644
@@ -35,16 +35,9 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
tests/i915/gem_exec_capture.c +0 -1
index 6950b2d2..19fdd03d 100644
@@ -29,7 +29,6 @@
 #include "i915/gem_create.h"
 #include "igt.h"
 #include "igt_device.h"
-#include "igt_rand.h"
 #include "igt_sysfs.h"
 
 #define MAX_RESET_TIME	600
tests/i915/gem_exec_create.c +0 -7
index 449aa5b2..49847331 100644
@@ -30,17 +30,10 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
-#include "i915/gem_create.h"
 #include "i915/gem_ring.h"
 #include "igt.h"
 
tests/i915/gem_exec_endless.c +0 -1
index b83d5a2c..f1c1c44d 100644
@@ -28,7 +28,6 @@
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
-#include "sw_sync.h"
 
 #define MAX_ENGINES 64
 
tests/i915/gem_exec_fair.c +0 -8
index 89921697..d369de1f 100644
@@ -3,16 +3,11 @@
  * Copyright © 2016 Intel Corporation
  */
 
-#include "config.h"
-
 #include <pthread.h>
 #include <sys/poll.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/resource.h>
-#include <sys/syscall.h>
-#include <sched.h>
-#include <signal.h>
 #include <unistd.h>
 
 #include "sync_file.h"
@@ -20,11 +15,8 @@
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
-#include "igt_rand.h"
-#include "igt_rapl.h"
 #include "igt_sysfs.h"
 #include "igt_syncobj.h"
-#include "igt_vgem.h"
 #include "ioctl_wrappers.h"
 #include "sw_sync.h"
 
tests/i915/gem_exec_fence.c +0 -1
index 7ff7614d..f634a56d 100644
@@ -31,7 +31,6 @@
 #include "igt_store.h"
 #include "igt_syncobj.h"
 #include "igt_sysfs.h"
-#include "igt_vgem.h"
 #include "intel_ctx.h"
 #include "sw_sync.h"
 
tests/i915/gem_exec_latency.c +0 -9
index fcdf7787..e187a5c7 100644
@@ -27,14 +27,6 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/signal.h>
-#include <time.h>
 #include <sched.h>
 
 #include "drm.h"
@@ -42,7 +34,6 @@
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
-#include "igt_vgem.h"
 #include "igt_dummyload.h"
 #include "igt_stats.h"
 
tests/i915/gem_exec_lut_handle.c +0 -6
index 06430866..a4b0c088 100644
@@ -27,16 +27,10 @@
 
 /* Exercises the basic execbuffer using the handle LUT interface */
 
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
tests/i915/gem_exec_nop.c +0 -7
index f35cc840..7fa36851 100644
@@ -30,16 +30,9 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/poll.h>
-#include <sys/time.h>
 #include <time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
tests/i915/gem_exec_params.c +0 -5
index 618635ec..c5fb125d 100644
@@ -28,14 +28,9 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
-#include <sys/time.h>
 
 #include "drm.h"
 #include "i915/gem.h"
tests/i915/gem_exec_reloc.c +0 -2
index 1f5d13e4..49ec4f38 100644
@@ -22,7 +22,6 @@
  */
 
 #include <signal.h>
-#include <sys/ioctl.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
@@ -30,7 +29,6 @@
 #include "igt_device.h"
 #include "igt_dummyload.h"
 #include "igt_kms.h"
-#include "sw_sync.h"
 
 IGT_TEST_DESCRIPTION("Basic sanity check of execbuf-ioctl relocations.");
 
tests/i915/gem_exec_schedule.c +0 -3
index 5ddf39bf..f610425d 100644
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#include "config.h"
-
 #include <linux/userfaultfd.h>
 
 #include <pthread.h>
@@ -41,7 +39,6 @@
 #include "igt_rand.h"
 #include "igt_rapl.h"
 #include "igt_sysfs.h"
-#include "igt_vgem.h"
 #include "intel_ctx.h"
 #include "sw_sync.h"
 
tests/i915/gem_fd_exhaustion.c +1 -5
index a6463685..ff4b2f74 100644
@@ -26,12 +26,8 @@
  */
 
 #include "igt.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/resource.h>
-#include <sys/time.h>
+
 #include <fcntl.h>
-#include <limits.h>
 
 #include "i915/gem_create.h"
 
tests/i915/gem_fence_thrash.c +0 -7
index 89a5ae29..6543295e 100644
@@ -26,19 +26,12 @@
  *
  */
 
-#include "config.h"
-
 #include <unistd.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <pthread.h>
-#include "drm.h"
 
 #include "i915/gem_create.h"
 #include "igt.h"
tests/i915/gem_fence_upload.c +0 -6
index 67487d67..3fecf260 100644
@@ -25,20 +25,14 @@
  *
  */
 
-#include "config.h"
-
 #include "igt.h"
-#include <unistd.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <sys/time.h>
 #include <pthread.h>
 
-#include "drm.h"
 #include "i915_drm.h"
 #include "i915/gem_create.h"
 
tests/i915/gem_fenced_exec_thrash.c +0 -1
index a9597d80..16bf007f 100644
@@ -27,7 +27,6 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <inttypes.h>
 #include <errno.h>
 
 #include "i915/gem.h"
tests/i915/gem_flink_basic.c +1 -5
index 4e207c2a..cc4e893e 100644
@@ -26,13 +26,9 @@
  */
 
 #include "igt.h"
-#include <stdlib.h>
-#include <stdio.h>
+
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
 
tests/i915/gem_gpgpu_fill.c +0 -9
index 74a227f6..bd8a94b5 100644
@@ -30,19 +30,10 @@
  * workload for the GPGPU pipeline.
  */
 
-#include <stdbool.h>
-#include <unistd.h>
 #include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "igt.h"
 #include "igt_collection.h"
tests/i915/gem_gtt_cpu_tlb.c +0 -7
index 8000e58c..5dfc0baa 100644
@@ -32,16 +32,9 @@
 
 #include "igt.h"
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Check whether gtt tlbs for cpu access are correctly"
tests/i915/gem_gtt_hog.c +0 -7
index 15a6139e..902acf8f 100644
@@ -28,15 +28,8 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
-#include <sys/wait.h>
 
 #include "drm.h"
 #include "i915/gem.h"
tests/i915/gem_gtt_speed.c +0 -7
index 272091fd..6ba2fcb9 100644
@@ -31,16 +31,9 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 #define OBJECT_SIZE 16384
tests/i915/gem_huc_copy.c +0 -7
index ea32b705..3c42fa1e 100644
@@ -21,17 +21,10 @@
  * IN THE SOFTWARE.
  */
 #include "igt.h"
-#include <stdbool.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/i915/gem_linear_blits.c +0 -7
index 1fd5b733..7d2e2e72 100644
@@ -34,15 +34,8 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
tests/i915/gem_lmem_swapping.c +0 -6
index 1a4f4ca5..3e7d386d 100644
@@ -5,7 +5,6 @@
 
 #include "i915/gem.h"
 #include "i915/gem_create.h"
-#include "i915/gem_vm.h"
 #include "i915/intel_memory_region.h"
 #include "igt.h"
 #include "igt_kmod.h"
@@ -14,14 +13,9 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 #include <sys/time.h>
 #include <sys/wait.h>
-#include "drm.h"
 #include "i915/i915_blt.h"
 #include "i915/intel_mocs.h"
 
tests/i915/gem_lut_handle.c +0 -5
index 32f76aaa..c3361c72 100644
@@ -29,15 +29,10 @@
 
 #include "igt.h"
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Exercises the basic execbuffer using the handle LUT"
tests/i915/gem_madvise.c +0 -4
index 2502d84c..5567ec1f 100644
@@ -27,16 +27,12 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <setjmp.h>
 #include <signal.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Checks that the kernel reports EFAULT when trying to use"
tests/i915/gem_media_fill.c +0 -8
index 1d08df24..35473b79 100644
@@ -30,19 +30,11 @@
  * workload for the Media pipeline.
  */
 
-#include <stdbool.h>
-#include <unistd.h>
 #include <stdlib.h>
-#include <sys/ioctl.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "igt.h"
 
tests/i915/gem_media_vme.c +0 -9
index 3ea70386..30a149c9 100644
@@ -20,19 +20,10 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  * IN THE SOFTWARE.
  */
-#include <stdbool.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "igt.h"
 
tests/i915/gem_mmap.c +0 -4
index 61f862a8..4f6b63de 100644
@@ -28,13 +28,9 @@
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 
 #include "drm.h"
 #include "i915/gem_create.h"
tests/i915/gem_mmap_gtt.c +0 -1
index e39b9047..892eec18 100644
@@ -37,7 +37,6 @@
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <sys/ptrace.h>
-#include <sys/stat.h>
 #include <sys/wait.h>
 #include "drm.h"
 
tests/i915/gem_mmap_offset.c +0 -1
index 5e6b19eb..abdfd91a 100644
@@ -28,7 +28,6 @@
 #include <stdatomic.h>
 #include <sys/ioctl.h>
 #include <sys/ptrace.h>
-#include <sys/stat.h>
 #include <sys/wait.h>
 #include <unistd.h>
 #include "drm.h"
tests/i915/gem_mmap_wc.c +0 -5
index 6dc7bae4..c6df3ca2 100644
@@ -27,15 +27,10 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <pthread.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 
 #include "drm.h"
 #include "i915/gem_create.h"
tests/i915/gem_partial_pwrite_pread.c +0 -6
index 474149d4..90e494e0 100644
@@ -28,13 +28,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "igt.h"
tests/i915/gem_pipe_control_store_loop.c +0 -6
index df3da9f5..148a8a80 100644
@@ -31,16 +31,10 @@
  * Writes a counter-value into an always newly allocated target bo (by disabling
  * buffer reuse). Decently trashes on tlb inconsistencies, too.
  */
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "igt.h"
 
tests/i915/gem_ppgtt.c +0 -7
index 0a06e9ec..52ff18b3 100644
@@ -24,17 +24,10 @@
 #include <stdbool.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
-#include <drm.h>
-
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
tests/i915/gem_pread.c +0 -2
index a8bf2b05..485a7f63 100644
@@ -34,11 +34,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
 #include <sys/ioctl.h>
 #include <sys/resource.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 #include <pthread.h>
 
tests/i915/gem_pread_after_blit.c +0 -7
index 3b56f787..df64528c 100644
@@ -34,16 +34,9 @@
  * ranged-buffer-flush paths in the kernel.
  */
 
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "igt.h"
tests/i915/gem_pwrite.c +0 -2
index 6e3f833c..8d2dd974 100644
@@ -34,11 +34,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
 #include <sys/ioctl.h>
 #include <sys/resource.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 
 #include "drm.h"
tests/i915/gem_pwrite_snooped.c +1 -9
index e6a10747..18446a61 100644
@@ -25,16 +25,8 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdint.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-
-#include "drm.h"
+
 #include "i915/gem.h"
 #include "igt.h"
 
tests/i915/gem_read_read_speed.c +0 -7
index 7c5c90f7..bf82678d 100644
@@ -26,19 +26,12 @@
  * This is a test of performance with multiple readers from the same source.
  */
 
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
 #include <time.h>
-#include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/wait.h>
 
-#include <drm.h>
-
 #include "i915/gem.h"
 #include "igt.h"
 #include "igt_sysfs.h"
tests/i915/gem_readwrite.c +0 -4
index 2d437dec..5ebd6337 100644
@@ -27,13 +27,9 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
 
 #include "drm.h"
tests/i915/gem_reg_read.c +0 -1
index 79facc1f..4841f260 100644
@@ -26,7 +26,6 @@
  */
 
 #include "igt.h"
-#include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/utsname.h>
tests/i915/gem_render_copy.c +0 -9
index 3da29ec4..c4e6e676 100644
@@ -30,19 +30,10 @@
  */
 
 #include <stdbool.h>
-#include <unistd.h>
 #include <cairo.h>
 #include <stdlib.h>
-#include <sys/ioctl.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "igt.h"
tests/i915/gem_render_copy_redux.c +0 -9
index 525c14d1..51c961c6 100644
@@ -34,17 +34,8 @@
 
 #include <stdbool.h>
 #include <unistd.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "igt.h"
tests/i915/gem_render_linear_blits.c +0 -10
index d40593c6..64a3b2d2 100644
@@ -33,19 +33,9 @@
  * The goal is to simply ensure the basics work.
  */
 
-#include "config.h"
-
 #include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "igt.h"
tests/i915/gem_render_tiled_blits.c +0 -9
index 52d67b76..d2fe1bc0 100644
@@ -34,18 +34,9 @@
  */
 
 #include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include <sys/mman.h>
 
-#include <drm.h>
-
 #include "i915/gem.h"
 #include "igt.h"
 
tests/i915/gem_request_retire.c +0 -13
index da9d405e..dbb5d4f5 100644
@@ -30,21 +30,8 @@
  * Collection of tests targeting request retirement code paths.
  */
 
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-#include <signal.h>
-#include <pthread.h>
-#include <time.h>
-
-#include "drm.h"
-#include "i915_drm.h"
 
 #include "i915/gem.h"
 #include "igt.h"
tests/i915/gem_reset_stats.c +0 -4
index baa10151..ad772533 100644
@@ -31,12 +31,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/ioctl.h>
-#include <sys/mman.h>
 #include <time.h>
 #include <signal.h>
 #include <poll.h>
tests/i915/gem_ringfill.c +0 -2
index b68c5ae6..9eb46c98 100644
@@ -37,10 +37,8 @@
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_gt.h"
-#include "igt_vgem.h"
 
 #include <signal.h>
-#include <sys/ioctl.h>
 
 #define INTERRUPTIBLE 0x1
 #define HANG 0x2
tests/i915/gem_set_tiling_vs_blt.c +0 -7
index 5e3bf6a1..a624b4c7 100644
@@ -44,17 +44,10 @@
  * transitions (i.e. changing stride).
  */
 
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 #include <stdbool.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "igt.h"
 
tests/i915/gem_set_tiling_vs_gtt.c +0 -7
index 2f890e83..acf64fbd 100644
@@ -27,16 +27,9 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Check set_tiling vs gtt mmap coherency.");
tests/i915/gem_set_tiling_vs_pwrite.c +0 -7
index 6bec7f27..bd2e419b 100644
@@ -27,16 +27,9 @@
 
 #include "igt.h"
 #include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Check set_tiling vs pwrite coherency.");
tests/i915/gem_streaming_writes.c +1 -8
index 883fe429..8dcce69b 100644
@@ -29,14 +29,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-
-#include "drm.h"
+
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
tests/i915/gem_stress.c +0 -8
index 3765ab14..1afab191 100644
@@ -51,16 +51,8 @@
 
 #include "igt.h"
 #include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 IGT_TEST_DESCRIPTION("General gem coherency test.");
 
tests/i915/gem_sync.c +0 -1
index 8ee33c77..6b506cf5 100644
@@ -31,7 +31,6 @@
 #include "igt_dummyload.h"
 #include "igt_gt.h"
 #include "igt.h"
-#include "igt_sysfs.h"
 
 #define MAX_PRIO I915_CONTEXT_MAX_USER_PRIORITY
 #define MIN_PRIO I915_CONTEXT_MIN_USER_PRIORITY
tests/i915/gem_tiled_blits.c +0 -7
index cc44d0f1..c42bf7ea 100644
@@ -42,15 +42,8 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-
-#include <drm.h>
 
 #include "i915/gem.h"
 #include "igt.h"
tests/i915/gem_tiled_partial_pwrite_pread.c +0 -6
index 95fb69c6..cc5df371 100644
@@ -26,13 +26,7 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
 
 #include <drm.h>
 
tests/i915/gem_tiled_pread_basic.c +0 -7
index 2b4cec6e..1809a101 100644
@@ -37,16 +37,9 @@
 
 #include "igt.h"
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Test pread behavior on tiled objects with respect to the"
tests/i915/gem_tiled_pread_pwrite.c +0 -8
index 2d21dfb7..290bb2e8 100644
@@ -46,17 +46,9 @@
 
 #include "igt.h"
 #include "igt_x86.h"
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Test swizzling by testing pwrite does the inverse of"
tests/i915/gem_tiled_swapping.c +0 -7
index f4bdce73..4fbb5482 100644
@@ -46,17 +46,10 @@
 
 #include "igt.h"
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
 #include <pthread.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Exercise swizzle code for swapping.");
tests/i915/gem_tiled_wb.c +0 -5
index e9efbdf2..bfbc158d 100644
@@ -34,14 +34,9 @@
 
 #include "igt.h"
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
 
 #include "drm.h"
 #include "i915/gem_create.h"
tests/i915/gem_tiled_wc.c +0 -4
index 1f245eb7..c4fb7079 100644
@@ -34,14 +34,10 @@
 
 #include "igt.h"
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
-#include <sys/stat.h>
 #include <sys/time.h>
-#include <sys/ioctl.h>
 
 #include "drm.h"
 #include "i915/gem_create.h"
tests/i915/gem_tiling_max_stride.c +0 -5
index 513d579d..14810945 100644
@@ -28,16 +28,11 @@
 #include "igt.h"
 #include <unistd.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <limits.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
 
-#include "drm.h"
 #include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Check that max fence stride works.");
tests/i915/gem_unfence_active_buffers.c +0 -8
index 532eed2e..befb094d 100644
@@ -38,17 +38,9 @@
  * problem - the race window is too small.
  */
 
-#include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
-#include <fcntl.h>
 #include <inttypes.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <stdbool.h>
 
-#include "drm.h"
 #include "i915/gem.h"
 #include "i915/gem_create.h"
 #include "igt.h"
tests/i915/gem_unref_active_buffers.c +0 -1
index 3b8c981d..3cd88469 100644
@@ -33,7 +33,6 @@
  */
 #include <errno.h>
 #include <fcntl.h>
-#include <inttypes.h>
 #include <sys/ioctl.h>
 #include <sys/signal.h>
 #include <sys/time.h>
tests/i915/gem_userptr_blits.c +0 -1
index 1343b109..754be2f7 100644
@@ -47,7 +47,6 @@
 #include <setjmp.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
-#include <sys/stat.h>
 #include <sys/syscall.h>
 #include <sys/time.h>
 #include <glib.h>
tests/i915/gem_vm_create.c +0 -1
index 3005d347..fa8ca9ee 100644
@@ -25,7 +25,6 @@
 #include "i915/gem_create.h"
 #include "i915/gem_vm.h"
 #include "igt.h"
-#include "igt_rand.h"
 #include "igt_dummyload.h"
 
 static int vm_create_ioctl(int i915, struct drm_i915_gem_vm_control *ctl)
tests/i915/gem_watchdog.c +0 -2
index 01eb0076..0a305ced 100644
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#include "config.h"
-
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <stdio.h>
Signature · 1 line
2.37.1
#15 lore raw

PATCH v2 15/19 lib/i915: Replace igt.h with individual header imports

In reply to Ryszard Knop

Prevents pulling in unnecessary definitions in the library, tools etc. Also makes it easier and faster to automatically analyze library files. It's fine to use it in tests, benchmarks and the runner.

---
 lib/i915/gem.c        |  6 ++++--
 lib/i915/gem_mman.h   |  1 +
 lib/i915/i915_blt.c   | 17 +++++++++++++++--
 lib/i915/i915_blt.h   |  7 ++++++-
 lib/i915/intel_mocs.c |  6 ++++--
 5 files changed, 30 insertions(+), 7 deletions(-)
lib/i915/gem.c +4 -2
index 27b872c2..bb5ee125 100644
@@ -26,10 +26,12 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 
-#include "i915/gem.h"
-#include "igt.h"
+#include "igt_dummyload.h"
 #include "igt_debugfs.h"
+#include "igt_params.h"
 #include "igt_sysfs.h"
+#include "i915/gem.h"
+#include "drmtest.h"
 
 static void __restore_defaults(int engine)
 {
lib/i915/gem_mman.h +1 -0
index 5966ddb5..a5f12dee 100644
@@ -26,6 +26,7 @@
 #define GEM_MMAN_H
 
 #include <stdint.h>
+#include <stdbool.h>
 
 void *gem_mmap__gtt(int fd, uint32_t handle, uint64_t size, unsigned prot);
 void *gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot);
lib/i915/i915_blt.c +15 -2
index d2d13a53..4e255f79 100644
@@ -4,10 +4,23 @@
  */
 
 #include <malloc.h>
+#include <string.h>
+#include <inttypes.h>
+
 #include <cairo.h>
-#include "igt.h"
-#include "gem_create.h"
+
+#include "igt_core.h"
+#include "igt_aux.h"
+
 #include "i915_blt.h"
+#include "gem_mman.h"
+#include "gem_create.h"
+
+#include "intel_reg.h"
+#include "intel_chipset.h"
+#include "ioctl_wrappers.h"
+#include "intel_allocator.h"
+#include "intel_memory_region.h"
 
 #define BITRANGE(start, end) (end - start + 1)
 
lib/i915/i915_blt.h +6 -1
index e0e8b52b..2fe83900 100644
@@ -42,11 +42,16 @@
  */
 
 #include <errno.h>
+#include <stdbool.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include <malloc.h>
+
 #include "drm.h"
-#include "igt.h"
+
+#include "intel_ctx.h"
+#include "igt_gt.h"
+
 
 #define CCS_RATIO 256
 
lib/i915/intel_mocs.c +4 -2
index df541ab0..083ed67b 100644
@@ -3,9 +3,11 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#include "igt.h"
-#include "i915/gem.h"
+#include "i915_drm.h"
+
+#include "intel_chipset.h"
 #include "intel_mocs.h"
+#include "i915/gem.h"
 
 #define DG1_MOCS_UC_IDX				1
 #define DG1_MOCS_WB_IDX				5
Signature · 1 line
2.37.1
#16 lore raw

PATCH v2 16/19 lib/igt*, lib/intel*: Replace igt.h with individual header imports

In reply to Ryszard Knop

Prevents pulling in unnecessary definitions in the library, tools etc. Also makes it easier and faster to automatically analyze library files. It's fine to use it in tests, benchmarks and the runner.

---
 lib/igt_amd.c                    | 8 ++++++--
 lib/igt_amd.h                    | 3 ++-
 lib/igt_collection.c             | 3 ++-
 lib/igt_device.c                 | 9 +++++++--
 lib/igt_nouveau.c                | 2 +-
 lib/igt_syncobj.c                | 3 ++-
 lib/intel_allocator.c            | 9 ++++++++-
 lib/intel_allocator_msgchannel.c | 6 +++++-
 lib/intel_allocator_random.c     | 6 +++++-
 lib/intel_allocator_reloc.c      | 5 ++++-
 lib/intel_bufops.c               | 7 +++++--
 11 files changed, 47 insertions(+), 14 deletions(-)
lib/igt_amd.c +6 -2
index bef9c193..74a180b1 100644
@@ -23,10 +23,14 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
+#include <amdgpu_drm.h>
+
+#include "igt_core.h"
 #include "igt_amd.h"
-#include "igt.h"
+#include "igt_kms.h"
 #include "igt_sysfs.h"
-#include <amdgpu_drm.h>
+#include "igt_debugfs.h"
+#include "drmtest.h"
 
 #define X0 1
 #define X1 2
lib/igt_amd.h +2 -1
index 428bfe6f..901a19c7 100644
@@ -24,8 +24,9 @@
 #define IGT_AMD_H
 
 #include <stdint.h>
-#include "igt.h"
+
 #include "igt_fb.h"
+#include "igt_kms.h"
 #include "igt_psr.h"
 
 /* Read & Write DSC parameters */
lib/igt_collection.c +2 -1
index 35e09c89..1511ded9 100644
@@ -21,7 +21,8 @@
  * IN THE SOFTWARE.
  */
 
-#include "igt.h"
+#include "igt_aux.h"
+#include "igt_core.h"
 #include "igt_collection.h"
 
 /**
lib/igt_device.c +7 -2
index 83ae7b21..526049a7 100644
@@ -22,10 +22,15 @@
  *
  */
 #include <fcntl.h>
-
+#include <errno.h>
 #include <sys/stat.h>
 #include <sys/sysmacros.h>
-#include "igt.h"
+
+#include <pciaccess.h>
+#include <xf86drm.h>
+
+#include "igt_core.h"
+#include "igt_debugfs.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
 
lib/igt_nouveau.c +1 -1
index 0a1326e9..0a47dc52 100644
@@ -27,7 +27,7 @@
 #include <nouveau/nouveau.h>
 #include <nouveau/nvif/class.h>
 
-#include "igt.h"
+#include "igt_fb.h"
 #include "igt_list.h"
 #include "igt_nouveau.h"
 
lib/igt_syncobj.c +2 -1
index a24ed10b..fe086e0f 100644
@@ -24,8 +24,9 @@
 #include <errno.h>
 #include <xf86drm.h>
 
-#include "igt.h"
+#include "igt_core.h"
 #include "igt_syncobj.h"
+#include "ioctl_wrappers.h"
 
 /**
  * SECTION:igt_syncobj
lib/intel_allocator.c +8 -1
index 717d7fc5..46417b83 100644
@@ -12,11 +12,18 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include "igt.h"
+#include <errno.h>
+
 #include "igt_map.h"
+#include "ioctl_wrappers.h"
+
 #include "intel_allocator.h"
 #include "intel_allocator_msgchannel.h"
 
+#include "i915/gem_mman.h"
+#include "i915/gem_context.h"
+#include "i915/intel_memory_region.h"
+
 //#define ALLOCDBG
 #ifdef ALLOCDBG
 #define alloc_info igt_info
lib/intel_allocator_msgchannel.c +5 -1
index d1f6486c..2a45bf80 100644
@@ -6,8 +6,12 @@
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/msg.h>
+#include <stdbool.h>
+#include <string.h>
+#include <errno.h>
 #include <fcntl.h>
-#include "igt.h"
+
+#include "igt_core.h"
 #include "intel_allocator_msgchannel.h"
 
 extern __thread pid_t child_tid;
lib/intel_allocator_random.c +5 -1
index 9ed92383..d0a59dd2 100644
@@ -4,8 +4,12 @@
  */
 
 #include <stdlib.h>
-#include "igt.h"
+#include <inttypes.h>
+
+#include "igt_aux.h"
 #include "igt_rand.h"
+#include "drmtest.h"
+#include "ioctl_wrappers.h"
 #include "intel_allocator.h"
 
 struct intel_allocator *
lib/intel_allocator_reloc.c +4 -1
index bf4d9c43..4db8ae4b 100644
@@ -4,8 +4,11 @@
  */
 
 #include <stdlib.h>
-#include "igt.h"
+
+#include "igt_aux.h"
 #include "igt_rand.h"
+#include "drmtest.h"
+#include "ioctl_wrappers.h"
 #include "intel_allocator.h"
 
 struct intel_allocator *
lib/intel_bufops.c +5 -2
index c63a5760..356ffddf 100644
@@ -25,10 +25,13 @@
 #include <sys/ioctl.h>
 #include <cairo.h>
 
-#include "i915/gem_create.h"
-#include "igt.h"
 #include "igt_x86.h"
 #include "intel_bufops.h"
+#include "intel_chipset.h"
+#include "ioctl_wrappers.h"
+
+#include "i915/gem_mman.h"
+#include "i915/gem_create.h"
 
 /**
  * SECTION:intel_bufops
Signature · 1 line
2.37.1
#17 lore raw

PATCH v2 17/19 tools, lib: Replace igt.h with individual header imports

In reply to Ryszard Knop

Prevents pulling in unnecessary definitions in the library, tools etc. Also makes it easier and faster to automatically analyze library files. It's fine to use it in tests, benchmarks and the runner.

---
 lib/nouveau/cea0b5.c              |  2 +-
 lib/veboxcopy_gen12.c             |  2 +-
 tools/amd_hdmi_compliance.c       |  4 +++-
 tools/igt_compliance_utils.c      |  2 +-
 tools/igt_dp_compliance_hotplug.c |  6 ++++--
 tools/intel_dp_compliance.c       |  8 ++++++--
 tools/intel_gem_info.c            |  4 +++-
 tools/intel_guc_logger.c          |  3 ++-
 tools/intel_gvtg_test.c           |  3 ++-
 tools/intel_pm_rpm.c              |  8 +++++++-
 tools/intel_reg.c                 | 14 ++++++++++----
 tools/intel_residency.c           |  4 +++-
 tools/lsgpu.c                     |  5 +++--
 tools/msm_dp_compliance.c         |  4 +++-
 14 files changed, 49 insertions(+), 20 deletions(-)
lib/nouveau/cea0b5.c +1 -1
index 2df80b05..6b0630af 100644
@@ -22,7 +22,7 @@
 
 #include <inttypes.h>
 
-#include "igt.h"
+#include "igt_fb.h"
 #include "igt_nouveau.h"
 
 #include "nouveau/nvif/push906f.h"
lib/veboxcopy_gen12.c +1 -1
index 38878e49..be6803f1 100644
@@ -21,8 +21,8 @@
  * IN THE SOFTWARE.
  */
 
-#include "igt.h"
 #include "intel_aux_pgtable.h"
+#include "intel_chipset.h"
 #include "veboxcopy.h"
 
 #define YCRCB_NORMAL	0
tools/amd_hdmi_compliance.c +3 -1
index 1a759299..b70fbd1d 100644
@@ -20,7 +20,9 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include "igt.h"
+#include "igt_core.h"
+#include "igt_kms.h"
+#include "drmtest.h"
 
 /* Common test data */
 typedef struct data {
tools/igt_compliance_utils.c +1 -1
index e206740d..d84bab8d 100644
@@ -23,12 +23,12 @@
  * IN THE SOFTWARE.
  */
 
-#include "igt.h"
 #include <string.h>
 #include <signal.h>
 #include <termios.h>
 #include <libgen.h>
 
+#include "igt_core.h"
 #include "igt_dp_compliance.h"
 
 static int tio_fd;
tools/igt_dp_compliance_hotplug.c +4 -2
index 3e0cf3d5..69229dd0 100644
@@ -23,14 +23,16 @@
  * IN THE SOFTWARE.
  */
 
-#include "igt.h"
 #include <string.h>
 #include <stdlib.h>
 
 #include <sys/stat.h>
 
-#include "igt_dp_compliance.h"
 #include <libudev.h>
+
+#include "igt_core.h"
+#include "igt_dp_compliance.h"
+
 static struct udev_monitor *uevent_monitor;
 static struct udev *udev;
 static GIOChannel *udevchannel;
tools/intel_dp_compliance.c +6 -2
index 7390348f..f86ec369 100644
@@ -106,8 +106,8 @@
  * DRM modeset example
  *
  */
-#include "igt.h"
 #include <errno.h>
+#include <stdlib.h>
 #include <getopt.h>
 #include <stdint.h>
 #include <stdbool.h>
@@ -117,8 +117,12 @@
 #include <fcntl.h>
 
 #include "igt_dp_compliance.h"
+#include "igt_core.h"
+#include "igt_kms.h"
+#include "drmtest.h"
+#include "intel_chipset.h"
 
-#include <stdlib.h>
+#include "i915/gem_mman.h"
 
 /* User Input definitions */
 #define HELP_DESCRIPTION 1
tools/intel_gem_info.c +3 -1
index 3700d20e..0763d0e6 100644
@@ -1,9 +1,11 @@
-#include "igt.h"
 #include <sys/ioctl.h>
 #include <errno.h>
 #include <signal.h>
+
 #include <i915_drm.h>
 
+#include "igt_core.h"
+#include "drmtest.h"
 
 int main(void)
 {
tools/intel_guc_logger.c +2 -1
index ec76eb30..7fb8611b 100644
@@ -36,7 +36,8 @@
 #include <sys/mman.h>
 #include <pthread.h>
 
-#include "igt.h"
+#include "igt_core.h"
+#include "igt_debugfs.h"
 
 #define MB(x) ((uint64_t)(x) * 1024 * 1024)
 #ifndef PAGE_SIZE
tools/intel_gvtg_test.c +2 -1
index 4ede5f08..dac5e5b1 100644
@@ -29,7 +29,6 @@
  * Enable more GVT-g related test cases.
  */
 
-#include "igt.h"
 #include <errno.h>
 #include <getopt.h>
 #include <strings.h>
@@ -40,6 +39,8 @@
 #include <pwd.h>
 #include <dirent.h>
 
+#include "igt_core.h"
+
 #define RANDOM(x) (rand() % x)
 
 
tools/intel_pm_rpm.c +7 -1
index 85ae115a..4851dc06 100644
@@ -26,11 +26,17 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdbool.h>
-#include "igt.h"
+
+#include "igt_core.h"
 #include "igt_device.h"
 #include "igt_device_scan.h"
+#include "igt_kms.h"
 #include "igt_pm.h"
 
+#include "intel_chipset.h"
+
+#include <drm.h>
+
 #define DONT_SET_AUTOSUSPEND_DELAY (1 << 0)
 #define SET_I915_AUTOSUSPEND_DELAY (1 << 1)
 
tools/intel_reg.c +10 -4
index 6ff34b4e..392d11a8 100644
@@ -31,14 +31,20 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "i915/gem_create.h"
-#include "igt.h"
+#include "i915_drm.h"
+
 #include "igt_gt.h"
-#include "intel_io.h"
-#include "intel_chipset.h"
+#include "drmtest.h"
+#include "ioctl_wrappers.h"
 
+#include "intel_io.h"
+#include "intel_reg.h"
 #include "intel_reg_spec.h"
+#include "intel_chipset.h"
 
+#include "i915/gem_mman.h"
+#include "i915/gem_create.h"
+#include "i915/gem_engine_topology.h"
 
 #ifdef HAVE_SYS_IO_H
 #include <sys/io.h>
tools/intel_residency.c +3 -1
index 1d329e1f..cf46ed3e 100644
@@ -32,7 +32,9 @@
 #include <signal.h>
 #include <time.h>
 #include <getopt.h>
-#include "igt.h"
+
+#include "igt_kms.h"
+#include "igt_draw.h"
 
 #define IA32_TIME_STAMP_COUNTER		0x10
 
tools/lsgpu.c +3 -2
index 0a5c114a..05b79e8d 100644
@@ -22,12 +22,13 @@
  *
  */
 
-#include "igt_device_scan.h"
-#include "igt.h"
 #include <string.h>
 #include <signal.h>
 #include <glib.h>
 
+#include "igt_device_scan.h"
+#include "igt_core.h"
+
 /**
  * SECTION:lsgpu
  * @short_description: lsgpu
tools/msm_dp_compliance.c +3 -1
index e7d4524e..9b11110c 100644
@@ -107,7 +107,6 @@
  * DRM modeset example
  *
  */
-#include "igt.h"
 #include <errno.h>
 #include <getopt.h>
 #include <stdint.h>
@@ -117,6 +116,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+#include "igt_core.h"
+#include "igt_kms.h"
+#include "drmtest.h"
 #include "igt_dp_compliance.h"
 
 #include <stdlib.h>
Signature · 1 line
2.37.1
#18 lore raw

PATCH v2 18/19 lib, tools: Add the 'graphics' build-time setting

In reply to Ryszard Knop

The graphics=<enabled/disabled> setting decides whenever igt will depend on cairo and pixman. Disabling those dependencies prevents transitive dependencies on a large number of graphics-related libraries (X11, etc), thus allowing igt tools to be installed in compute-only environments.

In practice this works for tools and benchmarks only - tests or overlays depend on those libraries too much to selectively disable features in there while keeping it all maintainable.

---
 lib/igt.h             |  7 +++-
 lib/igt_debugfs.c     |  2 +
 lib/igt_debugfs.h     |  5 ++-
 lib/igt_fb.h          | 10 ++++-
 lib/intel_bufops.c    |  5 +++
 lib/intel_bufops.h    |  2 +
 lib/meson.build       | 18 +++++----
 lib/tests/meson.build |  5 ++-
 meson.build           | 32 ++++++++++-----
 meson_options.txt     |  4 ++
 tools/meson.build     | 93 ++++++++++++++++++++++++-------------------
 11 files changed, 121 insertions(+), 62 deletions(-)
lib/igt.h +5 -2
index 869515e8..95f60881 100644
@@ -32,8 +32,6 @@
 #include "igt_debugfs.h"
 #include "igt_draw.h"
 #include "igt_dummyload.h"
-#include "igt_fb.h"
-#include "igt_frame.h"
 #include "igt_gt.h"
 #include "igt_kms.h"
 #include "igt_params.h"
@@ -50,6 +48,11 @@
 #include "i915/gem_mman.h"
 #include "i915/gem_engine_topology.h"
 
+#ifdef HAVE_GRAPHICS
+#include "igt_fb.h"
+#include "igt_frame.h"
+#endif
+
 #ifdef HAVE_CHAMELIUM
 #include "igt_alsa.h"
 #include "igt_audio.h"
lib/igt_debugfs.c +2 -0
index ca893c12..b3460327 100644
@@ -1041,6 +1041,7 @@ igt_pipe_crc_get_for_frame(int drm_fd, igt_pipe_crc_t *pipe_crc,
 	crc_sanity_checks(pipe_crc, crc);
 }
 
+#ifdef HAVE_GRAPHICS
 /**
  * igt_pipe_crc_get_current:
  * @drm_fd: Pointer to drm fd for vblank counter
@@ -1058,6 +1059,7 @@ igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc)
 
 	return igt_pipe_crc_get_for_frame(drm_fd, pipe_crc, vblank, crc);
 }
+#endif /* HAVE_GRAPHICS */
 
 /**
  * igt_pipe_crc_collect_crc:
lib/igt_debugfs.h +4 -1
index 37e85067..c7fbf78c 100644
@@ -119,10 +119,13 @@ int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs,
 			  igt_crc_t **out_crcs);
 void igt_pipe_crc_drain(igt_pipe_crc_t *pipe_crc);
 void igt_pipe_crc_get_single(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
-void igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc);
 void igt_pipe_crc_get_for_frame(int drm_fd, igt_pipe_crc_t *pipe_crc,
 				unsigned int vblank, igt_crc_t *crc);
 
+#ifdef HAVE_GRAPHICS
+void igt_pipe_crc_get_current(int drm_fd, igt_pipe_crc_t *pipe_crc, igt_crc_t *crc);
+#endif /* HAVE_GRAPHICS */
+
 void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc);
 
 void igt_hpd_storm_set_threshold(int fd, unsigned int threshold);
lib/igt_fb.h +9 -1
index b3f096fe..2c48ff4f 100644
@@ -29,7 +29,10 @@
 #ifndef __IGT_FB_H__
 #define __IGT_FB_H__
 
+#ifdef HAVE_GRAPHICS
 #include <cairo.h>
+#endif
+
 #include <stddef.h>
 #include <stdbool.h>
 #include <drm_fourcc.h>
@@ -90,7 +93,6 @@ typedef struct igt_fb {
 	enum igt_color_range color_range;
 	uint64_t modifier;
 	uint64_t size;
-	cairo_surface_t *cairo_surface;
 	unsigned int domain;
 	unsigned int num_planes;
 	uint32_t strides[4];
@@ -99,6 +101,10 @@ typedef struct igt_fb {
 	unsigned int plane_width[4];
 	unsigned int plane_height[4];
 	void *driver_priv;
+
+#ifdef HAVE_GRAPHICS
+	cairo_surface_t *cairo_surface;
+#endif /* HAVE_GRAPHICS */
 } igt_fb_t;
 
 /**
@@ -184,6 +190,7 @@ bool igt_fb_is_ccs_plane(const struct igt_fb *fb, int plane);
 bool igt_fb_is_gen12_ccs_cc_plane(const struct igt_fb *fb, int plane);
 int igt_fb_ccs_to_main_plane(const struct igt_fb *fb, int ccs_plane);
 
+#ifdef HAVE_GRAPHICS
 /* cairo-based painting */
 cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb);
 cairo_surface_t *igt_cairo_image_surface_create_from_png(const char *filename);
@@ -205,6 +212,7 @@ void igt_paint_image(cairo_t *cr, const char *filename,
 int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align,
 			       double yspacing, const char *fmt, ...)
 			       __attribute__((format (printf, 4, 5)));
+#endif /* HAVE_GRAPHICS */
 
 /* helpers to handle drm fourcc codes */
 uint32_t igt_bpp_depth_to_drm_format(int bpp, int depth);
lib/intel_bufops.c +5 -0
index 356ffddf..adbdd04d 100644
@@ -23,7 +23,10 @@
  */
 
 #include <sys/ioctl.h>
+
+#ifdef HAVE_GRAPHICS
 #include <cairo.h>
+#endif
 
 #include "igt_x86.h"
 #include "intel_bufops.h"
@@ -1208,6 +1211,7 @@ const char *intel_buf_set_name(struct intel_buf *buf, const char *name)
 	return strncpy(buf->name, name, INTEL_BUF_NAME_MAXSIZE);
 }
 
+#ifdef HAVE_GRAPHICS
 static void __intel_buf_write_to_png(struct buf_ops *bops,
 				     struct intel_buf *buf,
 				     const char *filename,
@@ -1250,6 +1254,7 @@ void intel_buf_write_aux_to_png(struct intel_buf *buf, const char *filename)
 
 	__intel_buf_write_to_png(buf->bops, buf, filename, true);
 }
+#endif /* HAVE_GRAPHICS */
 
 #define DEFAULT_BUFOPS(__gen_start, __gen_end) \
 	.gen_start          = __gen_start, \
lib/intel_bufops.h +2 -0
index 25b43073..d2b17329 100644
@@ -187,7 +187,9 @@ void intel_buf_print(const struct intel_buf *buf);
 void intel_buf_dump(const struct intel_buf *buf, const char *filename);
 const char *intel_buf_set_name(struct intel_buf *buf, const char *name);
 
+#ifdef HAVE_GRAPHICS
 void intel_buf_write_to_png(struct intel_buf *buf, const char *filename);
 void intel_buf_write_aux_to_png(struct intel_buf *buf, const char *filename);
+#endif /* HAVE_GRAPHICS */
 
 #endif
lib/meson.build +11 -7
index 98c2803b..f9f908aa 100644
@@ -12,7 +12,6 @@ lib_sources = [
 	'i915/gem_vm.c',
 	'i915/intel_memory_region.c',
 	'i915/intel_mocs.c',
-	'i915/i915_blt.c',
 	'i915/i915_crc.c',
 	'igt_collection.c',
 	'igt_color_encoding.c',
@@ -69,10 +68,7 @@ lib_sources = [
 	'intel_aux_pgtable.c',
 	'intel_reg_map.c',
 	'intel_iosf.c',
-	'igt_kms.c',
-	'igt_fb.c',
 	'igt_core.c',
-	'igt_draw.c',
 	'igt_list.c',
 	'igt_map.c',
 	'igt_pm.c',
@@ -93,7 +89,6 @@ lib_sources = [
 ]
 
 lib_deps = [
-	cairo,
 	glib,
 	libatomic,
 	libdrm,
@@ -103,12 +98,21 @@ lib_deps = [
 	libudev,
 	math,
 	pciaccess,
-	pixman,
 	pthreads,
 	realtime,
 	zlib
 ]
 
+if build_graphics
+	lib_deps += [cairo, pixman]
+	lib_sources += [
+		'igt_fb.c',
+		'igt_kms.c',
+		'igt_draw.c',
+		'i915/i915_blt.c',
+	]
+endif
+
 if libdrm_intel.found()
 	lib_deps += libdrm_intel
 else
@@ -146,7 +150,7 @@ if valgrind.found()
 	lib_deps += valgrind
 endif
 
-if gsl.found()
+if gsl.found() and build_graphics
 	lib_deps += gsl
 	lib_sources += [ 'igt_frame.c', 'igt_audio.c' ]
 endif
lib/tests/meson.build +4 -1
index ceaf548b..196699a8 100644
@@ -6,7 +6,6 @@ lib_tests = [
 	'igt_conflicting_args',
 	'igt_describe',
 	'igt_dynamic_subtests',
-	'igt_edid',
 	'igt_exit_handler',
 	'igt_fork',
 	'igt_fork_helper',
@@ -22,6 +21,10 @@ lib_tests = [
 	'i915_perf_data_alignment',
 ]
 
+if build_graphics
+	lib_tests += 'igt_edid'
+endif
+
 lib_fail_tests = [
 	'igt_no_subtest',
 	'igt_simple_test_subtests',
meson.build +23 -9
index 3e937f5a..03f46d63 100644
@@ -82,8 +82,13 @@ endforeach
 build_chamelium = get_option('chamelium')
 build_docs = get_option('docs')
 build_tests = not get_option('tests').disabled()
+build_graphics = not get_option('graphics').disabled()
 with_libdrm = get_option('libdrm_drivers')
 
+if build_tests and not build_graphics
+	error('Building tests without graphics features is not supported')
+endif
+
 build_info = ['Build type: ' + get_option('buildtype')]
 
 inc = include_directories('include/drm-uapi', 'include/linux-uapi', 'lib', 'lib/stubs/syscalls', '.')
@@ -127,7 +132,6 @@ libunwind = dependency('libunwind', required : get_option('libunwind'))
 build_info += 'With libunwind: @0@'.format(libunwind.found())
 
 libdw = dependency('libdw', required : true)
-pixman = dependency('pixman-1', required : true)
 
 valgrind = dependency('valgrind', required : get_option('valgrind'))
 if valgrind.found()
@@ -135,7 +139,15 @@ if valgrind.found()
 endif
 build_info += 'Valgrind annotations: @0@'.format(valgrind.found())
 
-cairo = dependency('cairo', version : '>1.12.0', required : true)
+if build_graphics
+	config.set('HAVE_GRAPHICS', 1)
+	cairo = dependency('cairo', version : '>1.12.0', required : true)
+	pixman = dependency('pixman-1', required : true)
+else
+	cairo = disabler()
+	pixman = disabler()
+endif
+
 libudev = dependency('libudev', required : true)
 glib = dependency('glib-2.0', required : true)
 
@@ -331,12 +343,14 @@ foreach str : build_info
 	message(str)
 endforeach
 
-if cairo.version().version_compare('<1.17.2')
-	if pixman.version().version_compare('<0.36.0')
-		warning('Pixman < 0.36.0 found, cannot test HDR formats')
+if build_graphics
+	if cairo.version().version_compare('<1.17.2')
+		if pixman.version().version_compare('<0.36.0')
+			warning('Pixman < 0.36.0 found, cannot test HDR formats')
+		endif
+		warning('Cairo < 1.17.2 found, cannot test HDR formats')
+	elif pixman.version().version_compare('<0.36.0')
+		# Cairo 1.17.2 requires 0.36.0 to compile, but somehow it went missing?
+		error('Cairo with floating point support found, but pixman version too old')
 	endif
-	warning('Cairo < 1.17.2 found, cannot test HDR formats')
-elif pixman.version().version_compare('<0.36.0')
-	# Cairo 1.17.2 requires 0.36.0 to compile, but somehow it went missing?
-	error('Cairo with floating point support found, but pixman version too old')
 endif
meson_options.txt +4 -0
index bed63efa..84dbe3a6 100644
@@ -34,6 +34,10 @@ option('libdrm_drivers',
        choices : ['', 'auto', 'intel', 'nouveau', 'amdgpu'],
        description : 'libdrm libraries to be used')
 
+option('graphics',
+       type : 'feature',
+       description : 'Enable graphics-dependent features (cairo)')
+
 option('libunwind',
        type : 'feature',
        description : 'Use libunwind')
tools/meson.build +52 -41

141 lines not on this page · raw message

Signature · 1 line
2.37.1
#19 lore raw

PATCH v2 19/19 lib, tools: Misc cleanups and typo fixes

In reply to Ryszard Knop

A couple of small fixes for annoyances found while introducing the new build-time option.

---
 lib/igt.h         | 1 -
 lib/igt_frame.h   | 2 --
 lib/meson.build   | 6 +++---
 tools/meson.build | 4 ++--
 4 files changed, 5 insertions(+), 8 deletions(-)
lib/igt.h +0 -1
index 95f60881..6d0ce175 100644
@@ -28,7 +28,6 @@
 #include "i915_3d.h"
 #include "igt_aux.h"
 #include "igt_core.h"
-#include "igt_core.h"
 #include "igt_debugfs.h"
 #include "igt_draw.h"
 #include "igt_dummyload.h"
lib/igt_frame.h +0 -2
index f44f57d7..5fd59edc 100644
@@ -27,8 +27,6 @@
 #ifndef IGT_FRAME_H
 #define IGT_FRAME_H
 
-#include "config.h"
-
 #include <stdbool.h>
 
 bool igt_frame_dump_is_enabled(void);
lib/meson.build +3 -3
index f9f908aa..81b980d6 100644
@@ -117,7 +117,7 @@ if libdrm_intel.found()
 	lib_deps += libdrm_intel
 else
 	lib_sources += 'stubs/drm/intel_bufmgr.c'
-	inc = [ inc, include_directories('stubs/drm') ]
+	inc += include_directories('stubs/drm')
 endif
 
 if libdrm_nouveau.found()
@@ -205,12 +205,12 @@ lib_igt = declare_dependency(link_with : lib_igt_build,
 
 igt_deps = [ lib_igt ] + lib_deps
 
-lin_igt_chipset_build = static_library('igt_chipset',
+lib_igt_chipset_build = static_library('igt_chipset',
                                        ['intel_chipset.c',
                                         'intel_device_info.c'],
                                        include_directories : inc)
 
-lib_igt_chipset = declare_dependency(link_with : lin_igt_chipset_build,
+lib_igt_chipset = declare_dependency(link_with : lib_igt_chipset_build,
                                      include_directories : inc)
 
 lib_igt_perf_build = static_library('igt_perf',
tools/meson.build +2 -2
index 106a7b04..95546b8a 100644
@@ -1,11 +1,11 @@
-tools_progs_noisnt = [
+tools_progs_noinstall = [
 	'cnl_compute_wrpll',
 	'hsw_compute_wrpll',
 	'skl_compute_wrpll',
 	'skl_ddb_allocation',
 ]
 
-foreach prog : tools_progs_noisnt
+foreach prog : tools_progs_noinstall
 	executable(prog, prog + '.c',
 			dependencies : igt_deps,
 			install : false)
Signature · 1 line
2.37.1