[igt-dev] [PATCH i-g-t v2 15/19] lib/i915: Replace igt.h with individual header imports

Ryszard Knop ryszard.knop at intel.com
Tue Aug 9 12:50:34 UTC 2022


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.

Signed-off-by: Ryszard Knop <ryszard.knop at intel.com>
---
 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(-)

diff --git a/lib/i915/gem.c b/lib/i915/gem.c
index 27b872c2..bb5ee125 100644
--- a/lib/i915/gem.c
+++ b/lib/i915/gem.c
@@ -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)
 {
diff --git a/lib/i915/gem_mman.h b/lib/i915/gem_mman.h
index 5966ddb5..a5f12dee 100644
--- a/lib/i915/gem_mman.h
+++ b/lib/i915/gem_mman.h
@@ -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);
diff --git a/lib/i915/i915_blt.c b/lib/i915/i915_blt.c
index d2d13a53..4e255f79 100644
--- a/lib/i915/i915_blt.c
+++ b/lib/i915/i915_blt.c
@@ -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)
 
diff --git a/lib/i915/i915_blt.h b/lib/i915/i915_blt.h
index e0e8b52b..2fe83900 100644
--- a/lib/i915/i915_blt.h
+++ b/lib/i915/i915_blt.h
@@ -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
 
diff --git a/lib/i915/intel_mocs.c b/lib/i915/intel_mocs.c
index df541ab0..083ed67b 100644
--- a/lib/i915/intel_mocs.c
+++ b/lib/i915/intel_mocs.c
@@ -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
-- 
2.37.1



More information about the igt-dev mailing list