drm_agpsupport.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. struct drm_agp_head {
  13. struct agp_kern_info agp_info;
  14. struct list_head memory;
  15. unsigned long mode;
  16. struct agp_bridge_data *bridge;
  17. int enabled;
  18. int acquired;
  19. unsigned long base;
  20. int agp_mtrr;
  21. int cant_use_aperture;
  22. unsigned long page_mask;
  23. };
  24. #if IS_ENABLED(CONFIG_AGP)
  25. void drm_free_agp(struct agp_memory * handle, int pages);
  26. int drm_bind_agp(struct agp_memory * handle, unsigned int start);
  27. int drm_unbind_agp(struct agp_memory * handle);
  28. struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
  29. struct page **pages,
  30. unsigned long num_pages,
  31. uint32_t gtt_offset,
  32. uint32_t type);
  33. struct drm_agp_head *drm_agp_init(struct drm_device *dev);
  34. void drm_agp_clear(struct drm_device *dev);
  35. int drm_agp_acquire(struct drm_device *dev);
  36. int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
  37. struct drm_file *file_priv);
  38. int drm_agp_release(struct drm_device *dev);
  39. int drm_agp_release_ioctl(struct drm_device *dev, void *data,
  40. struct drm_file *file_priv);
  41. int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
  42. int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
  43. struct drm_file *file_priv);
  44. int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
  45. int drm_agp_info_ioctl(struct drm_device *dev, void *data,
  46. struct drm_file *file_priv);
  47. int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
  48. int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
  49. struct drm_file *file_priv);
  50. int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
  51. int drm_agp_free_ioctl(struct drm_device *dev, void *data,
  52. struct drm_file *file_priv);
  53. int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
  54. int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
  55. struct drm_file *file_priv);
  56. int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
  57. int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
  58. struct drm_file *file_priv);
  59. #else /* CONFIG_AGP */
  60. static inline void drm_free_agp(struct agp_memory * handle, int pages)
  61. {
  62. }
  63. static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
  64. {
  65. return -ENODEV;
  66. }
  67. static inline int drm_unbind_agp(struct agp_memory * handle)
  68. {
  69. return -ENODEV;
  70. }
  71. static inline struct agp_memory *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. static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
  80. {
  81. return NULL;
  82. }
  83. static inline void drm_agp_clear(struct drm_device *dev)
  84. {
  85. }
  86. static inline int drm_agp_acquire(struct drm_device *dev)
  87. {
  88. return -ENODEV;
  89. }
  90. static inline int drm_agp_release(struct drm_device *dev)
  91. {
  92. return -ENODEV;
  93. }
  94. static inline int drm_agp_enable(struct drm_device *dev,
  95. struct drm_agp_mode mode)
  96. {
  97. return -ENODEV;
  98. }
  99. static inline int drm_agp_info(struct drm_device *dev,
  100. struct drm_agp_info *info)
  101. {
  102. return -ENODEV;
  103. }
  104. static inline int drm_agp_alloc(struct drm_device *dev,
  105. struct drm_agp_buffer *request)
  106. {
  107. return -ENODEV;
  108. }
  109. static inline int drm_agp_free(struct drm_device *dev,
  110. struct drm_agp_buffer *request)
  111. {
  112. return -ENODEV;
  113. }
  114. static inline int drm_agp_unbind(struct drm_device *dev,
  115. struct drm_agp_binding *request)
  116. {
  117. return -ENODEV;
  118. }
  119. static inline int drm_agp_bind(struct drm_device *dev,
  120. struct drm_agp_binding *request)
  121. {
  122. return -ENODEV;
  123. }
  124. #endif /* CONFIG_AGP */
  125. #endif /* _DRM_AGPSUPPORT_H_ */