[igt-dev] [PATCH 1/2] lib/intel_batchbuffer: Add tiling arguments to intel_blt_copy

Vanshidhar Konda vanshidhar.r.konda at intel.com
Thu Nov 14 01:10:14 UTC 2019


Refactor intel_blt_copy method to take tiling for buffer objects as an
argument instead of calling GET_TILING IOCTL.

Signed-off-by: Vanshidhar Konda <vanshidhar.r.konda at intel.com>
---
 lib/intel_batchbuffer.c          | 20 ++++++++++++--------
 lib/intel_batchbuffer.h          |  8 +++++---
 tests/i915/gem_concurrent_all.c  |  9 +++++++--
 tests/i915/gem_read_read_speed.c |  8 ++++++--
 tests/kms_big_fb.c               |  6 ++++--
 5 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 3828ba75..f60bd5bd 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -382,10 +382,12 @@ intel_batchbuffer_copy_data(struct intel_batchbuffer *batch,
  * @src_x1: source pixel x-coordination
  * @src_y1: source pixel y-coordination
  * @src_pitch: @src_bo's pitch in bytes
+ * @src_tiling: @src_bo's tiling
  * @dst_bo: destination libdrm buffer object
  * @dst_x1: destination pixel x-coordination
  * @dst_y1: destination pixel y-coordination
  * @dst_pitch: @dst_bo's pitch in bytes
+ * @dst_tiling: @dst_bo's tiling
  * @width: width of the copied rectangle
  * @height: height of the copied rectangle
  * @bpp: bits per pixel
@@ -395,12 +397,13 @@ intel_batchbuffer_copy_data(struct intel_batchbuffer *batch,
  */
 void
 intel_blt_copy(struct intel_batchbuffer *batch,
-	       drm_intel_bo *src_bo, int src_x1, int src_y1, int src_pitch,
-	       drm_intel_bo *dst_bo, int dst_x1, int dst_y1, int dst_pitch,
+	       drm_intel_bo *src_bo, int src_x1, int src_y1,
+	       int src_pitch, uint32_t src_tiling,
+	       drm_intel_bo *dst_bo, int dst_x1, int dst_y1,
+	       int dst_pitch, uint32_t dst_tiling,
 	       int width, int height, int bpp)
 {
 	const int gen = batch->gen;
-	uint32_t src_tiling, dst_tiling, swizzle;
 	uint32_t cmd_bits = 0;
 	uint32_t br13_bits;
 
@@ -409,9 +412,6 @@ intel_blt_copy(struct intel_batchbuffer *batch,
 	igt_assert(src_pitch * (src_y1 + height) <= src_bo->size);
 	igt_assert(dst_pitch * (dst_y1 + height) <= dst_bo->size);
 
-	drm_intel_bo_get_tiling(src_bo, &src_tiling, &swizzle);
-	drm_intel_bo_get_tiling(dst_bo, &dst_tiling, &swizzle);
-
 	if (gen >= 4 && src_tiling != I915_TILING_NONE) {
 		src_pitch /= 4;
 		cmd_bits |= XY_SRC_COPY_BLT_SRC_TILED;
@@ -492,11 +492,15 @@ intel_copy_bo(struct intel_batchbuffer *batch,
 	      drm_intel_bo *dst_bo, drm_intel_bo *src_bo,
 	      long int size)
 {
+	uint32_t src_tiling, dst_tiling, swizzle;
 	igt_assert(size % 4096 == 0);
 
+	drm_intel_bo_get_tiling(src_bo, &src_tiling, &swizzle);
+	drm_intel_bo_get_tiling(dst_bo, &dst_tiling, &swizzle);
+
 	intel_blt_copy(batch,
-		       src_bo, 0, 0, 4096,
-		       dst_bo, 0, 0, 4096,
+		       src_bo, 0, 0, 4096, src_tiling,
+		       dst_bo, 0, 0, 4096, dst_tiling,
 		       4096/4, size/4096, 32);
 }
 
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index e5f6e6d0..1e9558fb 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -191,9 +191,11 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
 
 void
 intel_blt_copy(struct intel_batchbuffer *batch,
-	      drm_intel_bo *src_bo, int src_x1, int src_y1, int src_pitch,
-	      drm_intel_bo *dst_bo, int dst_x1, int dst_y1, int dst_pitch,
-	      int width, int height, int bpp);
+	       drm_intel_bo *src_bo, int src_x1, int src_y1,
+	       int src_pitch, uint32_t src_tiling,
+	       drm_intel_bo *dst_bo, int dst_x1, int dst_y1,
+	       int dst_pitch, uint32_t dst_tiling,
+	       int width, int height, int bpp);
 void intel_copy_bo(struct intel_batchbuffer *batch,
 		   drm_intel_bo *dst_bo, drm_intel_bo *src_bo,
 		   long int size);
diff --git a/tests/i915/gem_concurrent_all.c b/tests/i915/gem_concurrent_all.c
index 992bea62..9ba377e8 100644
--- a/tests/i915/gem_concurrent_all.c
+++ b/tests/i915/gem_concurrent_all.c
@@ -875,9 +875,14 @@ static void render_copy_bo(struct buffers *b, drm_intel_bo *dst, drm_intel_bo *s
 
 static void blt_copy_bo(struct buffers *b, drm_intel_bo *dst, drm_intel_bo *src)
 {
+	uint32_t dst_tiling, src_tiling, swizzle;
+
+	drm_intel_bo_get_tiling(dst, &dst_tiling, &swizzle);
+	drm_intel_bo_get_tiling(src, &src_tiling, &swizzle);
+
 	intel_blt_copy(b->batch,
-		       src, 0, 0, 4*b->width,
-		       dst, 0, 0, 4*b->width,
+		       src, 0, 0, 4*b->width, src_tiling,
+		       dst, 0, 0, 4*b->width, dst_tiling,
 		       b->width, b->height, 32);
 }
 
diff --git a/tests/i915/gem_read_read_speed.c b/tests/i915/gem_read_read_speed.c
index 5f1356eb..b7f133cc 100644
--- a/tests/i915/gem_read_read_speed.c
+++ b/tests/i915/gem_read_read_speed.c
@@ -81,12 +81,16 @@ static drm_intel_bo *rcs_copy_bo(drm_intel_bo *dst, drm_intel_bo *src)
 
 static drm_intel_bo *bcs_copy_bo(drm_intel_bo *dst, drm_intel_bo *src)
 {
+	uint32_t dst_tiling, src_tiling, swizzle;
 	drm_intel_bo *bo = batch->bo;
 	drm_intel_bo_reference(bo);
 
+	drm_intel_bo_get_tiling(src, &src_tiling, &swizzle);
+	drm_intel_bo_get_tiling(dst, &dst_tiling, &swizzle);
+
 	intel_blt_copy(batch,
-		       src, 0, 0, 4*width,
-		       dst, 0, 0, 4*width,
+		       src, 0, 0, 4*width, src_tiling,
+		       dst, 0, 0, 4*width, dst_tiling,
 		       width, height, 32);
 
 	return bo;
diff --git a/tests/kms_big_fb.c b/tests/kms_big_fb.c
index c3498c67..35f157e7 100644
--- a/tests/kms_big_fb.c
+++ b/tests/kms_big_fb.c
@@ -99,8 +99,10 @@ static void copy_pattern(data_t *data,
 		h = min(h, src_fb->height - sy);
 		h = min(h, dst_fb->height - dy);
 
-		intel_blt_copy(data->batch, src.bo, sx, sy, src.stride,
-			       dst.bo, dx, dy, dst.stride, w, h, dst.bpp);
+		intel_blt_copy(data->batch,
+			       src.bo, sx, sy, src.stride, src.tiling,
+			       dst.bo, dx, dy, dst.stride, dst.tiling,
+			       w, h, dst.bpp);
 	}
 
 	fini_buf(&dst);
-- 
2.24.0



More information about the igt-dev mailing list