[Intel-gfx] [PATCH v3 3/5] drm/i915: Remove unnecessary ggtt_offset_bias from i915_gem_context

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 19 08:46:50 UTC 2018


Quoting Jakub BartmiĊ„ski (2018-07-19 09:35:40)
> +static inline u32 i915_ggtt_pin_bias(struct i915_vma *vma)
> +{
> +       return i915_vm_to_ggtt(vma->vm)->pin_bias;

The hint was to do this earlier in the series to avoid pulling it randomly
from i915->ggtt. If we allocate the vma, then we should have the
vm/i915_ggtt already to hand. If not, pulling it from vma->vm looks more
consistent than delving into a seemingly unrelated address space.

>  static int __context_pin(struct i915_gem_context *ctx, struct i915_vma *vma)
>  {
>         unsigned int flags;
> @@ -1362,10 +1367,8 @@ static int __context_pin(struct i915_gem_context *ctx, struct i915_vma *vma)
>                         return err;
>         }
>  
> -       flags = PIN_GLOBAL | PIN_HIGH;
> -       if (ctx->ggtt_offset_bias)
> -               flags |= PIN_OFFSET_BIAS | ctx->ggtt_offset_bias;
> -
> +       flags = PIN_GLOBAL | PIN_HIGH |
> +               PIN_OFFSET_BIAS | i915_ggtt_pin_bias(vma);

Looks messy :(

>         return i915_vma_pin(vma, 0, GEN8_LR_CONTEXT_ALIGN, flags);
>  }
>  
> @@ -1392,7 +1395,8 @@ __execlists_context_pin(struct intel_engine_cs *engine,
>                 goto unpin_vma;
>         }
>  
> -       ret = intel_ring_pin(ce->ring, ctx->i915, ctx->ggtt_offset_bias);
> +       ret = intel_ring_pin(ce->ring, ctx->i915,
> +                            i915_ggtt_pin_bias(ce->ring->vma));

This indicates that intel_ring_pin() now knows the pin_bias (as it
stored on the i915_ggtt and not on the context) and so no longer needs
it pass it from the context.
-Chris


More information about the Intel-gfx mailing list