[Intel-gfx] [RFC 31/31] drm/i915: Eliminate dual personality of i915_scratch_offset
Chris Wilson
chris at chris-wilson.co.uk
Fri Jun 14 16:40:55 UTC 2019
Quoting Tvrtko Ursulin (2019-06-14 16:17:31)
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index ad1dc58a2374..c80e26c1437d 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1423,9 +1423,9 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
> goto out_ctx;
> }
>
> -static int
> -i915_gem_init_scratch(struct drm_i915_private *i915, unsigned int size)
> +static int gt_init_scratch(struct intel_gt *gt, unsigned int size)
> {
> + struct drm_i915_private *i915 = gt->i915;
> struct drm_i915_gem_object *obj;
> struct i915_vma *vma;
> int ret;
> @@ -1438,7 +1438,7 @@ i915_gem_init_scratch(struct drm_i915_private *i915, unsigned int size)
> return PTR_ERR(obj);
> }
>
> - vma = i915_vma_instance(obj, &i915->ggtt.vm, NULL);
> + vma = i915_vma_instance(obj, >->ggtt->vm, NULL);
> if (IS_ERR(vma)) {
> ret = PTR_ERR(vma);
> goto err_unref;
> @@ -1448,7 +1448,7 @@ i915_gem_init_scratch(struct drm_i915_private *i915, unsigned int size)
> if (ret)
> goto err_unref;
>
> - i915->gt.scratch = vma;
> + gt->scratch = vma;
> return 0;
>
> err_unref:
> @@ -1456,9 +1456,20 @@ i915_gem_init_scratch(struct drm_i915_private *i915, unsigned int size)
> return ret;
> }
>
> +static int
> +i915_gem_init_scratch(struct drm_i915_private *i915, unsigned int size)
> +{
> + return gt_init_scratch(&i915->gt, size);
> +}
> +
> +static void gt_fini_scratch(struct intel_gt *gt)
> +{
> + i915_vma_unpin_and_release(>->scratch, 0);
> +}
> +
> static void i915_gem_fini_scratch(struct drm_i915_private *i915)
> {
> - i915_vma_unpin_and_release(&i915->gt.scratch, 0);
> + gt_fini_scratch(&i915->gt);
> }
Apart from this is now decidedly part of intel_gt.
-Chris
More information about the Intel-gfx
mailing list