diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2022-03-08 20:52:13 +0100 |
---|---|---|
committer | Patrik Jakobsson <patrik.r.jakobsson@gmail.com> | 2022-03-16 17:42:18 +0100 |
commit | 14e92dd104cde77db5612b111baf2f41f1eba127 (patch) | |
tree | f62c5d64a05adeeb9f21a939cad374bf982d226e /drivers/gpu/drm/gma500/gem.c | |
parent | drm/gma500: Acquire reservation lock for GEM objects (diff) | |
download | linux-14e92dd104cde77db5612b111baf2f41f1eba127.tar.xz linux-14e92dd104cde77db5612b111baf2f41f1eba127.zip |
drm/gma500: Move GTT locking into GTT helpers
Acquire the GTT mutex in psb_gtt_{insert,remove}_pages(). Remove
locking from callers. Also remove the GTT locking around the resume
code. Resume does not run concurrently with other GTT operations.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220308195222.13471-4-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/gma500/gem.c')
-rw-r--r-- | drivers/gpu/drm/gma500/gem.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/gpu/drm/gma500/gem.c b/drivers/gpu/drm/gma500/gem.c index 026ce11f7460..2f44535f58e7 100644 --- a/drivers/gpu/drm/gma500/gem.c +++ b/drivers/gpu/drm/gma500/gem.c @@ -35,15 +35,13 @@ int psb_gem_pin(struct psb_gem_object *pobj) if (drm_WARN_ONCE(dev, ret, "dma_resv_lock() failed, ret=%d\n", ret)) return ret; - mutex_lock(&dev_priv->gtt_mutex); - if (pobj->in_gart || pobj->stolen) goto out; /* already mapped */ pages = drm_gem_get_pages(obj); if (IS_ERR(pages)) { ret = PTR_ERR(pages); - goto err_mutex_unlock; + goto err_dma_resv_unlock; } npages = obj->size / PAGE_SIZE; @@ -59,13 +57,11 @@ int psb_gem_pin(struct psb_gem_object *pobj) out: ++pobj->in_gart; - mutex_unlock(&dev_priv->gtt_mutex); dma_resv_unlock(obj->resv); return 0; -err_mutex_unlock: - mutex_unlock(&dev_priv->gtt_mutex); +err_dma_resv_unlock: dma_resv_unlock(obj->resv); return ret; } @@ -83,8 +79,6 @@ void psb_gem_unpin(struct psb_gem_object *pobj) if (drm_WARN_ONCE(dev, ret, "dma_resv_lock() failed, ret=%d\n", ret)) return; - mutex_lock(&dev_priv->gtt_mutex); - WARN_ON(!pobj->in_gart); --pobj->in_gart; @@ -105,7 +99,6 @@ void psb_gem_unpin(struct psb_gem_object *pobj) pobj->pages = NULL; out: - mutex_unlock(&dev_priv->gtt_mutex); dma_resv_unlock(obj->resv); } |