Home | History | Annotate | Line # | Download | only in drm
drm_agpsupport.h revision 1.1.1.3
      1 /*	$NetBSD: drm_agpsupport.h,v 1.1.1.3 2021/12/18 20:15:56 riastradh Exp $	*/
      2 
      3 /* SPDX-License-Identifier: GPL-2.0 */
      4 #ifndef _DRM_AGPSUPPORT_H_
      5 #define _DRM_AGPSUPPORT_H_
      6 
      7 #include <linux/agp_backend.h>
      8 #include <linux/kernel.h>
      9 #include <linux/list.h>
     10 #include <linux/mm.h>
     11 #include <linux/mutex.h>
     12 #include <linux/types.h>
     13 #include <uapi/drm/drm.h>
     14 
     15 struct drm_device;
     16 struct drm_file;
     17 
     18 struct drm_agp_head {
     19 	struct agp_kern_info agp_info;
     20 	struct list_head memory;
     21 	unsigned long mode;
     22 	struct agp_bridge_data *bridge;
     23 	int enabled;
     24 	int acquired;
     25 	unsigned long base;
     26 	int agp_mtrr;
     27 	int cant_use_aperture;
     28 	unsigned long page_mask;
     29 };
     30 
     31 #if IS_ENABLED(CONFIG_AGP)
     32 
     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 
     37 struct drm_agp_head *drm_agp_init(struct drm_device *dev);
     38 void drm_legacy_agp_clear(struct drm_device *dev);
     39 int drm_agp_acquire(struct drm_device *dev);
     40 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
     41 			  struct drm_file *file_priv);
     42 int drm_agp_release(struct drm_device *dev);
     43 int drm_agp_release_ioctl(struct drm_device *dev, void *data,
     44 			  struct drm_file *file_priv);
     45 int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
     46 int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
     47 			 struct drm_file *file_priv);
     48 int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
     49 int drm_agp_info_ioctl(struct drm_device *dev, void *data,
     50 		       struct drm_file *file_priv);
     51 int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
     52 int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
     53 			struct drm_file *file_priv);
     54 int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
     55 int drm_agp_free_ioctl(struct drm_device *dev, void *data,
     56 		       struct drm_file *file_priv);
     57 int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
     58 int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
     59 			 struct drm_file *file_priv);
     60 int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
     61 int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
     62 		       struct drm_file *file_priv);
     63 
     64 #else /* CONFIG_AGP */
     65 
     66 static inline void drm_free_agp(struct agp_memory * handle, int pages)
     67 {
     68 }
     69 
     70 static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
     71 {
     72 	return -ENODEV;
     73 }
     74 
     75 static inline int drm_unbind_agp(struct agp_memory * handle)
     76 {
     77 	return -ENODEV;
     78 }
     79 
     80 static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
     81 {
     82 	return NULL;
     83 }
     84 
     85 static inline void drm_legacy_agp_clear(struct drm_device *dev)
     86 {
     87 }
     88 
     89 static inline int drm_agp_acquire(struct drm_device *dev)
     90 {
     91 	return -ENODEV;
     92 }
     93 
     94 static inline int drm_agp_release(struct drm_device *dev)
     95 {
     96 	return -ENODEV;
     97 }
     98 
     99 static inline int drm_agp_enable(struct drm_device *dev,
    100 				 struct drm_agp_mode mode)
    101 {
    102 	return -ENODEV;
    103 }
    104 
    105 static inline int drm_agp_info(struct drm_device *dev,
    106 			       struct drm_agp_info *info)
    107 {
    108 	return -ENODEV;
    109 }
    110 
    111 static inline int drm_agp_alloc(struct drm_device *dev,
    112 				struct drm_agp_buffer *request)
    113 {
    114 	return -ENODEV;
    115 }
    116 
    117 static inline int drm_agp_free(struct drm_device *dev,
    118 			       struct drm_agp_buffer *request)
    119 {
    120 	return -ENODEV;
    121 }
    122 
    123 static inline int drm_agp_unbind(struct drm_device *dev,
    124 				 struct drm_agp_binding *request)
    125 {
    126 	return -ENODEV;
    127 }
    128 
    129 static inline int drm_agp_bind(struct drm_device *dev,
    130 			       struct drm_agp_binding *request)
    131 {
    132 	return -ENODEV;
    133 }
    134 
    135 #endif /* CONFIG_AGP */
    136 
    137 #endif /* _DRM_AGPSUPPORT_H_ */
    138