[igt-dev] [PATCH i-g-t 19/77] tests/gem_exec_whisper: Convert to intel_ctx_t
Dixit, Ashutosh
ashutosh.dixit at intel.com
Thu Jun 17 19:40:07 UTC 2021
On Thu, 17 Jun 2021 11:31:08 -0700, Jason Ekstrand wrote:
>
> 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:
> > > @@ -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.
OK, I think the assert is needed because the vm created with
gem_vm_create(fd) cannot be used with intel_ctx_create(fds[n], ...) below.
> > > + local_cfg.vm = gem_vm_create(fd);
> > > + }
> > > + 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