blob: b2d912670a7fb07c27685008bc62b7bf5310a8b5 [file] [log] [blame]
David Herrmann00fd78e2013-08-08 22:19:12 +02001#ifndef _DRM_AGPSUPPORT_H_
2#define _DRM_AGPSUPPORT_H_
3
David Herrmannd7d2c482014-08-29 12:12:40 +02004#include <linux/agp_backend.h>
David Herrmann00fd78e2013-08-08 22:19:12 +02005#include <linux/kernel.h>
David Herrmannd7d2c482014-08-29 12:12:40 +02006#include <linux/list.h>
David Herrmann00fd78e2013-08-08 22:19:12 +02007#include <linux/mm.h>
8#include <linux/mutex.h>
9#include <linux/types.h>
David Herrmannd7d2c482014-08-29 12:12:40 +020010#include <uapi/drm/drm.h>
11
12struct drm_device;
13struct drm_file;
David Herrmann00fd78e2013-08-08 22:19:12 +020014
David Herrmanncc5ea592014-08-29 12:12:32 +020015struct 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 Vettera7fb8a22015-09-09 16:45:52 +020028#if IS_ENABLED(CONFIG_AGP)
David Herrmann00fd78e2013-08-08 22:19:12 +020029
Daniel Vetterd2e546b2013-12-11 11:34:40 +010030void drm_free_agp(struct agp_memory * handle, int pages);
31int drm_bind_agp(struct agp_memory * handle, unsigned int start);
32int drm_unbind_agp(struct agp_memory * handle);
33struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
David Herrmann00fd78e2013-08-08 22:19:12 +020034 struct page **pages,
35 unsigned long num_pages,
36 uint32_t gtt_offset,
37 uint32_t type);
38
39struct drm_agp_head *drm_agp_init(struct drm_device *dev);
Daniel Vetter366884b2016-04-26 19:29:34 +020040void drm_legacy_agp_clear(struct drm_device *dev);
David Herrmann00fd78e2013-08-08 22:19:12 +020041int drm_agp_acquire(struct drm_device *dev);
42int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
43 struct drm_file *file_priv);
44int drm_agp_release(struct drm_device *dev);
45int drm_agp_release_ioctl(struct drm_device *dev, void *data,
46 struct drm_file *file_priv);
47int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
48int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
49 struct drm_file *file_priv);
50int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
51int drm_agp_info_ioctl(struct drm_device *dev, void *data,
52 struct drm_file *file_priv);
53int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
54int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
55 struct drm_file *file_priv);
56int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
57int drm_agp_free_ioctl(struct drm_device *dev, void *data,
58 struct drm_file *file_priv);
59int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
60int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
61 struct drm_file *file_priv);
62int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
63int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
64 struct drm_file *file_priv);
David Herrmannd7d2c482014-08-29 12:12:40 +020065
Daniel Vettera7fb8a22015-09-09 16:45:52 +020066#else /* CONFIG_AGP */
David Herrmann00fd78e2013-08-08 22:19:12 +020067
Daniel Vetterd2e546b2013-12-11 11:34:40 +010068static inline void drm_free_agp(struct agp_memory * handle, int pages)
David Herrmann00fd78e2013-08-08 22:19:12 +020069{
70}
71
Daniel Vetterd2e546b2013-12-11 11:34:40 +010072static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
David Herrmann00fd78e2013-08-08 22:19:12 +020073{
74 return -ENODEV;
75}
76
Daniel Vetterd2e546b2013-12-11 11:34:40 +010077static inline int drm_unbind_agp(struct agp_memory * handle)
David Herrmann00fd78e2013-08-08 22:19:12 +020078{
79 return -ENODEV;
80}
81
Daniel Vetterd2e546b2013-12-11 11:34:40 +010082static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
David Herrmann00fd78e2013-08-08 22:19:12 +020083 struct page **pages,
84 unsigned long num_pages,
85 uint32_t gtt_offset,
86 uint32_t type)
87{
88 return NULL;
89}
90
91static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
92{
93 return NULL;
94}
95
Daniel Vetter366884b2016-04-26 19:29:34 +020096static inline void drm_legacy_agp_clear(struct drm_device *dev)
David Herrmann00fd78e2013-08-08 22:19:12 +020097{
98}
99
100static inline int drm_agp_acquire(struct drm_device *dev)
101{
102 return -ENODEV;
103}
104
David Herrmann00fd78e2013-08-08 22:19:12 +0200105static inline int drm_agp_release(struct drm_device *dev)
106{
107 return -ENODEV;
108}
109
David Herrmann00fd78e2013-08-08 22:19:12 +0200110static inline int drm_agp_enable(struct drm_device *dev,
111 struct drm_agp_mode mode)
112{
113 return -ENODEV;
114}
115
David Herrmann00fd78e2013-08-08 22:19:12 +0200116static inline int drm_agp_info(struct drm_device *dev,
117 struct drm_agp_info *info)
118{
119 return -ENODEV;
120}
121
David Herrmann00fd78e2013-08-08 22:19:12 +0200122static inline int drm_agp_alloc(struct drm_device *dev,
123 struct drm_agp_buffer *request)
124{
125 return -ENODEV;
126}
127
David Herrmann00fd78e2013-08-08 22:19:12 +0200128static inline int drm_agp_free(struct drm_device *dev,
129 struct drm_agp_buffer *request)
130{
131 return -ENODEV;
132}
133
David Herrmann00fd78e2013-08-08 22:19:12 +0200134static inline int drm_agp_unbind(struct drm_device *dev,
135 struct drm_agp_binding *request)
136{
137 return -ENODEV;
138}
139
David Herrmann00fd78e2013-08-08 22:19:12 +0200140static inline int drm_agp_bind(struct drm_device *dev,
141 struct drm_agp_binding *request)
142{
143 return -ENODEV;
144}
145
Daniel Vettera7fb8a22015-09-09 16:45:52 +0200146#endif /* CONFIG_AGP */
David Herrmann00fd78e2013-08-08 22:19:12 +0200147
148#endif /* _DRM_AGPSUPPORT_H_ */