drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 17 Mar 2017 19:46:47 +0000 (19:46 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 17 Mar 2017 22:54:06 +0000 (22:54 +0000)
Both object creation and backing storage page allocation do not require
struct_mutex, so do not require the caller to take it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170317194648.12468-1-chris@chris-wilson.co.uk
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/intel_uc.c

index fd611b4c1a2ce22073302517b35f14b056a201d6..3492f8d27c32d56512b090fa1788e947c7728acc 100644 (file)
@@ -4961,9 +4961,7 @@ i915_gem_object_create_from_data(struct drm_i915_private *dev_priv,
        if (IS_ERR(obj))
                return obj;
 
-       ret = i915_gem_object_set_to_cpu_domain(obj, true);
-       if (ret)
-               goto fail;
+       GEM_BUG_ON(obj->base.write_domain != I915_GEM_DOMAIN_CPU);
 
        ret = i915_gem_object_pin_pages(obj);
        if (ret)
index 21f6d822194d657e07343b3c98e144efe3045fee..86530c92337a0f7b5b55b3a455e38865704706df 100644 (file)
@@ -376,9 +376,7 @@ void intel_uc_prepare_fw(struct drm_i915_private *dev_priv,
                        uc_fw->major_ver_found, uc_fw->minor_ver_found,
                        uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted);
 
-       mutex_lock(&dev_priv->drm.struct_mutex);
        obj = i915_gem_object_create_from_data(dev_priv, fw->data, fw->size);
-       mutex_unlock(&dev_priv->drm.struct_mutex);
        if (IS_ERR_OR_NULL(obj)) {
                err = obj ? PTR_ERR(obj) : -ENOMEM;
                goto fail;