diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 11:26:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 11:26:17 -0500 |
commit | 3c2e81ef344a90bb0a39d84af6878b4aeff568a2 (patch) | |
tree | bd8c8b23466174899d2fe4d35af6e1e838edb068 /drivers/gpu/drm/exynos/exynos_drm_gem.h | |
parent | 221392c3ad0432e39fd74a349364f66cb0ed78f6 (diff) | |
parent | 55bde6b1442fed8af67b92d21acce67db454c9f9 (diff) |
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull DRM updates from Dave Airlie:
"This is the one and only next pull for 3.8, we had a regression we
found last week, so I was waiting for that to resolve itself, and I
ended up with some Intel fixes on top as well.
Highlights:
- new driver: nvidia tegra 20/30/hdmi support
- radeon: add support for previously unused DMA engines, more HDMI
regs, eviction speeds ups and fixes
- i915: HSW support enable, agp removal on GEN6, seqno wrapping
- exynos: IPP subsystem support (image post proc), HDMI
- nouveau: display class reworking, nv20->40 z compression
- ttm: start of locking fixes, rcu usage for lookups,
- core: documentation updates, docbook integration, monotonic clock
usage, move from connector to object properties"
* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (590 commits)
drm/exynos: add gsc ipp driver
drm/exynos: add rotator ipp driver
drm/exynos: add fimc ipp driver
drm/exynos: add iommu support for ipp
drm/exynos: add ipp subsystem
drm/exynos: support device tree for fimd
radeon: fix regression with eviction since evict caching changes
drm/radeon: add more pedantic checks in the CP DMA checker
drm/radeon: bump version for CS ioctl support for async DMA
drm/radeon: enable the async DMA rings in the CS ioctl
drm/radeon: add VM CS parser support for async DMA on cayman/TN/SI
drm/radeon/kms: add evergreen/cayman CS parser for async DMA (v2)
drm/radeon/kms: add 6xx/7xx CS parser for async DMA (v2)
drm/radeon: fix htile buffer size computation for command stream checker
drm/radeon: fix fence locking in the pageflip callback
drm/radeon: make indirect register access concurrency-safe
drm/radeon: add W|RREG32_IDX for MM_INDEX|DATA based mmio accesss
drm/exynos: support extended screen coordinate of fimd
drm/exynos: fix x, y coordinates for right bottom pixel
drm/exynos: fix fb offset calculation for plane
...
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_drm_gem.h')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_gem.h | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index 085b2a5d5f70..f11f2afd5bfc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h | |||
@@ -35,21 +35,27 @@ | |||
35 | * exynos drm gem buffer structure. | 35 | * exynos drm gem buffer structure. |
36 | * | 36 | * |
37 | * @kvaddr: kernel virtual address to allocated memory region. | 37 | * @kvaddr: kernel virtual address to allocated memory region. |
38 | * *userptr: user space address. | ||
38 | * @dma_addr: bus address(accessed by dma) to allocated memory region. | 39 | * @dma_addr: bus address(accessed by dma) to allocated memory region. |
39 | * - this address could be physical address without IOMMU and | 40 | * - this address could be physical address without IOMMU and |
40 | * device address with IOMMU. | 41 | * device address with IOMMU. |
42 | * @write: whether pages will be written to by the caller. | ||
43 | * @pages: Array of backing pages. | ||
41 | * @sgt: sg table to transfer page data. | 44 | * @sgt: sg table to transfer page data. |
42 | * @pages: contain all pages to allocated memory region. | ||
43 | * @page_size: could be 4K, 64K or 1MB. | ||
44 | * @size: size of allocated memory region. | 45 | * @size: size of allocated memory region. |
46 | * @pfnmap: indicate whether memory region from userptr is mmaped with | ||
47 | * VM_PFNMAP or not. | ||
45 | */ | 48 | */ |
46 | struct exynos_drm_gem_buf { | 49 | struct exynos_drm_gem_buf { |
47 | void __iomem *kvaddr; | 50 | void __iomem *kvaddr; |
51 | unsigned long userptr; | ||
48 | dma_addr_t dma_addr; | 52 | dma_addr_t dma_addr; |
49 | struct sg_table *sgt; | 53 | struct dma_attrs dma_attrs; |
54 | unsigned int write; | ||
50 | struct page **pages; | 55 | struct page **pages; |
51 | unsigned long page_size; | 56 | struct sg_table *sgt; |
52 | unsigned long size; | 57 | unsigned long size; |
58 | bool pfnmap; | ||
53 | }; | 59 | }; |
54 | 60 | ||
55 | /* | 61 | /* |
@@ -65,6 +71,7 @@ struct exynos_drm_gem_buf { | |||
65 | * or at framebuffer creation. | 71 | * or at framebuffer creation. |
66 | * @size: size requested from user, in bytes and this size is aligned | 72 | * @size: size requested from user, in bytes and this size is aligned |
67 | * in page unit. | 73 | * in page unit. |
74 | * @vma: a pointer to vm_area. | ||
68 | * @flags: indicate memory type to allocated buffer and cache attruibute. | 75 | * @flags: indicate memory type to allocated buffer and cache attruibute. |
69 | * | 76 | * |
70 | * P.S. this object would be transfered to user as kms_bo.handle so | 77 | * P.S. this object would be transfered to user as kms_bo.handle so |
@@ -74,6 +81,7 @@ struct exynos_drm_gem_obj { | |||
74 | struct drm_gem_object base; | 81 | struct drm_gem_object base; |
75 | struct exynos_drm_gem_buf *buffer; | 82 | struct exynos_drm_gem_buf *buffer; |
76 | unsigned long size; | 83 | unsigned long size; |
84 | struct vm_area_struct *vma; | ||
77 | unsigned int flags; | 85 | unsigned int flags; |
78 | }; | 86 | }; |
79 | 87 | ||
@@ -104,9 +112,9 @@ int exynos_drm_gem_create_ioctl(struct drm_device *dev, void *data, | |||
104 | * other drivers such as 2d/3d acceleration drivers. | 112 | * other drivers such as 2d/3d acceleration drivers. |
105 | * with this function call, gem object reference count would be increased. | 113 | * with this function call, gem object reference count would be increased. |
106 | */ | 114 | */ |
107 | void *exynos_drm_gem_get_dma_addr(struct drm_device *dev, | 115 | dma_addr_t *exynos_drm_gem_get_dma_addr(struct drm_device *dev, |
108 | unsigned int gem_handle, | 116 | unsigned int gem_handle, |
109 | struct drm_file *file_priv); | 117 | struct drm_file *filp); |
110 | 118 | ||
111 | /* | 119 | /* |
112 | * put dma address from gem handle and this function could be used for | 120 | * put dma address from gem handle and this function could be used for |
@@ -115,7 +123,7 @@ void *exynos_drm_gem_get_dma_addr(struct drm_device *dev, | |||
115 | */ | 123 | */ |
116 | void exynos_drm_gem_put_dma_addr(struct drm_device *dev, | 124 | void exynos_drm_gem_put_dma_addr(struct drm_device *dev, |
117 | unsigned int gem_handle, | 125 | unsigned int gem_handle, |
118 | struct drm_file *file_priv); | 126 | struct drm_file *filp); |
119 | 127 | ||
120 | /* get buffer offset to map to user space. */ | 128 | /* get buffer offset to map to user space. */ |
121 | int exynos_drm_gem_map_offset_ioctl(struct drm_device *dev, void *data, | 129 | int exynos_drm_gem_map_offset_ioctl(struct drm_device *dev, void *data, |
@@ -128,6 +136,10 @@ int exynos_drm_gem_map_offset_ioctl(struct drm_device *dev, void *data, | |||
128 | int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data, | 136 | int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data, |
129 | struct drm_file *file_priv); | 137 | struct drm_file *file_priv); |
130 | 138 | ||
139 | /* map user space allocated by malloc to pages. */ | ||
140 | int exynos_drm_gem_userptr_ioctl(struct drm_device *dev, void *data, | ||
141 | struct drm_file *file_priv); | ||
142 | |||
131 | /* get buffer information to memory region allocated by gem. */ | 143 | /* get buffer information to memory region allocated by gem. */ |
132 | int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, | 144 | int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, |
133 | struct drm_file *file_priv); | 145 | struct drm_file *file_priv); |
@@ -163,4 +175,36 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | |||
163 | /* set vm_flags and we can change the vm attribute to other one at here. */ | 175 | /* set vm_flags and we can change the vm attribute to other one at here. */ |
164 | int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); | 176 | int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |
165 | 177 | ||
178 | static inline int vma_is_io(struct vm_area_struct *vma) | ||
179 | { | ||
180 | return !!(vma->vm_flags & (VM_IO | VM_PFNMAP)); | ||
181 | } | ||
182 | |||
183 | /* get a copy of a virtual memory region. */ | ||
184 | struct vm_area_struct *exynos_gem_get_vma(struct vm_area_struct *vma); | ||
185 | |||
186 | /* release a userspace virtual memory area. */ | ||
187 | void exynos_gem_put_vma(struct vm_area_struct *vma); | ||
188 | |||
189 | /* get pages from user space. */ | ||
190 | int exynos_gem_get_pages_from_userptr(unsigned long start, | ||
191 | unsigned int npages, | ||
192 | struct page **pages, | ||
193 | struct vm_area_struct *vma); | ||
194 | |||
195 | /* drop the reference to pages. */ | ||
196 | void exynos_gem_put_pages_to_userptr(struct page **pages, | ||
197 | unsigned int npages, | ||
198 | struct vm_area_struct *vma); | ||
199 | |||
200 | /* map sgt with dma region. */ | ||
201 | int exynos_gem_map_sgt_with_dma(struct drm_device *drm_dev, | ||
202 | struct sg_table *sgt, | ||
203 | enum dma_data_direction dir); | ||
204 | |||
205 | /* unmap sgt from dma region. */ | ||
206 | void exynos_gem_unmap_sgt_from_dma(struct drm_device *drm_dev, | ||
207 | struct sg_table *sgt, | ||
208 | enum dma_data_direction dir); | ||
209 | |||
166 | #endif | 210 | #endif |