public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Andi Shyti <andi.shyti@intel.com>,
	IGT dev <igt-dev@lists.freedesktop.org>
Cc: Andi Shyti <andi@etezian.org>
Subject: Re: [igt-dev] [PATCH v12 6/7] lib/igt_gt: use for_each_engine_class_instance to loop through active engines
Date: Tue, 19 Mar 2019 10:22:20 +0000	[thread overview]
Message-ID: <def420a9-6290-20b7-060a-17d20d54ebc8@linux.intel.com> (raw)
In-Reply-To: <20190318232812.1307-7-andi.shyti@intel.com>


On 18/03/2019 23:28, Andi Shyti wrote:
> 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.
> 
> Update tests/perf_pmu.c that uses the
> 'for_each_engine_class_instance()' loop.
> 
> Signed-off-by: Andi Shyti <andi.shyti@intel.com>
> ---
>   lib/igt_gt.h     |  9 ++++++---
>   tests/perf_pmu.c | 21 +++++++++++----------
>   2 files changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/lib/igt_gt.h b/lib/igt_gt.h
> index 475c0b3c3cc6..22baabce7bb0 100644
> --- a/lib/igt_gt.h
> +++ b/lib/igt_gt.h
> @@ -117,8 +117,11 @@ 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++)
>   
>   #endif /* IGT_GT_H */
> diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
> index 45291298c021..1b02192201e8 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_class_instance(gem_fd, 0, e_) {

How much churn it would be to drop for_each_engine_class_instance and 
convert the for_each_engine_physical macro to use the new scheme?

I am thinking about ending with two macros:

for_each_engine_physical(fd, e) // or not e, if it is in the iterator?

for_each_engine_context(fd, ctx, e) // when tests are using contexts

The former would just be:

#define for_each_engine_physical(fd) for_each_engine_context(fd, 0)

Chris your opinion?

Regards,

Tvrtko

>   		if (e == e_)
>   			busy_idx = i;
>   
> @@ -473,15 +473,16 @@ busy_check_all(int gem_fd, const struct intel_execution_engine2 *e,
>   static void
>   __submit_spin_batch(int gem_fd, igt_spin_t *spin,
>   		    const struct intel_execution_engine2 *e,
> -		    int offset)
> +		    int offset,
> +		    unsigned int i)
>   {
>   	struct drm_i915_gem_execbuffer2 eb = spin->execbuf;
>   
>   	eb.flags &= ~(0x3f | I915_EXEC_BSD_MASK);
> -	eb.flags |= e2ring(gem_fd, e) | I915_EXEC_NO_RELOC;
> +	eb.flags |= I915_EXEC_NO_RELOC;
>   	eb.batch_start_offset += offset;
>   
> -	gem_execbuf(gem_fd, &eb);
> +	gem_context_execbuf(gem_fd, &eb, *e, i, 0);
>   }
>   
>   static void
> @@ -497,11 +498,11 @@ 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_class_instance(gem_fd, 0, e_) {
>   		if (e == e_)
>   			idle_idx = i;
>   		else if (spin)
> -			__submit_spin_batch(gem_fd, spin, e_, 64);
> +			__submit_spin_batch(gem_fd, spin, e_, 64, i + 1);
>   		else
>   			spin = __spin_poll(gem_fd, 0, e2ring(gem_fd, e_));
>   
> @@ -554,9 +555,9 @@ 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_class_instance(gem_fd, 0, e) {
>   		if (spin)
> -			__submit_spin_batch(gem_fd, spin, e, 64);
> +			__submit_spin_batch(gem_fd, spin, e, 64, i + 1);
>   		else
>   			spin = __spin_poll(gem_fd, 0, e2ring(gem_fd, e));
>   
> @@ -1597,7 +1598,7 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
>   
>   				/* Restart the spinbatch. */
>   				__rearm_spin_batch(spin);
> -				__submit_spin_batch(gem_fd, spin, e, 0);
> +				__submit_spin_batch(gem_fd, spin, e, 0, 0);
>   
>   				/* PWM busy sleep. */
>   				loop_busy = igt_nsec_elapsed(&start);
> @@ -1683,7 +1684,7 @@ igt_main
>   		igt_require_gem(fd);
>   		igt_require(i915_type_id() > 0);
>   
> -		for_each_engine_class_instance(fd, e)
> +		for_each_engine_class_instance(fd, 0, e)
>   			num_engines++;
>   	}
>   
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-03-19 10:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 23:28 [igt-dev] [PATCH v12 0/7] new engine discovery interface Andi Shyti
2019-03-18 23:28 ` [igt-dev] [PATCH v12 1/7] lib/igt_gt: remove unnecessary argument Andi Shyti
2019-03-18 23:28 ` [igt-dev] [PATCH v12 2/7] lib: ioctl_wrappers: reach engines by index as well Andi Shyti
2019-03-18 23:28 ` [igt-dev] [PATCH v12 3/7] lib: move gem_context_has_engine from ioctl_wrappers to gem_context Andi Shyti
2019-03-18 23:28 ` [igt-dev] [PATCH v12 4/7] include/drm-uapi: import i915_drm.h header file Andi Shyti
2019-03-18 23:28 ` [igt-dev] [PATCH v12 5/7] lib/i915: add gem_engine_topology library Andi Shyti
2019-03-19  9:43   ` Chris Wilson
2019-03-19 10:00     ` Andi Shyti
2019-03-19 10:18   ` Tvrtko Ursulin
2019-03-19 10:44     ` Andi Shyti
2019-03-19 11:01       ` Tvrtko Ursulin
2019-03-18 23:28 ` [igt-dev] [PATCH v12 6/7] lib/igt_gt: use for_each_engine_class_instance to loop through active engines Andi Shyti
2019-03-19 10:22   ` Tvrtko Ursulin [this message]
2019-03-19 10:26     ` Andi Shyti
2019-03-18 23:28 ` [igt-dev] [PATCH v12 7/7] tests: gem_exec_basic: add "exec-ctx" buffer execution demo test Andi Shyti
2019-03-18 23:33 ` [igt-dev] ✗ Fi.CI.BAT: failure for new engine discovery interface 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=def420a9-6290-20b7-060a-17d20d54ebc8@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=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