0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #ifndef __DRM_PRIME_H__
0033 #define __DRM_PRIME_H__
0034
0035 #include <linux/mutex.h>
0036 #include <linux/rbtree.h>
0037 #include <linux/scatterlist.h>
0038
0039
0040
0041
0042
0043
0044
0045 struct drm_prime_file_private {
0046
0047 struct mutex lock;
0048 struct rb_root dmabufs;
0049 struct rb_root handles;
0050 };
0051
0052 struct device;
0053
0054 struct dma_buf_export_info;
0055 struct dma_buf;
0056 struct dma_buf_attachment;
0057 struct iosys_map;
0058
0059 enum dma_data_direction;
0060
0061 struct drm_device;
0062 struct drm_gem_object;
0063 struct drm_file;
0064
0065
0066 struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev,
0067 struct dma_buf_export_info *exp_info);
0068 void drm_gem_dmabuf_release(struct dma_buf *dma_buf);
0069
0070 int drm_gem_prime_fd_to_handle(struct drm_device *dev,
0071 struct drm_file *file_priv, int prime_fd, uint32_t *handle);
0072 int drm_gem_prime_handle_to_fd(struct drm_device *dev,
0073 struct drm_file *file_priv, uint32_t handle, uint32_t flags,
0074 int *prime_fd);
0075
0076
0077 int drm_gem_map_attach(struct dma_buf *dma_buf,
0078 struct dma_buf_attachment *attach);
0079 void drm_gem_map_detach(struct dma_buf *dma_buf,
0080 struct dma_buf_attachment *attach);
0081 struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
0082 enum dma_data_direction dir);
0083 void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
0084 struct sg_table *sgt,
0085 enum dma_data_direction dir);
0086 int drm_gem_dmabuf_vmap(struct dma_buf *dma_buf, struct iosys_map *map);
0087 void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, struct iosys_map *map);
0088
0089 int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
0090 int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma);
0091
0092 struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev,
0093 struct page **pages, unsigned int nr_pages);
0094 struct dma_buf *drm_gem_prime_export(struct drm_gem_object *obj,
0095 int flags);
0096
0097 unsigned long drm_prime_get_contiguous_size(struct sg_table *sgt);
0098
0099
0100 struct drm_gem_object *drm_gem_prime_import_dev(struct drm_device *dev,
0101 struct dma_buf *dma_buf,
0102 struct device *attach_dev);
0103 struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
0104 struct dma_buf *dma_buf);
0105
0106 void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg);
0107
0108 int drm_prime_sg_to_page_array(struct sg_table *sgt, struct page **pages,
0109 int max_pages);
0110 int drm_prime_sg_to_dma_addr_array(struct sg_table *sgt, dma_addr_t *addrs,
0111 int max_pages);
0112
0113 #endif