All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Dugast <francois.dugast@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Cc: <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t v3 08/11] tests/xe_copy_basic: add subtest to verify mem-copy in pages
Date: Tue, 27 May 2025 21:23:58 +0200	[thread overview]
Message-ID: <aDYRTldlyPM-JRvb@fdugast-desk> (raw)
In-Reply-To: <20250523080126.75295-9-zbigniew.kempczynski@intel.com>

On Fri, May 23, 2025 at 10:01:23AM +0200, Zbigniew Kempczyński wrote:
> Mem-copy in linear mode supports copying in 256B pages. Verify is
> it properly handled in intel_blt.
> 
> Cc: Francois Dugast <francois.dugast@intel.com>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> ---
>  tests/intel/xe_copy_basic.c | 56 ++++++++++++++++++++++++++++++++++---
>  1 file changed, 52 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/intel/xe_copy_basic.c b/tests/intel/xe_copy_basic.c
> index bed3e39426..404fe7f50a 100644
> --- a/tests/intel/xe_copy_basic.c
> +++ b/tests/intel/xe_copy_basic.c
> @@ -48,6 +48,20 @@ struct rect {
>   * @0xfffe: 0xfffe
>   * @0x8fffe: 0x8fffe
>   */
> +
> +/**
> + *
> + * SUBTEST: mem-page-copy-%s
> + * Description: Test validates MEM_COPY command, it takes various
                                                                     ^
Is something missing here? The line wrap is odd and after this series the
test description ends up being exactly the same for mem-copy-linear-%s,
mem-page-copy-%s and mem-matrix-copy-%s.

With that fixed:

    Reviewed-by: Francois Dugast <francois.dugast@intel.com>

> + *              parameters needed for the filling batch buffer for MEM_COPY command
> + *              with size %arg[1].
> + * Test category: functionality test
> + *
> + * arg[1]:
> + * @1: 1
> + * @17: 17
> + */
> +
>  static void
>  mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ctx,
>  	 enum blt_memop_type type, enum blt_memop_mode mode,
> @@ -62,23 +76,45 @@ mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ct
>  	uint8_t src_mocs = intel_get_uc_mocs_index(fd);
>  	uint8_t dst_mocs = src_mocs;
>  	uint32_t bb;
> -	int result;
> +	uint8_t *psrc, *pdst;
> +	int result, i;
>  
>  	bb = xe_bo_create(fd, 0, bb_size, region, 0);
>  
> -	blt_mem_copy_init(fd, &mem, MODE_BYTE, TYPE_LINEAR);
> +	blt_mem_copy_init(fd, &mem, mode, type);
>  	blt_set_mem_object(&mem.src, src_handle, size, width, width, height,
>  			   region, src_mocs, DEFAULT_PAT_INDEX, COMPRESSION_DISABLED);
>  	blt_set_mem_object(&mem.dst, dst_handle, size, width, width, height,
>  			   region, dst_mocs, DEFAULT_PAT_INDEX, COMPRESSION_DISABLED);
>  	mem.src.ptr = xe_bo_map(fd, src_handle, size);
>  	mem.dst.ptr = xe_bo_map(fd, dst_handle, size);
> +	psrc = (uint8_t *) mem.src.ptr;
> +	pdst = (uint8_t *) mem.dst.ptr;
> +
> +	srand(time(NULL));
> +
> +	/* Randomize whole src */
> +	for (i = 0; i < size; i++)
> +		psrc[i] = rand();
>  
>  	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);
> -	result = memcmp(mem.src.ptr, mem.dst.ptr, mem.src.size);
> +
> +	if (type == TYPE_LINEAR && mode == MODE_BYTE) {
> +		result = memcmp(psrc, pdst, width);
> +
> +		/* Rest of dst must contain 0 */
> +		for (i = width; i < size; i++) {
> +			if (pdst[i] != 0) {
> +				result = -1;
> +				break;
> +			}
> +		}
> +	} else {
> +		result = memcmp(psrc, pdst, pitch << 8);
> +	}
>  
>  	intel_allocator_bind(ahnd, 0, 0);
>  	munmap(mem.src.ptr, size);
> @@ -86,7 +122,7 @@ mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ct
>  	gem_close(fd, bb);
>  	put_ahnd(ahnd);
>  
> -	igt_assert_f(!result, "source and destination differ\n");
> +	igt_assert_f(!result, "destination doesn't contain valid data\n");
>  }
>  
>  /**
> @@ -176,6 +212,8 @@ igt_main
>  				 { 0, 0x3fff, 1 },
>  				 { 0, 0xfffe, 1 },
>  				 { 0, 0x8fffe, 1 } };
> +	struct rect page[] = { { 0, 1, 1, MODE_PAGE },
> +			       { 0, 17, 1, MODE_PAGE }};
>  
>  	igt_fixture {
>  		fd = drm_open_driver(DRIVER_XE);
> @@ -195,6 +233,16 @@ igt_main
>  		}
>  	}
>  
> +	for (int i = 0; i < ARRAY_SIZE(page); i++) {
> +		igt_subtest_f("mem-page-copy-%u", page[i].width) {
> +			igt_require(blt_has_mem_copy(fd));
> +			for_each_variation_r(regions, 1, set) {
> +				region = igt_collection_get_value(regions, 0);
> +				copy_test(fd, &page[i], MEM_COPY, region);
> +			}
> +		}
> +	}
> +
>  	for (int i = 0; i < ARRAY_SIZE(linear); i++) {
>  		igt_subtest_f("mem-set-linear-0x%x", linear[i].width) {
>  			igt_require(blt_has_mem_set(fd));
> -- 
> 2.43.0
> 

  reply	other threads:[~2025-05-27 19:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23  8:01 [PATCH i-g-t v3 00/11] Improve mem-copy/mem-set lib and tests Zbigniew Kempczyński
2025-05-23  8:01 ` [PATCH i-g-t v3 01/11] lib/intel_cmds_info: rename M to TYPE in blt_memop_type Zbigniew Kempczyński
2025-05-23  8:01 ` [PATCH i-g-t v3 02/11] lib/intel_blt: separate mem-copy and mem-set Zbigniew Kempczyński
2025-05-23  8:01 ` [PATCH i-g-t v3 03/11] lib/intel_cmds_info: add blt_memop_mode (byte/page) Zbigniew Kempczyński
2025-05-27 12:19   ` Francois Dugast
2025-05-23  8:01 ` [PATCH i-g-t v3 04/11] lib/intel_blt: add emit batchbuffer end Zbigniew Kempczyński
2025-05-23  8:01 ` [PATCH i-g-t v3 05/11] lib/intel_blt: use struct instead of inline coding Zbigniew Kempczyński
2025-05-23  8:01 ` [PATCH i-g-t v3 06/11] tests/xe_copy_basic: replace size to rect which keeps objects geometry Zbigniew Kempczyński
2025-05-27 19:15   ` Francois Dugast
2025-05-28 19:28     ` Zbigniew Kempczyński
2025-05-23  8:01 ` [PATCH i-g-t v3 07/11] tests/xe_copy_basic: add testcase with large buffer size Zbigniew Kempczyński
2025-05-27 19:16   ` Francois Dugast
2025-05-23  8:01 ` [PATCH i-g-t v3 08/11] tests/xe_copy_basic: add subtest to verify mem-copy in pages Zbigniew Kempczyński
2025-05-27 19:23   ` Francois Dugast [this message]
2025-05-30  6:10     ` Zbigniew Kempczyński
2025-05-23  8:01 ` [PATCH i-g-t v3 09/11] lib/intel_blt: add support for matrix mem-copy Zbigniew Kempczyński
2025-05-28  8:23   ` Francois Dugast
2025-05-30  6:17     ` Zbigniew Kempczyński
2025-05-23  8:01 ` [PATCH i-g-t v3 10/11] tests/xe_copy_basic: add mem-copy matrix subtests Zbigniew Kempczyński
2025-05-28  8:26   ` Francois Dugast
2025-05-23  8:01 ` [PATCH i-g-t v3 11/11] lib/intel_blt: add mem-copy debug facility Zbigniew Kempczyński
2025-05-28  8:29   ` Francois Dugast
2025-05-23 10:45 ` ✗ i915.CI.BAT: failure for Improve mem-copy/mem-set lib and tests (rev2) Patchwork
2025-05-23 11:36 ` ✓ Xe.CI.BAT: success " Patchwork
2025-05-23 19:54 ` ✓ Xe.CI.Full: " 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=aDYRTldlyPM-JRvb@fdugast-desk \
    --to=francois.dugast@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.