Skip to content

Commit

Permalink
drm/ttm: add drm_gem_ttm_mmap()
Browse files Browse the repository at this point in the history
Add helper function to mmap ttm bo's using &drm_gem_object_funcs.mmap().

Note that with this code path access verification is done by
drm_gem_mmap() (which calls drm_vma_node_is_allowed(()).
The &ttm_bo_driver.verify_access() callback is is not used.

v3: use ttm_bo_mmap_obj instead of ttm_bo_mmap_vma_setup

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20191016115203.20095-9-kraxel@redhat.com
  • Loading branch information
Gerd Hoffmann committed Oct 17, 2019
1 parent 12067e0 commit 231927d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions drivers/gpu/drm/drm_gem_ttm_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,22 @@ void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,
}
EXPORT_SYMBOL(drm_gem_ttm_print_info);

/**
* drm_gem_ttm_mmap() - mmap &ttm_buffer_object
* @gem: GEM object.
* @vma: vm area.
*
* This function can be used as &drm_gem_object_funcs.mmap
* callback.
*/
int drm_gem_ttm_mmap(struct drm_gem_object *gem,
struct vm_area_struct *vma)
{
struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem);

return ttm_bo_mmap_obj(vma, bo);
}
EXPORT_SYMBOL(drm_gem_ttm_mmap);

MODULE_DESCRIPTION("DRM gem ttm helpers");
MODULE_LICENSE("GPL");
2 changes: 2 additions & 0 deletions include/drm/drm_gem_ttm_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@

void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *gem);
int drm_gem_ttm_mmap(struct drm_gem_object *gem,
struct vm_area_struct *vma);

#endif

0 comments on commit 231927d

Please sign in to comment.