blob: 63397ced9254f5ca64af636959975367aaad47a7 [file] [log] [blame]
Sascha Hauerb9d47452012-06-27 15:30:18 +02001#ifndef __DRM_GEM_CMA_HELPER_H__
2#define __DRM_GEM_CMA_HELPER_H__
3
4struct drm_gem_cma_object {
5 struct drm_gem_object base;
6 dma_addr_t paddr;
7 void *vaddr;
8};
9
10static inline struct drm_gem_cma_object *
11to_drm_gem_cma_obj(struct drm_gem_object *gem_obj)
12{
13 return container_of(gem_obj, struct drm_gem_cma_object, base);
14}
15
16/* free gem object. */
17void drm_gem_cma_free_object(struct drm_gem_object *gem_obj);
18
19/* create memory region for drm framebuffer. */
20int drm_gem_cma_dumb_create(struct drm_file *file_priv,
21 struct drm_device *drm, struct drm_mode_create_dumb *args);
22
23/* map memory region for drm framebuffer to user space. */
24int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv,
25 struct drm_device *drm, uint32_t handle, uint64_t *offset);
26
27/* set vm_flags and we can change the vm attribute to other one at here. */
28int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma);
29
30/*
31 * destroy memory region allocated.
32 * - a gem handle and physical memory region pointed by a gem object
33 * would be released by drm_gem_handle_delete().
34 */
35int drm_gem_cma_dumb_destroy(struct drm_file *file_priv,
36 struct drm_device *drm, unsigned int handle);
37
38/* allocate physical memory. */
39struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
40 unsigned int size);
41
42extern const struct vm_operations_struct drm_gem_cma_vm_ops;
43
Rob Clark6f646092012-12-10 10:46:43 -060044#ifdef CONFIG_DEBUG_FS
45void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
46#endif
47
Sascha Hauerb9d47452012-06-27 15:30:18 +020048#endif /* __DRM_GEM_CMA_HELPER_H__ */