[Intel-gfx] [PATCH 1/2] drm/i915: Trim struct_mutex usage for kms

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 8 13:51:59 UTC 2017


Quoting Ville Syrjälä (2017-06-08 14:47:27)
> On Thu, Jun 08, 2017 at 10:51:34AM +0100, Chris Wilson wrote:
> > +     ret = i915_gem_object_pin_pages(obj);
> > +     if (ret)
> > +             return ret;
> > +
> > +     ret = mutex_lock_interruptible(&dev_priv->drm.struct_mutex);
> > +     if (ret) {
> > +             i915_gem_object_unpin_pages(obj);
> > +             return ret;
> > +     }
> > +
> > +     i915_gem_object_wait_priority(obj, 0, I915_PRIORITY_DISPLAY);
> 
> Does this guy need struct mutex? Maybe it could use a lockdep assert if
> so.

It does today. One day it could be reduced to a obj->resv->lock and a
global spinlock.
> 
> > +
> > +     if (plane->type == DRM_PLANE_TYPE_CURSOR &&
> > +         INTEL_INFO(dev_priv)->cursor_needs_physical) {
> > +             const int align = intel_cursor_alignment(dev_priv);
> > +
> > +             ret = i915_gem_object_attach_phys(obj, align);
> 
> Isn't this going to fail due to the i915_gem_object_pin_pages() above?

Yes, so I rewrote attach_phys.
-Chris


More information about the Intel-gfx mailing list