drm_agpsupport.h 4.9 KB

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