blob: a184eeee9c96bfb4afc4a1bc8b173a0a71fa1225 [file] [log] [blame]
David Herrmann00fd78e2013-08-08 22:19:12 +02001#ifndef _DRM_AGPSUPPORT_H_
2#define _DRM_AGPSUPPORT_H_
3
4#include <linux/kernel.h>
5#include <linux/mm.h>
6#include <linux/mutex.h>
7#include <linux/types.h>
8#include <linux/agp_backend.h>
9#include <drm/drmP.h>
10
11#if __OS_HAS_AGP
12
13void drm_free_agp(DRM_AGP_MEM * handle, int pages);
14int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
15int drm_unbind_agp(DRM_AGP_MEM * handle);
16DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
17 struct page **pages,
18 unsigned long num_pages,
19 uint32_t gtt_offset,
20 uint32_t type);
21
22struct drm_agp_head *drm_agp_init(struct drm_device *dev);
23void drm_agp_destroy(struct drm_agp_head *agp);
24void drm_agp_clear(struct drm_device *dev);
25int drm_agp_acquire(struct drm_device *dev);
26int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
27 struct drm_file *file_priv);
28int drm_agp_release(struct drm_device *dev);
29int drm_agp_release_ioctl(struct drm_device *dev, void *data,
30 struct drm_file *file_priv);
31int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
32int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
33 struct drm_file *file_priv);
34int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
35int drm_agp_info_ioctl(struct drm_device *dev, void *data,
36 struct drm_file *file_priv);
37int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
38int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
39 struct drm_file *file_priv);
40int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
41int drm_agp_free_ioctl(struct drm_device *dev, void *data,
42 struct drm_file *file_priv);
43int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
44int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
45 struct drm_file *file_priv);
46int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
47int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
48 struct drm_file *file_priv);
49
50static inline int drm_core_has_AGP(struct drm_device *dev)
51{
52 return drm_core_check_feature(dev, DRIVER_USE_AGP);
53}
54
55#else /* __OS_HAS_AGP */
56
57static inline void drm_free_agp(DRM_AGP_MEM * handle, int pages)
58{
59}
60
61static inline int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start)
62{
63 return -ENODEV;
64}
65
66static inline int drm_unbind_agp(DRM_AGP_MEM * handle)
67{
68 return -ENODEV;
69}
70
71static inline DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
72 struct page **pages,
73 unsigned long num_pages,
74 uint32_t gtt_offset,
75 uint32_t type)
76{
77 return NULL;
78}
79
80static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
81{
82 return NULL;
83}
84
85static inline void drm_agp_destroy(struct drm_agp_head *agp)
86{
87}
88
89static inline void drm_agp_clear(struct drm_device *dev)
90{
91}
92
93static inline int drm_agp_acquire(struct drm_device *dev)
94{
95 return -ENODEV;
96}
97
98static inline int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
99 struct drm_file *file_priv)
100{
101 return -ENODEV;
102}
103
104static inline int drm_agp_release(struct drm_device *dev)
105{
106 return -ENODEV;
107}
108
109static inline int drm_agp_release_ioctl(struct drm_device *dev, void *data,
110 struct drm_file *file_priv)
111{
112 return -ENODEV;
113}
114
115static inline int drm_agp_enable(struct drm_device *dev,
116 struct drm_agp_mode mode)
117{
118 return -ENODEV;
119}
120
121static inline int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
122 struct drm_file *file_priv)
123{
124 return -ENODEV;
125}
126
127static inline int drm_agp_info(struct drm_device *dev,
128 struct drm_agp_info *info)
129{
130 return -ENODEV;
131}
132
133static inline int drm_agp_info_ioctl(struct drm_device *dev, void *data,
134 struct drm_file *file_priv)
135{
136 return -ENODEV;
137}
138
139static inline int drm_agp_alloc(struct drm_device *dev,
140 struct drm_agp_buffer *request)
141{
142 return -ENODEV;
143}
144
145static inline int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
146 struct drm_file *file_priv)
147{
148 return -ENODEV;
149}
150
151static inline int drm_agp_free(struct drm_device *dev,
152 struct drm_agp_buffer *request)
153{
154 return -ENODEV;
155}
156
157static inline int drm_agp_free_ioctl(struct drm_device *dev, void *data,
158 struct drm_file *file_priv)
159{
160 return -ENODEV;
161}
162
163static inline int drm_agp_unbind(struct drm_device *dev,
164 struct drm_agp_binding *request)
165{
166 return -ENODEV;
167}
168
169static inline int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
170 struct drm_file *file_priv)
171{
172 return -ENODEV;
173}
174
175static inline int drm_agp_bind(struct drm_device *dev,
176 struct drm_agp_binding *request)
177{
178 return -ENODEV;
179}
180
181static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
182 struct drm_file *file_priv)
183{
184 return -ENODEV;
185}
186
187static inline int drm_core_has_AGP(struct drm_device *dev)
188{
189 return 0;
190}
191
192#endif /* __OS_HAS_AGP */
193
194#endif /* _DRM_AGPSUPPORT_H_ */