[Intel-gfx] [PATCH 08/28] lib/intel_batchbuffer: igt_ namespace for the buffer structure

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


Step one to properly namespace the rendercpy/mediafill functions. Als
give the buf_height/width helpers a proper igt_ prefix.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 lib/intel_batchbuffer.c         |  4 +--
 lib/intel_batchbuffer.h         | 12 ++++----
 lib/media_fill.h                |  4 +--
 lib/media_fill_gen7.c           | 12 ++++----
 lib/media_fill_gen8.c           | 12 ++++----
 lib/rendercopy.h                | 20 ++++++-------
 lib/rendercopy_gen6.c           | 30 +++++++++----------
 lib/rendercopy_gen7.c           | 22 +++++++-------
 lib/rendercopy_gen8.c           | 32 ++++++++++-----------
 lib/rendercopy_i830.c           | 28 +++++++++---------
 lib/rendercopy_i915.c           | 12 ++++----
 tests/gem_ctx_basic.c           |  4 +--
 tests/gem_media_fill.c          |  6 ++--
 tests/gem_render_copy.c         | 12 ++++----
 tests/gem_render_linear_blits.c |  6 ++--
 tests/gem_render_tiled_blits.c  |  2 +-
 tests/gem_ring_sync_copy.c      | 12 ++++----
 tests/gem_ringfill.c            |  6 ++--
 tests/gem_seqno_wrap.c          |  8 +++---
 tests/gem_stress.c              | 64 ++++++++++++++++++++---------------------
 tests/kms_fbc_crc.c             |  4 +--
 tests/kms_flip.c                |  4 +--
 22 files changed, 158 insertions(+), 158 deletions(-)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 235c1d1d8310..0da0043c0f50 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -387,12 +387,12 @@ intel_copy_bo(struct intel_batchbuffer *batch,
 		       4096/4, size/4096, 32);
 }
 
-unsigned buf_width(struct scratch_buf *buf)
+unsigned igt_buf_width(struct igt_buf *buf)
 {
 	return buf->stride/sizeof(uint32_t);
 }
 
-unsigned buf_height(struct scratch_buf *buf)
+unsigned igt_buf_height(struct igt_buf *buf)
 {
 	return buf->size/buf->stride;
 }
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 26c5e6c34c89..333b08946789 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -196,7 +196,7 @@ void intel_copy_bo(struct intel_batchbuffer *batch,
 		   drm_intel_bo *dst_bo, drm_intel_bo *src_bo,
 		   long int size);
 
-struct scratch_buf {
+struct igt_buf {
     drm_intel_bo *bo;
     uint32_t stride;
     uint32_t tiling;
@@ -206,19 +206,19 @@ struct scratch_buf {
     unsigned num_tiles;
 };
 
-unsigned buf_width(struct scratch_buf *buf);
-unsigned buf_height(struct scratch_buf *buf);
+unsigned igt_buf_width(struct igt_buf *buf);
+unsigned igt_buf_height(struct igt_buf *buf);
 
 typedef void (*render_copyfunc_t)(struct intel_batchbuffer *batch,
 				  drm_intel_context *context,
-				  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+				  struct igt_buf *src, unsigned src_x, unsigned src_y,
 				  unsigned width, unsigned height,
-				  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
+				  struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
 
 render_copyfunc_t get_render_copyfunc(int devid);
 
 typedef void (*media_fillfunc_t)(struct intel_batchbuffer *batch,
-				struct scratch_buf *dst,
+				struct igt_buf *dst,
 				unsigned x, unsigned y,
 				unsigned width, unsigned height,
 				uint8_t color);
diff --git a/lib/media_fill.h b/lib/media_fill.h
index 4b2fd3a4fb30..2e1af325cac6 100644
--- a/lib/media_fill.h
+++ b/lib/media_fill.h
@@ -21,14 +21,14 @@
 
 void
 gen8_media_fillfunc(struct intel_batchbuffer *batch,
-		struct scratch_buf *dst,
+		struct igt_buf *dst,
 		unsigned x, unsigned y,
 		unsigned width, unsigned height,
 		uint8_t color);
 
 void
 gen7_media_fillfunc(struct intel_batchbuffer *batch,
-                struct scratch_buf *dst,
+                struct igt_buf *dst,
                 unsigned x, unsigned y,
                 unsigned width, unsigned height,
                 uint8_t color);
diff --git a/lib/media_fill_gen7.c b/lib/media_fill_gen7.c
index 8f43de7a2ec7..520c4a22ca75 100644
--- a/lib/media_fill_gen7.c
+++ b/lib/media_fill_gen7.c
@@ -82,7 +82,7 @@ gen7_fill_curbe_buffer_data(struct intel_batchbuffer *batch,
 
 static uint32_t
 gen7_fill_surface_state(struct intel_batchbuffer *batch,
-			struct scratch_buf *buf,
+			struct igt_buf *buf,
 			uint32_t format,
 			int is_dst)
 {
@@ -116,8 +116,8 @@ gen7_fill_surface_state(struct intel_batchbuffer *batch,
 				read_domain, write_domain);
 	assert(ret == 0);
 
-	ss->ss2.height = buf_height(buf) - 1;
-	ss->ss2.width  = buf_width(buf) - 1;
+	ss->ss2.height = igt_buf_height(buf) - 1;
+	ss->ss2.width  = igt_buf_width(buf) - 1;
 
 	ss->ss3.pitch  = buf->stride - 1;
 
@@ -131,7 +131,7 @@ gen7_fill_surface_state(struct intel_batchbuffer *batch,
 
 static uint32_t
 gen7_fill_binding_table(struct intel_batchbuffer *batch,
-			struct scratch_buf *dst)
+			struct igt_buf *dst)
 {
 	uint32_t *binding_table, offset;
 
@@ -156,7 +156,7 @@ gen7_fill_media_kernel(struct intel_batchbuffer *batch,
 }
 
 static uint32_t
-gen7_fill_interface_descriptor(struct intel_batchbuffer *batch, struct scratch_buf *dst)
+gen7_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst)
 {
 	struct gen7_interface_descriptor_data *idd;
 	uint32_t offset;
@@ -311,7 +311,7 @@ gen7_emit_media_objects(struct intel_batchbuffer *batch,
 
 void
 gen7_media_fillfunc(struct intel_batchbuffer *batch,
-		struct scratch_buf *dst,
+		struct igt_buf *dst,
 		unsigned x, unsigned y,
 		unsigned width, unsigned height,
 		uint8_t color)
diff --git a/lib/media_fill_gen8.c b/lib/media_fill_gen8.c
index 1af3b3d658fb..7e0a5677762b 100644
--- a/lib/media_fill_gen8.c
+++ b/lib/media_fill_gen8.c
@@ -82,7 +82,7 @@ gen8_fill_curbe_buffer_data(struct intel_batchbuffer *batch,
 
 static uint32_t
 gen8_fill_surface_state(struct intel_batchbuffer *batch,
-			struct scratch_buf *buf,
+			struct igt_buf *buf,
 			uint32_t format,
 			int is_dst)
 {
@@ -119,8 +119,8 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
 				read_domain, write_domain);
 	assert(ret == 0);
 
-	ss->ss2.height = buf_height(buf) - 1;
-	ss->ss2.width  = buf_width(buf) - 1;
+	ss->ss2.height = igt_buf_height(buf) - 1;
+	ss->ss2.width  = igt_buf_width(buf) - 1;
 	ss->ss3.pitch  = buf->stride - 1;
 
 	ss->ss7.shader_chanel_select_r = 4;
@@ -133,7 +133,7 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
 
 static uint32_t
 gen8_fill_binding_table(struct intel_batchbuffer *batch,
-			struct scratch_buf *dst)
+			struct igt_buf *dst)
 {
 	uint32_t *binding_table, offset;
 
@@ -158,7 +158,7 @@ gen8_fill_media_kernel(struct intel_batchbuffer *batch,
 }
 
 static uint32_t
-gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct scratch_buf *dst)
+gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst)
 {
 	struct gen8_interface_descriptor_data *idd;
 	uint32_t offset;
@@ -334,7 +334,7 @@ gen8_emit_media_objects(struct intel_batchbuffer *batch,
 
 void
 gen8_media_fillfunc(struct intel_batchbuffer *batch,
-		struct scratch_buf *dst,
+		struct igt_buf *dst,
 		unsigned x, unsigned y,
 		unsigned width, unsigned height,
 		uint8_t color)
diff --git a/lib/rendercopy.h b/lib/rendercopy.h
index 92691fcf7abf..bb9051e7e976 100644
--- a/lib/rendercopy.h
+++ b/lib/rendercopy.h
@@ -22,26 +22,26 @@ static inline void emit_vertex_normalized(struct intel_batchbuffer *batch,
 
 void gen8_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
 void gen7_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
 void gen6_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
 void gen3_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
 void gen2_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y);
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y);
diff --git a/lib/rendercopy_gen6.c b/lib/rendercopy_gen6.c
index 092a312b6c2e..4f5b57904d4a 100644
--- a/lib/rendercopy_gen6.c
+++ b/lib/rendercopy_gen6.c
@@ -107,7 +107,7 @@ gen6_render_flush(struct intel_batchbuffer *batch,
 }
 
 static uint32_t
-gen6_bind_buf(struct intel_batchbuffer *batch, struct scratch_buf *buf,
+gen6_bind_buf(struct intel_batchbuffer *batch, struct igt_buf *buf,
 	      uint32_t format, int is_dst)
 {
 	struct gen6_surface_state *ss;
@@ -135,8 +135,8 @@ gen6_bind_buf(struct intel_batchbuffer *batch, struct scratch_buf *buf,
 				      read_domain, write_domain);
 	assert(ret == 0);
 
-	ss->ss2.height = buf_height(buf) - 1;
-	ss->ss2.width  = buf_width(buf) - 1;
+	ss->ss2.height = igt_buf_height(buf) - 1;
+	ss->ss2.width  = igt_buf_width(buf) - 1;
 	ss->ss3.pitch  = buf->stride - 1;
 	ss->ss3.tiled_surface = buf->tiling != I915_TILING_NONE;
 	ss->ss3.tile_walk     = buf->tiling == I915_TILING_Y;
@@ -146,8 +146,8 @@ gen6_bind_buf(struct intel_batchbuffer *batch, struct scratch_buf *buf,
 
 static uint32_t
 gen6_bind_surfaces(struct intel_batchbuffer *batch,
-		   struct scratch_buf *src,
-		   struct scratch_buf *dst)
+		   struct igt_buf *src,
+		   struct igt_buf *dst)
 {
 	uint32_t *binding_table;
 
@@ -376,11 +376,11 @@ gen6_emit_binding_table(struct intel_batchbuffer *batch, uint32_t wm_table)
 }
 
 static void
-gen6_emit_drawing_rectangle(struct intel_batchbuffer *batch, struct scratch_buf *dst)
+gen6_emit_drawing_rectangle(struct intel_batchbuffer *batch, struct igt_buf *dst)
 {
 	OUT_BATCH(GEN6_3DSTATE_DRAWING_RECTANGLE | (4 - 2));
 	OUT_BATCH(0);
-	OUT_BATCH((buf_height(dst) - 1) << 16 | (buf_width(dst) - 1));
+	OUT_BATCH((igt_buf_height(dst) - 1) << 16 | (igt_buf_width(dst) - 1));
 	OUT_BATCH(0);
 }
 
@@ -547,9 +547,9 @@ static uint32_t gen6_emit_primitive(struct intel_batchbuffer *batch)
 
 void gen6_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y)
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
 	uint32_t wm_state, wm_kernel, wm_table;
 	uint32_t cc_vp, cc_blend, offset;
@@ -601,16 +601,16 @@ void gen6_render_copyfunc(struct intel_batchbuffer *batch,
 		batch_round_upto(batch, VERTEX_SIZE)/VERTEX_SIZE;
 
 	emit_vertex_2s(batch, dst_x + width, dst_y + height);
-	emit_vertex_normalized(batch, src_x + width, buf_width(src));
-	emit_vertex_normalized(batch, src_y + height, buf_height(src));
+	emit_vertex_normalized(batch, src_x + width, igt_buf_width(src));
+	emit_vertex_normalized(batch, src_y + height, igt_buf_height(src));
 
 	emit_vertex_2s(batch, dst_x, dst_y + height);
-	emit_vertex_normalized(batch, src_x, buf_width(src));
-	emit_vertex_normalized(batch, src_y + height, buf_height(src));
+	emit_vertex_normalized(batch, src_x, igt_buf_width(src));
+	emit_vertex_normalized(batch, src_y + height, igt_buf_height(src));
 
 	emit_vertex_2s(batch, dst_x, dst_y);
-	emit_vertex_normalized(batch, src_x, buf_width(src));
-	emit_vertex_normalized(batch, src_y, buf_height(src));
+	emit_vertex_normalized(batch, src_x, igt_buf_width(src));
+	emit_vertex_normalized(batch, src_y, igt_buf_height(src));
 
 	gen6_render_flush(batch, context, batch_end);
 	intel_batchbuffer_reset(batch);
diff --git a/lib/rendercopy_gen7.c b/lib/rendercopy_gen7.c
index 04bc69062916..ddd6b97c7619 100644
--- a/lib/rendercopy_gen7.c
+++ b/lib/rendercopy_gen7.c
@@ -93,7 +93,7 @@ gen7_tiling_bits(uint32_t tiling)
 
 static uint32_t
 gen7_bind_buf(struct intel_batchbuffer *batch,
-	      struct scratch_buf *buf,
+	      struct igt_buf *buf,
 	      uint32_t format,
 	      int is_dst)
 {
@@ -114,8 +114,8 @@ gen7_bind_buf(struct intel_batchbuffer *batch,
 		 gen7_tiling_bits(buf->tiling) |
 		format << GEN7_SURFACE_FORMAT_SHIFT);
 	ss[1] = buf->bo->offset;
-	ss[2] = ((buf_width(buf) - 1)  << GEN7_SURFACE_WIDTH_SHIFT |
-		 (buf_height(buf) - 1) << GEN7_SURFACE_HEIGHT_SHIFT);
+	ss[2] = ((igt_buf_width(buf) - 1)  << GEN7_SURFACE_WIDTH_SHIFT |
+		 (igt_buf_height(buf) - 1) << GEN7_SURFACE_HEIGHT_SHIFT);
 	ss[3] = (buf->stride - 1) << GEN7_SURFACE_PITCH_SHIFT;
 	ss[4] = 0;
 	ss[5] = 0;
@@ -220,8 +220,8 @@ static void gen7_emit_vertex_buffer(struct intel_batchbuffer *batch,
 
 static uint32_t
 gen7_bind_surfaces(struct intel_batchbuffer *batch,
-		   struct scratch_buf *src,
-		   struct scratch_buf *dst)
+		   struct igt_buf *src,
+		   struct igt_buf *dst)
 {
 	uint32_t *binding_table;
 
@@ -237,19 +237,19 @@ gen7_bind_surfaces(struct intel_batchbuffer *batch,
 
 static void
 gen7_emit_binding_table(struct intel_batchbuffer *batch,
-			struct scratch_buf *src,
-			struct scratch_buf *dst)
+			struct igt_buf *src,
+			struct igt_buf *dst)
 {
 	OUT_BATCH(GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS | (2 - 2));
 	OUT_BATCH(gen7_bind_surfaces(batch, src, dst));
 }
 
 static void
-gen7_emit_drawing_rectangle(struct intel_batchbuffer *batch, struct scratch_buf *dst)
+gen7_emit_drawing_rectangle(struct intel_batchbuffer *batch, struct igt_buf *dst)
 {
 	OUT_BATCH(GEN7_3DSTATE_DRAWING_RECTANGLE | (4 - 2));
 	OUT_BATCH(0);
-	OUT_BATCH((buf_height(dst) - 1) << 16 | (buf_width(dst) - 1));
+	OUT_BATCH((igt_buf_height(dst) - 1) << 16 | (igt_buf_width(dst) - 1));
 	OUT_BATCH(0);
 }
 
@@ -531,9 +531,9 @@ gen7_emit_null_depth_buffer(struct intel_batchbuffer *batch)
 #define BATCH_STATE_SPLIT 2048
 void gen7_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y)
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
 	uint32_t batch_end;
 
diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c
index 09d9fe4eb172..f6dd2b5b0445 100644
--- a/lib/rendercopy_gen8.c
+++ b/lib/rendercopy_gen8.c
@@ -177,7 +177,7 @@ gen6_render_flush(struct intel_batchbuffer *batch,
 
 /* Mostly copy+paste from gen6, except height, width, pitch moved */
 static uint32_t
-gen8_bind_buf(struct intel_batchbuffer *batch, struct scratch_buf *buf,
+gen8_bind_buf(struct intel_batchbuffer *batch, struct igt_buf *buf,
 	      uint32_t format, int is_dst) {
 	struct gen8_surface_state *ss;
 	uint32_t write_domain, read_domain, offset;
@@ -213,8 +213,8 @@ gen8_bind_buf(struct intel_batchbuffer *batch, struct scratch_buf *buf,
 				      read_domain, write_domain);
 	assert(ret == 0);
 
-	ss->ss2.height = buf_height(buf) - 1;
-	ss->ss2.width  = buf_width(buf) - 1;
+	ss->ss2.height = igt_buf_height(buf) - 1;
+	ss->ss2.width  = igt_buf_width(buf) - 1;
 	ss->ss3.pitch  = buf->stride - 1;
 
 	ss->ss7.shader_chanel_select_r = 4;
@@ -227,8 +227,8 @@ gen8_bind_buf(struct intel_batchbuffer *batch, struct scratch_buf *buf,
 
 static uint32_t
 gen8_bind_surfaces(struct intel_batchbuffer *batch,
-		   struct scratch_buf *src,
-		   struct scratch_buf *dst)
+		   struct igt_buf *src,
+		   struct igt_buf *dst)
 {
 	uint32_t *binding_table, offset;
 
@@ -295,7 +295,7 @@ gen8_fill_ps(struct intel_batchbuffer *batch,
  */
 static uint32_t
 gen7_fill_vertex_buffer_data(struct intel_batchbuffer *batch,
-			     struct scratch_buf *src,
+			     struct igt_buf *src,
 			     uint32_t src_x, uint32_t src_y,
 			     uint32_t dst_x, uint32_t dst_y,
 			     uint32_t width, uint32_t height)
@@ -307,16 +307,16 @@ gen7_fill_vertex_buffer_data(struct intel_batchbuffer *batch,
 	start = batch->ptr;
 
 	emit_vertex_2s(batch, dst_x + width, dst_y + height);
-	emit_vertex_normalized(batch, src_x + width, buf_width(src));
-	emit_vertex_normalized(batch, src_y + height, buf_height(src));
+	emit_vertex_normalized(batch, src_x + width, igt_buf_width(src));
+	emit_vertex_normalized(batch, src_y + height, igt_buf_height(src));
 
 	emit_vertex_2s(batch, dst_x, dst_y + height);
-	emit_vertex_normalized(batch, src_x, buf_width(src));
-	emit_vertex_normalized(batch, src_y + height, buf_height(src));
+	emit_vertex_normalized(batch, src_x, igt_buf_width(src));
+	emit_vertex_normalized(batch, src_y + height, igt_buf_height(src));
 
 	emit_vertex_2s(batch, dst_x, dst_y);
-	emit_vertex_normalized(batch, src_x, buf_width(src));
-	emit_vertex_normalized(batch, src_y, buf_height(src));
+	emit_vertex_normalized(batch, src_x, igt_buf_width(src));
+	emit_vertex_normalized(batch, src_y, igt_buf_height(src));
 
 	offset = batch_offset(batch, start);
 	annotation_add_state(&aub_annotations, AUB_TRACE_VERTEX_BUFFER,
@@ -843,11 +843,11 @@ gen7_emit_clear(struct intel_batchbuffer *batch) {
 }
 
 static void
-gen6_emit_drawing_rectangle(struct intel_batchbuffer *batch, struct scratch_buf *dst)
+gen6_emit_drawing_rectangle(struct intel_batchbuffer *batch, struct igt_buf *dst)
 {
 	OUT_BATCH(GEN6_3DSTATE_DRAWING_RECTANGLE | (4 - 2));
 	OUT_BATCH(0);
-	OUT_BATCH((buf_height(dst) - 1) << 16 | (buf_width(dst) - 1));
+	OUT_BATCH((igt_buf_height(dst) - 1) << 16 | (igt_buf_width(dst) - 1));
 	OUT_BATCH(0);
 }
 
@@ -907,9 +907,9 @@ static void gen8_emit_primitive(struct intel_batchbuffer *batch, uint32_t offset
 
 void gen8_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y)
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
 	uint32_t ps_sampler_state, ps_kernel_off, ps_binding_table;
 	uint32_t scissor_state;
diff --git a/lib/rendercopy_i830.c b/lib/rendercopy_i830.c
index cb9088e2030f..5ebd31a4677a 100644
--- a/lib/rendercopy_i830.c
+++ b/lib/rendercopy_i830.c
@@ -134,7 +134,7 @@ static void gen2_emit_invariant(struct intel_batchbuffer *batch)
 }
 
 static void gen2_emit_target(struct intel_batchbuffer *batch,
-			     struct scratch_buf *dst)
+			     struct igt_buf *dst)
 {
 	uint32_t tiling;
 
@@ -156,13 +156,13 @@ static void gen2_emit_target(struct intel_batchbuffer *batch,
 	OUT_BATCH(_3DSTATE_DRAW_RECT_CMD);
 	OUT_BATCH(0);
 	OUT_BATCH(0);		/* ymin, xmin */
-	OUT_BATCH(DRAW_YMAX(buf_height(dst) - 1) |
-		  DRAW_XMAX(buf_width(dst) - 1));
+	OUT_BATCH(DRAW_YMAX(igt_buf_height(dst) - 1) |
+		  DRAW_XMAX(igt_buf_width(dst) - 1));
 	OUT_BATCH(0);		/* yorig, xorig */
 }
 
 static void gen2_emit_texture(struct intel_batchbuffer *batch,
-			      struct scratch_buf *src,
+			      struct igt_buf *src,
 			      int unit)
 {
 	uint32_t tiling;
@@ -175,8 +175,8 @@ static void gen2_emit_texture(struct intel_batchbuffer *batch,
 
 	OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_2 | LOAD_TEXTURE_MAP(unit) | 4);
 	OUT_RELOC(src->bo, I915_GEM_DOMAIN_SAMPLER, 0, 0);
-	OUT_BATCH((buf_height(src) - 1) << TM0S1_HEIGHT_SHIFT |
-		  (buf_width(src) - 1) << TM0S1_WIDTH_SHIFT |
+	OUT_BATCH((igt_buf_height(src) - 1) << TM0S1_HEIGHT_SHIFT |
+		  (igt_buf_width(src) - 1) << TM0S1_WIDTH_SHIFT |
 		  MAPSURF_32BIT | MT_32BIT_ARGB8888 | tiling);
 	OUT_BATCH((src->stride / 4 - 1) << TM0S2_PITCH_SHIFT | TM0S2_MAP_2D);
 	OUT_BATCH(FILTER_NEAREST << TM0S3_MAG_FILTER_SHIFT |
@@ -210,9 +210,9 @@ static void gen2_emit_copy_pipeline(struct intel_batchbuffer *batch)
 
 void gen2_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y)
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
 	gen2_emit_invariant(batch);
 	gen2_emit_copy_pipeline(batch);
@@ -231,18 +231,18 @@ void gen2_render_copyfunc(struct intel_batchbuffer *batch,
 	OUT_BATCH(PRIM3D_INLINE | PRIM3D_RECTLIST | (3*4 -1));
 	emit_vertex(batch, dst_x + width);
 	emit_vertex(batch, dst_y + height);
-	emit_vertex_normalized(batch, src_x + width, buf_width(src));
-	emit_vertex_normalized(batch, src_y + height, buf_height(src));
+	emit_vertex_normalized(batch, src_x + width, igt_buf_width(src));
+	emit_vertex_normalized(batch, src_y + height, igt_buf_height(src));
 
 	emit_vertex(batch, dst_x);
 	emit_vertex(batch, dst_y + height);
-	emit_vertex_normalized(batch, src_x, buf_width(src));
-	emit_vertex_normalized(batch, src_y + height, buf_height(src));
+	emit_vertex_normalized(batch, src_x, igt_buf_width(src));
+	emit_vertex_normalized(batch, src_y + height, igt_buf_height(src));
 
 	emit_vertex(batch, dst_x);
 	emit_vertex(batch, dst_y);
-	emit_vertex_normalized(batch, src_x, buf_width(src));
-	emit_vertex_normalized(batch, src_y, buf_height(src));
+	emit_vertex_normalized(batch, src_x, igt_buf_width(src));
+	emit_vertex_normalized(batch, src_y, igt_buf_height(src));
 
 	intel_batchbuffer_flush(batch);
 }
diff --git a/lib/rendercopy_i915.c b/lib/rendercopy_i915.c
index f7de2662b22b..b63c5cc4f03d 100644
--- a/lib/rendercopy_i915.c
+++ b/lib/rendercopy_i915.c
@@ -22,9 +22,9 @@
 
 void gen3_render_copyfunc(struct intel_batchbuffer *batch,
 			  drm_intel_context *context,
-			  struct scratch_buf *src, unsigned src_x, unsigned src_y,
+			  struct igt_buf *src, unsigned src_x, unsigned src_y,
 			  unsigned width, unsigned height,
-			  struct scratch_buf *dst, unsigned dst_x, unsigned dst_y)
+			  struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
 	/* invariant state */
 	{
@@ -96,8 +96,8 @@ void gen3_render_copyfunc(struct intel_batchbuffer *batch,
 		OUT_RELOC(src->bo, I915_GEM_DOMAIN_SAMPLER, 0, 0);
 		OUT_BATCH(MAPSURF_32BIT | MT_32BIT_ARGB8888 |
 			  tiling_bits |
-			  (buf_height(src) - 1) << MS3_HEIGHT_SHIFT |
-			  (buf_width(src) - 1) << MS3_WIDTH_SHIFT);
+			  (igt_buf_height(src) - 1) << MS3_HEIGHT_SHIFT |
+			  (igt_buf_width(src) - 1) << MS3_WIDTH_SHIFT);
 		OUT_BATCH((src->stride/4-1) << MS4_PITCH_SHIFT);
 
 		OUT_BATCH(_3DSTATE_SAMPLER_STATE | (3 * TEX_COUNT));
@@ -133,8 +133,8 @@ void gen3_render_copyfunc(struct intel_batchbuffer *batch,
 		OUT_BATCH(_3DSTATE_DRAW_RECT_CMD);
 		OUT_BATCH(0x00000000);
 		OUT_BATCH(0x00000000);	/* ymin, xmin */
-		OUT_BATCH(DRAW_YMAX(buf_height(dst) - 1) |
-			  DRAW_XMAX(buf_width(dst) - 1));
+		OUT_BATCH(DRAW_YMAX(igt_buf_height(dst) - 1) |
+			  DRAW_XMAX(igt_buf_width(dst) - 1));
 		/* yorig, xorig (relate to color buffer?) */
 		OUT_BATCH(0x00000000);
 	}
diff --git a/tests/gem_ctx_basic.c b/tests/gem_ctx_basic.c
index 345425119f21..67d6191e529c 100644
--- a/tests/gem_ctx_basic.c
+++ b/tests/gem_ctx_basic.c
@@ -61,7 +61,7 @@ int devid;
 int fd;
 
 static void init_buffer(drm_intel_bufmgr *bufmgr,
-			struct scratch_buf *buf,
+			struct igt_buf *buf,
 			uint32_t size)
 {
 	buf->bo = drm_intel_bo_alloc(bufmgr, "", size, 4096);
@@ -93,7 +93,7 @@ static void *work(void *arg)
 	igt_require(context);
 
 	for (i = 0; i < iter; i++) {
-		struct scratch_buf src, dst;
+		struct igt_buf src, dst;
 
 		init_buffer(bufmgr, &src, 4096);
 		init_buffer(bufmgr, &dst, 4096);
diff --git a/tests/gem_media_fill.c b/tests/gem_media_fill.c
index df891290c11c..7fc567612f97 100644
--- a/tests/gem_media_fill.c
+++ b/tests/gem_media_fill.c
@@ -66,7 +66,7 @@ typedef struct {
 	uint8_t linear[WIDTH * HEIGHT];
 } data_t;
 
-static void scratch_buf_init(data_t *data, struct scratch_buf *buf,
+static void scratch_buf_init(data_t *data, struct igt_buf *buf,
 			int width, int height, int stride, uint8_t color)
 {
 	drm_intel_bo *bo;
@@ -85,7 +85,7 @@ static void scratch_buf_init(data_t *data, struct scratch_buf *buf,
 }
 
 static void
-scratch_buf_check(data_t *data, struct scratch_buf *buf, int x, int y,
+scratch_buf_check(data_t *data, struct igt_buf *buf, int x, int y,
 		uint8_t color)
 {
 	uint8_t val;
@@ -104,7 +104,7 @@ igt_simple_main
 {
 	data_t data = {0, };
 	struct intel_batchbuffer *batch = NULL;
-	struct scratch_buf dst;
+	struct igt_buf dst;
 	media_fillfunc_t media_fill = NULL;
 	int i, j;
 
diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index 65323a940c4e..7196a51a0198 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -66,7 +66,7 @@ typedef struct {
 	uint32_t linear[WIDTH * HEIGHT];
 } data_t;
 
-static void scratch_buf_write_to_png(struct scratch_buf *buf, const char *filename)
+static void scratch_buf_write_to_png(struct igt_buf *buf, const char *filename)
 {
 	cairo_surface_t *surface;
 	cairo_status_t ret;
@@ -74,8 +74,8 @@ static void scratch_buf_write_to_png(struct scratch_buf *buf, const char *filena
 	drm_intel_bo_map(buf->bo, 0);
 	surface = cairo_image_surface_create_for_data(buf->bo->virtual,
 						      CAIRO_FORMAT_RGB24,
-						      buf_width(buf),
-						      buf_height(buf),
+						      igt_buf_width(buf),
+						      igt_buf_height(buf),
 						      buf->stride);
 	ret = cairo_surface_write_to_png(surface, filename);
 	if (ret != CAIRO_STATUS_SUCCESS) {
@@ -86,7 +86,7 @@ static void scratch_buf_write_to_png(struct scratch_buf *buf, const char *filena
 	drm_intel_bo_unmap(buf->bo);
 }
 
-static void scratch_buf_init(data_t *data, struct scratch_buf *buf,
+static void scratch_buf_init(data_t *data, struct igt_buf *buf,
 			     int width, int height, int stride, uint32_t color)
 {
 	drm_intel_bo *bo;
@@ -105,7 +105,7 @@ static void scratch_buf_init(data_t *data, struct scratch_buf *buf,
 }
 
 static void
-scratch_buf_check(data_t *data, struct scratch_buf *buf, int x, int y,
+scratch_buf_check(data_t *data, struct igt_buf *buf, int x, int y,
 		  uint32_t color)
 {
 	uint32_t val;
@@ -124,7 +124,7 @@ int main(int argc, char **argv)
 {
 	data_t data = {0, };
 	struct intel_batchbuffer *batch = NULL;
-	struct scratch_buf src, dst;
+	struct igt_buf src, dst;
 	render_copyfunc_t render_copy = NULL;
 	int opt;
 	int opt_dump_png = false;
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index 5efcc210d4ef..9d5d4ccf8cd0 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -137,7 +137,7 @@ int main(int argc, char **argv)
 
 	printf("Cyclic blits, forward...\n");
 	for (i = 0; i < count * 4; i++) {
-		struct scratch_buf src, dst;
+		struct igt_buf src, dst;
 
 		src.bo = bo[i % count];
 		src.stride = STRIDE;
@@ -160,7 +160,7 @@ int main(int argc, char **argv)
 
 	printf("Cyclic blits, backward...\n");
 	for (i = 0; i < count * 4; i++) {
-		struct scratch_buf src, dst;
+		struct igt_buf src, dst;
 
 		src.bo = bo[(i + 1) % count];
 		src.stride = STRIDE;
@@ -180,7 +180,7 @@ int main(int argc, char **argv)
 
 	printf("Random blits...\n");
 	for (i = 0; i < count * 4; i++) {
-		struct scratch_buf src, dst;
+		struct igt_buf src, dst;
 		int s = random() % count;
 		int d = random() % count;
 
diff --git a/tests/gem_render_tiled_blits.c b/tests/gem_render_tiled_blits.c
index 71dfdd64fcee..0552af1fff80 100644
--- a/tests/gem_render_tiled_blits.c
+++ b/tests/gem_render_tiled_blits.c
@@ -84,7 +84,7 @@ int main(int argc, char **argv)
 	drm_intel_bufmgr *bufmgr;
 	struct intel_batchbuffer *batch;
 	uint32_t *start_val;
-	struct scratch_buf *buf;
+	struct igt_buf *buf;
 	uint32_t start = 0;
 	int i, j, fd, count;
 
diff --git a/tests/gem_ring_sync_copy.c b/tests/gem_ring_sync_copy.c
index b7dcf9dfdd4c..1ab9b0ce1224 100644
--- a/tests/gem_ring_sync_copy.c
+++ b/tests/gem_ring_sync_copy.c
@@ -70,8 +70,8 @@ typedef struct {
 
 	struct {
 		render_copyfunc_t copy;
-		struct scratch_buf *srcs;
-		struct scratch_buf *dsts;
+		struct igt_buf *srcs;
+		struct igt_buf *dsts;
 	} render;
 
 	struct {
@@ -128,7 +128,7 @@ static void bo_check(data_t *data, drm_intel_bo *bo, uint32_t val)
 		igt_assert_cmpint(data->linear[i], ==, val);
 }
 
-static void scratch_buf_init_from_bo(struct scratch_buf *buf, drm_intel_bo *bo)
+static void scratch_buf_init_from_bo(struct igt_buf *buf, drm_intel_bo *bo)
 {
 	buf->bo = bo;
 	buf->stride = 4 * WIDTH;
@@ -136,7 +136,7 @@ static void scratch_buf_init_from_bo(struct scratch_buf *buf, drm_intel_bo *bo)
 	buf->size = 4 * WIDTH * HEIGHT;
 }
 
-static void scratch_buf_init(data_t *data, struct scratch_buf *buf,
+static void scratch_buf_init(data_t *data, struct igt_buf *buf,
 			     int width, int height, uint32_t color)
 {
 	drm_intel_bo *bo;
@@ -162,7 +162,7 @@ static void render_busy(data_t *data)
 	size_t array_size;
 	int i;
 
-	array_size = data->n_buffers_load * sizeof(struct scratch_buf);
+	array_size = data->n_buffers_load * sizeof(struct igt_buf);
 	data->render.srcs = malloc(array_size);
 	data->render.dsts = malloc(array_size);
 
@@ -201,7 +201,7 @@ static void render_busy_fini(data_t *data)
 
 static void render_copy(data_t *data, drm_intel_bo *src, drm_intel_bo *dst)
 {
-	struct scratch_buf src_buf, dst_buf;
+	struct igt_buf src_buf, dst_buf;
 
 	scratch_buf_init_from_bo(&src_buf, src);
 	scratch_buf_init_from_bo(&dst_buf, dst);
diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index 8e0ca91b98aa..0dd222722fb2 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -115,7 +115,7 @@ static int check_ring(drm_intel_bufmgr *bufmgr,
 		      const char *ring,
 		      render_copyfunc_t copy)
 {
-	struct scratch_buf src, tmp, dst;
+	struct igt_buf src, tmp, dst;
 	struct bo bo;
 	char output[100];
 	int i;
@@ -174,9 +174,9 @@ static int check_ring(drm_intel_bufmgr *bufmgr,
 
 static void blt_copy(struct intel_batchbuffer *batch,
 		     drm_intel_context *context,
-		     struct scratch_buf *src, unsigned src_x, unsigned src_y,
+		     struct igt_buf *src, unsigned src_x, unsigned src_y,
 		     unsigned w, unsigned h,
-		     struct scratch_buf *dst, unsigned dst_x, unsigned dst_y)
+		     struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
 	BLIT_COPY_BATCH_START(batch->devid, 0);
 	OUT_BATCH((3 << 24) | /* 32 bits */
diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c
index cc133a9acc9b..664e552cbfcc 100644
--- a/tests/gem_seqno_wrap.c
+++ b/tests/gem_seqno_wrap.c
@@ -70,7 +70,7 @@ struct option_struct {
 static struct option_struct options;
 
 static void init_buffer(drm_intel_bufmgr *bufmgr,
-			struct scratch_buf *buf,
+			struct igt_buf *buf,
 			drm_intel_bo *bo,
 			int width, int height)
 {
@@ -139,8 +139,8 @@ static void release_bo(drm_intel_bo *bo)
 	drm_intel_bo_unreference(bo);
 }
 
-static void render_copyfunc(struct scratch_buf *src,
-			    struct scratch_buf *dst,
+static void render_copyfunc(struct igt_buf *src,
+			    struct igt_buf *dst,
 			    int width,
 			    int height)
 {
@@ -188,7 +188,7 @@ static int run_sync_test(int num_buffers, bool verify)
 	int r = -1;
 	int failed = 0;
 	unsigned int *p_dst1, *p_dst2;
-	struct scratch_buf *s_src, *s_dst;
+	struct igt_buf *s_src, *s_dst;
 
 	fd = drm_open_any();
 	igt_assert(fd >= 0);
diff --git a/tests/gem_stress.c b/tests/gem_stress.c
index 527f7de823a3..20f2ca335485 100644
--- a/tests/gem_stress.c
+++ b/tests/gem_stress.c
@@ -117,7 +117,7 @@ struct option_struct options;
 #define BUSY_BUF_SIZE		(256*4096)
 #define TILE_BYTES(size)	((size)*(size)*sizeof(uint32_t))
 
-static struct scratch_buf buffers[2][MAX_BUFS];
+static struct igt_buf buffers[2][MAX_BUFS];
 /* tile i is at logical position tile_permutation[i] */
 static unsigned *tile_permutation;
 static unsigned num_buffers = 0;
@@ -133,7 +133,7 @@ struct {
 	unsigned max_failed_reads;
 } stats;
 
-static void tile2xy(struct scratch_buf *buf, unsigned tile, unsigned *x, unsigned *y)
+static void tile2xy(struct igt_buf *buf, unsigned tile, unsigned *x, unsigned *y)
 {
 	igt_assert(tile < buf->num_tiles);
 	*x = (tile*options.tile_size) % (buf->stride/sizeof(uint32_t));
@@ -194,15 +194,15 @@ static void keep_gpu_busy(void)
 		 busy_bo, 0, 4096, 0, 128);
 }
 
-static void set_to_cpu_domain(struct scratch_buf *buf, int writing)
+static void set_to_cpu_domain(struct igt_buf *buf, int writing)
 {
 	gem_set_domain(drm_fd, buf->bo->handle, I915_GEM_DOMAIN_CPU,
 		       writing ? I915_GEM_DOMAIN_CPU : 0);
 }
 
 static unsigned int copyfunc_seq = 0;
-static void (*copyfunc)(struct scratch_buf *src, unsigned src_x, unsigned src_y,
-			struct scratch_buf *dst, unsigned dst_x, unsigned dst_y,
+static void (*copyfunc)(struct igt_buf *src, unsigned src_x, unsigned src_y,
+			struct igt_buf *dst, unsigned dst_x, unsigned dst_y,
 			unsigned logical_tile_no);
 
 /* stride, x, y in units of uint32_t! */
@@ -240,8 +240,8 @@ static void cpucpy2d(uint32_t *src, unsigned src_stride, unsigned src_x, unsigne
 		stats.num_failed++;
 }
 
-static void cpu_copyfunc(struct scratch_buf *src, unsigned src_x, unsigned src_y,
-			 struct scratch_buf *dst, unsigned dst_x, unsigned dst_y,
+static void cpu_copyfunc(struct igt_buf *src, unsigned src_x, unsigned src_y,
+			 struct igt_buf *dst, unsigned dst_x, unsigned dst_y,
 			 unsigned logical_tile_no)
 {
 	igt_assert(batch->ptr == batch->buffer);
@@ -259,8 +259,8 @@ static void cpu_copyfunc(struct scratch_buf *src, unsigned src_x, unsigned src_y
 		 logical_tile_no);
 }
 
-static void prw_copyfunc(struct scratch_buf *src, unsigned src_x, unsigned src_y,
-			 struct scratch_buf *dst, unsigned dst_x, unsigned dst_y,
+static void prw_copyfunc(struct igt_buf *src, unsigned src_x, unsigned src_y,
+			 struct igt_buf *dst, unsigned dst_x, unsigned dst_y,
 			 unsigned logical_tile_no)
 {
 	uint32_t tmp_tile[options.tile_size*options.tile_size];
@@ -303,8 +303,8 @@ static void prw_copyfunc(struct scratch_buf *src, unsigned src_x, unsigned src_y
 	}
 }
 
-static void blitter_copyfunc(struct scratch_buf *src, unsigned src_x, unsigned src_y,
-			     struct scratch_buf *dst, unsigned dst_x, unsigned dst_y,
+static void blitter_copyfunc(struct igt_buf *src, unsigned src_x, unsigned src_y,
+			     struct igt_buf *dst, unsigned dst_x, unsigned dst_y,
 			     unsigned logical_tile_no)
 {
 	static unsigned keep_gpu_busy_counter = 0;
@@ -333,8 +333,8 @@ static void blitter_copyfunc(struct scratch_buf *src, unsigned src_x, unsigned s
 	}
 }
 
-static void render_copyfunc(struct scratch_buf *src, unsigned src_x, unsigned src_y,
-			    struct scratch_buf *dst, unsigned dst_x, unsigned dst_y,
+static void render_copyfunc(struct igt_buf *src, unsigned src_x, unsigned src_y,
+			    struct igt_buf *dst, unsigned dst_x, unsigned dst_y,
 			    unsigned logical_tile_no)
 {
 	static unsigned keep_gpu_busy_counter = 0;
@@ -453,28 +453,28 @@ static void fan_in_and_check(void)
 	}
 }
 
-static void sanitize_stride(struct scratch_buf *buf)
+static void sanitize_stride(struct igt_buf *buf)
 {
 
-	if (buf_height(buf) > options.max_dimension)
+	if (igt_buf_height(buf) > options.max_dimension)
 		buf->stride = buf->size / options.max_dimension;
 
-	if (buf_height(buf) < options.tile_size)
+	if (igt_buf_height(buf) < options.tile_size)
 		buf->stride = buf->size / options.tile_size;
 
-	if (buf_width(buf) < options.tile_size)
+	if (igt_buf_width(buf) < options.tile_size)
 		buf->stride = options.tile_size * sizeof(uint32_t);
 
 	igt_assert(buf->stride <= 8192);
-	igt_assert(buf_width(buf) <= options.max_dimension);
-	igt_assert(buf_height(buf) <= options.max_dimension);
+	igt_assert(igt_buf_width(buf) <= options.max_dimension);
+	igt_assert(igt_buf_height(buf) <= options.max_dimension);
 
-	igt_assert(buf_width(buf) >= options.tile_size);
-	igt_assert(buf_height(buf) >= options.tile_size);
+	igt_assert(igt_buf_width(buf) >= options.tile_size);
+	igt_assert(igt_buf_height(buf) >= options.tile_size);
 
 }
 
-static void init_buffer(struct scratch_buf *buf, unsigned size)
+static void init_buffer(struct igt_buf *buf, unsigned size)
 {
 	buf->bo = drm_intel_bo_alloc(bufmgr, "tiled bo", size, 4096);
 	buf->size = size;
@@ -499,12 +499,12 @@ static void init_buffer(struct scratch_buf *buf, unsigned size)
 
 static void exchange_buf(void *array, unsigned i, unsigned j)
 {
-	struct scratch_buf *buf_arr, tmp;
+	struct igt_buf *buf_arr, tmp;
 	buf_arr = array;
 
-	memcpy(&tmp, &buf_arr[i], sizeof(struct scratch_buf));
-	memcpy(&buf_arr[i], &buf_arr[j], sizeof(struct scratch_buf));
-	memcpy(&buf_arr[j], &tmp, sizeof(struct scratch_buf));
+	memcpy(&tmp, &buf_arr[i], sizeof(struct igt_buf));
+	memcpy(&buf_arr[i], &buf_arr[j], sizeof(struct igt_buf));
+	memcpy(&buf_arr[j], &tmp, sizeof(struct igt_buf));
 }
 
 
@@ -576,7 +576,7 @@ static void copy_tiles(unsigned *permutation)
 {
 	unsigned src_tile, src_buf_idx, src_x, src_y;
 	unsigned dst_tile, dst_buf_idx, dst_x, dst_y;
-	struct scratch_buf *src_buf, *dst_buf;
+	struct igt_buf *src_buf, *dst_buf;
 	int i, idx;
 	for (i = 0; i < num_total_tiles; i++) {
 		/* tile_permutation is independent of current_permutation, so
@@ -820,7 +820,7 @@ static void init(void)
 
 static void check_render_copyfunc(void)
 {
-	struct scratch_buf src, dst;
+	struct igt_buf src, dst;
 	uint32_t *ptr;
 	int i, j, pass;
 
@@ -831,10 +831,10 @@ static void check_render_copyfunc(void)
 	init_buffer(&dst, options.scratch_buf_size);
 
 	for (pass = 0; pass < 16; pass++) {
-		int sx = random() % (buf_width(&src)-options.tile_size);
-		int sy = random() % (buf_height(&src)-options.tile_size);
-		int dx = random() % (buf_width(&dst)-options.tile_size);
-		int dy = random() % (buf_height(&dst)-options.tile_size);
+		int sx = random() % (igt_buf_width(&src)-options.tile_size);
+		int sy = random() % (igt_buf_height(&src)-options.tile_size);
+		int dx = random() % (igt_buf_width(&dst)-options.tile_size);
+		int dy = random() % (igt_buf_height(&dst)-options.tile_size);
 
 		if (options.use_cpu_maps)
 			set_to_cpu_domain(&src, 1);
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index bb06bc491812..d05d14e0eca4 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -168,7 +168,7 @@ static void fill_blt(data_t *data, uint32_t handle, unsigned char color)
 	gem_bo_busy(data->drm_fd, handle);
 }
 
-static void scratch_buf_init(struct scratch_buf *buf, drm_intel_bo *bo)
+static void scratch_buf_init(struct igt_buf *buf, drm_intel_bo *bo)
 {
 	buf->bo = bo;
 	buf->stride = 4096;
@@ -204,7 +204,7 @@ static void fill_render(data_t *data, uint32_t handle,
 {
 	drm_intel_bo *src, *dst;
 	struct intel_batchbuffer *batch;
-	struct scratch_buf src_buf, dst_buf;
+	struct igt_buf src_buf, dst_buf;
 	const uint8_t buf[4] = { color, color, color, color };
 	render_copyfunc_t rendercopy = get_render_copyfunc(data->devid);
 
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 5ef5afa2c211..e89ae99d2abf 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -248,7 +248,7 @@ static void emit_dummy_load__rcs(struct test_output *o)
 {
 	const struct kmstest_fb *fb_info = &o->fb_info[o->current_fb_id];
 	render_copyfunc_t copyfunc;
-	struct scratch_buf sb[2], *src, *dst;
+	struct igt_buf sb[2], *src, *dst;
 	int i, limit;
 
 	copyfunc = get_render_copyfunc(devid);
@@ -277,7 +277,7 @@ static void emit_dummy_load__rcs(struct test_output *o)
 	dst = &sb[1];
 
 	for (i = 0; i < limit; i++) {
-		struct scratch_buf *tmp;
+		struct igt_buf *tmp;
 
 		copyfunc(batch, NULL,
 			 src, 0, 0,
-- 
1.8.5.2




More information about the Intel-gfx mailing list