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] [RFC PATCH v10 3/6] lib/igt_gt: use for_each_engine2 to loop through engines
Date: Thu, 7 Mar 2019 12:27:02 +0000	[thread overview]
Message-ID: <56608e5f-15ae-6544-92f2-0cb4361b364f@linux.intel.com> (raw)
In-Reply-To: <14453ead-dd9a-10f5-5249-79d351379d7f@linux.intel.com>


On 07/03/2019 12:07, Tvrtko Ursulin wrote:
> 
> On 05/03/2019 13:16, Andi Shyti wrote:
>> 'for_each_engine2()' defines a loop through the gpu engines.
>>
>> It can work with both active and pre-defined engines.
>>
>> In case we are looping through active engines (i.e. the running
>> kernel has the query and get/setparam ioctls), the
>> intel_active_engines2 points to an array that contains only the
>> list engines dynamically allocated after having interrogated the
>> driver.
>>
>> While, if we are looping through pre-defined engines,
>> intel_active_engines2 points to the 'intel_execution_engines2'
>> array and works exactly as for_each_engine() but using the
>> new 'struct intel_execution_engine2' data type.
>>
>> Signed-off-by: Andi Shyti <andi.shyti@intel.com>
>> ---
>>   lib/igt_gt.h | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/lib/igt_gt.h b/lib/igt_gt.h
>> index f4bd6c22a81a..f8bdaa62899f 100644
>> --- a/lib/igt_gt.h
>> +++ b/lib/igt_gt.h
>> @@ -30,6 +30,8 @@
>>   #include "i915_drm.h"
>> +#include "i915/gem_engine_topology.h"
>> +
>>   void igt_require_hang_ring(int fd, int ring);
>>   typedef struct igt_hang {
>> @@ -86,6 +88,12 @@ extern const struct intel_execution_engine {
>>            e__++) \
>>           for_if (gem_ring_has_physical_engine(fd__, flags__ = 
>> e__->exec_id | e__->flags))
>> +#define for_each_engine2(fd, ctx) \
>> +        for (struct intel_execution_engine2 *e2__ = \
>> +             gem_set_context_get_engines(fd, ctx); e2__->name; e2__++) \
>> +            for_if (gem_has_engine_topology() || \
>> +                gem_has_engine(fd, e2__->class, e2__->instance))
> 
> gem_has_engine is a legacy hack which shouldn't be used and can 
> hopefully be eliminated by the end of this work.
> 
> I think this iterator should assume ctx engine map has been configured 
> with only available engines so neiher gem_has_engine_topology or 
> gem_has_engine should be needed. Unless I am missing something?

I forgot about the desire to run on old kernels.. blah..

But it still doesn't work since whatever is in the loop will use the 
index and the context may not have one.

Would a helper like gem_get_ctx_engine_flags(fd, ctx, e2, i) solve this?

I think something along those lines was in discussion some time back.

bool gem_get_ctx_engine_flags(...)
{
	if (ctx.has_map, or maybe, if gem_has_engine_topology)
		return i;
	else
		return e2->eb_flags;
}

It would need a comeback of index param to the iterator though.

Regards,

Tvrtko

> 
>> +
>>   bool gem_ring_is_physical_engine(int fd, unsigned int ring);
>>   bool gem_ring_has_physical_engine(int fd, unsigned int ring);
>>
> 
> Regards,
> 
> Tvrtko
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-03-07 12:27 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 13:16 [igt-dev] [RFC PATCH v10 0/6] new engine discovery interface Andi Shyti
2019-03-05 13:16 ` [igt-dev] [RFC PATCH v10 1/6] include/drm-uapi: import i915_drm.h header file Andi Shyti
2019-03-05 13:16 ` [igt-dev] [RFC PATCH v10 2/6] lib/i915: add gem_engine_topology library Andi Shyti
2019-03-05 13:24   ` Chris Wilson
2019-03-07 13:00     ` Andi Shyti
2019-03-07 12:05   ` Tvrtko Ursulin
2019-03-07 13:42     ` Andi Shyti
2019-03-07 14:16       ` Tvrtko Ursulin
2019-03-07 14:59         ` Chris Wilson
2019-03-07 16:25           ` Tvrtko Ursulin
2019-03-05 13:16 ` [igt-dev] [RFC PATCH v10 3/6] lib/igt_gt: use for_each_engine2 to loop through engines Andi Shyti
2019-03-05 13:36   ` Chris Wilson
2019-03-07 12:07   ` Tvrtko Ursulin
2019-03-07 12:27     ` Tvrtko Ursulin [this message]
2019-03-07 13:52       ` Andi Shyti
2019-03-08  7:09   ` Tvrtko Ursulin
2019-03-05 13:16 ` [igt-dev] [RFC PATCH v10 4/6] lib: ioctl_wrappers: reach engines by index as well Andi Shyti
2019-03-05 13:27   ` Chris Wilson
2019-03-07 12:10   ` Tvrtko Ursulin
2019-03-07 13:54     ` Andi Shyti
2019-03-07 14:27       ` Tvrtko Ursulin
2019-03-07 15:46         ` Andi Shyti
2019-03-07 15:57           ` Andi Shyti
2019-03-07 16:28           ` Tvrtko Ursulin
2019-03-07 17:17             ` Andi Shyti
2019-03-08  6:59               ` Tvrtko Ursulin
2019-03-05 13:16 ` [igt-dev] [RFC PATCH v10 5/6] lib: move gem_context_has_engine from ioctl_wrappers to gem_context Andi Shyti
2019-03-05 13:16 ` [igt-dev] [RFC PATCH v10 6/6] tests: gem_exec_basic: add "exec-ctx" buffer execution demo test Andi Shyti
2019-03-05 14:13 ` [igt-dev] ✓ Fi.CI.BAT: success for new engine discovery interface Patchwork
2019-03-05 15:22 ` [igt-dev] ✓ Fi.CI.IGT: " 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=56608e5f-15ae-6544-92f2-0cb4361b364f@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