blob: f0f6b1af25adf7b108e89160d9eb651c2b777ff9 [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
44#endif /* __DRM_GEM_CMA_HELPER_H__ */