[igt-dev] [PATCH i-g-t 21/93] tests/i915/perf_pmu: Convert to intel_ctx_t

Jason Ekstrand jason at jlekstrand.net
Mon Jun 14 14:50:31 UTC 2021


On Fri, Jun 11, 2021 at 8:49 PM Dixit, Ashutosh
<ashutosh.dixit at intel.com> wrote:
>
> On Wed, 09 Jun 2021 10:36:04 -0700, Jason Ekstrand wrote:
> >
> > @@ -2107,48 +2130,48 @@ igt_main
> >        * Test that a single engine metric can be initialized or it
> >        * is correctly rejected.
> >        */
> > -     test_each_engine("init-busy", fd, e)
> > +     test_each_engine("init-busy", fd, ctx, e)
> >               init(fd, e, I915_SAMPLE_BUSY);
> >
> > -     test_each_engine("init-wait", fd, e)
> > +     test_each_engine("init-wait", fd, ctx, e)
> >               init(fd, e, I915_SAMPLE_WAIT);
> >
> > -     test_each_engine("init-sema", fd, e)
> > +     test_each_engine("init-sema", fd, ctx, e)
> >               init(fd, e, I915_SAMPLE_SEMA);
>
> To be completely equivalent to the previous code it seems we should be
> passing in ctx into init() so that ctx->id can be passed into
> gem_context_has_engine() instead of id 0. Since only ctx has all engines
> and ctx 0 only has legacy engines (unlike previous code where ctx 0 had all
> engines).

Yup.  Fixed.


> >       /**
> >        * Check render nodes are counted.
> >        */
> >       igt_subtest_group {
> >               int render_fd = -1;
> > +             const intel_ctx_t *render_ctx = NULL;
> >
> >               igt_fixture {
> >                       render_fd = __drm_open_driver_render(DRIVER_INTEL);
> >                       igt_require_gem(render_fd);
> > +                     render_ctx = intel_ctx_create_all_physical(render_fd);
> >
> >                       gem_quiescent_gpu(fd);
> >               }
> >
> > -             test_each_engine("render-node-busy", render_fd, e)
> > -                     single(render_fd, e, TEST_BUSY);
> > -             test_each_engine("render-node-busy-idle", render_fd, e)
> > -                     single(render_fd, e, TEST_BUSY | TEST_TRAILING_IDLE);
> > +             test_each_engine("render-node-busy", render_fd, ctx, e)
>
> Shouldn't this be render_ctx instead of ctx?

Yup.  Didn't break anything because both drm FDs enumerate the same
engines but it's technically wrong.

> > +                     single(render_fd, render_ctx, e, TEST_BUSY);
> > +             test_each_engine("render-node-busy-idle", render_fd, ctx, e)
>
> Shouldn't this be render_ctx instead of ctx?

Fixed both.


More information about the igt-dev mailing list