1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef DRM_GEM_TTM_HELPER_H
4 #define DRM_GEM_TTM_HELPER_H
5 
6 #include <linux/container_of.h>
7 
8 #include <drm/drm_device.h>
9 #include <drm/drm_gem.h>
10 #include <drm/ttm/ttm_bo.h>
11 
12 struct iosys_map;
13 
14 #define drm_gem_ttm_of_gem(gem_obj) \
15 	container_of(gem_obj, struct ttm_buffer_object, base)
16 
17 void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,
18 			    const struct drm_gem_object *gem);
19 int drm_gem_ttm_vmap(struct drm_gem_object *gem,
20 		     struct iosys_map *map);
21 void drm_gem_ttm_vunmap(struct drm_gem_object *gem,
22 			struct iosys_map *map);
23 int drm_gem_ttm_mmap(struct drm_gem_object *gem,
24 		     struct vm_area_struct *vma);
25 
26 int drm_gem_ttm_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
27 				uint32_t handle, uint64_t *offset);
28 
29 #endif
30