[PATCH i-g-t, v3 3/5] lib/xe/xe_util: Control ncopies in xe_blt_mem_copy()
Francois Dugast
francois.dugast at intel.com
Wed Mar 26 12:02:58 UTC 2025
The new xe_blt_mem_copy() argument ncopies is handed over to the
underlying function blt_mem_copy() which actually runs the copy,
so that the caller of xe_blt_mem_copy() can use it to stress the
hardware copy functions.
Signed-off-by: Francois Dugast <francois.dugast at intel.com>
---
lib/xe/xe_util.c | 5 +++--
lib/xe/xe_util.h | 2 +-
tests/intel/xe_copy_basic.c | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/xe/xe_util.c b/lib/xe/xe_util.c
index 2d9e67955..420f77640 100644
--- a/lib/xe/xe_util.c
+++ b/lib/xe/xe_util.c
@@ -288,11 +288,12 @@ uint32_t xe_nsec_to_ticks(int fd, int gt_id, uint64_t nsec)
* @width: width
* @height: height
* @region: memory region
+ * @ncopies: how many times copy is run, > 1 can be used to stress the copy function
*
* Copy BO with mem blit from @src_handle into @dst_handle.
*/
void xe_blt_mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ctx,
- uint32_t size, uint32_t width, uint32_t height, uint32_t region)
+ uint32_t size, uint32_t width, uint32_t height, uint32_t region, int ncopies)
{
struct blt_mem_data mem = {};
uint64_t bb_size = xe_bb_size(fd, SZ_4K);
@@ -319,7 +320,7 @@ void xe_blt_mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const int
blt_set_batch(&mem.bb, bb, bb_size, region);
igt_assert(mem.src.width == mem.dst.width);
- blt_mem_copy(fd, ctx, NULL, ahnd, &mem, 1);
+ blt_mem_copy(fd, ctx, NULL, ahnd, &mem, ncopies);
result = memcmp(mem.src.ptr, mem.dst.ptr, mem.src.size);
intel_allocator_bind(ahnd, 0, 0);
diff --git a/lib/xe/xe_util.h b/lib/xe/xe_util.h
index 550c62101..bf532a385 100644
--- a/lib/xe/xe_util.h
+++ b/lib/xe/xe_util.h
@@ -50,6 +50,6 @@ void xe_bind_unbind_async(int fd, uint32_t vm, uint32_t bind_engine,
uint32_t xe_nsec_to_ticks(int fd, int gt_id, uint64_t ns);
void xe_blt_mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ctx,
- uint32_t size, uint32_t width, uint32_t height, uint32_t region);
+ uint32_t size, uint32_t width, uint32_t height, uint32_t region, int ncopies);
#endif /* XE_UTIL_H */
diff --git a/tests/intel/xe_copy_basic.c b/tests/intel/xe_copy_basic.c
index b7cee6f62..a6b2e9d27 100644
--- a/tests/intel/xe_copy_basic.c
+++ b/tests/intel/xe_copy_basic.c
@@ -44,7 +44,7 @@ static void
mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ctx,
uint32_t size, uint32_t width, uint32_t height, uint32_t region)
{
- xe_blt_mem_copy(fd, src_handle, dst_handle, ctx, size, width, height, region);
+ xe_blt_mem_copy(fd, src_handle, dst_handle, ctx, size, width, height, region, 1);
}
/**
--
2.43.0
More information about the igt-dev
mailing list