From: Francois Dugast <francois.dugast@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Francois Dugast <francois.dugast@intel.com>
Subject: [PATCH i-g-t 2/5] lib/intel_blt: Allow forcing multiple runs in blt_mem_copy()
Date: Wed, 5 Mar 2025 10:06:12 +0100 [thread overview]
Message-ID: <20250305090743.16894-3-francois.dugast@intel.com> (raw)
In-Reply-To: <20250305090743.16894-1-francois.dugast@intel.com>
Allowing to run the same copy multiple times presents no functional
advantage but it can be used to keep the copy functions busy longer
while other tests are being performed.
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
---
lib/intel_blt.c | 34 +++++++++++++++++++---------------
lib/intel_blt.h | 3 ++-
2 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/lib/intel_blt.c b/lib/intel_blt.c
index 84318a557..315a2e145 100644
--- a/lib/intel_blt.c
+++ b/lib/intel_blt.c
@@ -1815,10 +1815,10 @@ void blt_mem_init(int fd, struct blt_mem_data *mem)
mem->driver = get_intel_driver(fd);
}
-static void emit_blt_mem_copy(int fd, uint64_t ahnd, const struct blt_mem_data *mem)
+static void emit_blt_mem_copy(int fd, uint64_t ahnd, const struct blt_mem_data *mem, int ncopies)
{
uint64_t dst_offset, src_offset;
- int i;
+ int i, j;
uint32_t *batch;
uint32_t optype;
@@ -1831,16 +1831,18 @@ static void emit_blt_mem_copy(int fd, uint64_t ahnd, const struct blt_mem_data *
optype = mem->src.type == M_MATRIX ? 1 << 17 : 0;
i = 0;
- batch[i++] = MEM_COPY_CMD | optype;
- batch[i++] = mem->src.width - 1;
- batch[i++] = mem->src.height - 1;
- batch[i++] = mem->src.pitch - 1;
- batch[i++] = mem->dst.pitch - 1;
- batch[i++] = src_offset;
- batch[i++] = src_offset << 32;
- batch[i++] = dst_offset;
- batch[i++] = dst_offset << 32;
- batch[i++] = mem->src.mocs_index << MEM_COPY_MOCS_SHIFT | mem->dst.mocs_index;
+ for (j = 0; j < ncopies; j++) {
+ batch[i++] = MEM_COPY_CMD | optype;
+ batch[i++] = mem->src.width - 1;
+ batch[i++] = mem->src.height - 1;
+ batch[i++] = mem->src.pitch - 1;
+ batch[i++] = mem->dst.pitch - 1;
+ batch[i++] = src_offset;
+ batch[i++] = src_offset << 32;
+ batch[i++] = dst_offset;
+ batch[i++] = dst_offset << 32;
+ batch[i++] = mem->src.mocs_index << MEM_COPY_MOCS_SHIFT | mem->dst.mocs_index;
+ }
batch[i++] = MI_BATCH_BUFFER_END;
munmap(batch, mem->bb.size);
@@ -1853,6 +1855,7 @@ static void emit_blt_mem_copy(int fd, uint64_t ahnd, const struct blt_mem_data *
* @e: blitter engine for @ctx
* @ahnd: allocator handle
* @blt: blitter data for mem-copy.
+ * @ncopies: how many times copy is run, > 1 can be used to stress the copy function
*
* Function does mem blit between @src and @dst described in @blt object.
*
@@ -1862,7 +1865,8 @@ static void emit_blt_mem_copy(int fd, uint64_t ahnd, const struct blt_mem_data *
int blt_mem_copy(int fd, const intel_ctx_t *ctx,
const struct intel_execution_engine2 *e,
uint64_t ahnd,
- const struct blt_mem_data *mem)
+ const struct blt_mem_data *mem,
+ int ncopies)
{
struct drm_i915_gem_execbuffer2 execbuf = {};
struct drm_i915_gem_exec_object2 obj[3] = {};
@@ -1875,7 +1879,7 @@ int blt_mem_copy(int fd, const intel_ctx_t *ctx,
0, mem->dst.pat_index);
bb_offset = get_offset(ahnd, mem->bb.handle, mem->bb.size, 0);
- emit_blt_mem_copy(fd, ahnd, mem);
+ emit_blt_mem_copy(fd, ahnd, mem, ncopies);
if (mem->driver == INTEL_DRIVER_XE) {
intel_ctx_xe_exec(ctx, ahnd, CANONICAL(bb_offset));
@@ -1944,7 +1948,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);
+ blt_mem_copy(fd, ctx, NULL, ahnd, &mem, 1);
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 4357d70eb..217cade02 100644
--- a/lib/intel_blt.h
+++ b/lib/intel_blt.h
@@ -269,7 +269,8 @@ void blt_mem_init(int fd, struct blt_mem_data *mem);
int blt_mem_copy(int fd, const intel_ctx_t *ctx,
const struct intel_execution_engine2 *e,
uint64_t ahnd,
- const struct blt_mem_data *mem);
+ const struct blt_mem_data *mem,
+ 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);
--
2.43.0
next prev parent reply other threads:[~2025-03-05 9:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 9:06 [PATCH i-g-t 0/5] Stress copy engines during render Francois Dugast
2025-03-05 9:06 ` [PATCH i-g-t 1/5] lib/intel_blt: Promote blt_bo_copy() Francois Dugast
2025-03-19 12:41 ` Thomas Hellström
2025-03-19 19:15 ` Zbigniew Kempczyński
2025-03-05 9:06 ` Francois Dugast [this message]
2025-03-19 12:42 ` [PATCH i-g-t 2/5] lib/intel_blt: Allow forcing multiple runs in blt_mem_copy() Thomas Hellström
2025-03-05 9:06 ` [PATCH i-g-t 3/5] lib/intel_blt: Use blt_mem_copy() to stress copy functions Francois Dugast
2025-03-19 12:46 ` Thomas Hellström
2025-03-19 19:21 ` Zbigniew Kempczyński
2025-03-05 9:06 ` [PATCH i-g-t 4/5] tests/intel/xe_render_copy: Expose render duration Francois Dugast
2025-03-19 12:48 ` Thomas Hellström
2025-03-05 9:06 ` [PATCH i-g-t 5/5] tests/intel/xe_render_copy: Render under copy stress Francois Dugast
2025-03-06 4:30 ` ✓ Xe.CI.BAT: success for Stress copy engines during render (rev2) Patchwork
2025-03-06 4:47 ` ✓ i915.CI.BAT: " Patchwork
2025-03-06 7:00 ` ✗ i915.CI.Full: failure " Patchwork
2025-03-06 10:38 ` ✗ Xe.CI.Full: " Patchwork
2025-03-11 7:31 ` ✓ Xe.CI.BAT: success for Stress copy engines during render (rev3) Patchwork
2025-03-11 8:04 ` ✓ i915.CI.BAT: " Patchwork
2025-03-11 9:24 ` ✗ i915.CI.Full: failure " Patchwork
2025-03-12 1:06 ` ✗ Xe.CI.Full: " Patchwork
2025-03-12 22:53 ` ✗ Xe.CI.BAT: failure for Stress copy engines during render (rev4) Patchwork
2025-03-12 23:04 ` ✓ i915.CI.BAT: success " Patchwork
2025-03-12 23:46 ` ✓ i915.CI.Full: " Patchwork
2025-03-13 14:39 ` ✗ Xe.CI.Full: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2025-03-05 13:57 [PATCH i-g-t 0/5] Stress copy engines during render Francois Dugast
2025-03-05 13:57 ` [PATCH i-g-t 2/5] lib/intel_blt: Allow forcing multiple runs in blt_mem_copy() Francois Dugast
2025-03-06 5:35 ` 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=20250305090743.16894-3-francois.dugast@intel.com \
--to=francois.dugast@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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