2 * omap_gem.h -- OMAP DRM GEM Object Management
4 * Copyright (C) 2011 Texas Instruments
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __OMAPDRM_GEM_H__
21 #define __OMAPDRM_GEM_H__
23 #include <linux/types.h>
24 #include <linux/mm_types.h>
26 enum dma_data_direction;
31 struct drm_gem_object;
32 struct drm_mode_create_dumb;
37 struct vm_area_struct;
42 /* Initialization and Cleanup */
43 void omap_gem_init(struct drm_device *dev);
44 void omap_gem_deinit(struct drm_device *dev);
47 int omap_gem_resume(struct drm_device *dev);
50 #ifdef CONFIG_DEBUG_FS
51 void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m);
52 void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
55 /* GEM Object Creation and Deletion */
56 struct drm_gem_object *omap_gem_new(struct drm_device *dev,
57 union omap_gem_size gsize, u32 flags);
58 struct drm_gem_object *omap_gem_new_dmabuf(struct drm_device *dev, size_t size,
59 struct sg_table *sgt);
60 int omap_gem_new_handle(struct drm_device *dev, struct drm_file *file,
61 union omap_gem_size gsize, u32 flags, u32 *handle);
62 void omap_gem_free_object(struct drm_gem_object *obj);
63 void *omap_gem_vaddr(struct drm_gem_object *obj);
65 /* Dumb Buffers Interface */
66 int omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
67 u32 handle, u64 *offset);
68 int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
69 struct drm_mode_create_dumb *args);
71 /* mmap() Interface */
72 int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma);
73 int omap_gem_mmap_obj(struct drm_gem_object *obj,
74 struct vm_area_struct *vma);
75 u64 omap_gem_mmap_offset(struct drm_gem_object *obj);
76 size_t omap_gem_mmap_size(struct drm_gem_object *obj);
79 struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
80 struct drm_gem_object *obj, int flags);
81 struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
82 struct dma_buf *buffer);
84 vm_fault_t omap_gem_fault(struct vm_fault *vmf);
85 int omap_gem_roll(struct drm_gem_object *obj, u32 roll);
86 void omap_gem_cpu_sync_page(struct drm_gem_object *obj, int pgoff);
87 void omap_gem_dma_sync_buffer(struct drm_gem_object *obj,
88 enum dma_data_direction dir);
89 int omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr);
90 void omap_gem_unpin(struct drm_gem_object *obj);
91 int omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages,
93 int omap_gem_put_pages(struct drm_gem_object *obj);
95 u32 omap_gem_flags(struct drm_gem_object *obj);
96 int omap_gem_rotated_dma_addr(struct drm_gem_object *obj, u32 orient,
97 int x, int y, dma_addr_t *dma_addr);
98 int omap_gem_tiled_stride(struct drm_gem_object *obj, u32 orient);
100 #endif /* __OMAPDRM_GEM_H__ */