[Intel-gfx] [PATCH 15/21] drm/i915: Allow userspace to clone contexts on creation

Chris Wilson chris at chris-wilson.co.uk
Fri Mar 15 15:13:35 UTC 2019


Quoting Chris Wilson (2019-03-15 15:03:27)
> +static int create_clone(struct i915_user_extension __user *ext, void *data)
> +{
> +       static int (* const fn[])(struct i915_gem_context *dst,
> +                                 struct i915_gem_context *src) = {
> +               [ilog2(I915_CONTEXT_CLONE_FLAGS)] = clone_flags,
> +               [ilog2(I915_CONTEXT_CLONE_SCHEDATTR)] = clone_schedattr,
> +               [ilog2(I915_CONTEXT_CLONE_SSEU)] = clone_sseu,
> +               [ilog2(I915_CONTEXT_CLONE_TIMELINE)] = clone_timeline,
> +               [ilog2(I915_CONTEXT_CLONE_VM)] = clone_vm,
> +       };

Should be able to do something like

BUILD_BUG_ON(GENMASK(ARRAY_SIZE(fn)-1, 0) != I915_CONTEXT_CLONE_UNKNOWN);
-Chris


More information about the Intel-gfx mailing list