[PATCH i-g-t 3/5] lib/intel_blt: Use blt_mem_copy() to stress copy functions

Thomas Hellström thomas.hellstrom at linux.intel.com
Wed Mar 19 12:46:32 UTC 2025


On Wed, 2025-03-05 at 10:06 +0100, Francois Dugast wrote:
> The new blt_mem_copy() argument ncopies is handed over to the
> underlying function blt_bo_copy() which actually runs the copy,

Hmm. I'm confused by this commit message. Isn't it blt_mem_copy() that
actually performs the copy?

>  so
> that the caller of blt_mem_copy() can use a higher level function
> to stress the hardware copy function.
> 
> Signed-off-by: Francois Dugast <francois.dugast at intel.com>
Otherwise LGTM.
/Thomas

> ---
>  lib/intel_blt.c             | 5 +++--
>  lib/intel_blt.h             | 2 +-
>  tests/intel/xe_copy_basic.c | 2 +-
>  3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/intel_blt.c b/lib/intel_blt.c
> index 315a2e145..5cdf1ea8d 100644
> --- a/lib/intel_blt.c
> +++ b/lib/intel_blt.c
> @@ -1917,11 +1917,12 @@ int blt_mem_copy(int fd, const intel_ctx_t
> *ctx,
>   * @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 blt_bo_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);
> @@ -1948,7 +1949,7 @@ void blt_bo_copy(int fd, uint32_t src_handle,
> uint32_t dst_handle, const intel_c
>  	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/intel_blt.h b/lib/intel_blt.h
> index 217cade02..86681f1dd 100644
> --- a/lib/intel_blt.h
> +++ b/lib/intel_blt.h
> @@ -273,7 +273,7 @@ int blt_mem_copy(int fd, const intel_ctx_t *ctx,
>  			 int ncopies);
>  
>  void blt_bo_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);
>  
>  int blt_mem_set(int fd, const intel_ctx_t *ctx,
>  			const struct intel_execution_engine2 *e,
> uint64_t ahnd,
> diff --git a/tests/intel/xe_copy_basic.c
> b/tests/intel/xe_copy_basic.c
> index 458106b0b..20926cbb7 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)
>  {
> -	blt_bo_copy(fd, src_handle, dst_handle, ctx, size, width,
> height, region);
> +	blt_bo_copy(fd, src_handle, dst_handle, ctx, size, width,
> height, region, 1);
>  }
>  
>  /**



More information about the igt-dev mailing list