From: Andi Shyti <andi.shyti@intel.com>
To: IGT dev <igt-dev@lists.freedesktop.org>
Cc: Andi Shyti <andi@etezian.org>
Subject: [igt-dev] [PATCH v13 7/9] lib/igt_gt: use for_each_engine_class_instance to loop through active engines
Date: Wed, 20 Mar 2019 01:44:39 +0200 [thread overview]
Message-ID: <20190319234441.1449-8-andi.shyti@intel.com> (raw)
In-Reply-To: <20190319234441.1449-1-andi.shyti@intel.com>
Extend the 'for_each_engine_class_instance' so that it can loop
only through active engines.
The 'for_each_engine_class_instance()' define starts its loop
from generating a 'struct intel_engine_data' that contains only
the current engines and it loops through the list.
A new parameter is added which refers to the context, to which
engines ar bound.
For back compatibility the previous version of the loop
definition has been renamed to 'for_each_engine_physical', which
uses the default context 0.
Update tests/perf_pmu.c that uses the
'for_each_engine_physical()' loop.
Signed-off-by: Andi Shyti <andi.shyti@intel.com>
---
lib/igt_gt.h | 11 ++++++++---
tests/perf_pmu.c | 8 ++++----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/lib/igt_gt.h b/lib/igt_gt.h
index 9f28af8cfb5c..691cbb11ee0a 100644
--- a/lib/igt_gt.h
+++ b/lib/igt_gt.h
@@ -118,8 +118,13 @@ void gem_require_engine(int gem_fd,
#define __for_each_engine_class_instance(e__) \
for ((e__) = intel_execution_engines2; (e__)->name; (e__)++)
-#define for_each_engine_class_instance(fd__, e__) \
- for ((e__) = intel_execution_engines2; (e__)->name; (e__)++) \
- for_if (gem_has_engine((fd__), (e__)->class, (e__)->instance))
+#include "i915/gem_engine_topology.h"
+
+#define for_each_engine_class_instance(fd__, ctx__, e__) \
+ for (struct intel_engine_data i__ = intel_init_engine_list(fd__, ctx__); \
+ ((e__) = (i__.n < i__.nengines) ? &i__.engines[i__.n] : NULL); \
+ i__.n++)
+
+#define for_each_engine_physical(f, e) for_each_engine_class_instance(f, 0, e)
#endif /* IGT_GT_H */
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 45291298c021..79adeb2c8f3f 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -434,7 +434,7 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
i = 0;
fd[0] = -1;
- for_each_engine_class_instance(gem_fd, e_) {
+ for_each_engine_physical(gem_fd, e_) {
if (e == e_)
busy_idx = i;
@@ -497,7 +497,7 @@ most_busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
unsigned int idle_idx, i;
i = 0;
- for_each_engine_class_instance(gem_fd, e_) {
+ for_each_engine_physical(gem_fd, e_) {
if (e == e_)
idle_idx = i;
else if (spin)
@@ -554,7 +554,7 @@ all_busy_check_all(int gem_fd, const unsigned int num_engines,
unsigned int i;
i = 0;
- for_each_engine_class_instance(gem_fd, e) {
+ for_each_engine_physical(gem_fd, e) {
if (spin)
__submit_spin_batch(gem_fd, spin, e, 64);
else
@@ -1683,7 +1683,7 @@ igt_main
igt_require_gem(fd);
igt_require(i915_type_id() > 0);
- for_each_engine_class_instance(fd, e)
+ for_each_engine_physical(fd, e)
num_engines++;
}
--
2.20.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-03-19 23:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 23:44 [igt-dev] [PATCH v13 0/9] new engine discovery interface Andi Shyti
2019-03-19 23:44 ` [igt-dev] [PATCH v13 1/9] lib/igt_gt: remove unnecessary argument Andi Shyti
2019-03-19 23:44 ` [igt-dev] [PATCH v13 2/9] lib: ioctl_wrappers: reach engines by index as well Andi Shyti
2019-03-20 9:14 ` Chris Wilson
2019-03-19 23:44 ` [igt-dev] [PATCH v13 3/9] lib: move gem_context_has_engine from ioctl_wrappers to gem_context Andi Shyti
2019-03-19 23:44 ` [igt-dev] [PATCH v13 4/9] include/drm-uapi: import i915_drm.h header file Andi Shyti
2019-03-19 23:44 ` [igt-dev] [PATCH v13 5/9] lib: igt_gt: use flags in intel_execution_engines2 Andi Shyti
2019-03-20 9:48 ` Tvrtko Ursulin
2019-03-19 23:44 ` [igt-dev] [PATCH v13 6/9] lib/i915: add gem_engine_topology library Andi Shyti
2019-03-20 9:47 ` Tvrtko Ursulin
2019-03-20 10:49 ` Andi Shyti
2019-03-20 11:10 ` Tvrtko Ursulin
2019-03-20 11:21 ` Andi Shyti
2019-03-20 9:56 ` Chris Wilson
2019-03-20 10:49 ` Andi Shyti
2019-03-20 10:59 ` Chris Wilson
2019-03-20 11:13 ` Andi Shyti
2019-03-20 11:18 ` Chris Wilson
2019-03-20 11:35 ` Andi Shyti
2019-03-19 23:44 ` Andi Shyti [this message]
2019-03-20 10:04 ` [igt-dev] [PATCH v13 7/9] lib/igt_gt: use for_each_engine_class_instance to loop through active engines Tvrtko Ursulin
2019-03-20 10:09 ` Chris Wilson
2019-03-20 10:33 ` Tvrtko Ursulin
2019-03-20 10:40 ` Chris Wilson
2019-03-19 23:44 ` [igt-dev] [PATCH v13 8/9] tests: perf_pmu: use the flag value embedded in intel_execution_engines2 Andi Shyti
2019-03-19 23:44 ` [igt-dev] [PATCH v13 9/9] tests: gem_exec_basic: add "exec-ctx" buffer execution demo test Andi Shyti
2019-03-20 0:13 ` [igt-dev] ✓ Fi.CI.BAT: success for new engine discovery interface Patchwork
2019-03-20 9:35 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20190319234441.1449-8-andi.shyti@intel.com \
--to=andi.shyti@intel.com \
--cc=andi@etezian.org \
--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