[igt-dev] [PATCH igt 1/2] Iterate over physical engines

Chris Wilson chris at chris-wilson.co.uk
Wed Feb 21 20:41:40 UTC 2018


Quoting Chris Wilson (2018-02-21 14:45:21)
> diff --git a/tests/gem_sync.c b/tests/gem_sync.c
> index d70515ea..788fafc3 100644
> --- a/tests/gem_sync.c
> +++ b/tests/gem_sync.c
> @@ -86,23 +86,9 @@ sync_ring(int fd, unsigned ring, int num_children, int timeout)
>         int num_engines = 0;
>  
>         if (ring == ~0u) {
> -               const struct intel_execution_engine *e;
> -
> -               for (e = intel_execution_engines; e->name; e++) {
> -                       if (e->exec_id == 0)
> -                               continue;
> -
> -                       if (!gem_has_ring(fd, e->exec_id | e->flags))
> -                               continue;
> -
> -                       if (e->exec_id == I915_EXEC_BSD) {
> -                               int is_bsd2 = e->flags != 0;
> -                               if (gem_has_bsd2(fd) != is_bsd2)
> -                                       continue;
> -                       }
> -
> -                       names[num_engines] = e->name;
> -                       engines[num_engines++] = e->exec_id | e->flags;
> +               for_each_physical_engine(fd, ring) {
> +                       names[num_engines] = e__->name;
> +                       engines[num_engines++] = ring;
>                         if (num_engines == ARRAY_SIZE(engines))
>                                 break;
>                 }
> @@ -200,26 +186,9 @@ store_ring(int fd, unsigned ring, int num_children, int timeout)
>         int num_engines = 0;
>  
>         if (ring == ~0u) {
> -               const struct intel_execution_engine *e;
> -
> -               for (e = intel_execution_engines; e->name; e++) {
> -                       if (e->exec_id == 0)
> -                               continue;
> -
> -                       if (!gem_has_ring(fd, e->exec_id | e->flags))
> -                               continue;
> -
> -                       if (!gem_can_store_dword(fd, e->exec_id | e->flags))
> -                               continue;
> -
> -                       if (e->exec_id == I915_EXEC_BSD) {
> -                               int is_bsd2 = e->flags != 0;
> -                               if (gem_has_bsd2(fd) != is_bsd2)
> -                                       continue;
> -                       }
> -
> -                       names[num_engines] = e->name;
> -                       engines[num_engines++] = e->exec_id | e->flags;
> +               for_each_physical_engine(fd, ring) {
> +                       names[num_engines] = e__->name;
> +                       engines[num_engines++] = ring;
>                         if (num_engines == ARRAY_SIZE(engines))
>                                 break;
>                 }

So I missed the stores inside gem_sync, which require
gem_can_store_dword() protection.
-Chris


More information about the igt-dev mailing list