1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * omap_gem.h -- OMAP DRM GEM Object Management 4 * 5 * Copyright (C) 2011 Texas Instruments 6 * Author: Rob Clark <rob@ti.com> 7 */ 8 9 #ifndef __OMAPDRM_GEM_H__ 10 #define __OMAPDRM_GEM_H__ 11 12 #include <linux/types.h> 13 #include <linux/mm_types.h> 14 15 enum dma_data_direction; 16 17 struct dma_buf; 18 struct drm_device; 19 struct drm_file; 20 struct drm_gem_object; 21 struct drm_mode_create_dumb; 22 struct file; 23 struct list_head; 24 struct page; 25 struct seq_file; 26 struct vm_area_struct; 27 struct vm_fault; 28 29 union omap_gem_size; 30 31 /* Initialization and Cleanup */ 32 void omap_gem_init(struct drm_device *dev); 33 void omap_gem_deinit(struct drm_device *dev); 34 35 #ifdef CONFIG_PM 36 int omap_gem_resume(struct drm_device *dev); 37 #endif 38 39 #ifdef CONFIG_DEBUG_FS 40 void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m); 41 void omap_gem_describe_objects(struct list_head *list, struct seq_file *m); 42 #endif 43 44 /* GEM Object Creation and Deletion */ 45 struct drm_gem_object *omap_gem_new(struct drm_device *dev, 46 union omap_gem_size gsize, u32 flags); 47 struct drm_gem_object *omap_gem_new_dmabuf(struct drm_device *dev, size_t size, 48 struct sg_table *sgt); 49 int omap_gem_new_handle(struct drm_device *dev, struct drm_file *file, 50 union omap_gem_size gsize, u32 flags, u32 *handle); 51 void *omap_gem_vaddr(struct drm_gem_object *obj); 52 53 /* Dumb Buffers Interface */ 54 int omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, 55 u32 handle, u64 *offset); 56 int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev, 57 struct drm_mode_create_dumb *args); 58 59 /* mmap() Interface */ 60 u64 omap_gem_mmap_offset(struct drm_gem_object *obj); 61 size_t omap_gem_mmap_size(struct drm_gem_object *obj); 62 63 /* PRIME Interface */ 64 struct dma_buf *omap_gem_prime_export(struct drm_gem_object *obj, int flags); 65 struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev, 66 struct dma_buf *buffer); 67 68 int omap_gem_roll(struct drm_gem_object *obj, u32 roll); 69 void omap_gem_cpu_sync_page(struct drm_gem_object *obj, int pgoff); 70 void omap_gem_dma_sync_buffer(struct drm_gem_object *obj, 71 enum dma_data_direction dir); 72 int omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr); 73 void omap_gem_unpin(struct drm_gem_object *obj); 74 int omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages, 75 bool remap); 76 int omap_gem_put_pages(struct drm_gem_object *obj); 77 78 u32 omap_gem_flags(struct drm_gem_object *obj); 79 int omap_gem_rotated_dma_addr(struct drm_gem_object *obj, u32 orient, 80 int x, int y, dma_addr_t *dma_addr); 81 int omap_gem_tiled_stride(struct drm_gem_object *obj, u32 orient); 82 struct sg_table *omap_gem_get_sg(struct drm_gem_object *obj, 83 enum dma_data_direction dir); 84 void omap_gem_put_sg(struct drm_gem_object *obj, struct sg_table *sgt); 85 86 #endif /* __OMAPDRM_GEM_H__ */ 87