diff options
| author | Laurent Pinchart <[email protected]> | 2018-05-25 16:39:22 +0000 |
|---|---|---|
| committer | Tomi Valkeinen <[email protected]> | 2018-06-28 10:41:05 +0000 |
| commit | dc8c9aeee5098688c1085691213fb9a703bf20ad (patch) | |
| tree | 233f6c722cbdd5b50fe81753921fea8e6fd5f95b /drivers/gpu/drm/omapdrm/omap_gem.c | |
| parent | drm/omap: gem: Merge __omap_gem_get_pages() and omap_gem_attach_pages() (diff) | |
| download | kernel-dc8c9aeee5098688c1085691213fb9a703bf20ad.tar.gz kernel-dc8c9aeee5098688c1085691213fb9a703bf20ad.zip | |
drm/omap: gem: Don't take struct_mutex to get GEM object mmap offset
GEM objects mmap offsets are created by calling
drm_gem_create_mmap_offset_size() that doesn't need struct_mutex
protection as it includes its own locking, based on a size that is
static across the object's life time. Remove the unneeded struct_mutex
locking.
Signed-off-by: Laurent Pinchart <[email protected]>
Reviewed-by: Daniel Vetter <[email protected]>
Reviewed-by: Tomi Valkeinen <[email protected]>
Signed-off-by: Tomi Valkeinen <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_gem.c')
| -rw-r--r-- | drivers/gpu/drm/omapdrm/omap_gem.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index a3efac4abd4b..623856d9b85a 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -137,14 +137,12 @@ struct omap_drm_usergart { */ /** get mmap offset */ -static u64 mmap_offset(struct drm_gem_object *obj) +u64 omap_gem_mmap_offset(struct drm_gem_object *obj) { struct drm_device *dev = obj->dev; int ret; size_t size; - WARN_ON(!mutex_is_locked(&dev->struct_mutex)); - /* Make it mmapable */ size = omap_gem_mmap_size(obj); ret = drm_gem_create_mmap_offset_size(obj, size); @@ -178,7 +176,7 @@ static void omap_gem_evict_entry(struct drm_gem_object *obj, struct omap_drm_private *priv = obj->dev->dev_private; int n = priv->usergart[fmt].height; size_t size = PAGE_SIZE * n; - loff_t off = mmap_offset(obj) + + loff_t off = omap_gem_mmap_offset(obj) + (entry->obj_pgoff << PAGE_SHIFT); const int m = DIV_ROUND_UP(omap_obj->width << fmt, PAGE_SIZE); @@ -319,16 +317,6 @@ u32 omap_gem_flags(struct drm_gem_object *obj) return to_omap_bo(obj)->flags; } -u64 omap_gem_mmap_offset(struct drm_gem_object *obj) -{ - u64 offset; - - mutex_lock(&obj->dev->struct_mutex); - offset = mmap_offset(obj); - mutex_unlock(&obj->dev->struct_mutex); - return offset; -} - /** get mmap size */ size_t omap_gem_mmap_size(struct drm_gem_object *obj) { |
