[Intel-gfx] [PATCH v7 3/4] drm/i915/perf: prepare driver to receive multiple ctx handles

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 28 10:23:42 UTC 2020


Quoting Lionel Landwerlin (2020-04-28 11:08:15)
> +static int ctx_id_equal(const void *key, const void *elem)
> +{
> +       const struct i915_perf_context_detail *details = elem;
> +
> +       return ((int)details->id) - *((int *)key);
> +}
> +
> +static inline bool ctx_id_match(struct i915_perf_stream *stream,
> +                               u32 masked_ctx_id)
> +{
> +       return bsearch(&masked_ctx_id,

You might as well just (void *)(uintptr_t)masked_ctx_id and

static int ctx_id_cmp(const void *key, const void *elem)
{
       const struct i915_perf_context_detail *details = elem;

       return details->id - (uinptr_t)key;
}


More information about the Intel-gfx mailing list