All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Andi Shyti <andi.shyti@intel.com>
Cc: IGT dev <igt-dev@lists.freedesktop.org>, Andi Shyti <andi@etezian.org>
Subject: Re: [igt-dev] [RFC PATCH v10 4/6] lib: ioctl_wrappers: reach engines by index as well
Date: Fri, 8 Mar 2019 06:59:51 +0000	[thread overview]
Message-ID: <ab849a82-0e4a-3524-89ed-0e031bcc57f0@linux.intel.com> (raw)
In-Reply-To: <20190307171706.GA8818@intel.intel>


On 07/03/2019 17:17, Andi Shyti wrote:
>> I understand the loop itself works, but I wanted to find out how do I write
>> a test which uses it and actually submits work.
>>
>> for_each_engine2(fd, ctx) {
>> 	...
>> 	eb.flags = ???;
>> 	eb.rsvd1 = ctx;
>>
>> 	gem_execbuf(fd, &eb);
>> }
>>
>> What do I replace ??? with so the test works on old and new kernels?
> 
> I guess it would be:
> 
>    index_map = 0;
>    for_each_engine2(fd, ctx) {
>        ...
>        eb.flags = ++index_map;
>        eb.rsvd1 = ctx;
> 
>        gem_execbuf(fd, &eb);
>    }
> 
> for_each_engine2 is just responsible for iterating through
> engines. (*)
> 
> while for the current api it would be:
> 
>    for_each_engine2(fd, 0) {
>        eb.flags = gem_class_instance_to_eb_flags(fd, e2__->class, e2__->instance));
>        eb.rsvd1 = 0;
>    }

So as I was pointing out it is not possible to write a test which works 
with same code on both old and new kernels? Which makes me ask - what is 
the point of making the iterator backward compatible?

IMHO we either drop the backward compatible goal or make some additions 
to enable writing truly agnostic tests. Maybe along the lines of:

for_each_engine2(fd, ctx, i) {
	...
	gem_set_execbuf_engine(&eb, fd, ctx, e2, i);
	...

    	gem_execbuf(fd, &eb);
}

void gem_set_execbuf_engine(...)
{
	if (gem_has_discovered_engines() /* simple pointer check, no ioctl */) {
		eb->rsvd1 = ctx;
		eb->flags |= i;
	} else {
		eb->flags |= gem_class_instance_to_eb_flags(...);
	}
}

A bit longish parameter list for the helper but I don't have better 
ideas at the moment.

Regards,

Tvrtko

> There definitely are better way for doing the
> for_each_engine(...) but I think this is the most consistent to
> the way things are done now.
> 
> In my opinion, next step would be, indeed, to get rid of all
> legacy and have a single for_each_engine(...) that works with
> everything.
> 
> But for this, at my current understanding, we need some
> re-architecturing of igt (and possibly using dynamic lists of
> engines as Chris pointed out).
> 
> Once this patch gets in, I can start looking at the next steps,
> but in one go, we would get everything in only at "[PATCH v1174]" :)
> 
> Andi
> 
> (*) Some extra code would be required to increment index_map
> into the for_each_engine2(), Chris was suggesting, indeed, an
> iter structure (or we can use some other 'C' tricks that would
> make the code quite unreadable).
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-03-08  6:59 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
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 [this message]
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=ab849a82-0e4a-3524-89ed-0e031bcc57f0@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.