[Intel-gfx] [RFC i-g-t 8/9] lib: Replace intel specific header includes with intel_drm_stubs.h.

Daniel Vetter daniel at ffwll.ch
Tue May 24 08:07:52 UTC 2016


On Fri, May 20, 2016 at 06:59:32PM -0400, robert.foss at collabora.com wrote:
> From: Robert Foss <robert.foss at collabora.com>
> 
> Replace intel specific header includes with intel_drm_stubs.h.
> 
> The stubbed functions will all call igt_require(false) and cause a skip.
> 
> Signed-off-by: Robert Foss <robert.foss at collabora.com>

Do we need this sed job really? I kinda hoped we could have a dummy header
somewhere, like lib/stubs/drm/i915_drm.h and similar (instead of your
intel_drm_stubs.h), and then add lib/stubs/ to the include path when
!HAVE_LIBDRM_INTEL? That way 0 changes to tests/lib itself should be
needed.
-Daniel

> ---
>  lib/drmtest.c           | 2 +-
>  lib/gpgpu_fill.c        | 7 +++----
>  lib/igt_aux.c           | 2 +-
>  lib/igt_aux.h           | 3 ++-
>  lib/igt_debugfs.c       | 4 ++--
>  lib/igt_draw.h          | 3 +--
>  lib/igt_fb.h            | 3 ++-
>  lib/igt_kms.c           | 3 +--
>  lib/intel_batchbuffer.c | 4 ----
>  lib/intel_batchbuffer.h | 3 +--
>  lib/intel_chipset.c     | 2 +-
>  lib/ioctl_wrappers.c    | 1 -
>  lib/ioctl_wrappers.h    | 4 ++--
>  lib/media_fill_gen7.c   | 3 +--
>  lib/media_fill_gen8.c   | 4 +---
>  lib/media_fill_gen8lp.c | 6 ++----
>  lib/media_fill_gen9.c   | 4 +---
>  lib/media_spin.c        | 2 --
>  lib/rendercopy_gen6.c   | 5 ++---
>  lib/rendercopy_gen7.c   | 4 +---
>  lib/rendercopy_gen8.c   | 4 +---
>  lib/rendercopy_gen9.c   | 5 +----
>  lib/rendercopy_i830.c   | 5 +----
>  lib/rendercopy_i915.c   | 9 +++------
>  24 files changed, 31 insertions(+), 61 deletions(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 7d6b74a..f043607 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -48,13 +48,13 @@
>  #include <termios.h>
>  
>  #include "drmtest.h"
> -#include "i915_drm.h"
>  #include "intel_chipset.h"
>  #include "intel_io.h"
>  #include "igt_gt.h"
>  #include "igt_debugfs.h"
>  #include "version.h"
>  #include "config.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_reg.h"
>  #include "ioctl_wrappers.h"
>  
> diff --git a/lib/gpgpu_fill.c b/lib/gpgpu_fill.c
> index 4d98643..62b1161 100644
> --- a/lib/gpgpu_fill.c
> +++ b/lib/gpgpu_fill.c
> @@ -25,15 +25,14 @@
>   *  Dominik Zeromski <dominik.zeromski at intel.com>
>   */
>  
> -#include <intel_bufmgr.h>
> -#include <i915_drm.h>
>  
> -#include "intel_reg.h"
>  #include "drmtest.h"
> -#include "intel_batchbuffer.h"
>  #include "gen7_media.h"
>  #include "gen8_media.h"
>  #include "gpgpu_fill.h"
> +#include "intel_batchbuffer.h"
> +#include "intel_drm_stubs.h"
> +#include "intel_reg.h"
>  
>  /* shaders/gpgpu/gpgpu_fill.gxa */
>  static const uint32_t gen7_gpgpu_kernel[][4] = {
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index fe18365..772c902 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -52,12 +52,12 @@
>  #include <assert.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 "config.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_reg.h"
>  #include "ioctl_wrappers.h"
>  #include "igt_kms.h"
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index f66de72..c66121b 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -28,10 +28,11 @@
>  #ifndef IGT_AUX_H
>  #define IGT_AUX_H
>  
> -#include <intel_bufmgr.h>
>  #include <stdbool.h>
>  #include <sys/time.h>
>  
> +#include "intel_drm_stubs.h"
> +
>  extern drm_intel_bo **trash_bos;
>  extern int num_trash_bos;
>  
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index a32ed78..d9f371f 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -32,12 +32,12 @@
>  #include <string.h>
>  #include <fcntl.h>
>  #include <unistd.h>
> -#include <i915_drm.h>
>  
>  #include "drmtest.h"
> +#include "intel_drm_stubs.h"
>  #include "igt_aux.h"
> -#include "igt_kms.h"
>  #include "igt_debugfs.h"
> +#include "igt_kms.h"
>  
>  /**
>   * SECTION:igt_debugfs
> diff --git a/lib/igt_draw.h b/lib/igt_draw.h
> index b030131..c0e95ca 100644
> --- a/lib/igt_draw.h
> +++ b/lib/igt_draw.h
> @@ -25,9 +25,8 @@
>  #ifndef __IGT_DRAW_H__
>  #define __IGT_DRAW_H__
>  
> -#include <intel_bufmgr.h>
>  #include "igt_fb.h"
> -
> +#include "intel_drm_stubs.h"
>  /**
>   * igt_draw_method:
>   * @IGT_DRAW_MMAP_CPU: draw using a CPU mmap.
> diff --git a/lib/igt_fb.h b/lib/igt_fb.h
> index ce2cc0f..82dbacb 100644
> --- a/lib/igt_fb.h
> +++ b/lib/igt_fb.h
> @@ -38,10 +38,11 @@ typedef struct _cairo cairo_t;
>  
>  #include <stddef.h>
>  #include <stdbool.h>
> +#include <stdint.h>
>  #include <drm_fourcc.h>
>  #include <xf86drmMode.h>
>  
> -#include <i915_drm.h>
> +#include "intel_drm_stubs.h"
>  
>  /* helpers to create nice-looking framebuffers */
>  struct igt_fb {
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index f85be1e..7afee53 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -41,12 +41,11 @@
>  #include <errno.h>
>  #include <time.h>
>  
> -#include <i915_drm.h>
> -
>  #include "drmtest.h"
>  #include "igt_kms.h"
>  #include "igt_aux.h"
>  #include "intel_chipset.h"
> +#include "intel_drm_stubs.h"
>  #include "igt_debugfs.h"
>  
>  /* list of connectors that need resetting on exit */
> diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> index 692521f..a28eb33 100644
> --- a/lib/intel_batchbuffer.c
> +++ b/lib/intel_batchbuffer.c
> @@ -31,10 +31,8 @@
>  #include <string.h>
>  #include <assert.h>
>  
> -#include "drm.h"
>  #include "drmtest.h"
>  #include "intel_batchbuffer.h"
> -#include "intel_bufmgr.h"
>  #include "intel_chipset.h"
>  #include "intel_reg.h"
>  #include "rendercopy.h"
> @@ -43,8 +41,6 @@
>  #include "media_spin.h"
>  #include "gpgpu_fill.h"
>  
> -#include <i915_drm.h>
> -
>  /**
>   * SECTION:intel_batchbuffer
>   * @short_description: Batchbuffer and blitter support
> diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
> index 869747d..bd365db 100644
> --- a/lib/intel_batchbuffer.h
> +++ b/lib/intel_batchbuffer.h
> @@ -2,10 +2,9 @@
>  #define INTEL_BATCHBUFFER_H
>  
>  #include <stdint.h>
> -#include <intel_bufmgr.h>
> -#include <i915_drm.h>
>  
>  #include "igt_core.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_reg.h"
>  
>  #define BATCH_SZ 4096
> diff --git a/lib/intel_chipset.c b/lib/intel_chipset.c
> index 56746b0..6ac74e9 100644
> --- a/lib/intel_chipset.c
> +++ b/lib/intel_chipset.c
> @@ -36,9 +36,9 @@
>  #include <fcntl.h>
>  #include <sys/stat.h>
>  #include <sys/mman.h>
> -#include "i915_drm.h"
>  
>  #include "drmtest.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_chipset.h"
>  #include "igt_core.h"
>  
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index f224091..e46811a 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -50,7 +50,6 @@
>  #include <errno.h>
>  
>  #include "drmtest.h"
> -#include "i915_drm.h"
>  #include "intel_chipset.h"
>  #include "intel_io.h"
>  #include "igt_debugfs.h"
> diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
> index 8fe35b0..aa8c60f 100644
> --- a/lib/ioctl_wrappers.h
> +++ b/lib/ioctl_wrappers.h
> @@ -32,8 +32,8 @@
>  
>  #include <stdint.h>
>  #include <stdbool.h>
> -#include <intel_bufmgr.h>
> -#include <i915_drm.h>
> +
> +#include "intel_drm_stubs.h"
>  
>  extern int (*igt_ioctl)(int fd, unsigned long request, void *arg);
>  
> diff --git a/lib/media_fill_gen7.c b/lib/media_fill_gen7.c
> index 6fb4479..5ec8502 100644
> --- a/lib/media_fill_gen7.c
> +++ b/lib/media_fill_gen7.c
> @@ -1,9 +1,8 @@
> -#include <intel_bufmgr.h>
> -#include <i915_drm.h>
>  
>  #include "media_fill.h"
>  #include "gen7_media.h"
>  #include "intel_reg.h"
> +#include "intel_drm_stubs.h"
>  #include "drmtest.h"
>  
>  #include <assert.h>
> diff --git a/lib/media_fill_gen8.c b/lib/media_fill_gen8.c
> index 4a8fe5a..a1e1fe4 100644
> --- a/lib/media_fill_gen8.c
> +++ b/lib/media_fill_gen8.c
> @@ -1,8 +1,6 @@
> -#include <intel_bufmgr.h>
> -#include <i915_drm.h>
> -
>  #include "media_fill.h"
>  #include "gen8_media.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_reg.h"
>  #include "drmtest.h"
>  
> diff --git a/lib/media_fill_gen8lp.c b/lib/media_fill_gen8lp.c
> index 1f8a4ad..eed26ee 100644
> --- a/lib/media_fill_gen8lp.c
> +++ b/lib/media_fill_gen8lp.c
> @@ -1,13 +1,11 @@
> -#include <intel_bufmgr.h>
> -#include <i915_drm.h>
> +#include <assert.h>
>  
>  #include "media_fill.h"
>  #include "gen8_media.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_reg.h"
>  #include "drmtest.h"
>  
> -#include <assert.h>
> -
>  
>  static const uint32_t media_kernel[][4] = {
>  	{ 0x00400001, 0x20202288, 0x00000020, 0x00000000 },
> diff --git a/lib/media_fill_gen9.c b/lib/media_fill_gen9.c
> index 3fd2181..902b28b 100644
> --- a/lib/media_fill_gen9.c
> +++ b/lib/media_fill_gen9.c
> @@ -1,8 +1,6 @@
> -#include <intel_bufmgr.h>
> -#include <i915_drm.h>
> -
>  #include "media_fill.h"
>  #include "gen8_media.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_reg.h"
>  
>  #include <assert.h>
> diff --git a/lib/media_spin.c b/lib/media_spin.c
> index 580c109..f4a432a 100644
> --- a/lib/media_spin.c
> +++ b/lib/media_spin.c
> @@ -24,8 +24,6 @@
>   * 	Jeff McGee <jeff.mcgee at intel.com>
>   */
>  
> -#include <intel_bufmgr.h>
> -#include <i915_drm.h>
>  #include "intel_reg.h"
>  #include "drmtest.h"
>  #include "intel_batchbuffer.h"
> diff --git a/lib/rendercopy_gen6.c b/lib/rendercopy_gen6.c
> index 8c24cf8..d5207d5 100644
> --- a/lib/rendercopy_gen6.c
> +++ b/lib/rendercopy_gen6.c
> @@ -9,11 +9,10 @@
>  #include <errno.h>
>  #include <sys/stat.h>
>  #include <sys/time.h>
> -#include "drm.h"
> -#include "i915_drm.h"
> +
>  #include "drmtest.h"
> -#include "intel_bufmgr.h"
>  #include "intel_batchbuffer.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_io.h"
>  #include "rendercopy.h"
>  #include "gen6_render.h"
> diff --git a/lib/rendercopy_gen7.c b/lib/rendercopy_gen7.c
> index 3b92406..dc48a99 100644
> --- a/lib/rendercopy_gen7.c
> +++ b/lib/rendercopy_gen7.c
> @@ -9,10 +9,8 @@
>  #include <errno.h>
>  #include <sys/stat.h>
>  #include <sys/time.h>
> -#include "drm.h"
> -#include "i915_drm.h"
> +
>  #include "drmtest.h"
> -#include "intel_bufmgr.h"
>  #include "intel_batchbuffer.h"
>  #include "intel_io.h"
>  #include "intel_chipset.h"
> diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c
> index a7fc2c4..6fbb680 100644
> --- a/lib/rendercopy_gen8.c
> +++ b/lib/rendercopy_gen8.c
> @@ -10,12 +10,10 @@
>  #include <sys/stat.h>
>  #include <sys/time.h>
>  
> -#include <drm.h>
> -#include <i915_drm.h>
>  
>  #include "drmtest.h"
> -#include "intel_bufmgr.h"
>  #include "intel_batchbuffer.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_io.h"
>  #include "rendercopy.h"
>  #include "gen8_render.h"
> diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
> index 9537480..d575ddf 100644
> --- a/lib/rendercopy_gen9.c
> +++ b/lib/rendercopy_gen9.c
> @@ -11,12 +11,9 @@
>  #include <sys/time.h>
>  #include <getopt.h>
>  
> -#include <drm.h>
> -#include <i915_drm.h>
> -
>  #include "drmtest.h"
> -#include "intel_bufmgr.h"
>  #include "intel_batchbuffer.h"
> +#include "intel_drm_stubs.h"
>  #include "intel_io.h"
>  #include "rendercopy.h"
>  #include "gen9_render.h"
> diff --git a/lib/rendercopy_i830.c b/lib/rendercopy_i830.c
> index 04215b1..738d4d2 100644
> --- a/lib/rendercopy_i830.c
> +++ b/lib/rendercopy_i830.c
> @@ -8,13 +8,10 @@
>  #include <errno.h>
>  #include <sys/stat.h>
>  #include <sys/time.h>
> -#include "drm.h"
> -#include "i915_drm.h"
> +
>  #include "drmtest.h"
> -#include "intel_bufmgr.h"
>  #include "intel_batchbuffer.h"
>  #include "intel_io.h"
> -
>  #include "i830_reg.h"
>  #include "rendercopy.h"
>  
> diff --git a/lib/rendercopy_i915.c b/lib/rendercopy_i915.c
> index fc9583c..8846fdc 100644
> --- a/lib/rendercopy_i915.c
> +++ b/lib/rendercopy_i915.c
> @@ -8,15 +8,12 @@
>  #include <errno.h>
>  #include <sys/stat.h>
>  #include <sys/time.h>
> -#include "drm.h"
> -#include "i915_drm.h"
> -#include "drmtest.h"
> -#include "intel_bufmgr.h"
> -#include "intel_batchbuffer.h"
> -#include "intel_io.h"
>  
> +#include "drmtest.h"
>  #include "i915_reg.h"
>  #include "i915_3d.h"
> +#include "intel_batchbuffer.h"
> +#include "intel_io.h"
>  #include "rendercopy.h"
>  
>  void gen3_render_copyfunc(struct intel_batchbuffer *batch,
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list