]>
Commit | Line | Data |
---|---|---|
b9d47450 SH |
1 | #ifndef __DRM_GEM_CMA_HELPER_H__ |
2 | #define __DRM_GEM_CMA_HELPER_H__ | |
3 | ||
740c22ae SG |
4 | #include <drm/drmP.h> |
5 | ||
b9d47450 SH |
6 | struct drm_gem_cma_object { |
7 | struct drm_gem_object base; | |
8 | dma_addr_t paddr; | |
71d7282a LP |
9 | struct sg_table *sgt; |
10 | ||
11 | /* For objects with DMA memory allocated by GEM CMA */ | |
b9d47450 SH |
12 | void *vaddr; |
13 | }; | |
14 | ||
15 | static inline struct drm_gem_cma_object * | |
16 | to_drm_gem_cma_obj(struct drm_gem_object *gem_obj) | |
17 | { | |
18 | return container_of(gem_obj, struct drm_gem_cma_object, base); | |
19 | } | |
20 | ||
21 | /* free gem object. */ | |
22 | void drm_gem_cma_free_object(struct drm_gem_object *gem_obj); | |
23 | ||
24 | /* create memory region for drm framebuffer. */ | |
25 | int drm_gem_cma_dumb_create(struct drm_file *file_priv, | |
26 | struct drm_device *drm, struct drm_mode_create_dumb *args); | |
27 | ||
28 | /* map memory region for drm framebuffer to user space. */ | |
29 | int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv, | |
30 | struct drm_device *drm, uint32_t handle, uint64_t *offset); | |
31 | ||
32 | /* set vm_flags and we can change the vm attribute to other one at here. */ | |
33 | int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma); | |
34 | ||
b9d47450 SH |
35 | /* allocate physical memory. */ |
36 | struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, | |
37 | unsigned int size); | |
38 | ||
39 | extern const struct vm_operations_struct drm_gem_cma_vm_ops; | |
40 | ||
6f646095 RC |
41 | #ifdef CONFIG_DEBUG_FS |
42 | void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m); | |
43 | #endif | |
44 | ||
78467dc5 JS |
45 | struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj); |
46 | struct drm_gem_object * | |
47 | drm_gem_cma_prime_import_sg_table(struct drm_device *dev, size_t size, | |
48 | struct sg_table *sgt); | |
49 | int drm_gem_cma_prime_mmap(struct drm_gem_object *obj, | |
50 | struct vm_area_struct *vma); | |
51 | void *drm_gem_cma_prime_vmap(struct drm_gem_object *obj); | |
52 | void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, void *vaddr); | |
53 | ||
b9d47450 | 54 | #endif /* __DRM_GEM_CMA_HELPER_H__ */ |