[Intel-gfx] [PATCH 05/28] lib: make rendercopy.h an internal header

Daniel Vetter daniel.vetter at ffwll.ch
Sun Mar 23 15:18:39 CET 2014


And move the public interfaces into intel_batchbuffer.[hc].

A bit messy since we are fairly inconsistent with our header #include
handling.

Also exclude rendercopy.h from the documentation.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 .../intel-gpu-tools/intel-gpu-tools-docs.xml       |  1 -
 lib/intel_batchbuffer.c                            | 19 ++++++++
 lib/intel_batchbuffer.h                            | 29 ++++++++++++
 lib/media_fill.h                                   | 20 ---------
 lib/rendercopy.h                                   | 51 ----------------------
 lib/rendercopy_gen6.c                              | 20 ++++++++-
 lib/rendercopy_gen7.c                              | 20 ++++++++-
 lib/rendercopy_gen8.c                              | 20 ++++++++-
 lib/rendercopy_i830.c                              | 36 +++++++--------
 lib/rendercopy_i915.c                              | 18 ++++++++
 tests/gem_ctx_basic.c                              | 19 +++++++-
 tests/gem_render_copy.c                            | 20 ++++++++-
 tests/gem_render_linear_blits.c                    | 20 ++++++++-
 tests/gem_render_tiled_blits.c                     | 19 +++++++-
 tests/gem_reset_stats.c                            |  5 ++-
 tests/gem_ring_sync_copy.c                         |  2 +-
 tests/gem_ringfill.c                               |  2 +-
 tests/gem_seqno_wrap.c                             |  4 +-
 tests/gem_stress.c                                 | 19 +++++++-
 tests/gem_wait_render_timeout.c                    | 18 +++++++-
 tests/kms_fbc_crc.c                                |  2 +-
 tests/kms_flip.c                                   |  2 +-
 22 files changed, 255 insertions(+), 111 deletions(-)

diff --git a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml
index 9f8eebedd0aa..468844ec6bd1 100644
--- a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml
+++ b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml
@@ -25,7 +25,6 @@
     <xi:include href="xml/intel_chipset.xml"/>
     <xi:include href="xml/intel_gpu_tools.xml"/>
     <xi:include href="xml/media_fill.xml"/>
-    <xi:include href="xml/rendercopy.xml"/>
 
   </chapter>
   <index id="api-index-full">
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 195f1b29925d..df036013792d 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -37,6 +37,7 @@
 #include "intel_bufmgr.h"
 #include "intel_chipset.h"
 #include "intel_reg.h"
+#include "rendercopy.h"
 #include <i915_drm.h>
 
 /**
@@ -384,3 +385,21 @@ intel_copy_bo(struct intel_batchbuffer *batch,
 		       dst_bo, 0, 0, 4096,
 		       4096/4, size/4096, 32);
 }
+
+render_copyfunc_t get_render_copyfunc(int devid)
+{
+	render_copyfunc_t copy = NULL;
+
+	if (IS_GEN2(devid))
+		copy = gen2_render_copyfunc;
+	else if (IS_GEN3(devid))
+		copy = gen3_render_copyfunc;
+	else if (IS_GEN6(devid))
+		copy = gen6_render_copyfunc;
+	else if (IS_GEN7(devid))
+		copy = gen7_render_copyfunc;
+	else if (IS_GEN8(devid))
+		copy = gen8_render_copyfunc;
+
+	return copy;
+}
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 10088c2ecc3c..5e02269c24ca 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -2,6 +2,7 @@
 #define INTEL_BATCHBUFFER_H
 
 #include <assert.h>
+#include <stdint.h>
 #include "intel_bufmgr.h"
 
 #define BATCH_SZ 4096
@@ -195,4 +196,32 @@ void intel_copy_bo(struct intel_batchbuffer *batch,
 		   drm_intel_bo *dst_bo, drm_intel_bo *src_bo,
 		   long int size);
 
+struct scratch_buf {
+    drm_intel_bo *bo;
+    uint32_t stride;
+    uint32_t tiling;
+    uint32_t *data;
+    uint32_t *cpu_mapping;
+    uint32_t size;
+    unsigned num_tiles;
+};
+
+static inline unsigned buf_width(struct scratch_buf *buf)
+{
+	return buf->stride/sizeof(uint32_t);
+}
+
+static inline unsigned buf_height(struct scratch_buf *buf)
+{
+	return buf->size/buf->stride;
+}
+
+typedef void (*render_copyfunc_t)(struct intel_batchbuffer *batch,
+				  drm_intel_context *context,
+				  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+				  unsigned width, unsigned height,
+				  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
+
+render_copyfunc_t get_render_copyfunc(int devid);
+
 #endif
diff --git a/lib/media_fill.h b/lib/media_fill.h
index 719eb54aa8fd..9115776a93d4 100644
--- a/lib/media_fill.h
+++ b/lib/media_fill.h
@@ -19,26 +19,6 @@
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
 
-struct scratch_buf {
-    drm_intel_bo *bo;
-    uint32_t stride;
-    uint32_t tiling;
-    uint32_t *data;
-    uint32_t *cpu_mapping;
-    uint32_t size;
-    unsigned num_tiles;
-};
-
-static inline unsigned buf_width(struct scratch_buf *buf)
-{
-	return buf->stride/sizeof(uint8_t);
-}
-
-static inline unsigned buf_height(struct scratch_buf *buf)
-{
-	return buf->size/buf->stride;
-}
-
 typedef void (*media_fillfunc_t)(struct intel_batchbuffer *batch,
 				struct scratch_buf *dst,
 				unsigned x, unsigned y,
diff --git a/lib/rendercopy.h b/lib/rendercopy.h
index 6312cc327e17..92691fcf7abf 100644
--- a/lib/rendercopy.h
+++ b/lib/rendercopy.h
@@ -1,34 +1,3 @@
-#ifndef RENDERCOPY_H
-#define RENDERCOPY_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_bufmgr.h"
-#include "intel_batchbuffer.h"
-#include "intel_gpu_tools.h"
-
-struct scratch_buf {
-    drm_intel_bo *bo;
-    uint32_t stride;
-    uint32_t tiling;
-    uint32_t *data;
-    uint32_t *cpu_mapping;
-    uint32_t size;
-    unsigned num_tiles;
-};
-
 static inline void emit_vertex_2s(struct intel_batchbuffer *batch,
 				  int16_t x, int16_t y)
 {
@@ -51,24 +20,6 @@ static inline void emit_vertex_normalized(struct intel_batchbuffer *batch,
 	OUT_BATCH(u.ui);
 }
 
-static inline unsigned buf_width(struct scratch_buf *buf)
-{
-	return buf->stride/sizeof(uint32_t);
-}
-
-static inline unsigned buf_height(struct scratch_buf *buf)
-{
-	return buf->size/buf->stride;
-}
-
-typedef void (*render_copyfunc_t)(struct intel_batchbuffer *batch,
-				  drm_intel_context *context,
-				  struct scratch_buf *src, unsigned src_x, unsigned src_y,
-				  unsigned width, unsigned height,
-				  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
-
-render_copyfunc_t get_render_copyfunc(int devid);
-
 void gen8_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
 			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
@@ -94,5 +45,3 @@ void gen2_render_copyfunc(struct intel_batchbuffer *batch,
 			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
 			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
-
-#endif /* RENDERCOPY_H */
diff --git a/lib/rendercopy_gen6.c b/lib/rendercopy_gen6.c
index 457cb354932e..092a312b6c2e 100644
--- a/lib/rendercopy_gen6.c
+++ b/lib/rendercopy_gen6.c
@@ -1,8 +1,24 @@
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.h"
 #include "rendercopy.h"
 #include "gen6_render.h"
 
-#include <assert.h>
-
 #define ALIGN(x, y) (((x) + (y)-1) & ~((y)-1))
 #define VERTEX_SIZE (3*4)
 
diff --git a/lib/rendercopy_gen7.c b/lib/rendercopy_gen7.c
index f6981c7db1fa..04bc69062916 100644
--- a/lib/rendercopy_gen7.c
+++ b/lib/rendercopy_gen7.c
@@ -1,8 +1,24 @@
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.h"
 #include "rendercopy.h"
 #include "gen7_render.h"
 
-#include <assert.h>
-
 #define ALIGN(x, y) (((x) + (y)-1) & ~((y)-1))
 
 static const uint32_t ps_kernel[][4] = {
diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c
index 45a134c37dc9..09d9fe4eb172 100644
--- a/lib/rendercopy_gen8.c
+++ b/lib/rendercopy_gen8.c
@@ -1,8 +1,24 @@
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.h"
 #include "rendercopy.h"
 #include "gen8_render.h"
 
-#include <assert.h>
-
 #include <intel_aub.h>
 
 #define ALIGN(x, y) (((x) + (y)-1) & ~((y)-1))
diff --git a/lib/rendercopy_i830.c b/lib/rendercopy_i830.c
index 73edcfa5974e..cb9088e2030f 100644
--- a/lib/rendercopy_i830.c
+++ b/lib/rendercopy_i830.c
@@ -1,3 +1,21 @@
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.h"
+
 #include "i830_reg.h"
 #include "rendercopy.h"
 
@@ -228,21 +246,3 @@ void gen2_render_copyfunc(struct intel_batchbuffer *batch,
 
 	intel_batchbuffer_flush(batch);
 }
-
-render_copyfunc_t get_render_copyfunc(int devid)
-{
-	render_copyfunc_t copy = NULL;
-
-	if (IS_GEN2(devid))
-		copy = gen2_render_copyfunc;
-	else if (IS_GEN3(devid))
-		copy = gen3_render_copyfunc;
-	else if (IS_GEN6(devid))
-		copy = gen6_render_copyfunc;
-	else if (IS_GEN7(devid))
-		copy = gen7_render_copyfunc;
-	else if (IS_GEN8(devid))
-		copy = gen8_render_copyfunc;
-
-	return copy;
-}
diff --git a/lib/rendercopy_i915.c b/lib/rendercopy_i915.c
index 33e027e0f670..f7de2662b22b 100644
--- a/lib/rendercopy_i915.c
+++ b/lib/rendercopy_i915.c
@@ -1,3 +1,21 @@
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.h"
+
 #include "i915_reg.h"
 #include "i915_3d.h"
 #include "rendercopy.h"
diff --git a/tests/gem_ctx_basic.c b/tests/gem_ctx_basic.c
index e1eeaa1664b4..345425119f21 100644
--- a/tests/gem_ctx_basic.c
+++ b/tests/gem_ctx_basic.c
@@ -30,7 +30,24 @@
  */
 
 #include <pthread.h>
-#include "rendercopy.h"
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.h"
 
 /* options */
 int num_contexts = 10;
diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index 5e2433c9a722..65323a940c4e 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -32,8 +32,24 @@
 #include <stdbool.h>
 #include <unistd.h>
 #include <cairo.h>
-
-#include "rendercopy.h"
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.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 5ba7c98fcb6b..5efcc210d4ef 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -37,8 +37,24 @@
 #include "config.h"
 #endif
 
-#include "rendercopy.h"
-
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.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 9b6e92041530..71dfdd64fcee 100644
--- a/tests/gem_render_tiled_blits.c
+++ b/tests/gem_render_tiled_blits.c
@@ -33,7 +33,24 @@
  * The goal is to simply ensure the basics work.
  */
 
-#include "rendercopy.h"
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.h"
 
 #define WIDTH 512
 #define STRIDE (WIDTH*4)
diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index 3719f4070403..8ac93a898243 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -26,6 +26,7 @@
  */
 
 #define _GNU_SOURCE
+#include <stdbool.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -40,11 +41,11 @@
 #include <signal.h>
 
 #include "i915_drm.h"
+#include "drmtest.h"
+#include "igt_debugfs.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
-#include "rendercopy.h"
-#include "igt_debugfs.h"
 
 #define RS_NO_ERROR      0
 #define RS_BATCH_ACTIVE  (1 << 0)
diff --git a/tests/gem_ring_sync_copy.c b/tests/gem_ring_sync_copy.c
index 2cd78a32d8c2..b7dcf9dfdd4c 100644
--- a/tests/gem_ring_sync_copy.c
+++ b/tests/gem_ring_sync_copy.c
@@ -52,7 +52,7 @@
 
 #include "i915_drm.h"
 #include "drmtest.h"
-#include "rendercopy.h"
+#include "intel_batchbuffer.h"
 
 #define WIDTH	512
 #define HEIGHT	512
diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index 31a21cbbc042..8e0ca91b98aa 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -43,10 +43,10 @@
 
 #include "drm.h"
 #include "i915_drm.h"
+#include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
-#include "rendercopy.h"
 
 struct bo {
 	const char *ring;
diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c
index 79562693d250..cc133a9acc9b 100644
--- a/tests/gem_seqno_wrap.c
+++ b/tests/gem_seqno_wrap.c
@@ -39,13 +39,15 @@
 #include <sys/wait.h>
 #include <limits.h>
 #include <wordexp.h>
+#include <getopt.h>
 #include <signal.h>
 
 #include "i915_drm.h"
+#include "drmtest.h"
+#include "igt_core.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
 #include "intel_gpu_tools.h"
-#include "rendercopy.h"
 
 static int devid;
 static int card_index = 0;
diff --git a/tests/gem_stress.c b/tests/gem_stress.c
index c01e92eb004e..527f7de823a3 100644
--- a/tests/gem_stress.c
+++ b/tests/gem_stress.c
@@ -49,7 +49,24 @@
  * In short: designed for maximum evilness.
  */
 
-#include "rendercopy.h"
+#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_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.h"
 
 #define CMD_POLY_STIPPLE_OFFSET       0x7906
 
diff --git a/tests/gem_wait_render_timeout.c b/tests/gem_wait_render_timeout.c
index e16d623828ce..1c6aa7d1da18 100644
--- a/tests/gem_wait_render_timeout.c
+++ b/tests/gem_wait_render_timeout.c
@@ -27,8 +27,24 @@
 
 #include <stdio.h>
 #include <time.h>
+#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 "rendercopy.h"
+#include "i915_drm.h"
+#include "drmtest.h"
+#include "intel_bufmgr.h"
+#include "intel_batchbuffer.h"
+#include "intel_gpu_tools.h"
 
 #define MSEC_PER_SEC	1000L
 #define USEC_PER_MSEC	1000L
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index 2f1b90d28e18..bb06bc491812 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -32,7 +32,7 @@
 #include "drmtest.h"
 #include "igt_debugfs.h"
 #include "igt_kms.h"
-#include "rendercopy.h"
+#include "intel_batchbuffer.h"
 
 enum test_mode {
 	TEST_PAGE_FLIP,
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 09dc20bdc777..5ef5afa2c211 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -39,7 +39,7 @@
 #include "i915_drm.h"
 #include "drmtest.h"
 #include "testdisplay.h"
-#include "rendercopy.h"
+#include "intel_batchbuffer.h"
 #include "igt_kms.h"
 
 #define TEST_DPMS		(1 << 0)
-- 
1.8.5.2




More information about the Intel-gfx mailing list