1 #ifndef _DRM_AGPSUPPORT_H_
2 #define _DRM_AGPSUPPORT_H_
4 #include <linux/agp_backend.h>
5 #include <linux/kernel.h>
6 #include <linux/list.h>
8 #include <linux/mutex.h>
9 #include <linux/types.h>
10 #include <uapi/drm/drm.h>
15 #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && \
19 struct agp_kern_info agp_info;
20 struct list_head memory;
22 struct agp_bridge_data *bridge;
27 int cant_use_aperture;
28 unsigned long page_mask;
33 void drm_free_agp(struct agp_memory * handle, int pages);
34 int drm_bind_agp(struct agp_memory * handle, unsigned int start);
35 int drm_unbind_agp(struct agp_memory * handle);
36 struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
38 unsigned long num_pages,
42 struct drm_agp_head *drm_agp_init(struct drm_device *dev);
43 void drm_agp_clear(struct drm_device *dev);
44 int drm_agp_acquire(struct drm_device *dev);
45 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
46 struct drm_file *file_priv);
47 int drm_agp_release(struct drm_device *dev);
48 int drm_agp_release_ioctl(struct drm_device *dev, void *data,
49 struct drm_file *file_priv);
50 int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
51 int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
52 struct drm_file *file_priv);
53 int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
54 int drm_agp_info_ioctl(struct drm_device *dev, void *data,
55 struct drm_file *file_priv);
56 int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
57 int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
58 struct drm_file *file_priv);
59 int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
60 int drm_agp_free_ioctl(struct drm_device *dev, void *data,
61 struct drm_file *file_priv);
62 int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
63 int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
64 struct drm_file *file_priv);
65 int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
66 int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
67 struct drm_file *file_priv);
69 #else /* __OS_HAS_AGP */
71 static inline void drm_free_agp(struct agp_memory * handle, int pages)
75 static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
80 static inline int drm_unbind_agp(struct agp_memory * handle)
85 static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
87 unsigned long num_pages,
94 static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
99 static inline void drm_agp_clear(struct drm_device *dev)
103 static inline int drm_agp_acquire(struct drm_device *dev)
108 static inline int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
109 struct drm_file *file_priv)
114 static inline int drm_agp_release(struct drm_device *dev)
119 static inline int drm_agp_release_ioctl(struct drm_device *dev, void *data,
120 struct drm_file *file_priv)
125 static inline int drm_agp_enable(struct drm_device *dev,
126 struct drm_agp_mode mode)
131 static inline int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
132 struct drm_file *file_priv)
137 static inline int drm_agp_info(struct drm_device *dev,
138 struct drm_agp_info *info)
143 static inline int drm_agp_info_ioctl(struct drm_device *dev, void *data,
144 struct drm_file *file_priv)
149 static inline int drm_agp_alloc(struct drm_device *dev,
150 struct drm_agp_buffer *request)
155 static inline int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
156 struct drm_file *file_priv)
161 static inline int drm_agp_free(struct drm_device *dev,
162 struct drm_agp_buffer *request)
167 static inline int drm_agp_free_ioctl(struct drm_device *dev, void *data,
168 struct drm_file *file_priv)
173 static inline int drm_agp_unbind(struct drm_device *dev,
174 struct drm_agp_binding *request)
179 static inline int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
180 struct drm_file *file_priv)
185 static inline int drm_agp_bind(struct drm_device *dev,
186 struct drm_agp_binding *request)
191 static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
192 struct drm_file *file_priv)
197 #endif /* __OS_HAS_AGP */
199 #endif /* _DRM_AGPSUPPORT_H_ */