[Intel-gfx] [RFC PATCH 42/42] HAX drm/i915/lmem: default userspace allocations to LMEM

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 19 17:44:13 UTC 2019


Quoting Chris Wilson (2019-02-14 16:13:18)
> Quoting Matthew Auld (2019-02-14 14:57:40)
> > Hack patch to default all userspace allocations to LMEM. Useful for
> > testing purposes.
> > 
> > Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> > Cc: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_gem.c | 45 +++++++++++++++++++++++++++++++--
> >  1 file changed, 43 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index 3c86909d55b9..bd857f477ef9 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -641,7 +641,8 @@ i915_gem_create(struct drm_file *file,
> >                 u32 *handle_p)
> >  {
> >         struct drm_i915_gem_object *obj;
> > -       int ret;
> > +       intel_wakeref_t wakeref;
> > +       int ret = 0;
> >         u32 handle;
> >  
> >         size = roundup(size, PAGE_SIZE);
> > @@ -649,10 +650,50 @@ i915_gem_create(struct drm_file *file,
> >                 return -EINVAL;
> >  
> >         /* Allocate the new object */
> > -       obj = i915_gem_object_create(dev_priv, size);
> > +       if (HAS_LMEM(dev_priv))
> > +               obj = i915_gem_object_create_lmem(dev_priv, size, 0);
> > +       else
> > +               obj = i915_gem_object_create(dev_priv, size);
> >         if (IS_ERR(obj))
> >                 return PTR_ERR(obj);
> >  
> > +       if (i915_gem_object_is_lmem(obj)) {
> > +               struct i915_gem_context *ctx;
> > +
> > +               /* XXX: we should prob use the blitter context for this? */
> 
> Or the kernel_context which is setup for emitting without taking
> struct_mutex...

Using a single context should only be a last resort; be it kernel or
blitter context. We need to defer this until an owning HW context is
known so that we can properly queue it in their name, or else we end up
with a global barrier being the kernel context and priority inversions
abound.

This does suggest to me that async pages needs to be in better shape...
-Chris


More information about the Intel-gfx mailing list