mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-25 15:24:17 +08:00
drm/i915: Add gem object locking to madvise.
Doesn't need the full ww lock, only checking if pages are bound. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> #irc Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20210323155059.628690-7-maarten.lankhorst@linux.intel.com
This commit is contained in:
parent
1eef0de18f
commit
aaee716e4a
@ -963,10 +963,14 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
|
||||
if (!obj)
|
||||
return -ENOENT;
|
||||
|
||||
err = mutex_lock_interruptible(&obj->mm.lock);
|
||||
err = i915_gem_object_lock_interruptible(obj, NULL);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = mutex_lock_interruptible(&obj->mm.lock);
|
||||
if (err)
|
||||
goto out_ww;
|
||||
|
||||
if (i915_gem_object_has_pages(obj) &&
|
||||
i915_gem_object_is_tiled(obj) &&
|
||||
i915->quirks & QUIRK_PIN_SWIZZLED_PAGES) {
|
||||
@ -1011,6 +1015,8 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
|
||||
args->retained = obj->mm.madv != __I915_MADV_PURGED;
|
||||
mutex_unlock(&obj->mm.lock);
|
||||
|
||||
out_ww:
|
||||
i915_gem_object_unlock(obj);
|
||||
out:
|
||||
i915_gem_object_put(obj);
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user