Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/*
2 * omap_gem.h -- OMAP DRM GEM Object Management
3 *
4 * Copyright (C) 2011 Texas Instruments
5 * Author: Rob Clark <rob@ti.com>
6 *
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.
10 *
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
14 * more details.
15 *
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/>.
18 */
19
20#ifndef __OMAPDRM_GEM_H__
21#define __OMAPDRM_GEM_H__
22
23#include <linux/types.h>
24#include <linux/mm_types.h>
25
26enum dma_data_direction;
27
28struct dma_buf;
29struct drm_device;
30struct drm_file;
31struct drm_gem_object;
32struct drm_mode_create_dumb;
33struct file;
34struct list_head;
35struct page;
36struct seq_file;
37struct vm_area_struct;
38struct vm_fault;
39
40union omap_gem_size;
41
42/* Initialization and Cleanup */
43void omap_gem_init(struct drm_device *dev);
44void omap_gem_deinit(struct drm_device *dev);
45
46#ifdef CONFIG_PM
47int omap_gem_resume(struct drm_device *dev);
48#endif
49
50#ifdef CONFIG_DEBUG_FS
51void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m);
52void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
53#endif
54
55/* GEM Object Creation and Deletion */
56struct drm_gem_object *omap_gem_new(struct drm_device *dev,
57 union omap_gem_size gsize, u32 flags);
58struct drm_gem_object *omap_gem_new_dmabuf(struct drm_device *dev, size_t size,
59 struct sg_table *sgt);
60int omap_gem_new_handle(struct drm_device *dev, struct drm_file *file,
61 union omap_gem_size gsize, u32 flags, u32 *handle);
62void omap_gem_free_object(struct drm_gem_object *obj);
63void *omap_gem_vaddr(struct drm_gem_object *obj);
64
65/* Dumb Buffers Interface */
66int omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
67 u32 handle, u64 *offset);
68int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
69 struct drm_mode_create_dumb *args);
70
71/* mmap() Interface */
72int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma);
73int omap_gem_mmap_obj(struct drm_gem_object *obj,
74 struct vm_area_struct *vma);
75u64 omap_gem_mmap_offset(struct drm_gem_object *obj);
76size_t omap_gem_mmap_size(struct drm_gem_object *obj);
77
78/* PRIME Interface */
79struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
80 struct drm_gem_object *obj, int flags);
81struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
82 struct dma_buf *buffer);
83
84vm_fault_t omap_gem_fault(struct vm_fault *vmf);
85int omap_gem_roll(struct drm_gem_object *obj, u32 roll);
86void omap_gem_cpu_sync_page(struct drm_gem_object *obj, int pgoff);
87void omap_gem_dma_sync_buffer(struct drm_gem_object *obj,
88 enum dma_data_direction dir);
89int omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr);
90void omap_gem_unpin(struct drm_gem_object *obj);
91int omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages,
92 bool remap);
93int omap_gem_put_pages(struct drm_gem_object *obj);
94
95u32 omap_gem_flags(struct drm_gem_object *obj);
96int omap_gem_rotated_dma_addr(struct drm_gem_object *obj, u32 orient,
97 int x, int y, dma_addr_t *dma_addr);
98int omap_gem_tiled_stride(struct drm_gem_object *obj, u32 orient);
99
100#endif /* __OMAPDRM_GEM_H__ */