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 10/15] tests/xe_copy_basic: replace size to rect which keeps objects geometry
Date: Thu, 22 May 2025 14:05:51 +0200 [thread overview]
Message-ID: <aC8THxeHA6Zurcxe@fdugast-desk> (raw)
In-Reply-To: <20250513185811.897232-11-zbigniew.kempczynski@intel.com>
On Tue, May 13, 2025 at 08:58:05PM +0200, Zbigniew Kempczyński wrote:
> Testing byte/page + linear/matrix mem-copy requires passing different
> pitch/width/height so replace simple size to geometry.
>
> Change mem-copy and mem-set to use rect instead of size for
> copying bytes.
>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Francois Dugast <francois.dugast@intel.com>
> ---
> tests/intel/xe_copy_basic.c | 44 +++++++++++++++++++++++--------------
> 1 file changed, 28 insertions(+), 16 deletions(-)
>
> diff --git a/tests/intel/xe_copy_basic.c b/tests/intel/xe_copy_basic.c
> index f252d29fd4..7bec248b06 100644
> --- a/tests/intel/xe_copy_basic.c
> +++ b/tests/intel/xe_copy_basic.c
> @@ -19,6 +19,13 @@
>
> #define MEM_FILL 0x8b
>
> +struct rect {
> + uint32_t pitch;
> + uint32_t width;
> + uint32_t height;
> + enum blt_memop_mode mode;
> +};
> +
> /**
> * TEST: Test to validate copy commands on xe
> * Category: Core
> @@ -42,7 +49,9 @@
> */
> 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)
> + enum blt_memop_type type, enum blt_memop_mode mode,
> + uint32_t size, uint32_t pitch,
> + uint32_t width, uint32_t height, uint32_t region)
> {
> struct blt_mem_copy_data mem = {};
> uint64_t bb_size = xe_bb_size(fd, SZ_4K);
> @@ -125,13 +134,15 @@ mem_set(int fd, uint32_t dst_handle, const intel_ctx_t *ctx, uint32_t size,
> munmap(mem.dst.ptr, size);
> }
>
> -static void copy_test(int fd, uint32_t size, enum blt_cmd_type cmd, uint32_t region)
> +static void copy_test(int fd, struct rect *rect, enum blt_cmd_type cmd, uint32_t region)
> {
> struct drm_xe_engine_class_instance inst = {
> .engine_class = DRM_XE_ENGINE_CLASS_COPY,
> };
> - uint32_t src_handle, dst_handle, vm, exec_queue, src_size, dst_size;
> - uint32_t bo_size = ALIGN(size, xe_get_default_alignment(fd));
> + uint32_t src_handle, dst_handle, vm, exec_queue;
> + uint32_t pitch = rect->pitch ?: rect->width;
> + uint32_t blocksize = rect->mode ? pitch << 8 : pitch;
Is this assuming enum values for MODE_BYTE and MODE_PAGE? Better use
explicit comparison with: rect->mode == MODE_PAGE ?
> + uint32_t bo_size = ALIGN(blocksize * rect->height, xe_get_default_alignment(fd));
> intel_ctx_t *ctx;
>
> src_handle = xe_bo_create(fd, 0, bo_size, region, 0);
> @@ -140,13 +151,11 @@ static void copy_test(int fd, uint32_t size, enum blt_cmd_type cmd, uint32_t reg
> exec_queue = xe_exec_queue_create(fd, vm, &inst, 0);
> ctx = intel_ctx_xe(fd, vm, exec_queue, 0, 0, 0);
>
> - src_size = bo_size;
> - dst_size = bo_size;
> -
> if (cmd == MEM_COPY)
> - mem_copy(fd, src_handle, dst_handle, ctx, src_size, size, 1, region);
> + mem_copy(fd, src_handle, dst_handle, ctx, TYPE_LINEAR, rect->mode,
> + bo_size, pitch, rect->width, rect->height, region);
> else if (cmd == MEM_SET)
> - mem_set(fd, dst_handle, ctx, dst_size, size, 1, MEM_FILL, region);
> + mem_set(fd, dst_handle, ctx, bo_size, rect->width, 1, MEM_FILL, region);
>
> gem_close(fd, src_handle);
> gem_close(fd, dst_handle);
> @@ -160,7 +169,10 @@ igt_main
> int fd;
> struct igt_collection *set, *regions;
> uint32_t region;
> - uint64_t size[] = {0xFD, 0x369, 0x3FFF, 0xFFFE};
> + struct rect linear[] = { { 0, 0xfd, 1 },
> + { 0, 0x369, 0x1 },
Any reason for using 0x1 here, unlike for others? What about the mode?
> + { 0, 0x3fff, 1 },
> + { 0, 0xfffe, 1 } };
>
> igt_fixture {
> fd = drm_open_driver(DRIVER_XE);
> @@ -170,22 +182,22 @@ igt_main
> DRM_XE_MEM_REGION_CLASS_VRAM);
> }
>
> - for (int i = 0; i < ARRAY_SIZE(size); i++) {
> - igt_subtest_f("mem-copy-linear-0x%"PRIx64"", size[i]) {
> + for (int i = 0; i < ARRAY_SIZE(linear); i++) {
> + igt_subtest_f("mem-copy-linear-0x%x", linear[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, size[i], MEM_COPY, region);
> + copy_test(fd, &linear[i], MEM_COPY, region);
> }
> }
> }
>
> - for (int i = 0; i < ARRAY_SIZE(size); i++) {
> - igt_subtest_f("mem-set-linear-0x%"PRIx64"", size[i]) {
> + 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));
> for_each_variation_r(regions, 1, set) {
> region = igt_collection_get_value(regions, 0);
> - copy_test(fd, size[i], MEM_SET, region);
> + copy_test(fd, &linear[i], MEM_SET, region);
> }
> }
> }
> --
> 2.43.0
>
next prev parent reply other threads:[~2025-05-22 12:06 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-13 18:57 [PATCH i-g-t 00/15] Improve mem-copy/mem-set lib and tests Zbigniew Kempczyński
2025-05-13 18:57 ` [PATCH i-g-t 01/15] lib/xe_spin: limit width/pitch for mem-copy Zbigniew Kempczyński
2025-05-19 7:56 ` Francois Dugast
2025-05-13 18:57 ` [PATCH i-g-t 02/15] tests/xe_render_copy: change width and pitch to be in valid range Zbigniew Kempczyński
2025-05-19 7:56 ` Francois Dugast
2025-05-13 18:57 ` [PATCH i-g-t 03/15] tests/xe_spin_batch: " Zbigniew Kempczyński
2025-05-19 7:57 ` Francois Dugast
2025-05-13 18:57 ` [PATCH i-g-t 04/15] tests/xe_copy_basic: use non-zero pitch Zbigniew Kempczyński
2025-05-19 7:57 ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 05/15] lib/intel_cmds_info: rename M to TYPE in blt_memop_type Zbigniew Kempczyński
2025-05-19 8:03 ` Francois Dugast
2025-05-19 11:17 ` Zbigniew Kempczyński
2025-05-22 11:31 ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 06/15] lib/intel_blt: separate mem-copy and mem-set Zbigniew Kempczyński
2025-05-19 8:35 ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 07/15] lib/intel_cmds_info: add blt_memop_mode (byte/page) Zbigniew Kempczyński
2025-05-19 8:54 ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 08/15] lib/intel_blt: add emit batchbuffer end Zbigniew Kempczyński
2025-05-19 8:55 ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 09/15] lib/intel_blt: use struct instead of inline coding Zbigniew Kempczyński
2025-05-22 11:50 ` Francois Dugast
2025-05-22 11:52 ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 10/15] tests/xe_copy_basic: replace size to rect which keeps objects geometry Zbigniew Kempczyński
2025-05-22 12:05 ` Francois Dugast [this message]
2025-05-22 14:15 ` Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 11/15] tests/xe_copy_basic: add testcase with large buffer size Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 12/15] tests/xe_copy_basic: add subtest to verify mem-copy in pages Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 13/15] lib/intel_blt: add support for matrix mem-copy Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 14/15] tests/xe_copy_basic: add mem-copy matrix subtests Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 15/15] lib/intel_blt: add mem-copy debug facility Zbigniew Kempczyński
2025-05-13 20:26 ` ✓ Xe.CI.BAT: success for Improve mem-copy/mem-set lib and tests Patchwork
2025-05-13 20:44 ` ✓ i915.CI.BAT: " Patchwork
2025-05-13 22:01 ` ✗ Xe.CI.Full: failure " Patchwork
2025-05-14 5:04 ` Zbigniew Kempczyński
2025-05-13 23:12 ` ✗ i915.CI.Full: " Patchwork
2025-05-14 5:05 ` Zbigniew Kempczyński
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=aC8THxeHA6Zurcxe@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox