[Intel-gfx] [RFC i-g-t 1/2] intel-gpu-overlay: Use new class/instance based PMU API

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 2 12:56:29 UTC 2017


Quoting Tvrtko Ursulin (2017-08-02 13:33:11)
> @@ -67,39 +62,53 @@ static int perf_i915_open(int config, int group)
>  
>  static int perf_init(struct gpu_top *gt)
>  {
> -       const char *names[] = {
> -               "RCS",
> -               "BCS",
> -               "VCS0",
> -               "VCS1",
> -               NULL,
> +       struct engine_desc {
> +               unsigned class, instance;
> +               const char *name;
> +       } *d, engines[] = {
> +               { I915_ENGINE_CLASS_RENDER, 0, "rcs0" },
> +               { I915_ENGINE_CLASS_COPY, 0, "bcs0" },
> +               { I915_ENGINE_CLASS_VIDEO, 0, "vcs0" },
> +               { I915_ENGINE_CLASS_VIDEO, 1, "vcs1" },
> +               { I915_ENGINE_CLASS_VIDEO_ENHANCE, 0, "vecs0" },
> +               { 0, 0, NULL }
>         };
> -       int n;
>  
> -       gt->fd = perf_i915_open(I915_PERF_RING_BUSY(0), -1);
> +       d = &engines[0];
> +
> +       gt->fd = perf_i915_open(I915_PMU_ENGINE_BUSY(d->class, d->instance),
> +                               -1);
>         if (gt->fd < 0)
>                 return -1;
>  
> -       if (perf_i915_open(I915_PERF_RING_WAIT(0), gt->fd) >= 0)
> +       if (perf_i915_open(I915_PMU_ENGINE_WAIT(d->class, d->instance),
> +                          gt->fd) >= 0)
>                 gt->have_wait = 1;
>  
> -       if (perf_i915_open(I915_PERF_RING_SEMA(0), gt->fd) >= 0)
> +       if (perf_i915_open(I915_PMU_ENGINE_SEMA(d->class, d->instance),
> +                          gt->fd) >= 0)
>                 gt->have_sema = 1;
>  
> -       gt->ring[0].name = names[0];
> +       gt->ring[0].name = d->name;
>         gt->num_rings = 1;
>  
> -       for (n = 1; names[n]; n++) {
> -               if (perf_i915_open(I915_PERF_RING_BUSY(n), gt->fd) >= 0) {
> +       for (d++; d->name; d++) {
> +               if (perf_i915_open(I915_PMU_ENGINE_BUSY(d->class, d->instance),
> +                                  gt->fd) >= 0) {
>                         if (gt->have_wait &&
> -                           perf_i915_open(I915_PERF_RING_WAIT(n), gt->fd) < 0)
> +                           perf_i915_open(I915_PMU_ENGINE_WAIT(d->class,
> +                                                               d->instance),
> +                                          gt->fd) < 0)
>                                 return -1;
>  
>                         if (gt->have_sema &&
> -                           perf_i915_open(I915_PERF_RING_SEMA(n), gt->fd) < 0)
> +                           perf_i915_open(I915_PMU_ENGINE_SEMA(d->class,
> +                                                               d->instance),
> +                                          gt->fd) < 0)
>                                 return -1;
>  
> -                       gt->ring[gt->num_rings++].name = names[n];
> +                       gt->ring[gt->num_rings++].name = d->name;
> +printf("%s busy = %x\n", d->name, I915_PMU_ENGINE_BUSY(d->class, d->instance));

Debugging stray.
-Chris


More information about the Intel-gfx mailing list