1 #ifndef __DRM_GEM_CMA_HELPER_H__
2 #define __DRM_GEM_CMA_HELPER_H__
6 struct drm_gem_cma_object
{
7 struct drm_gem_object base
;
11 /* For objects with DMA memory allocated by GEM CMA */
15 static inline struct drm_gem_cma_object
*
16 to_drm_gem_cma_obj(struct drm_gem_object
*gem_obj
)
18 return container_of(gem_obj
, struct drm_gem_cma_object
, base
);
21 /* free gem object. */
22 void drm_gem_cma_free_object(struct drm_gem_object
*gem_obj
);
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
);
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
);
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
);
35 /* allocate physical memory. */
36 struct drm_gem_cma_object
*drm_gem_cma_create(struct drm_device
*drm
,
39 extern const struct vm_operations_struct drm_gem_cma_vm_ops
;
41 #ifdef CONFIG_DEBUG_FS
42 void drm_gem_cma_describe(struct drm_gem_cma_object
*obj
, struct seq_file
*m
);
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
);
54 #endif /* __DRM_GEM_CMA_HELPER_H__ */