From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BEDBC3ABC3 for ; Tue, 13 May 2025 18:59:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 005FD10E5EB; Tue, 13 May 2025 18:59:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="nMLLoRKB"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 21D4910E5EB for ; Tue, 13 May 2025 18:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1747162758; x=1778698758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XNBwx3s0oOAbS6Z7cKQp/2Km0G5vo04WqPLNNXhFgEs=; b=nMLLoRKBli/GibQLQYJgmWbnv9xEGCgTjy/lZuC3dqqNfd1MVad/vbEU ebigkITBIZMXHS16zq5EWRjpMKWWlOWZgY4rUIn4OGuzzLZfSjcP8uDmu 6rjonu5dlF1loSzRKT1Z88qhqagIXuZzqlJWOSazFGXhMGDE/04TwFjWN hKX2xDL9jWEQwSH7l5/3osnM6jvbSQ6YurjSzNXDWjQYiVpBLbkhEzW9b A6gQh3ZR+nC2dvV9JGjfUdxH1l1lQT2JfeqFj6ybrtNBK9VplE1RCXacl +A8SEjgt9aVWauu/+cG6Eaoqkps68XGoGAZwYDEjwzD1b+8qjtV5O3x1f A==; X-CSE-ConnectionGUID: KCWPq5SjQXKQfvQq79OfUw== X-CSE-MsgGUID: zeAJoeBDT9+aB1hOx60Xag== X-IronPort-AV: E=McAfee;i="6700,10204,11432"; a="60428203" X-IronPort-AV: E=Sophos;i="6.15,286,1739865600"; d="scan'208";a="60428203" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2025 11:59:13 -0700 X-CSE-ConnectionGUID: axPduNXWRdq+oTnv0XBHBA== X-CSE-MsgGUID: iNCoT9gtSmWpKJw7g8i3cA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,286,1739865600"; d="scan'208";a="137841087" Received: from pgcooper-mobl3.ger.corp.intel.com (HELO localhost) ([10.245.245.60]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2025 11:59:11 -0700 From: =?UTF-8?q?Zbigniew=20Kempczy=C5=84ski?= To: igt-dev@lists.freedesktop.org Cc: =?UTF-8?q?Zbigniew=20Kempczy=C5=84ski?= , Francois Dugast Subject: [PATCH i-g-t 14/15] tests/xe_copy_basic: add mem-copy matrix subtests Date: Tue, 13 May 2025 20:58:09 +0200 Message-ID: <20250513185811.897232-15-zbigniew.kempczynski@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250513185811.897232-1-zbigniew.kempczynski@intel.com> References: <20250513185811.897232-1-zbigniew.kempczynski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" Verify intel_blt is able to properly copy matrix from one buffer to another. Signed-off-by: Zbigniew KempczyƄski Cc: Francois Dugast --- tests/intel/xe_copy_basic.c | 52 +++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/tests/intel/xe_copy_basic.c b/tests/intel/xe_copy_basic.c index 7cd21131e0..7f52a6f7be 100644 --- a/tests/intel/xe_copy_basic.c +++ b/tests/intel/xe_copy_basic.c @@ -62,6 +62,19 @@ struct rect { * @17: 17 */ +/** + * + * SUBTEST: mem-matrix-copy-%s + * Description: Test validates MEM_COPY command, it takes various + * parameters needed for the filling batch buffer for MEM_COPY command + * with size %arg[1]. + * Test category: functionality test + * + * arg[1]: + * @2x2: 2x2 + * @200x127: 200x127 + */ + 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, @@ -79,13 +92,17 @@ mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ct uint8_t *psrc, *pdst; int result, i; + igt_debug("size: %u, pitch: %u, width: %u, height: %u (type: %d, mode: %d)\n", + size, pitch, width, height, type, mode); + bb = xe_bo_create(fd, 0, bb_size, region, 0); blt_mem_copy_init(fd, &mem, mode, type); - blt_set_mem_object(&mem.src, src_handle, size, width, width, height, + blt_set_mem_object(&mem.src, src_handle, size, pitch, width, height, region, src_mocs, DEFAULT_PAT_INDEX, COMPRESSION_DISABLED); - blt_set_mem_object(&mem.dst, dst_handle, size, width, width, height, + blt_set_mem_object(&mem.dst, dst_handle, size, pitch, 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; @@ -112,8 +129,20 @@ mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ct break; } } - } else { + } else if (type == TYPE_LINEAR && mode == MODE_PAGE) { result = memcmp(psrc, pdst, pitch << 8); + } else { + result = 0; + + for (i = 0; i < pitch * height; i++) { + if (i % pitch > width && pdst[i] != 0) { + result = -1; + break; + } else if (i % pitch < width && psrc[i] != pdst[i]) { + result = -1; + break; + } + } } intel_allocator_bind(ahnd, 0, 0); @@ -190,8 +219,10 @@ static void copy_test(int fd, struct rect *rect, enum blt_cmd_type cmd, uint32_t ctx = intel_ctx_xe(fd, vm, exec_queue, 0, 0, 0); if (cmd == MEM_COPY) - mem_copy(fd, src_handle, dst_handle, ctx, TYPE_LINEAR, rect->mode, - bo_size, pitch, rect->width, rect->height, region); + mem_copy(fd, src_handle, dst_handle, ctx, + rect->height > 1 ? TYPE_MATRIX : TYPE_LINEAR, + rect->mode, + bo_size, pitch, rect->width, rect->height, region); else if (cmd == MEM_SET) mem_set(fd, dst_handle, ctx, bo_size, rect->width, 1, MEM_FILL, region); @@ -214,6 +245,7 @@ igt_main { 0, 0x8fffe, 1 } }; struct rect page[] = { { 0, 1, 1, MODE_PAGE }, { 0, 17, 1, MODE_PAGE }}; + struct rect matrix[] = { { 4, 2, 2 }, { 256, 200, 127 } }; igt_fixture { fd = drm_open_driver(DRIVER_XE); @@ -243,6 +275,16 @@ igt_main } } + for (int i = 0; i < ARRAY_SIZE(matrix); i++) { + igt_subtest_f("mem-matrix-copy-%ux%u", matrix[i].width, matrix[i].height) { + igt_require(blt_has_mem_copy(fd)); + for_each_variation_r(regions, 1, set) { + region = igt_collection_get_value(regions, 0); + copy_test(fd, &matrix[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