summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_gem_vram_helper.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2019-05-21 13:08:31 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-05-22 12:43:30 +0200
commit9977e5b43776fd0f6cc62c29b4b7ade16bfdf649 (patch)
tree77d5c16da2c3eaa639365cca5e4463705263bf4a /drivers/gpu/drm/drm_gem_vram_helper.c
parentdrm: Rename reserve/unreserve to lock/unlock in GEM VRAM helpers (diff)
downloadlinux-9977e5b43776fd0f6cc62c29b4b7ade16bfdf649.tar.xz
linux-9977e5b43776fd0f6cc62c29b4b7ade16bfdf649.zip
drm: Assert that BO is locked in drm_gem_vram_{pin, unpin}_locked()
We may not call drm_gem_vram_{pin,unpin}_locked() with an unlocked BO. Now test for this. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20190521110831.20200-4-tzimmermann@suse.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_gem_vram_helper.c')
-rw-r--r--drivers/gpu/drm/drm_gem_vram_helper.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index aefb0c361486..7380a06a582c 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -284,6 +284,8 @@ int drm_gem_vram_pin_locked(struct drm_gem_vram_object *gbo,
int i, ret;
struct ttm_operation_ctx ctx = { false, false };
+ lockdep_assert_held(&gbo->bo.resv->lock.base);
+
if (gbo->pin_count) {
++gbo->pin_count;
return 0;
@@ -361,6 +363,8 @@ int drm_gem_vram_unpin_locked(struct drm_gem_vram_object *gbo)
int i, ret;
struct ttm_operation_ctx ctx = { false, false };
+ lockdep_assert_held(&gbo->bo.resv->lock.base);
+
if (WARN_ON_ONCE(!gbo->pin_count))
return 0;