[igt-dev] [PATCH i-g-t 17/89] lib/dummyload: Support intel_ctx_t

Jason Ekstrand jason at jlekstrand.net
Wed Jun 9 14:54:46 UTC 2021


On Tue, Jun 1, 2021 at 5:02 AM Zbigniew Kempczyński
<zbigniew.kempczynski at intel.com> wrote:
>
> On Fri, Apr 23, 2021 at 04:47:41PM -0500, Jason Ekstrand wrote:
> > Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> > ---
> >  lib/igt_dummyload.c | 30 ++++++++++++++++++++++--------
> >  lib/igt_dummyload.h |  4 ++++
> >  2 files changed, 26 insertions(+), 8 deletions(-)
> >
> > diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> > index 5a11ec4e..ac83b331 100644
> > --- a/lib/igt_dummyload.c
> > +++ b/lib/igt_dummyload.c
> > @@ -123,16 +123,28 @@ emit_recursive_batch(igt_spin_t *spin,
> >       addr += random() % addr / 2;
> >       addr &= -4096;
> >
> > +     assert(!(opts->ctx && opts->ctx_id));
>
> igt_assert().

Done

> > +
> >       nengine = 0;
> >       if (opts->engine == ALL_ENGINES) {
> >               struct intel_execution_engine2 *engine;
> >
> > -             for_each_context_engine(fd, opts->ctx_id, engine) {
> > -                     if (opts->flags & IGT_SPIN_POLL_RUN &&
> > -                         !gem_class_can_store_dword(fd, engine->class))
> > -                             continue;
> > +             if (opts->ctx) {
> > +                     for_each_ctx_engine(fd, opts->ctx, engine) {
> > +                             if (opts->flags & IGT_SPIN_POLL_RUN &&
> > +                                 !gem_class_can_store_dword(fd, engine->class))
> > +                                     continue;
> >
> > -                     flags[nengine++] = engine->flags;
> > +                             flags[nengine++] = engine->flags;
> > +                     }
> > +             } else {
> > +                     for_each_context_engine(fd, opts->ctx_id, engine) {
> > +                             if (opts->flags & IGT_SPIN_POLL_RUN &&
> > +                                 !gem_class_can_store_dword(fd, engine->class))
> > +                                     continue;
> > +
> > +                             flags[nengine++] = engine->flags;
> > +                     }
> >               }
> >       } else {
> >               flags[nengine++] = opts->engine;
> > @@ -325,7 +337,7 @@ emit_recursive_batch(igt_spin_t *spin,
> >
> >       execbuf->buffers_ptr =
> >               to_user_pointer(obj + (2 - execbuf->buffer_count));
> > -     execbuf->rsvd1 = opts->ctx_id;
> > +     execbuf->rsvd1 = opts->ctx ? opts->ctx->id : opts->ctx_id;
> >
> >       if (opts->flags & IGT_SPIN_FENCE_OUT)
> >               execbuf->flags |= I915_EXEC_FENCE_OUT;
> > @@ -422,8 +434,10 @@ igt_spin_factory(int fd, const struct igt_spin_factory *opts)
> >               struct intel_execution_engine2 e;
> >               int class;
> >
> > -             if (!gem_context_lookup_engine(fd, opts->engine,
> > -                                            opts->ctx_id, &e)) {
> > +             if (opts->ctx) {
> > +                     class = opts->ctx->cfg.engines[opts->engine].engine_class;
> > +             } else if (!gem_context_lookup_engine(fd, opts->engine,
> > +                                                   opts->ctx_id, &e)) {
> >                       class = e.class;
> >               } else {
> >                       gem_require_ring(fd, opts->engine);
> > diff --git a/lib/igt_dummyload.h b/lib/igt_dummyload.h
> > index ad1ce28c..4534d2ca 100644
> > --- a/lib/igt_dummyload.h
> > +++ b/lib/igt_dummyload.h
> > @@ -31,10 +31,12 @@
> >  #include "igt_core.h"
> >  #include "igt_list.h"
> >  #include "i915_drm.h"
> > +#include "intel_ctx.h"
> >
> >  typedef struct igt_spin {
> >       struct igt_list_head link;
> >
> > +
>
> Extra line.

Oops.  Rebase fail.

> Apart of that code looks ok. Fix minor nits and:
>
> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

Thanks!

> --
> Zbigniew
>
> >       uint32_t handle;
> >       uint32_t poll_handle;
> >
> > @@ -62,6 +64,7 @@ typedef struct igt_spin {
> >  /**
> >   * igt_spin_factory_t:
> >   * @ctx_id: GEM context handle
> > + * @ctx: intel_ctx_t context wrapper
> >   * @dependency: GEM object to depend on
> >   * @engine: Flags describing the engine to execute on
> >   * @flags: Set of IGT_SPIN_* flags
> > @@ -71,6 +74,7 @@ typedef struct igt_spin {
> >   */
> >  typedef struct igt_spin_factory {
> >       uint32_t ctx_id;
> > +     const intel_ctx_t *ctx;
> >       uint32_t dependency;
> >       unsigned int engine;
> >       unsigned int flags;
> > --
> > 2.31.1
> >
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list