summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Grzegorzek <dominik.grzegorzek@intel.com>2020-10-27 10:23:04 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-11-19 18:50:02 +0000
commit8fd08b167a92531fdc760212e812739422db5854 (patch)
treecbaff8cba22a803142fbc5a9086a591238bb9a18
parent5bc1047cc8f38a9e0c5a914b6511a639b15a740e (diff)
lib/intel_batchbuffer: add intel_bb_blit_copy wrapper
This patch adds intel_bb_copy_intel_buf to make copying a whole intel_buf easier and more readable. Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Zbigniew KempczyƄski <zbigniew.kempczynski@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--lib/intel_batchbuffer.c23
-rw-r--r--lib/intel_batchbuffer.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 7b4cfb0d..8dd8a502 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -2522,6 +2522,29 @@ void intel_bb_blt_copy(struct intel_bb *ibb,
}
/**
+ * intel_bb_copy_intel_buf:
+ * @batch: batchbuffer object
+ * @src: source buffer (intel_buf)
+ * @dst: destination libdrm buffer object
+ * @size: size of the copy range in bytes
+ *
+ * Emits a copy operation using blitter commands into the supplied batch.
+ * A total of @size bytes from the start of @src is copied
+ * over to @dst. Note that @size must be page-aligned.
+ */
+void intel_bb_copy_intel_buf(struct intel_bb *ibb,
+ struct intel_buf *src, struct intel_buf *dst,
+ long int size)
+{
+ igt_assert(size % 4096 == 0);
+
+ intel_bb_blt_copy(ibb,
+ src, 0, 0, 4096,
+ dst, 0, 0, 4096,
+ 4096/4, size/4096, 32);
+}
+
+/**
* igt_get_huc_copyfunc:
* @devid: pci device id
*
diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h
index ab1b0c28..4c930a88 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -648,6 +648,9 @@ void intel_bb_blt_copy(struct intel_bb *ibb,
struct intel_buf *dst,
int dst_x1, int dst_y1, int dst_pitch,
int width, int height, int bpp);
+void intel_bb_copy_intel_buf(struct intel_bb *ibb,
+ struct intel_buf *dst, struct intel_buf *src,
+ long int size);
/**
* igt_huc_copyfunc_t: