diff --git a/benchmarks/intel_upload_blit_large.c b/benchmarks/intel_upload_blit_large.c
index 4d1b66f2c1a5..b44433f9a30d 100644
--- a/benchmarks/intel_upload_blit_large.c
+++ b/benchmarks/intel_upload_blit_large.c
@@ -59,6 +59,7 @@
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define OBJECT_WIDTH	1280
 #define OBJECT_HEIGHT	720
diff --git a/benchmarks/intel_upload_blit_large_gtt.c b/benchmarks/intel_upload_blit_large_gtt.c
index 6f864cbd57e6..4910710223a3 100644
--- a/benchmarks/intel_upload_blit_large_gtt.c
+++ b/benchmarks/intel_upload_blit_large_gtt.c
@@ -59,6 +59,7 @@
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define OBJECT_WIDTH	1280
 #define OBJECT_HEIGHT	720
diff --git a/benchmarks/intel_upload_blit_large_map.c b/benchmarks/intel_upload_blit_large_map.c
index 97b825dd3ae1..93433fc95db1 100644
--- a/benchmarks/intel_upload_blit_large_map.c
+++ b/benchmarks/intel_upload_blit_large_map.c
@@ -62,6 +62,7 @@
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define OBJECT_WIDTH	1280
 #define OBJECT_HEIGHT	720
diff --git a/benchmarks/intel_upload_blit_small.c b/benchmarks/intel_upload_blit_small.c
index 3fd095f3d922..e2f804bbdf06 100644
--- a/benchmarks/intel_upload_blit_small.c
+++ b/benchmarks/intel_upload_blit_small.c
@@ -55,6 +55,7 @@
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 /* Happens to be 128k, the size of the VBOs used by i965's Mesa driver. */
 #define OBJECT_WIDTH	256
diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c
index 98c0af912c9b..fb375f4f2b62 100644
--- a/demos/intel_sprite_on.c
+++ b/demos/intel_sprite_on.c
@@ -47,10 +47,9 @@
 #include "drmtest.h"
 #include "igt_kms.h"
 
-#if defined(DRM_IOCTL_MODE_ADDFB2) && defined(DRM_I915_SET_SPRITE_COLORKEY)
-#define TEST_PLANES 1
-#include "drm_fourcc.h"
-#endif
+#include <drm_fourcc.h>
+
+#include "ioctl_wrappers.h"
 
 /*
  * Mode setting with the kernel interfaces is a bit of a chore.
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 112f04977445..c6f7bdebe006 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -56,6 +56,7 @@
 #include "../version.h"
 #include "config.h"
 #include "intel_reg.h"
+#include "ioctl_wrappers.h"
 
 /* This file contains a bunch of wrapper functions to directly use gem ioctls.
  * Mostly useful to write kernel tests. */
diff --git a/lib/drmtest.h b/lib/drmtest.h
index d048ee095386..4c55068ee54c 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -33,18 +33,11 @@
 #include <unistd.h>
 #include <errno.h>
 #include <stdbool.h>
-#include <setjmp.h>
 #include <sys/mman.h>
 
 #include "xf86drm.h"
 #include "xf86drmMode.h"
-#include "i915_drm.h"
 #include "intel_batchbuffer.h"
-#include "intel_chipset.h"
-#include "intel_gpu_tools.h"
-
-#include "ioctl_wrappers.h"
-#include "igt_core.h"
 
 #ifdef ANDROID
 #ifndef HAVE_MMAP64
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 05036fc06ba2..f467ce0f3992 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -22,6 +22,7 @@
  *
  */
 
+#include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
 #include <errno.h>
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index ac27d7ae1534..88ee83be2f91 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -34,6 +34,7 @@
 
 #include "drmtest.h"
 #include "igt_kms.h"
+#include "ioctl_wrappers.h"
 
 /* helpers to create nice-looking framebuffers */
 static int create_bo_for_fb(int fd, int width, int height, int bpp,
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index 6e3eb0f2d0dc..8ca218148b6b 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -30,6 +30,11 @@
 #ifndef IOCTL_WRAPPERS_H
 #define IOCTL_WRAPPERS_H
 
+#include <stdint.h>
+#include <stdbool.h>
+#include <intel_bufmgr.h>
+#include <i915_drm.h>
+
 /* libdrm interfacing */
 drm_intel_bo * gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd,
 				       const char *name, uint32_t handle);
diff --git a/lib/rendercopy_gen7.c b/lib/rendercopy_gen7.c
index 05e6829319a4..75e0571618fc 100644
--- a/lib/rendercopy_gen7.c
+++ b/lib/rendercopy_gen7.c
@@ -16,6 +16,7 @@
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 #include "rendercopy.h"
 #include "gen7_render.h"
 #include "intel_reg.h"
diff --git a/tests/core_get_client_auth.c b/tests/core_get_client_auth.c
index 566a6580ce72..eef97e029a2d 100644
--- a/tests/core_get_client_auth.c
+++ b/tests/core_get_client_auth.c
@@ -40,7 +40,7 @@
 # include <sys/syscall.h>
 
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 /* Checks whether the thread id is the current thread */
diff --git a/tests/drm_vma_limiter.c b/tests/drm_vma_limiter.c
index b38037ad466f..f14ced8c85b6 100644
--- a/tests/drm_vma_limiter.c
+++ b/tests/drm_vma_limiter.c
@@ -33,11 +33,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/drm_vma_limiter_cached.c b/tests/drm_vma_limiter_cached.c
index 3a78436d6d16..7c40541c5ff5 100644
--- a/tests/drm_vma_limiter_cached.c
+++ b/tests/drm_vma_limiter_cached.c
@@ -33,11 +33,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/drm_vma_limiter_cpu.c b/tests/drm_vma_limiter_cpu.c
index 77a50b1d3219..4da4673752cd 100644
--- a/tests/drm_vma_limiter_cpu.c
+++ b/tests/drm_vma_limiter_cpu.c
@@ -33,11 +33,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/drm_vma_limiter_gtt.c b/tests/drm_vma_limiter_gtt.c
index 5104b0da43de..283bf6b47df8 100644
--- a/tests/drm_vma_limiter_gtt.c
+++ b/tests/drm_vma_limiter_gtt.c
@@ -33,11 +33,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c
index ff8a348bdd77..ed393af40d13 100644
--- a/tests/drv_suspend.c
+++ b/tests/drv_suspend.c
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "igt_debugfs.h"
 
diff --git a/tests/gem_bad_address.c b/tests/gem_bad_address.c
index 6e5f0254b176..58819357bf2a 100644
--- a/tests/gem_bad_address.c
+++ b/tests/gem_bad_address.c
@@ -35,9 +35,10 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
+#include "intel_chipset.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_bad_batch.c b/tests/gem_bad_batch.c
index abeda881bc86..5bb08b442b5c 100644
--- a/tests/gem_bad_batch.c
+++ b/tests/gem_bad_batch.c
@@ -35,10 +35,11 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 
 static drm_intel_bufmgr *bufmgr;
diff --git a/tests/gem_bad_blit.c b/tests/gem_bad_blit.c
index c518b4fd3350..ec414eaff7dc 100644
--- a/tests/gem_bad_blit.c
+++ b/tests/gem_bad_blit.c
@@ -50,10 +50,11 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 
 static drm_intel_bufmgr *bufmgr;
diff --git a/tests/gem_bad_length.c b/tests/gem_bad_length.c
index ae48d5529289..4b93cdeb1031 100644
--- a/tests/gem_bad_length.c
+++ b/tests/gem_bad_length.c
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 /*
diff --git a/tests/gem_basic.c b/tests/gem_basic.c
index 5d8f840683cd..71d29ae79191 100644
--- a/tests/gem_basic.c
+++ b/tests/gem_basic.c
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 static void
diff --git a/tests/gem_caching.c b/tests/gem_caching.c
index d788891b5336..da6f2d8f02f7 100644
--- a/tests/gem_caching.c
+++ b/tests/gem_caching.c
@@ -35,11 +35,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 /*
  * Testcase: snoop consistency when touching partial cachelines
diff --git a/tests/gem_close_race.c b/tests/gem_close_race.c
index 2087fed6080d..e46e2c150f9f 100644
--- a/tests/gem_close_race.c
+++ b/tests/gem_close_race.c
@@ -38,8 +38,9 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
+#include "intel_chipset.h"
 
 #define OBJECT_SIZE 1024*1024*4
 
diff --git a/tests/gem_concurrent_blit.c b/tests/gem_concurrent_blit.c
index 254bc4c265a3..29f42c7dc2d6 100644
--- a/tests/gem_concurrent_blit.c
+++ b/tests/gem_concurrent_blit.c
@@ -45,11 +45,12 @@
 #include <sys/time.h>
 #include <sys/wait.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static void
 prw_set_bo(drm_intel_bo *bo, uint32_t val, int width, int height)
diff --git a/tests/gem_cpu_reloc.c b/tests/gem_cpu_reloc.c
index 6e1f88861d8d..77d9109eef2c 100644
--- a/tests/gem_cpu_reloc.c
+++ b/tests/gem_cpu_reloc.c
@@ -54,11 +54,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static uint32_t use_blt;
 
diff --git a/tests/gem_cs_prefetch.c b/tests/gem_cs_prefetch.c
index 9ff65732b3e7..842e4276dd84 100644
--- a/tests/gem_cs_prefetch.c
+++ b/tests/gem_cs_prefetch.c
@@ -44,11 +44,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/gem_cs_tlb.c b/tests/gem_cs_tlb.c
index 6f1fd5b543a3..7d5c99dc67dd 100644
--- a/tests/gem_cs_tlb.c
+++ b/tests/gem_cs_tlb.c
@@ -47,7 +47,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_ctx_bad_destroy.c b/tests/gem_ctx_bad_destroy.c
index 3fcc946eae78..092f34221061 100644
--- a/tests/gem_ctx_bad_destroy.c
+++ b/tests/gem_ctx_bad_destroy.c
@@ -31,7 +31,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 struct local_drm_i915_context_destroy {
diff --git a/tests/gem_ctx_bad_exec.c b/tests/gem_ctx_bad_exec.c
index 834b5fe30720..f0bb0fc9cc34 100644
--- a/tests/gem_ctx_bad_exec.c
+++ b/tests/gem_ctx_bad_exec.c
@@ -42,7 +42,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 /* Copied from gem_exec_nop.c */
diff --git a/tests/gem_ctx_basic.c b/tests/gem_ctx_basic.c
index 4340000e25a1..3dbef2bd767c 100644
--- a/tests/gem_ctx_basic.c
+++ b/tests/gem_ctx_basic.c
@@ -41,11 +41,12 @@
 #include <sys/time.h>
 #include <getopt.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 /* options */
 int num_contexts = 10;
diff --git a/tests/gem_ctx_create.c b/tests/gem_ctx_create.c
index d7a45387c86a..f32c2287f8d9 100644
--- a/tests/gem_ctx_create.c
+++ b/tests/gem_ctx_create.c
@@ -27,7 +27,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 struct local_drm_i915_gem_context_create {
diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
index 8a20181bb7a2..3afa7652c8e9 100644
--- a/tests/gem_ctx_exec.c
+++ b/tests/gem_ctx_exec.c
@@ -41,7 +41,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 struct local_drm_i915_gem_context_destroy {
diff --git a/tests/gem_double_irq_loop.c b/tests/gem_double_irq_loop.c
index 47784adda578..f5c762962a43 100644
--- a/tests/gem_double_irq_loop.c
+++ b/tests/gem_double_irq_loop.c
@@ -34,12 +34,13 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 #include "i830_reg.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/gem_dummy_reloc_loop.c b/tests/gem_dummy_reloc_loop.c
index 955de96f8280..7c9da637e89c 100644
--- a/tests/gem_dummy_reloc_loop.c
+++ b/tests/gem_dummy_reloc_loop.c
@@ -34,12 +34,13 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 #include "i830_reg.h"
+#include "intel_chipset.h"
 
 #define LOCAL_I915_EXEC_VEBOX (4<<0)
 
diff --git a/tests/gem_evict_alignment.c b/tests/gem_evict_alignment.c
index c478f18e0e3a..46da5ba1fcd4 100644
--- a/tests/gem_evict_alignment.c
+++ b/tests/gem_evict_alignment.c
@@ -42,8 +42,9 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
+#include "intel_chipset.h"
 
 #define HEIGHT 256
 #define WIDTH 1024
diff --git a/tests/gem_evict_everything.c b/tests/gem_evict_everything.c
index ad33c0ae2a04..c595302ecb89 100644
--- a/tests/gem_evict_everything.c
+++ b/tests/gem_evict_everything.c
@@ -42,8 +42,9 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
+#include "intel_chipset.h"
 
 #include "eviction_common.c"
 
diff --git a/tests/gem_exec_bad_domains.c b/tests/gem_exec_bad_domains.c
index e0e13de5e765..0000e9edd144 100644
--- a/tests/gem_exec_bad_domains.c
+++ b/tests/gem_exec_bad_domains.c
@@ -34,11 +34,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 /* Testcase: Test whether the kernel rejects relocations with non-gpu domains
  *
diff --git a/tests/gem_exec_big.c b/tests/gem_exec_big.c
index 4be8559fc21b..707531643036 100644
--- a/tests/gem_exec_big.c
+++ b/tests/gem_exec_big.c
@@ -44,7 +44,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define BATCH_SIZE		(1024*1024)
diff --git a/tests/gem_exec_blt.c b/tests/gem_exec_blt.c
index bac11f10f3fa..6c3ea37d60bb 100644
--- a/tests/gem_exec_blt.c
+++ b/tests/gem_exec_blt.c
@@ -37,7 +37,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_chipset.h"
 #include "intel_gpu_tools.h"
diff --git a/tests/gem_exec_faulting_reloc.c b/tests/gem_exec_faulting_reloc.c
index d5ca18cf6ce2..51e5b6ed1ed3 100644
--- a/tests/gem_exec_faulting_reloc.c
+++ b/tests/gem_exec_faulting_reloc.c
@@ -37,7 +37,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_chipset.h"
 #include "intel_gpu_tools.h"
diff --git a/tests/gem_exec_lut_handle.c b/tests/gem_exec_lut_handle.c
index c27e4d58f5d7..d0e212642f84 100644
--- a/tests/gem_exec_lut_handle.c
+++ b/tests/gem_exec_lut_handle.c
@@ -36,7 +36,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define BATCH_SIZE		(1024*1024)
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index 868f010e721e..28ec66b3b151 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -37,7 +37,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_fd_exhaustion.c b/tests/gem_fd_exhaustion.c
index afaa10077e76..7d865d4278cc 100644
--- a/tests/gem_fd_exhaustion.c
+++ b/tests/gem_fd_exhaustion.c
@@ -32,6 +32,7 @@
 #include <fcntl.h>
 #include <limits.h>
 #include "drmtest.h"
+#include "ioctl_wrappers.h"
 
 
 #define FD_ARR_SZ 100
diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index 86ee5bec30ce..9c1ff1c5396b 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -41,7 +41,7 @@
 #include <sys/ioctl.h>
 #include <pthread.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define OBJECT_SIZE (128*1024) /* restricted to 1MiB alignment on i915 fences */
diff --git a/tests/gem_fenced_exec_thrash.c b/tests/gem_fenced_exec_thrash.c
index 6b3608e06929..cd53cafc5fdf 100644
--- a/tests/gem_fenced_exec_thrash.c
+++ b/tests/gem_fenced_exec_thrash.c
@@ -34,9 +34,10 @@
 #include <fcntl.h>
 #include <inttypes.h>
 #include <drm.h>
-#include <i915_drm.h>
+#include "ioctl_wrappers.h"
 
 #include "drmtest.h"
+#include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 
 #define WIDTH 1024
diff --git a/tests/gem_flink.c b/tests/gem_flink.c
index 4b3b7c2f69c3..339f7f1d2233 100644
--- a/tests/gem_flink.c
+++ b/tests/gem_flink.c
@@ -34,7 +34,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 static void
diff --git a/tests/gem_flink_race.c b/tests/gem_flink_race.c
index 195ec1513d61..26c71cecce07 100644
--- a/tests/gem_flink_race.c
+++ b/tests/gem_flink_race.c
@@ -33,7 +33,7 @@
 #include <pthread.h>
 
 #include "drmtest.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "intel_bufmgr.h"
 #include "igt_debugfs.h"
 
diff --git a/tests/gem_gtt_cpu_tlb.c b/tests/gem_gtt_cpu_tlb.c
index d66402589d5b..c087a37934a7 100644
--- a/tests/gem_gtt_cpu_tlb.c
+++ b/tests/gem_gtt_cpu_tlb.c
@@ -40,7 +40,7 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_gtt_hog.c b/tests/gem_gtt_hog.c
index c7206dca45c9..7fd22bd01f30 100644
--- a/tests/gem_gtt_hog.c
+++ b/tests/gem_gtt_hog.c
@@ -39,8 +39,9 @@
 #include <sys/wait.h>
 
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
+#include "intel_chipset.h"
 
 static const uint32_t canary = 0xdeadbeef;
 
diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c
index 2f70276fcb05..6ebe275e5fb4 100644
--- a/tests/gem_gtt_speed.c
+++ b/tests/gem_gtt_speed.c
@@ -38,7 +38,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define OBJECT_SIZE 16384
diff --git a/tests/gem_hang.c b/tests/gem_hang.c
index a675eaed0048..5b1f5dc81be1 100644
--- a/tests/gem_hang.c
+++ b/tests/gem_hang.c
@@ -35,9 +35,10 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
+#include "intel_chipset.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_hangcheck_forcewake.c b/tests/gem_hangcheck_forcewake.c
index cd51d6ca6fc5..d1bf000efb7a 100644
--- a/tests/gem_hangcheck_forcewake.c
+++ b/tests/gem_hangcheck_forcewake.c
@@ -34,11 +34,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 /*
  * Testcase: Provoke the hangcheck timer on an otherwise idle system
diff --git a/tests/gem_largeobject.c b/tests/gem_largeobject.c
index 5f0bb558e7b2..c01045e5a8d4 100644
--- a/tests/gem_largeobject.c
+++ b/tests/gem_largeobject.c
@@ -34,7 +34,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 /* Should take 64 pages to store the page pointers on 64 bit */
diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c
index e76de02a6d13..a7e398fb7d95 100644
--- a/tests/gem_linear_blits.c
+++ b/tests/gem_linear_blits.c
@@ -42,7 +42,8 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
+#include "intel_chipset.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
diff --git a/tests/gem_lut_handle.c b/tests/gem_lut_handle.c
index 10fa22bd1509..e682ccf76470 100644
--- a/tests/gem_lut_handle.c
+++ b/tests/gem_lut_handle.c
@@ -36,7 +36,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define BATCH_SIZE		(1024*1024)
diff --git a/tests/gem_madvise.c b/tests/gem_madvise.c
index 17e59754c3b3..04a82aa355b1 100644
--- a/tests/gem_madvise.c
+++ b/tests/gem_madvise.c
@@ -36,7 +36,7 @@
 #include <signal.h>
 
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define OBJECT_SIZE (1024*1024)
diff --git a/tests/gem_media_fill.c b/tests/gem_media_fill.c
index 220f8629ea5d..68bbdf23adf0 100644
--- a/tests/gem_media_fill.c
+++ b/tests/gem_media_fill.c
@@ -43,11 +43,12 @@
 #include <sys/time.h>
 #include <getopt.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define WIDTH 64
 #define STRIDE (WIDTH)
diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c
index 4c5be8fac074..a1b00fa5cf36 100644
--- a/tests/gem_mmap.c
+++ b/tests/gem_mmap.c
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define OBJECT_SIZE 16384
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index 5f9e6382e8a2..7ba5e39c6ce9 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -36,7 +36,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "igt_debugfs.h"
 
diff --git a/tests/gem_mmap_offset_exhaustion.c b/tests/gem_mmap_offset_exhaustion.c
index 670ca466323d..d5939ecbdfd2 100644
--- a/tests/gem_mmap_offset_exhaustion.c
+++ b/tests/gem_mmap_offset_exhaustion.c
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define OBJECT_SIZE (1024*1024)
diff --git a/tests/gem_non_secure_batch.c b/tests/gem_non_secure_batch.c
index 101b9dcf1e5a..1d96222dc58b 100644
--- a/tests/gem_non_secure_batch.c
+++ b/tests/gem_non_secure_batch.c
@@ -34,10 +34,11 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 #include "i830_reg.h"
 
diff --git a/tests/gem_partial_pwrite_pread.c b/tests/gem_partial_pwrite_pread.c
index 0f4c9aed468d..c246537341c8 100644
--- a/tests/gem_partial_pwrite_pread.c
+++ b/tests/gem_partial_pwrite_pread.c
@@ -34,8 +34,9 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
+#include "intel_chipset.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
diff --git a/tests/gem_persistent_relocs.c b/tests/gem_persistent_relocs.c
index 50d8e0e3fb11..1a705fad8fff 100644
--- a/tests/gem_persistent_relocs.c
+++ b/tests/gem_persistent_relocs.c
@@ -37,9 +37,10 @@
 #include <signal.h>
 #include <sys/wait.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
+#include "intel_chipset.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 #include "igt_debugfs.h"
diff --git a/tests/gem_pin.c b/tests/gem_pin.c
index 860e56524d8b..e57ddcc4c740 100644
--- a/tests/gem_pin.c
+++ b/tests/gem_pin.c
@@ -36,7 +36,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_chipset.h"
 #include "intel_gpu_tools.h"
diff --git a/tests/gem_pipe_control_store_loop.c b/tests/gem_pipe_control_store_loop.c
index f4c03bad9631..41bfc1b0e40a 100644
--- a/tests/gem_pipe_control_store_loop.c
+++ b/tests/gem_pipe_control_store_loop.c
@@ -40,10 +40,11 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 
 static drm_intel_bufmgr *bufmgr;
diff --git a/tests/gem_pread.c b/tests/gem_pread.c
index d1baf541fa6f..5f8246b4b9c9 100644
--- a/tests/gem_pread.c
+++ b/tests/gem_pread.c
@@ -37,7 +37,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define OBJECT_SIZE 16384
diff --git a/tests/gem_pread_after_blit.c b/tests/gem_pread_after_blit.c
index eb8fd3a4854f..f263286c0f49 100644
--- a/tests/gem_pread_after_blit.c
+++ b/tests/gem_pread_after_blit.c
@@ -43,8 +43,9 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
+#include "intel_chipset.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c
index d04535b919ef..4d47f6f229df 100644
--- a/tests/gem_pwrite.c
+++ b/tests/gem_pwrite.c
@@ -37,7 +37,7 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define OBJECT_SIZE 16384
diff --git a/tests/gem_pwrite_pread.c b/tests/gem_pwrite_pread.c
index db939b6ea3fe..c3314e48bc89 100644
--- a/tests/gem_pwrite_pread.c
+++ b/tests/gem_pwrite_pread.c
@@ -37,8 +37,9 @@
 #include <sys/ioctl.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
+#include "intel_chipset.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
diff --git a/tests/gem_readwrite.c b/tests/gem_readwrite.c
index 149254a2e514..5260fb962db7 100644
--- a/tests/gem_readwrite.c
+++ b/tests/gem_readwrite.c
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 #define OBJECT_SIZE 16384
diff --git a/tests/gem_reg_read.c b/tests/gem_reg_read.c
index a88c6a461c77..19f1351b3fd1 100644
--- a/tests/gem_reg_read.c
+++ b/tests/gem_reg_read.c
@@ -27,7 +27,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 
 struct local_drm_i915_reg_read {
diff --git a/tests/gem_reloc_overflow.c b/tests/gem_reloc_overflow.c
index fa7baab5f0d0..98b7dd4a7b0c 100644
--- a/tests/gem_reloc_overflow.c
+++ b/tests/gem_reloc_overflow.c
@@ -43,7 +43,8 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
+#include "intel_chipset.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_reloc_vs_gpu.c b/tests/gem_reloc_vs_gpu.c
index 34e81a20c094..07c79b33d937 100644
--- a/tests/gem_reloc_vs_gpu.c
+++ b/tests/gem_reloc_vs_gpu.c
@@ -37,10 +37,11 @@
 #include <signal.h>
 #include <sys/wait.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 #include "igt_debugfs.h"
 
diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index ad48bfc25848..54f971d127b7 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -43,11 +43,12 @@
 #include <sys/time.h>
 #include <getopt.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define WIDTH 512
 #define STRIDE (WIDTH*4)
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index 92c5bf6aaa32..ac2b29b00d14 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -48,11 +48,13 @@
 #include <sys/time.h>
 #include <getopt.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
+
 #define WIDTH 512
 #define STRIDE (WIDTH*4)
 #define HEIGHT 512
diff --git a/tests/gem_render_tiled_blits.c b/tests/gem_render_tiled_blits.c
index 5233b2314816..8481e51d3bda 100644
--- a/tests/gem_render_tiled_blits.c
+++ b/tests/gem_render_tiled_blits.c
@@ -44,11 +44,12 @@
 #include <sys/time.h>
 #include <getopt.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define WIDTH 512
 #define STRIDE (WIDTH*4)
diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index 8ac93a898243..90befd70a527 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -40,10 +40,11 @@
 #include <time.h>
 #include <signal.h>
 
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "igt_debugfs.h"
 #include "intel_bufmgr.h"
+#include "intel_chipset.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_ring_sync_copy.c b/tests/gem_ring_sync_copy.c
index b8b1454c90e5..768d02d0d0f9 100644
--- a/tests/gem_ring_sync_copy.c
+++ b/tests/gem_ring_sync_copy.c
@@ -50,9 +50,10 @@
 #include <stdlib.h>
 #include <stdbool.h>
 
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 
 #define WIDTH	512
 #define HEIGHT	512
diff --git a/tests/gem_ring_sync_loop.c b/tests/gem_ring_sync_loop.c
index 95fcd305a72b..5010d3562142 100644
--- a/tests/gem_ring_sync_loop.c
+++ b/tests/gem_ring_sync_loop.c
@@ -34,12 +34,13 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 #include "i830_reg.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index ef98701c5b7c..716ff5692cf7 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -42,9 +42,10 @@
 #include <sys/time.h>
 
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
+#include "intel_chipset.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c
index f97403249374..19c0201e21ba 100644
--- a/tests/gem_seqno_wrap.c
+++ b/tests/gem_seqno_wrap.c
@@ -42,12 +42,13 @@
 #include <getopt.h>
 #include <signal.h>
 
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "igt_core.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static int devid;
 static int card_index = 0;
diff --git a/tests/gem_set_tiling_vs_blt.c b/tests/gem_set_tiling_vs_blt.c
index 7335da87c017..1ad0e5c1e91b 100644
--- a/tests/gem_set_tiling_vs_blt.c
+++ b/tests/gem_set_tiling_vs_blt.c
@@ -54,10 +54,11 @@
 #include <sys/time.h>
 #include <stdbool.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 
 static drm_intel_bufmgr *bufmgr;
diff --git a/tests/gem_set_tiling_vs_gtt.c b/tests/gem_set_tiling_vs_gtt.c
index 5dc90aea57d1..abe096396d57 100644
--- a/tests/gem_set_tiling_vs_gtt.c
+++ b/tests/gem_set_tiling_vs_gtt.c
@@ -35,9 +35,10 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define OBJECT_SIZE (1024*1024)
 #define TEST_STRIDE (1024*4)
diff --git a/tests/gem_set_tiling_vs_pwrite.c b/tests/gem_set_tiling_vs_pwrite.c
index 4ef372013e8c..d07ebafc3fa6 100644
--- a/tests/gem_set_tiling_vs_pwrite.c
+++ b/tests/gem_set_tiling_vs_pwrite.c
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_storedw_batches_loop.c b/tests/gem_storedw_batches_loop.c
index 85d6f6c076eb..f07085c46a01 100644
--- a/tests/gem_storedw_batches_loop.c
+++ b/tests/gem_storedw_batches_loop.c
@@ -35,9 +35,10 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
+#include "intel_chipset.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_storedw_loop_blt.c b/tests/gem_storedw_loop_blt.c
index d08f5b0d50fe..b242b292017a 100644
--- a/tests/gem_storedw_loop_blt.c
+++ b/tests/gem_storedw_loop_blt.c
@@ -35,11 +35,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/gem_storedw_loop_bsd.c b/tests/gem_storedw_loop_bsd.c
index 079b139f42d9..482e276b0158 100644
--- a/tests/gem_storedw_loop_bsd.c
+++ b/tests/gem_storedw_loop_bsd.c
@@ -35,11 +35,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/gem_storedw_loop_render.c b/tests/gem_storedw_loop_render.c
index 2dc16b107925..7cbc0a80d08c 100644
--- a/tests/gem_storedw_loop_render.c
+++ b/tests/gem_storedw_loop_render.c
@@ -35,11 +35,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/gem_storedw_loop_vebox.c b/tests/gem_storedw_loop_vebox.c
index aa1987ac7ccc..872d4b2aa56b 100644
--- a/tests/gem_storedw_loop_vebox.c
+++ b/tests/gem_storedw_loop_vebox.c
@@ -34,11 +34,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define LOCAL_I915_EXEC_VEBOX (4<<0)
 
diff --git a/tests/gem_stress.c b/tests/gem_stress.c
index 3a94fb1aa5d5..d6434bcc5b63 100644
--- a/tests/gem_stress.c
+++ b/tests/gem_stress.c
@@ -60,11 +60,12 @@
 #include <sys/time.h>
 #include <getopt.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define CMD_POLY_STIPPLE_OFFSET       0x7906
 
diff --git a/tests/gem_threaded_access_tiled.c b/tests/gem_threaded_access_tiled.c
index cf07daf42fa0..3752a1f647a5 100644
--- a/tests/gem_threaded_access_tiled.c
+++ b/tests/gem_threaded_access_tiled.c
@@ -31,7 +31,7 @@
 #include <pthread.h>
 
 #include "drmtest.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "intel_bufmgr.h"
 
 /* Testcase: check parallel access to tiled memory
diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c
index e21fc7894c0f..00b695549b35 100644
--- a/tests/gem_tiled_blits.c
+++ b/tests/gem_tiled_blits.c
@@ -50,10 +50,11 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 
 static drm_intel_bufmgr *bufmgr;
diff --git a/tests/gem_tiled_fence_blits.c b/tests/gem_tiled_fence_blits.c
index b33be58c3e1b..3dfcf0039dba 100644
--- a/tests/gem_tiled_fence_blits.c
+++ b/tests/gem_tiled_fence_blits.c
@@ -50,11 +50,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/gem_tiled_partial_pwrite_pread.c b/tests/gem_tiled_partial_pwrite_pread.c
index bcae6e9e307a..322cca9d8794 100644
--- a/tests/gem_tiled_partial_pwrite_pread.c
+++ b/tests/gem_tiled_partial_pwrite_pread.c
@@ -34,9 +34,10 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
+#include "intel_chipset.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_tiled_pread.c b/tests/gem_tiled_pread.c
index 0592b8c0bc8f..6f104a6ca38b 100644
--- a/tests/gem_tiled_pread.c
+++ b/tests/gem_tiled_pread.c
@@ -45,9 +45,10 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define WIDTH 512
 #define HEIGHT 512
diff --git a/tests/gem_tiled_pread_pwrite.c b/tests/gem_tiled_pread_pwrite.c
index 09d3ea4c9323..06c32fcc1fde 100644
--- a/tests/gem_tiled_pread_pwrite.c
+++ b/tests/gem_tiled_pread_pwrite.c
@@ -54,7 +54,7 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c
index e8fcc7ef1ea0..28d21d458e68 100644
--- a/tests/gem_tiled_swapping.c
+++ b/tests/gem_tiled_swapping.c
@@ -54,7 +54,7 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
 
diff --git a/tests/gem_tiling_max_stride.c b/tests/gem_tiling_max_stride.c
index e4b58dcb2670..ded965aef0ef 100644
--- a/tests/gem_tiling_max_stride.c
+++ b/tests/gem_tiling_max_stride.c
@@ -36,9 +36,10 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static void do_test_invalid_tiling(int fd, uint32_t handle, int tiling, int stride)
 {
diff --git a/tests/gem_unfence_active_buffers.c b/tests/gem_unfence_active_buffers.c
index b79b124abf2d..9ccabe9fd29b 100644
--- a/tests/gem_unfence_active_buffers.c
+++ b/tests/gem_unfence_active_buffers.c
@@ -48,11 +48,12 @@
 #include <sys/time.h>
 #include <stdbool.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/gem_unref_active_buffers.c b/tests/gem_unref_active_buffers.c
index 1e9e2146daff..8906705756ea 100644
--- a/tests/gem_unref_active_buffers.c
+++ b/tests/gem_unref_active_buffers.c
@@ -41,11 +41,12 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 static drm_intel_bufmgr *bufmgr;
 struct intel_batchbuffer *batch;
diff --git a/tests/gem_vmap_blits.c b/tests/gem_vmap_blits.c
index 48297afc5e98..4fb2a215e3d5 100644
--- a/tests/gem_vmap_blits.c
+++ b/tests/gem_vmap_blits.c
@@ -44,7 +44,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
diff --git a/tests/gem_wait_render_timeout.c b/tests/gem_wait_render_timeout.c
index 074810490c55..d4c12fee17c8 100644
--- a/tests/gem_wait_render_timeout.c
+++ b/tests/gem_wait_render_timeout.c
@@ -38,11 +38,12 @@
 #include <sys/time.h>
 #include <getopt.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define MSEC_PER_SEC	1000L
 #define USEC_PER_MSEC	1000L
diff --git a/tests/gem_write_read_ring_switch.c b/tests/gem_write_read_ring_switch.c
index 524d6fb0de6e..cd235c95c190 100644
--- a/tests/gem_write_read_ring_switch.c
+++ b/tests/gem_write_read_ring_switch.c
@@ -34,10 +34,11 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "intel_gpu_tools.h"
 #include "i830_reg.h"
 
diff --git a/tests/gen3_mixed_blits.c b/tests/gen3_mixed_blits.c
index 17ccf202ce47..64041a0ec29b 100644
--- a/tests/gen3_mixed_blits.c
+++ b/tests/gen3_mixed_blits.c
@@ -43,9 +43,10 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #include "i915_reg.h"
 #include "i915_3d.h"
diff --git a/tests/gen3_render_linear_blits.c b/tests/gen3_render_linear_blits.c
index 129b5068388f..eed3ba5e47f1 100644
--- a/tests/gen3_render_linear_blits.c
+++ b/tests/gen3_render_linear_blits.c
@@ -42,9 +42,10 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #include "i915_reg.h"
 #include "i915_3d.h"
diff --git a/tests/gen3_render_mixed_blits.c b/tests/gen3_render_mixed_blits.c
index d60e72612581..ac5452a8cde7 100644
--- a/tests/gen3_render_mixed_blits.c
+++ b/tests/gen3_render_mixed_blits.c
@@ -43,9 +43,10 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #include "i915_reg.h"
 #include "i915_3d.h"
diff --git a/tests/gen3_render_tiledx_blits.c b/tests/gen3_render_tiledx_blits.c
index 427a5c7185f7..1b2a00c50880 100644
--- a/tests/gen3_render_tiledx_blits.c
+++ b/tests/gen3_render_tiledx_blits.c
@@ -43,9 +43,10 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #include "i915_reg.h"
 #include "i915_3d.h"
diff --git a/tests/gen3_render_tiledy_blits.c b/tests/gen3_render_tiledy_blits.c
index a82f994f1895..803054138002 100644
--- a/tests/gen3_render_tiledy_blits.c
+++ b/tests/gen3_render_tiledy_blits.c
@@ -43,9 +43,10 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #include "i915_reg.h"
 #include "i915_3d.h"
diff --git a/tests/gen7_forcewake_mt.c b/tests/gen7_forcewake_mt.c
index db5dd3e0ff51..03eb6e92625f 100644
--- a/tests/gen7_forcewake_mt.c
+++ b/tests/gen7_forcewake_mt.c
@@ -35,10 +35,11 @@
 #include <string.h>
 
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "i915_pciids.h"
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 #define FORCEWAKE_MT 0xa188
 
diff --git a/tests/kms_addfb.c b/tests/kms_addfb.c
index 3f727cc00eef..349e7fb96b62 100644
--- a/tests/kms_addfb.c
+++ b/tests/kms_addfb.c
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "drm_fourcc.h"
 
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index 07a572d2d488..db595c72036c 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -27,12 +27,14 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "drm_fourcc.h"
+#include <drm_fourcc.h>
 
 #include "drmtest.h"
 #include "igt_debugfs.h"
 #include "igt_kms.h"
+#include "intel_chipset.h"
 #include "intel_batchbuffer.h"
+#include "ioctl_wrappers.h"
 
 enum test_mode {
 	TEST_PAGE_FLIP,
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 70d67e572059..d5292e8924e1 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -35,10 +35,12 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include <linux/kd.h>
+#include <time.h>
+#include <pthread.h>
 
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
-#include "testdisplay.h"
+#include "intel_chipset.h"
 #include "intel_batchbuffer.h"
 #include "igt_kms.h"
 
diff --git a/tests/kms_render.c b/tests/kms_render.c
index e661753e3abf..7bff958b876c 100644
--- a/tests/kms_render.c
+++ b/tests/kms_render.c
@@ -30,13 +30,16 @@
 #include <unistd.h>
 #include <sys/time.h>
 
-#include "drm_fourcc.h"
+#include <drm_fourcc.h>
+
 #include "drmtest.h"
 #include "testdisplay.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 #include "igt_kms.h"
+#include "ioctl_wrappers.h"
 
 drmModeRes *resources;
 int drm_fd;
diff --git a/tests/pm_lpsp.c b/tests/pm_lpsp.c
index ede9149514a3..1dc7a73f5dae 100644
--- a/tests/pm_lpsp.c
+++ b/tests/pm_lpsp.c
@@ -31,6 +31,8 @@
 
 #include "drmtest.h"
 #include "igt_kms.h"
+#include "intel_gpu_tools.h"
+#include "intel_chipset.h"
 
 /* We know that if we don't enable audio runtime PM, snd_hda_intel will never
  * release its power well refcount, and we'll never reach the LPSP sate. OTOH
diff --git a/tests/pm_pc8.c b/tests/pm_pc8.c
index c672e809d04e..5a1e74700760 100644
--- a/tests/pm_pc8.c
+++ b/tests/pm_pc8.c
@@ -44,7 +44,8 @@
 #include "drmtest.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
-#include "i915_drm.h"
+#include "intel_chipset.h"
+#include "ioctl_wrappers.h"
 #include "igt_kms.h"
 #include "igt_debugfs.h"
 
diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 038987c03b28..e6ab37907e8e 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -34,11 +34,14 @@
 #include <getopt.h>
 #include <fcntl.h>
 #include <signal.h>
+
 #include "drmtest.h"
 #include "intel_gpu_tools.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "igt_debugfs.h"
+#include "ioctl_wrappers.h"
 
 static int drm_fd;
 
diff --git a/tests/prime_nv_api.c b/tests/prime_nv_api.c
index e2448befff02..c510c1cfe3bb 100644
--- a/tests/prime_nv_api.c
+++ b/tests/prime_nv_api.c
@@ -19,6 +19,7 @@
 #include "intel_gpu_tools.h"
 #include "intel_batchbuffer.h"
 #include "drmtest.h"
+#include "intel_chipset.h"
 
 #define BO_SIZE (256*1024)
 
diff --git a/tests/prime_nv_pcopy.c b/tests/prime_nv_pcopy.c
index fd2018ba3e1f..3f3814afc786 100644
--- a/tests/prime_nv_pcopy.c
+++ b/tests/prime_nv_pcopy.c
@@ -23,11 +23,12 @@
 #include <sys/ioctl.h>
 #include <errno.h>
 
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "intel_bufmgr.h"
 #include "nouveau.h"
 #include "intel_gpu_tools.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "drmtest.h"
 
 static int intel_fd = -1, nouveau_fd = -1;
diff --git a/tests/prime_nv_test.c b/tests/prime_nv_test.c
index 640515b4bebb..ee54e7a6eb6c 100644
--- a/tests/prime_nv_test.c
+++ b/tests/prime_nv_test.c
@@ -22,11 +22,12 @@
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "intel_bufmgr.h"
 #include "nouveau.h"
 #include "intel_gpu_tools.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 #include "drmtest.h"
 
 int intel_fd = -1, nouveau_fd = -1;
diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c
index 2566af98e6f6..efdd24f6f2f7 100644
--- a/tests/prime_self_import.c
+++ b/tests/prime_self_import.c
@@ -44,7 +44,7 @@
 #include <pthread.h>
 
 #include "drm.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "igt_debugfs.h"
 
diff --git a/tests/prime_udl.c b/tests/prime_udl.c
index d85308515873..892a952795a7 100644
--- a/tests/prime_udl.c
+++ b/tests/prime_udl.c
@@ -25,11 +25,12 @@
 
 #include "xf86drm.h"
 #include "xf86drmMode.h"
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "intel_bufmgr.h"
 #include "intel_gpu_tools.h"
 #include "intel_batchbuffer.h"
 #include "drmtest.h"
+#include "intel_chipset.h"
 
 int intel_fd = -1, udl_fd = -1;
 drm_intel_bufmgr *bufmgr;
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index d0cd5123ab0c..b70287ec958a 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -62,7 +62,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include "i915_drm.h"
+#include "ioctl_wrappers.h"
 #include "drmtest.h"
 #include "testdisplay.h"
 #include "igt_kms.h"
diff --git a/tools/intel_perf_counters.c b/tools/intel_perf_counters.c
index 23d9ed3a0006..c31111e60bbb 100644
--- a/tools/intel_perf_counters.c
+++ b/tools/intel_perf_counters.c
@@ -48,6 +48,7 @@
 #include "intel_gpu_tools.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
+#include "intel_chipset.h"
 
 #define GEN5_COUNTER_COUNT 29
 
