Re: [igt-dev] [PATCH v19 2/6] lib/i915: add gem_engine_topology library and for_each loop definition

Andi Shyti
2019-04-08T18:22:02Z

Hi Tvrtko,

I forgot to answer to this one,

> > +struct intel_execution_engine2
> > +*intel_get_current_engine(struct intel_engine_data *ed)
> > +{
>
> Our coding style is
>
> type *
> func_name(..)

Yes.

> (Take care of all instances in source and header.)

You know I might forget :)

> > + if (igt_only_list_subtests())
> > + return -EPERM;
>
> Puzzling choice of errno, not that it matters, but I am tempted to suggest
> -ENODEV.

I will can change it to ENODEV. It looked more appropriate
because if we fall into this case it doesn't mean that there is
no device, but that any ioctl to the device is "forbidden".

But, OK, I don't really mind.

> > + if (!igt_only_list_subtests()) {
> > + __e2->flags = gem_class_instance_to_eb_flags(fd,
> > + e2->class, e2->instance);
>
> Would it make sense to "poison" flags with like -1 (when listing subtests)
> so any mistakes would never have a chance to work?

yes, makes sense.

> > +/*
> > + * Limit what we support for simplicity due limitation in how much we
> > + * can address via execbuf2.
> > + */
> > +#define SIZEOF_CTX_PARAM offsetof(struct i915_context_param_engines, \
> > + class_instance[GEM_MAX_ENGINES])
> > +#define SIZEOF_QUERY offsetof(struct drm_i915_query_engine_info, \
> > + engines[GEM_MAX_ENGINES])
>
> Do you need these two in the header file?

You defined the same in your "fixup" patch, so that I thought to
define i once and here.

> > +#define GEM_MAX_ENGINES I915_EXEC_RING_MASK + 1
> > +
> > +struct intel_engine_data {
> > + uint32_t nengines;
> > + uint32_t n;
> > + int error;
>
> Unused?

It's a leftover from one of the previous reworks, it was added to
check in the for_each whether I was receiving more engines than
the limit.

I'll remove it.

> Coding style and question against the header file are the only real ones
> left. Otherwise looks good.
>
> Regards,

Thanks!
Andi