[igt-dev] [PATCH i-g-t 19/77] tests/gem_exec_whisper: Convert to intel_ctx_t

Jason Ekstrand jason at jlekstrand.net
Thu Jun 17 18:31:08 UTC 2021


On Wed, Jun 16, 2021 at 9:17 PM Dixit, Ashutosh
<ashutosh.dixit at intel.com> wrote:
>
> On Mon, 14 Jun 2021 09:36:34 -0700, Jason Ekstrand wrote:
> >
> > @@ -98,6 +101,13 @@ static void init_hang(struct hang *h, int fd)
> >
> >       gen = intel_gen(intel_get_drm_devid(h->fd));
> >
> > +     if (gem_has_contexts(fd)) {
> > +             h->ctx = intel_ctx_create(h->fd, cfg);
>
> Probably could submit against the ctx passed into whisper(), but probably
> doesn't matter so should be ok.
>
> > @@ -221,10 +234,10 @@ static void whisper(int fd, unsigned engine, unsigned flags)
> >               gem_require_contexts(fd);
> >
> >       if (flags & QUEUES)
> > -             igt_require(gem_has_queues(fd));
> > +             igt_require(gem_has_vm(fd));
>
> Don't need to check for I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE support here?

Yeah.  I dropped the SINGLE_TIMELINE.  I didn't think it was helping
with anything but I've restored it.

> > @@ -294,18 +308,20 @@ static void whisper(int fd, unsigned engine, unsigned flags)
> >               igt_assert(loc == sizeof(uint32_t) * i);
> >               batch[++i] = MI_BATCH_BUFFER_END;
> >
> > -             if (flags & CONTEXTS) {
> > -                     for (n = 0; n < 64; n++)
> > -                             contexts[n] = gem_context_clone_with_engines(fd, 0);
> > -             }
> > -             if (flags & QUEUES) {
> > -                     for (n = 0; n < 64; n++)
> > -                             contexts[n] = gem_queue_create(fd);
> > -             }
> >               if (flags & FDS) {
> >                       for (n = 0; n < 64; n++) {
> >                               fds[n] = gem_reopen_driver(fd);
> > -                             gem_context_copy_engines(fd, 0, fds[n], 0);
> > +                     }
> > +             }
> > +             if (flags & (CONTEXTS | QUEUES | FDS)) {
> > +                     local_cfg = ctx->cfg;
> > +                     if (flags & QUEUES) {
> > +                             igt_assert(!(flags & FDS));
>
> Is this assert needed, what is the reason for it?

Because I use fd and not fds[n] below.  Yeah, it's not needed but I
like dropping asserts for assumptions.

> > +                             local_cfg.vm = gem_vm_create(fd);
>
> Don't need to handle I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE here (so
> that contexts share a timeline)?

I've restored it.

--Jason

> > +                     }
> > +                     for (n = 0; n < 64; n++) {
> > +                             int this_fd = (flags & FDS) ? fds[n] : fd;
> > +                             contexts[n] = intel_ctx_create(this_fd, &local_cfg);
> >                       }
> >               }


More information about the igt-dev mailing list