Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] lib/intel_batchbuffer: Add delta argument to igt_blitter_fast_copy__raw, v2.
Date: Mon, 29 Jan 2018 13:10:49 +0100	[thread overview]
Message-ID: <20180129121049.41045-1-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20180123125642.58698-5-maarten.lankhorst@linux.intel.com>

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

Changes since v1:
- Set src and destination addresses to the delta, in case BO is mapped at offset 0.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com> #v1
---
 lib/igt_fb.c            |  8 ++++----
 lib/intel_batchbuffer.c | 19 ++++++++++++-------
 lib/intel_batchbuffer.h |  2 ++
 3 files changed, 18 insertions(+), 11 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..127d847088e8 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)
@@ -659,11 +664,11 @@ void igt_blitter_fast_copy__raw(int fd,
 	batch[i++] = dword1 | dst_pitch;
 	batch[i++] = (dst_y << 16) | dst_x; /* dst x1,y1 */
 	batch[i++] = ((dst_y + height) << 16) | (dst_x + width); /* dst x2,y2 */
-	batch[i++] = 0; /* dst address lower bits */
+	batch[i++] = dst_delta; /* dst address lower bits */
 	batch[i++] = 0;	/* dst address upper bits */
 	batch[i++] = (src_y << 16) | src_x; /* src x1,y1 */
 	batch[i++] = src_pitch;
-	batch[i++] = 0; /* src address lower bits */
+	batch[i++] = src_delta; /* src address lower bits */
 	batch[i++] = 0;	/* src address upper bits */
 	batch[i++] = MI_BATCH_BUFFER_END;
 	batch[i++] = MI_NOOP;
@@ -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

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2018-01-29 12:10 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 12:56 [igt-dev] [PATCH i-g-t 0/8] lib/igt_fb: Add support for the NV12 format Maarten Lankhorst
2018-01-23 12:56 ` [igt-dev] [PATCH i-g-t 1/8] lib/igt_fb: Add igt_put_cairo_ctx as counter to igt_get_cairo_ctx Maarten Lankhorst
2018-01-23 15:50   ` Ville Syrjälä
2018-01-24 12:26     ` Maarten Lankhorst
2018-01-25 11:43       ` Mika Kahola
2018-01-29 17:01         ` Maarten Lankhorst
2018-01-31 17:03   ` Ville Syrjälä
2018-01-23 12:56 ` [igt-dev] [PATCH i-g-t 2/8] lib/igt_fb: Pass format to igt_calc_fb_size Maarten Lankhorst
2018-01-25 11:51   ` Mika Kahola
2018-01-23 12:56 ` [igt-dev] [PATCH i-g-t 3/8] lib/fb: Handle planar formats in igt_calc_fb_size and create_bo_for_fb Maarten Lankhorst
2018-01-26  9:00   ` Mika Kahola
2018-01-26 10:20     ` Maarten Lankhorst
2018-01-26 10:24       ` Mika Kahola
2018-01-26 12:01         ` Maarten Lankhorst
2018-01-26 13:10           ` Mika Kahola
2018-02-01 14:39   ` Ville Syrjälä
2018-01-23 12:56 ` [igt-dev] [PATCH i-g-t 4/8] lib/intel_batchbuffer: Add delta argument to igt_blitter_fast_copy__raw Maarten Lankhorst
2018-01-26  9:02   ` Mika Kahola
2018-01-29 12:10   ` Maarten Lankhorst [this message]
2018-01-23 12:56 ` [igt-dev] [PATCH i-g-t 5/8] lib/intel_batchbuffer: Add src/dst delta arguments to igt_blitter_fast_copy too Maarten Lankhorst
2018-01-26  9:04   ` Mika Kahola
2018-01-23 12:56 ` [igt-dev] [PATCH i-g-t 6/8] lib/fb: Add support for creating planar framebuffers Maarten Lankhorst
2018-01-23 14:50   ` [igt-dev] [PATCH i-g-t] lib/fb: Add support for creating planar framebuffers, v2 Maarten Lankhorst
2018-01-24 10:53     ` [igt-dev] [PATCH i-g-t] lib/fb: Add support for creating planar framebuffers, v3 Maarten Lankhorst
2018-01-29  8:44       ` Mika Kahola
2018-01-23 12:56 ` [igt-dev] [PATCH i-g-t 7/8] tests/kms_render: Copy all planes when copying fb Maarten Lankhorst
2018-01-26 13:56   ` Mika Kahola
2018-02-28 15:40     ` Arkadiusz Hiler
2018-02-28 15:43       ` Maarten Lankhorst
2018-02-28 15:43       ` Arkadiusz Hiler
2018-01-23 12:56 ` [igt-dev] [PATCH i-g-t 8/8] lib/igt_fb: Add support for NV12 format through conversion Maarten Lankhorst
2018-01-31 13:45   ` Mika Kahola
2018-01-31 14:32     ` Ville Syrjälä
2018-01-31 15:09       ` Maarten Lankhorst
2018-01-31 16:52       ` [igt-dev] [PATCH i-g-t] lib/igt_fb: Add support for NV12 format through conversion, v2 Maarten Lankhorst
2018-02-01 14:23         ` Ville Syrjälä
2018-02-01 14:43           ` Maarten Lankhorst
2018-01-23 14:28 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_fb: Add support for the NV12 format Patchwork
2018-01-23 15:41 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Add support for the NV12 format. (rev2) Patchwork
2018-01-23 19:47 ` [igt-dev] ✗ Fi.CI.IGT: failure for lib/igt_fb: Add support for the NV12 format Patchwork
2018-01-23 22:30 ` [igt-dev] ✗ Fi.CI.IGT: failure for lib/igt_fb: Add support for the NV12 format. (rev2) Patchwork
2018-01-24 12:16 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Add support for the NV12 format. (rev3) Patchwork
2018-01-24 15:57 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-01-29 12:37 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Add support for the NV12 format. (rev4) Patchwork
2018-01-29 17:29 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-01-31 17:15 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Add support for the NV12 format. (rev5) Patchwork
2018-01-31 18:55 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180129121049.41045-1-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox