Re: [RFC 31/31] drm/i915: Eliminate dual personality of i915_scratch_offset

Tvrtko Ursulin
2019-06-14T16:46:47Z

On 14/06/2019 17:40, Chris Wilson wrote:
> 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, &gt->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(&gt->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.

Was considering to move it, not sure what tipped the scales at the end,
but yes, can do.

Regards,

Tvrtko