From: Ramalingam C <ramalingam.c@intel.com>
To: igt-dev@lists.freedesktop.org, tvrtko.ursulin@linux.intel.com,
andi@etezian.org
Subject: [igt-dev] [RFC v2 23/43] tests/i915/gem_exec_nop: use the gem_engine_topology library
Date: Fri, 21 Jun 2019 15:33:25 +0530 [thread overview]
Message-ID: <20190621100345.20019-24-ramalingam.c@intel.com> (raw)
In-Reply-To: <20190621100345.20019-1-ramalingam.c@intel.com>
Replace the legacy for_each_engine* defines with the ones
implemented in the gem_engine_topology library.
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
tests/i915/gem_exec_nop.c | 119 ++++++++++++++++++++------------------
1 file changed, 63 insertions(+), 56 deletions(-)
diff --git a/tests/i915/gem_exec_nop.c b/tests/i915/gem_exec_nop.c
index 8922685af357..937ec01433b4 100644
--- a/tests/i915/gem_exec_nop.c
+++ b/tests/i915/gem_exec_nop.c
@@ -66,7 +66,8 @@ static double elapsed(const struct timespec *start, const struct timespec *end)
(end->tv_nsec - start->tv_nsec)*1e-9);
}
-static double nop_on_ring(int fd, uint32_t handle, unsigned ring_id,
+static double nop_on_ring(int fd, uint32_t handle,
+ const struct intel_execution_engine2 *e,
int timeout, unsigned long *out)
{
struct drm_i915_gem_execbuffer2 execbuf;
@@ -80,11 +81,11 @@ static double nop_on_ring(int fd, uint32_t handle, unsigned ring_id,
memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = to_user_pointer(&obj);
execbuf.buffer_count = 1;
- execbuf.flags = ring_id;
+ execbuf.flags = e->flags;
execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
if (__gem_execbuf(fd, &execbuf)) {
- execbuf.flags = ring_id;
+ execbuf.flags = e->flags;
gem_execbuf(fd, &execbuf);
}
intel_detect_and_clear_missed_interrupts(fd);
@@ -104,7 +105,8 @@ static double nop_on_ring(int fd, uint32_t handle, unsigned ring_id,
return elapsed(&start, &now);
}
-static void poll_ring(int fd, unsigned engine, const char *name, int timeout)
+static void poll_ring(int fd, const struct intel_execution_engine2 *e,
+ const char *name, int timeout)
{
const int gen = intel_gen(intel_get_drm_devid(fd));
const uint32_t MI_ARB_CHK = 0x5 << 23;
@@ -121,8 +123,8 @@ static void poll_ring(int fd, unsigned engine, const char *name, int timeout)
if (gen == 4 || gen == 5)
flags |= I915_EXEC_SECURE;
- gem_require_ring(fd, engine);
- igt_require(gem_can_store_dword(fd, engine));
+ gem_require_ring(fd, e->flags);
+ igt_require(gem_class_can_store_dword(fd, e->class));
memset(&obj, 0, sizeof(obj));
obj.handle = gem_create(fd, 4096);
@@ -186,7 +188,7 @@ static void poll_ring(int fd, unsigned engine, const char *name, int timeout)
memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = to_user_pointer(&obj);
execbuf.buffer_count = 1;
- execbuf.flags = engine | flags;
+ execbuf.flags = e->flags | flags;
cycles = 0;
do {
@@ -222,7 +224,8 @@ static void poll_sequential(int fd, const char *name, int timeout)
struct drm_i915_gem_exec_object2 obj[2];
struct drm_i915_gem_relocation_entry reloc[4], *r;
uint32_t *bbe[2], *state, *batch;
- unsigned engines[16], nengine, engine, flags;
+ unsigned engines[16], nengine, flags;
+ const struct intel_execution_engine2 *e;
struct timespec tv = {};
unsigned long cycles;
uint64_t elapsed;
@@ -233,11 +236,11 @@ static void poll_sequential(int fd, const char *name, int timeout)
flags |= I915_EXEC_SECURE;
nengine = 0;
- for_each_physical_engine(fd, engine) {
- if (!gem_can_store_dword(fd, engine))
+ __for_each_physical_engine(fd, e) {
+ if (!gem_class_can_store_dword(fd, e->class))
continue;
- engines[nengine++] = engine;
+ engines[nengine++] = e->flags;
}
igt_require(nengine);
@@ -342,20 +345,22 @@ static void poll_sequential(int fd, const char *name, int timeout)
}
static void single(int fd, uint32_t handle,
- unsigned ring_id, const char *ring_name)
+ const struct intel_execution_engine2 *e,
+ const char *ring_name)
{
double time;
unsigned long count;
- gem_require_ring(fd, ring_id);
+ gem_require_ring(fd, e->flags);
- time = nop_on_ring(fd, handle, ring_id, 20, &count);
+ time = nop_on_ring(fd, handle, e, 20, &count);
igt_info("%s: %'lu cycles: %.3fus\n",
ring_name, count, time*1e6 / count);
}
static double
-stable_nop_on_ring(int fd, uint32_t handle, unsigned int engine,
+stable_nop_on_ring(int fd, uint32_t handle,
+ const struct intel_execution_engine2 *e,
int timeout, int reps)
{
igt_stats_t s;
@@ -370,7 +375,7 @@ stable_nop_on_ring(int fd, uint32_t handle, unsigned int engine,
unsigned long count;
double time;
- time = nop_on_ring(fd, handle, engine, timeout, &count);
+ time = nop_on_ring(fd, handle, e, timeout, &count);
igt_stats_push_float(&s, time / count);
}
@@ -432,20 +437,20 @@ static void parallel(int fd, uint32_t handle, int timeout)
unsigned engines[16];
const char *names[16];
unsigned nengine;
- unsigned engine;
+ const struct intel_execution_engine2 *e;
unsigned long count;
double time, sum;
sum = 0;
nengine = 0;
- for_each_physical_engine(fd, engine) {
- engines[nengine] = engine;
- names[nengine] = e__->name;
+ __for_each_physical_engine(fd, e) {
+ engines[nengine] = e->flags;
+ names[nengine] = e->name;
nengine++;
- time = nop_on_ring(fd, handle, engine, 1, &count) / count;
+ time = nop_on_ring(fd, handle, e, 1, &count) / count;
sum += time;
- igt_debug("%s: %.3fus\n", e__->name, 1e6*time);
+ igt_debug("%s: %.3fus\n", e->name, 1e6*time);
}
igt_require(nengine);
igt_info("average (individually): %.3fus\n", sum/nengine*1e6);
@@ -491,25 +496,25 @@ static void series(int fd, uint32_t handle, int timeout)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 obj;
+ const struct intel_execution_engine2 *e;
struct timespec start, now, sync;
unsigned engines[16];
unsigned nengine;
- unsigned engine;
unsigned long count;
double time, max = 0, min = HUGE_VAL, sum = 0;
const char *name;
nengine = 0;
- for_each_physical_engine(fd, engine) {
- time = nop_on_ring(fd, handle, engine, 1, &count) / count;
+ __for_each_physical_engine(fd, e) {
+ time = nop_on_ring(fd, handle, e, 1, &count) / count;
if (time > max) {
- name = e__->name;
+ name = e->name;
max = time;
}
if (time < min)
min = time;
sum += time;
- engines[nengine++] = engine;
+ engines[nengine++] = e->flags;
}
igt_require(nengine);
igt_info("Maximum execution latency on %s, %.3fus, min %.3fus, total %.3fus per cycle, average %.3fus\n",
@@ -582,11 +587,12 @@ static void sequential(int fd, uint32_t handle, unsigned flags, int timeout)
const int ncpus = flags & FORKED ? sysconf(_SC_NPROCESSORS_ONLN) : 1;
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 obj[2];
+ const struct intel_execution_engine2 *e;
unsigned engines[16];
unsigned nengine;
double *results;
double time, sum;
- unsigned n;
+ int n;
gem_require_contexts(fd);
@@ -595,14 +601,14 @@ static void sequential(int fd, uint32_t handle, unsigned flags, int timeout)
nengine = 0;
sum = 0;
- for_each_physical_engine(fd, n) {
+ __for_each_physical_engine(fd, e) {
unsigned long count;
- time = nop_on_ring(fd, handle, n, 1, &count) / count;
+ time = nop_on_ring(fd, handle, e, 1, &count) / count;
sum += time;
- igt_debug("%s: %.3fus\n", e__->name, 1e6*time);
+ igt_debug("%s: %.3fus\n", e->name, 1e6*time);
- engines[nengine++] = n;
+ engines[nengine++] = e->flags;
}
igt_require(nengine);
igt_info("Total (individual) execution latency %.3fus per cycle\n",
@@ -710,10 +716,11 @@ static bool fence_wait(int fence)
}
static void fence_signal(int fd, uint32_t handle,
- unsigned ring_id, const char *ring_name,
- int timeout)
+ const struct intel_execution_engine2 *e,
+ const char *ring_name, int timeout)
{
#define NFENCES 512
+ const struct intel_execution_engine2 *other;
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 obj;
struct timespec start, now;
@@ -725,12 +732,12 @@ static void fence_signal(int fd, uint32_t handle,
igt_require(gem_has_exec_fence(fd));
nengine = 0;
- if (ring_id == ALL_ENGINES) {
- for_each_physical_engine(fd, n)
- engines[nengine++] = n;
+ if (!e) {
+ __for_each_physical_engine(fd, other)
+ engines[nengine++] = other->flags;
} else {
- gem_require_ring(fd, ring_id);
- engines[nengine++] = ring_id;
+ gem_require_ring(fd, e->flags);
+ engines[nengine++] = e->flags;
}
igt_require(nengine);
@@ -754,14 +761,14 @@ static void fence_signal(int fd, uint32_t handle,
clock_gettime(CLOCK_MONOTONIC, &start);
do {
for (int loop = 0; loop < 1024; loop++) {
- for (int e = 0; e < nengine; e++) {
+ for (int i = 0; i < nengine; i++) {
if (fences[n] != -1) {
igt_assert(fence_wait(fences[n]));
close(fences[n]);
}
execbuf.flags &= ~ENGINE_FLAGS;
- execbuf.flags |= engines[e];
+ execbuf.flags |= engines[i];
gem_execbuf_wr(fd, &execbuf);
/* Enable signaling by doing a poll() */
@@ -787,7 +794,8 @@ static void fence_signal(int fd, uint32_t handle,
}
static void preempt(int fd, uint32_t handle,
- unsigned ring_id, const char *ring_name)
+ const struct intel_execution_engine2 *e,
+ const char *ring_name)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 obj;
@@ -795,7 +803,7 @@ static void preempt(int fd, uint32_t handle,
unsigned long count;
uint32_t ctx[2];
- gem_require_ring(fd, ring_id);
+ gem_require_ring(fd, e->flags);
ctx[0] = gem_context_create(fd);
gem_context_set_priority(fd, ctx[0], MIN_PRIO);
@@ -809,11 +817,11 @@ static void preempt(int fd, uint32_t handle,
memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = to_user_pointer(&obj);
execbuf.buffer_count = 1;
- execbuf.flags = ring_id;
+ execbuf.flags = e->flags;
execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
if (__gem_execbuf(fd, &execbuf)) {
- execbuf.flags = ring_id;
+ execbuf.flags = e->flags;
gem_execbuf(fd, &execbuf);
}
execbuf.rsvd1 = ctx[1];
@@ -825,7 +833,7 @@ static void preempt(int fd, uint32_t handle,
igt_spin_t *spin =
__igt_spin_new(fd,
.ctx = ctx[0],
- .engine = ring_id);
+ .engine = e->flags);
for (int loop = 0; loop < 1024; loop++)
gem_execbuf(fd, &execbuf);
@@ -846,7 +854,7 @@ static void preempt(int fd, uint32_t handle,
igt_main
{
- const struct intel_execution_engine *e;
+ const struct intel_execution_engine2 *e;
uint32_t handle = 0;
int device = -1;
@@ -873,15 +881,15 @@ igt_main
igt_subtest("basic-sequential")
sequential(device, handle, 0, 5);
- for (e = intel_execution_engines; e->name; e++) {
+ __for_each_physical_engine(device, e) {
igt_subtest_f("%s", e->name)
- single(device, handle, e->exec_id | e->flags, e->name);
+ single(device, handle, e, e->name);
igt_subtest_f("signal-%s", e->name)
- fence_signal(device, handle, e->exec_id | e->flags, e->name, 5);
+ fence_signal(device, handle, e, e->name, 5);
}
igt_subtest("signal-all")
- fence_signal(device, handle, ALL_ENGINES, "all", 150);
+ fence_signal(device, handle, NULL, "all", 150);
igt_subtest("series")
series(device, handle, 150);
@@ -908,9 +916,9 @@ igt_main
igt_require(gem_scheduler_has_preemption(device));
}
- for (e = intel_execution_engines; e->name; e++) {
+ __for_each_physical_engine(device, e) {
igt_subtest_f("preempt-%s", e->name)
- preempt(device, handle, e->exec_id | e->flags, e->name);
+ preempt(device, handle, e, e->name);
}
}
@@ -919,11 +927,10 @@ igt_main
igt_device_set_master(device);
}
- for (e = intel_execution_engines; e->name; e++) {
+ __for_each_physical_engine(device, e) {
/* Requires master for STORE_DWORD on gen4/5 */
igt_subtest_f("poll-%s", e->name)
- poll_ring(device,
- e->exec_id | e->flags, e->name, 20);
+ poll_ring(device, e, e->name, 20);
}
igt_subtest("poll-sequential")
--
2.19.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-06-21 10:01 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 10:03 [igt-dev] [RFC v2 00/43] Upgrading the Engine discovery Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 01/43] test/i915: gem_bad_reloc: use the gem_engine_topology library Ramalingam C
2019-06-21 10:02 ` Chris Wilson
2019-06-21 10:05 ` Tvrtko Ursulin
2019-06-21 10:51 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 02/43] test/i915: gem_exec_async: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 03/43] test/i915: gem_exec_capture: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 04/43] test/i915: gem_exec_params: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 05/43] lib/i915: Helper func for engine class to exec_flag Ramalingam C
2019-06-21 10:49 ` Tvrtko Ursulin
2019-06-21 12:52 ` Ramalingam C
2019-06-25 11:43 ` Andi Shyti
2019-06-21 10:03 ` [igt-dev] [RFC v2 06/43] test/prime_vgem: use the gem_engine_topology library Ramalingam C
2019-06-21 10:08 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 07/43] tests/i915/gem_exec_reuse: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 08/43] tests/i915/gem_sync: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 09/43] tests/i915/gem_busy: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 10/43] tests/i915/gem_concurrent_all: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 11/43] tests/i915/gem_cs_prefetch: " Ramalingam C
2019-06-21 10:11 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 12/43] tests/i915/gem_ctx_create: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 13/43] tests/i915/gem_ctx_isolation: " Ramalingam C
2019-06-28 22:12 ` Stimson, Dale B
2019-06-21 10:03 ` [igt-dev] [RFC v2 14/43] tests/i915/gem_ctx_switch: " Ramalingam C
2019-06-21 10:14 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 15/43] tests/i915/gem_ctx_thrash: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 16/43] tests/i915/gem_eio: " Ramalingam C
2019-06-21 10:20 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 17/43] tests/i915/gem_exec_await: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 18/43] tests/i915/gem_exec_create: " Ramalingam C
2019-06-21 10:21 ` Chris Wilson
2019-06-25 12:17 ` Andi Shyti
2019-06-21 10:03 ` [igt-dev] [RFC v2 19/43] tests/i915/gem_exec_fence: " Ramalingam C
2019-06-21 10:22 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 20/43] tests/i915/gem_exec_flush: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 21/43] tests/i915/gem_exec_gttfill: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 22/43] tests/i915/gem_exec_latency: " Ramalingam C
2019-06-21 10:03 ` Ramalingam C [this message]
2019-06-21 10:23 ` [igt-dev] [RFC v2 23/43] tests/i915/gem_exec_nop: " Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 24/43] tests/i915/gem_exec_reloc: " Ramalingam C
2019-06-21 10:24 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 25/43] tests/i915/gem_exec_schedule: " Ramalingam C
2019-06-21 10:25 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 26/43] tests/i915/gem_exec_suspend: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 27/43] tests/i915/gem_exec_whisper: " Ramalingam C
2019-06-21 10:26 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 28/43] tests/i915/gem_mocs_settings: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 29/43] tests/i915/gem_reset_stats: " Ramalingam C
2019-06-21 10:29 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 30/43] tests/i915/gem_ring_sync_loop: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 31/43] tests/i915/gem_ringfill: " Ramalingam C
2019-06-21 10:29 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 32/43] tests/i915/gem_shrink: " Ramalingam C
2019-06-21 10:30 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 33/43] tests/i915/gem_spin_batch: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 34/43] tests/i915/gem_storedw_loop: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 35/43] tests/i915/gem_userptr_blits: " Ramalingam C
2019-06-21 10:32 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 36/43] tests/i915/i915_hangman: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 37/43] tests/i915/i915_module_load: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 38/43] tests/kms_busy: " Ramalingam C
2019-06-21 10:35 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 39/43] tests/prime_busy: " Ramalingam C
2019-06-21 10:36 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 40/43] tests/amdgpu/amd_prime: " Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 41/43] tests/i915/gem_ctx_shared: " Ramalingam C
2019-06-21 10:37 ` Chris Wilson
2019-06-21 10:03 ` [igt-dev] [RFC v2 42/43] lib: replace the legacy funcs with gem_engine_topology libraries Ramalingam C
2019-06-21 10:03 ` [igt-dev] [RFC v2 43/43] lib/gem_engine_topology: rename the macros Ramalingam C
2019-06-21 10:42 ` [igt-dev] ✓ Fi.CI.BAT: success for Upgrading the Engine discovery Patchwork
2019-06-21 16:12 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-06-28 22:25 ` [igt-dev] ✗ Fi.CI.BAT: failure for Upgrading the Engine discovery (rev2) 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=20190621100345.20019-24-ramalingam.c@intel.com \
--to=ramalingam.c@intel.com \
--cc=andi@etezian.org \
--cc=igt-dev@lists.freedesktop.org \
--cc=tvrtko.ursulin@linux.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