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

Chris Wilson
2019-02-14T15:38:42Z

Quoting Matthew Auld (2019-02-14 14:57:11)
> +static struct i915_vma *
> +__i915_gem_fill_blt(struct i915_vma *vma, u32 value)
> +{
> + struct drm_i915_private *i915 = to_i915(vma->obj->base.dev);
> + const int gen = INTEL_GEN(i915);
> + struct drm_i915_gem_object *obj;
> + struct i915_vma *batch;
> + u32 *cmd;
> + int err;
> +
> + obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
> + if (IS_ERR(obj))
> + return ERR_CAST(obj);
> +
> + cmd = i915_gem_object_pin_map(obj, I915_MAP_WB);
> + if (IS_ERR(cmd)) {
> + err = PTR_ERR(cmd);
> + goto err;
> + }
> +
> + if (gen >= 8) {
> + *cmd++ = XY_COLOR_BLT_CMD | BLT_WRITE_RGBA;
> + *cmd++ = BLT_DEPTH_32 | BLT_ROP_COLOR_COPY | PAGE_SIZE;
> + *cmd++ = 0;
> + *cmd++ = vma->obj->base.size >> PAGE_SHIFT << 16 | PAGE_SIZE / 4;
> + *cmd++ = lower_32_bits(vma->node.start);
> + *cmd++ = upper_32_bits(vma->node.start);
> + *cmd++ = value;
> + *cmd++ = MI_NOOP;
> + } else {
> + *cmd++ = COLOR_BLT_CMD | BLT_WRITE_RGBA;
> + *cmd++ = BLT_DEPTH_32 | BLT_ROP_COLOR_COPY | PAGE_SIZE;
> + *cmd++ = vma->obj->base.size >> PAGE_SHIFT << 16 | PAGE_SIZE;
> + *cmd++ = vma->node.start;
> + *cmd++ = value;
> + *cmd++ = MI_NOOP;
> + }
> +
> + *cmd = MI_BATCH_BUFFER_END;

Why did you create a batch? Just issue the command from inside the
request.
-Chris