This source file includes following definitions.
- drm_gem_vram_of_bo
- drm_gem_vram_of_gem
1
2
3 #ifndef DRM_GEM_VRAM_HELPER_H
4 #define DRM_GEM_VRAM_HELPER_H
5
6 #include <drm/drm_gem.h>
7 #include <drm/ttm/ttm_bo_api.h>
8 #include <drm/ttm/ttm_placement.h>
9 #include <linux/kernel.h>
10
11 struct drm_mode_create_dumb;
12 struct drm_vram_mm_funcs;
13 struct filp;
14 struct vm_area_struct;
15
16 #define DRM_GEM_VRAM_PL_FLAG_VRAM TTM_PL_FLAG_VRAM
17 #define DRM_GEM_VRAM_PL_FLAG_SYSTEM TTM_PL_FLAG_SYSTEM
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 struct drm_gem_vram_object {
39 struct ttm_buffer_object bo;
40 struct ttm_bo_kmap_obj kmap;
41
42
43 struct ttm_placement placement;
44 struct ttm_place placements[2];
45
46 int pin_count;
47 };
48
49
50
51
52
53
54
55 static inline struct drm_gem_vram_object *drm_gem_vram_of_bo(
56 struct ttm_buffer_object *bo)
57 {
58 return container_of(bo, struct drm_gem_vram_object, bo);
59 }
60
61
62
63
64
65
66
67 static inline struct drm_gem_vram_object *drm_gem_vram_of_gem(
68 struct drm_gem_object *gem)
69 {
70 return container_of(gem, struct drm_gem_vram_object, bo.base);
71 }
72
73 struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,
74 struct ttm_bo_device *bdev,
75 size_t size,
76 unsigned long pg_align,
77 bool interruptible);
78 void drm_gem_vram_put(struct drm_gem_vram_object *gbo);
79 u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo);
80 s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo);
81 int drm_gem_vram_pin(struct drm_gem_vram_object *gbo, unsigned long pl_flag);
82 int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo);
83 void *drm_gem_vram_kmap(struct drm_gem_vram_object *gbo, bool map,
84 bool *is_iomem);
85 void drm_gem_vram_kunmap(struct drm_gem_vram_object *gbo);
86
87 int drm_gem_vram_fill_create_dumb(struct drm_file *file,
88 struct drm_device *dev,
89 struct ttm_bo_device *bdev,
90 unsigned long pg_align,
91 bool interruptible,
92 struct drm_mode_create_dumb *args);
93
94
95
96
97
98 void drm_gem_vram_bo_driver_evict_flags(struct ttm_buffer_object *bo,
99 struct ttm_placement *pl);
100
101 int drm_gem_vram_bo_driver_verify_access(struct ttm_buffer_object *bo,
102 struct file *filp);
103
104 extern const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs;
105
106
107
108
109
110 int drm_gem_vram_driver_dumb_create(struct drm_file *file,
111 struct drm_device *dev,
112 struct drm_mode_create_dumb *args);
113 int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file,
114 struct drm_device *dev,
115 uint32_t handle, uint64_t *offset);
116
117
118
119
120
121
122
123
124 #define DRM_GEM_VRAM_DRIVER \
125 .dumb_create = drm_gem_vram_driver_dumb_create, \
126 .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset, \
127 .gem_prime_mmap = drm_gem_prime_mmap
128
129 #endif