Merge drm/drm-next into drm-misc-next
[sfrench/cifs-2.6.git] / drivers / gpu / drm / drm_gem.c
index 8b68a3c1e6ab6ea53a712b891c1ba8adbc8d1bbc..b8db675e7fb5e6a113603a730124f1348c2e5751 100644 (file)
@@ -1158,6 +1158,8 @@ int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
 {
        int ret;
 
+       dma_resv_assert_held(obj->resv);
+
        if (!obj->funcs->vmap)
                return -EOPNOTSUPP;
 
@@ -1173,6 +1175,8 @@ EXPORT_SYMBOL(drm_gem_vmap);
 
 void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map)
 {
+       dma_resv_assert_held(obj->resv);
+
        if (iosys_map_is_null(map))
                return;
 
@@ -1184,6 +1188,26 @@ void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map)
 }
 EXPORT_SYMBOL(drm_gem_vunmap);
 
+int drm_gem_vmap_unlocked(struct drm_gem_object *obj, struct iosys_map *map)
+{
+       int ret;
+
+       dma_resv_lock(obj->resv, NULL);
+       ret = drm_gem_vmap(obj, map);
+       dma_resv_unlock(obj->resv);
+
+       return ret;
+}
+EXPORT_SYMBOL(drm_gem_vmap_unlocked);
+
+void drm_gem_vunmap_unlocked(struct drm_gem_object *obj, struct iosys_map *map)
+{
+       dma_resv_lock(obj->resv, NULL);
+       drm_gem_vunmap(obj, map);
+       dma_resv_unlock(obj->resv);
+}
+EXPORT_SYMBOL(drm_gem_vunmap_unlocked);
+
 /**
  * drm_gem_lock_reservations - Sets up the ww context and acquires
  * the lock on an array of GEM objects.