[igt-dev] [PATCH i-g-t v3 01/15] lib/intel_batchbuffer: add intel_bb_blit_copy wrapper
Dominik Grzegorzek
dominik.grzegorzek at intel.com
Fri Oct 2 06:54:28 UTC 2020
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 at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
lib/intel_batchbuffer.c | 23 +++++++++++++++++++++++
lib/intel_batchbuffer.h | 3 +++
2 files changed, 26 insertions(+)
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 60dbfe26..d810e10e 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -2521,6 +2521,29 @@ void intel_bb_blt_copy(struct intel_bb *ibb,
intel_bb_flush_blit(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 d20b4e66..dd401d89 100644
--- a/lib/intel_batchbuffer.h
+++ b/lib/intel_batchbuffer.h
@@ -646,6 +646,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:
--
2.20.1
More information about the igt-dev
mailing list