serial: mxs-auart+imx: allow compile testing on non-Freescale architectures
[linux/fpc-iii.git] / include / drm / drm_gem_cma_helper.h
blobacd6af8a8e675b5b58856651f18f788257bcc868
1 #ifndef __DRM_GEM_CMA_HELPER_H__
2 #define __DRM_GEM_CMA_HELPER_H__
4 #include <drm/drmP.h>
5 #include <drm/drm_gem.h>
7 /**
8 * struct drm_gem_cma_object - GEM object backed by CMA memory allocations
9 * @base: base GEM object
10 * @paddr: physical address of the backing memory
11 * @sgt: scatter/gather table for imported PRIME buffers
12 * @vaddr: kernel virtual address of the backing memory
14 struct drm_gem_cma_object {
15 struct drm_gem_object base;
16 dma_addr_t paddr;
17 struct sg_table *sgt;
19 /* For objects with DMA memory allocated by GEM CMA */
20 void *vaddr;
23 static inline struct drm_gem_cma_object *
24 to_drm_gem_cma_obj(struct drm_gem_object *gem_obj)
26 return container_of(gem_obj, struct drm_gem_cma_object, base);
29 /* free GEM object */
30 void drm_gem_cma_free_object(struct drm_gem_object *gem_obj);
32 /* create memory region for DRM framebuffer */
33 int drm_gem_cma_dumb_create_internal(struct drm_file *file_priv,
34 struct drm_device *drm,
35 struct drm_mode_create_dumb *args);
37 /* create memory region for DRM framebuffer */
38 int drm_gem_cma_dumb_create(struct drm_file *file_priv,
39 struct drm_device *drm,
40 struct drm_mode_create_dumb *args);
42 /* map memory region for DRM framebuffer to user space */
43 int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv,
44 struct drm_device *drm, u32 handle,
45 u64 *offset);
47 /* set vm_flags and we can change the VM attribute to other one at here */
48 int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma);
50 /* allocate physical memory */
51 struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
52 size_t size);
54 extern const struct vm_operations_struct drm_gem_cma_vm_ops;
56 #ifdef CONFIG_DEBUG_FS
57 void drm_gem_cma_describe(struct drm_gem_cma_object *obj, struct seq_file *m);
58 #endif
60 struct sg_table *drm_gem_cma_prime_get_sg_table(struct drm_gem_object *obj);
61 struct drm_gem_object *
62 drm_gem_cma_prime_import_sg_table(struct drm_device *dev,
63 struct dma_buf_attachment *attach,
64 struct sg_table *sgt);
65 int drm_gem_cma_prime_mmap(struct drm_gem_object *obj,
66 struct vm_area_struct *vma);
67 void *drm_gem_cma_prime_vmap(struct drm_gem_object *obj);
68 void drm_gem_cma_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
70 #endif /* __DRM_GEM_CMA_HELPER_H__ */