[igt-dev] [PATCH i-g-t 4/8] lib/intel_batchbuffer: Add delta argument to igt_blitter_fast_copy__raw

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Tue Jan 23 12:56:38 UTC 2018


Adding a delta offset will allow us to copy planar framebuffers with this
function.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 lib/igt_fb.c            |  8 ++++----
 lib/intel_batchbuffer.c | 15 ++++++++++-----
 lib/intel_batchbuffer.h |  2 ++
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 6a331f06724b..1251f462d24e 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1121,13 +1121,13 @@ static void destroy_cairo_surface__blit(void *arg)
 			I915_GEM_DOMAIN_GTT, 0);
 
 	igt_blitter_fast_copy__raw(blit->fd,
-				   blit->linear.handle,
+				   blit->linear.handle, 0,
 				   blit->linear.stride,
 				   I915_TILING_NONE,
 				   0, 0, /* src_x, src_y */
 				   fb->width, fb->height,
 				   igt_drm_format_to_bpp(fb->drm_format),
-				   fb->gem_handle,
+				   fb->gem_handle, 0,
 				   fb->stride,
 				   obj_tiling,
 				   0, 0 /* dst_x, dst_y */);
@@ -1169,13 +1169,13 @@ static void create_cairo_surface__blit(int fd, struct igt_fb *fb)
 			I915_GEM_DOMAIN_GTT, 0);
 
 	igt_blitter_fast_copy__raw(fd,
-				   fb->gem_handle,
+				   fb->gem_handle, 0,
 				   fb->stride,
 				   obj_tiling,
 				   0, 0, /* src_x, src_y */
 				   fb->width, fb->height,
 				   igt_drm_format_to_bpp(fb->drm_format),
-				   blit->linear.handle,
+				   blit->linear.handle, 0,
 				   blit->linear.stride,
 				   I915_TILING_NONE,
 				   0, 0 /* dst_x, dst_y */);
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 9a53b6f8e706..3a199fa7ba57 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -554,11 +554,12 @@ static uint32_t fast_copy_dword1(unsigned int src_tiling,
 
 static void
 fill_relocation(struct drm_i915_gem_relocation_entry *reloc,
-		uint32_t gem_handle, uint32_t offset, /* in dwords */
+		uint32_t gem_handle, uint32_t delta, /* in bytes */
+		uint32_t offset, /* in dwords */
 		uint32_t read_domains, uint32_t write_domains)
 {
 	reloc->target_handle = gem_handle;
-	reloc->delta = 0;
+	reloc->delta = delta;
 	reloc->offset = offset * sizeof(uint32_t);
 	reloc->presumed_offset = 0;
 	reloc->read_domains = read_domains;
@@ -599,6 +600,7 @@ static void exec_blit(int fd,
  * igt_blitter_fast_copy__raw:
  * @fd: file descriptor of the i915 driver
  * @src_handle: GEM handle of the source buffer
+ * @src_delta: offset into the source GEM bo, in bytes
  * @src_stride: Stride (in bytes) of the source buffer
  * @src_tiling: Tiling mode of the source buffer
  * @src_x: X coordinate of the source region to copy
@@ -606,7 +608,8 @@ static void exec_blit(int fd,
  * @width: Width of the region to copy
  * @height: Height of the region to copy
  * @bpp: source and destination bits per pixel
- * @dst_handle: GEM handle of the source buffer
+ * @dst_handle: GEM handle of the destination buffer
+ * @dst_delta: offset into the destination GEM bo, in bytes
  * @dst_stride: Stride (in bytes) of the destination buffer
  * @dst_tiling: Tiling mode of the destination buffer
  * @dst_x: X coordinate of destination
@@ -617,6 +620,7 @@ static void exec_blit(int fd,
 void igt_blitter_fast_copy__raw(int fd,
 				/* src */
 				uint32_t src_handle,
+				unsigned int src_delta,
 				unsigned int src_stride,
 				unsigned int src_tiling,
 				unsigned int src_x, unsigned src_y,
@@ -629,6 +633,7 @@ void igt_blitter_fast_copy__raw(int fd,
 
 				/* dst */
 				uint32_t dst_handle,
+				unsigned dst_delta,
 				unsigned int dst_stride,
 				unsigned int dst_tiling,
 				unsigned int dst_x, unsigned dst_y)
@@ -673,9 +678,9 @@ void igt_blitter_fast_copy__raw(int fd,
 	batch_handle = gem_create(fd, 4096);
 	gem_write(fd, batch_handle, 0, batch, sizeof(batch));
 
-	fill_relocation(&relocs[0], dst_handle, 4,
+	fill_relocation(&relocs[0], dst_handle, dst_delta, 4,
 			I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
-	fill_relocation(&relocs[1], src_handle, 8, I915_GEM_DOMAIN_RENDER, 0);
+	fill_relocation(&relocs[1], src_handle, src_delta, 8, I915_GEM_DOMAIN_RENDER, 0);
 
 	fill_object(&objs[0], dst_handle, NULL, 0);
 	fill_object(&objs[1], src_handle, NULL, 0);
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index 6bee41676627..a6d8f9863698 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -234,6 +234,7 @@ void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
 void igt_blitter_fast_copy__raw(int fd,
 				/* src */
 				uint32_t src_handle,
+				unsigned int src_delta,
 				unsigned int src_stride,
 				unsigned int src_tiling,
 				unsigned int src_x, unsigned src_y,
@@ -246,6 +247,7 @@ void igt_blitter_fast_copy__raw(int fd,
 
 				/* dst */
 				uint32_t dst_handle,
+				unsigned int dst_delta,
 				unsigned int dst_stride,
 				unsigned int dst_tiling,
 				unsigned int dst_x, unsigned dst_y);
-- 
2.15.1



More information about the igt-dev mailing list