[igt-dev] [RFC PATCH v10 4/6] lib: ioctl_wrappers: reach engines by index as well

Andi Shyti andi.shyti at intel.com
Thu Mar 7 17:17:06 UTC 2019


> 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;
  }

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).


More information about the igt-dev mailing list