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