[Intel-gfx] [RFC PATCH 13/42] drm/i915: support object clearing via blitter engine

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 14 15:40:04 UTC 2019


Quoting Matthew Auld (2019-02-14 14:57:11)
> +static int i915_gem_object_fill_blt(struct i915_gem_context *ctx,
> +                                   struct drm_i915_gem_object *obj,
> +                                   u32 value)
> +{
> +       struct drm_i915_private *i915 = to_i915(obj->base.dev);
> +       struct i915_address_space *vm = ctx->ppgtt ? &ctx->ppgtt->vm : &i915->ggtt.vm;
> +       struct i915_vma *vma;
> +       int err;
> +
> +       lockdep_assert_held(&i915->drm.struct_mutex);
> +
> +       vma = i915_vma_instance(obj, vm, NULL);
> +       if (IS_ERR(vma))
> +               return PTR_ERR(vma);
> +
> +       err = i915_vma_pin(vma, 0, 0, PIN_USER);
> +       if (err) {
> +               i915_vma_close(vma);
> +               return err;
> +       }
> +
> +       err = i915_gem_fill_blt(ctx, vma, value);
> +       i915_vma_unpin(vma);
> +       if (err)
> +               return err;
> +
> +       return i915_gem_object_wait(obj,
> +                                   I915_WAIT_LOCKED |
> +                                   I915_WAIT_ALL,
> +                                   MAX_SCHEDULE_TIMEOUT);

Oh no, don't even start by making this synchronous.
-Chris


More information about the Intel-gfx mailing list