[igt-dev] [Intel-gfx] [PATCH i-g-t] tests/perf_pmu: Fix usage of for_each_engine_class_instance

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 29 09:24:49 UTC 2018


Quoting Tvrtko Ursulin (2018-03-29 10:11:28)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Wrong file descriptor was passed to the iterator. This had currently no
> effect, since it wasn't used in the macro, but needs to be fixed.
> 
> At the same time make the macro consistent by checking for engine presence
> like the other iterators do.
> 
> Added __for_each_engine_class_instance which does not check for engine
> presence and so is useful for enumerating all possible engines - like for
> instance for subtest enumeration.
> 
> And another 'wrong fd used' fixlet in the render node subtests.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Reported-by: Michel Thierry <michel.thierry at intel.com>
> Cc: Michel Thierry <michel.thierry at intel.com>
> ---
>  lib/igt_gt.h     | 12 +++++++-----
>  tests/perf_pmu.c | 30 ++++++++++--------------------
>  2 files changed, 17 insertions(+), 25 deletions(-)
> 
> diff --git a/lib/igt_gt.h b/lib/igt_gt.h
> index a517ed7b29a0..d44b7552f3c4 100644
> --- a/lib/igt_gt.h
> +++ b/lib/igt_gt.h
> @@ -100,11 +100,6 @@ extern const struct intel_execution_engine2 {
>         int instance;
>  } intel_execution_engines2[];
>  
> -#define for_each_engine_class_instance(fd__, e__) \
> -       for ((e__) = intel_execution_engines2;\
> -            (e__)->name; \
> -            (e__)++)
> -
>  unsigned int
>  gem_class_instance_to_eb_flags(int gem_fd,
>                                enum drm_i915_gem_engine_class class,
> @@ -122,4 +117,11 @@ void gem_require_engine(int gem_fd,
>         igt_require(gem_has_engine(gem_fd, class, instance));
>  }
>  
> +#define __for_each_engine_class_instance(fd__, 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))

Ok.

Conversions made sense.
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list