2 * Internal Header for the Direct Rendering Manager
4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6 * Copyright (c) 2009-2010, Code Aurora Forum.
9 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
10 * Author: Gareth Hughes <gareth@valinux.com>
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
19 * The above copyright notice and this permission notice (including the next
20 * paragraph) shall be included in all copies or substantial portions of the
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29 * OTHER DEALINGS IN THE SOFTWARE.
35 #include <linux/agp_backend.h>
36 #include <linux/cdev.h>
37 #include <linux/dma-mapping.h>
38 #include <linux/file.h>
40 #include <linux/highmem.h>
41 #include <linux/idr.h>
42 #include <linux/init.h>
44 #include <linux/jiffies.h>
45 #include <linux/kernel.h>
46 #include <linux/kref.h>
47 #include <linux/miscdevice.h>
49 #include <linux/mutex.h>
50 #include <linux/platform_device.h>
51 #include <linux/poll.h>
52 #include <linux/ratelimit.h>
53 #include <linux/sched.h>
54 #include <linux/slab.h>
55 #include <linux/types.h>
56 #include <linux/vmalloc.h>
57 #include <linux/workqueue.h>
58 #include <linux/dma-fence.h>
59 #include <linux/module.h>
62 #include <asm/pgalloc.h>
63 #include <linux/uaccess.h>
65 #include <uapi/drm/drm.h>
66 #include <uapi/drm/drm_mode.h>
68 #include <drm/drm_agpsupport.h>
69 #include <drm/drm_crtc.h>
70 #include <drm/drm_fourcc.h>
71 #include <drm/drm_global.h>
72 #include <drm/drm_hashtab.h>
73 #include <drm/drm_mem_util.h>
74 #include <drm/drm_mm.h>
75 #include <drm/drm_os_linux.h>
76 #include <drm/drm_sarea.h>
77 #include <drm/drm_drv.h>
78 #include <drm/drm_prime.h>
79 #include <drm/drm_pci.h>
80 #include <drm/drm_file.h>
81 #include <drm/drm_debugfs.h>
82 #include <drm/drm_ioctl.h>
83 #include <drm/drm_sysfs.h>
86 #include <drm/drm_auth.h> /* for struct drm_lock_data */
89 #include <sys/sysctl.h>
91 #include <vm/vm_extern.h>
92 #include <vm/vm_pager.h>
100 struct drm_device_dma;
101 struct drm_gem_object;
103 struct drm_vblank_crtc;
104 struct drm_vma_offset_manager;
108 struct reservation_object;
109 struct dma_buf_attachment;
112 struct pci_controller;
115 * The following categories are defined:
117 * CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ...
118 * This is the category used by the DRM_DEBUG() macro.
120 * DRIVER: Used in the vendor specific part of the driver: i915, radeon, ...
121 * This is the category used by the DRM_DEBUG_DRIVER() macro.
123 * KMS: used in the modesetting code.
124 * This is the category used by the DRM_DEBUG_KMS() macro.
126 * PRIME: used in the prime code.
127 * This is the category used by the DRM_DEBUG_PRIME() macro.
129 * ATOMIC: used in the atomic code.
130 * This is the category used by the DRM_DEBUG_ATOMIC() macro.
132 * VBL: used for verbose debug message in the vblank code
133 * This is the category used by the DRM_DEBUG_VBL() macro.
135 * DragonFly-specific categories:
137 * PID: used as modifier to include PID number in messages.
138 * This is the category used by the all debug macros.
140 * FIOCTL: used in failed ioctl debugging.
141 * This is the category used by the DRM_DEBUG_FIOCTL() macro.
143 * IOCTL: used in ioctl debugging.
144 * This is the category used by the DRM_DEBUG_IOCTL() macro.
146 * Enabling verbose debug messages is done through the drm.debug parameter,
147 * each category being enabled by a bit.
149 * drm.debug=0x1 will enable CORE messages
150 * drm.debug=0x2 will enable DRIVER messages
151 * drm.debug=0x3 will enable CORE and DRIVER messages
153 * drm.debug=0x3f will enable all messages
155 * An interesting feature is that it's possible to enable verbose logging at
156 * run-time by using the hw.drm.debug sysctl variable:
157 * # sysctl hw.drm.debug=0xfff
159 #define DRM_UT_NONE 0x00
160 #define DRM_UT_CORE 0x01
161 #define DRM_UT_DRIVER 0x02
162 #define DRM_UT_KMS 0x04
163 #define DRM_UT_PRIME 0x08
164 #define DRM_UT_ATOMIC 0x10
165 #define DRM_UT_VBL 0x20
166 #define DRM_UT_STATE 0x40
167 /* Extra DragonFly debug categories */
169 #define DRM_UT_RES8 0x80 /* reserved for future expansion */
170 #define DRM_UT_PID 0x100
171 #define DRM_UT_FIOCTL 0x200
172 #define DRM_UT_IOCTL 0x400
174 extern __printflike(2, 3)
175 void drm_ut_debug_printk(const char *function_name,
176 const char *format, ...);
177 extern __printflike(2, 3)
178 void drm_err(const char *func, const char *format, ...);
181 /***********************************************************************/
182 /** \name DRM template customization defaults */
185 /***********************************************************************/
186 /** \name Macros to make printk easier */
189 #define _DRM_PRINTK(once, level, fmt, ...) \
191 printk##once(KERN_##level "[" DRM_NAME "] " fmt, \
195 #define DRM_INFO(fmt, ...) \
196 _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
197 #define DRM_NOTE(fmt, ...) \
198 _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
199 #define DRM_WARN(fmt, ...) \
200 _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
202 #define DRM_INFO_ONCE(fmt, ...) \
203 _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
204 #define DRM_NOTE_ONCE(fmt, ...) \
205 _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
206 #define DRM_WARN_ONCE(fmt, ...) \
207 _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
212 * \param fmt printf() like format string.
213 * \param arg arguments
215 #define DRM_DEV_ERROR(dev, fmt, ...) \
216 drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
218 #define DRM_ERROR(fmt, ...) \
219 drm_err(__func__, fmt, ##__VA_ARGS__)
222 * Rate limited error output. Like DRM_ERROR() but won't flood the log.
224 * \param fmt printf() like format string.
225 * \param arg arguments
227 #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...) \
229 static DEFINE_RATELIMIT_STATE(_rs, \
230 DEFAULT_RATELIMIT_INTERVAL, \
231 DEFAULT_RATELIMIT_BURST); \
233 if (__ratelimit(&_rs)) \
234 DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__); \
236 #define DRM_ERROR_RATELIMITED(fmt, ...) \
237 DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
239 #define DRM_DEV_INFO(dev, fmt, ...) \
240 drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt, \
243 #define DRM_DEV_INFO_ONCE(dev, fmt, ...) \
245 static bool __print_once __read_mostly; \
246 if (!__print_once) { \
247 __print_once = true; \
248 DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__); \
255 * \param fmt printf() like format string.
256 * \param arg arguments
258 #define DRM_DEV_DEBUG(dev, fmt, args...) \
259 drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt, \
261 #define DRM_DEBUG(fmt, args...) \
263 if (unlikely(drm_debug & DRM_UT_CORE)) \
264 drm_ut_debug_printk(__func__, fmt, ##args); \
267 #define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...) \
268 drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "", \
270 #define DRM_DEBUG_DRIVER(fmt, args...) \
272 if (unlikely(drm_debug & DRM_UT_DRIVER)) \
273 drm_ut_debug_printk(__func__, fmt, ##args); \
276 #define DRM_DEV_DEBUG_KMS(dev, fmt, args...) \
277 drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt, \
279 #define DRM_DEBUG_KMS(fmt, args...) \
281 if (unlikely(drm_debug & DRM_UT_KMS)) \
282 drm_ut_debug_printk(__func__, fmt, ##args); \
285 #define DRM_DEV_DEBUG_PRIME(dev, fmt, args...) \
286 drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "", \
288 #define DRM_DEBUG_PRIME(fmt, args...) \
290 if (unlikely(drm_debug & DRM_UT_PRIME)) \
291 drm_ut_debug_printk(__func__, fmt, ##args); \
294 #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...) \
295 drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "", \
297 #define DRM_DEBUG_ATOMIC(fmt, ...) \
299 if (unlikely(drm_debug & DRM_UT_ATOMIC)) \
300 drm_ut_debug_printk(__func__, fmt, ##__VA_ARGS__); \
303 #define DRM_DEV_DEBUG_VBL(dev, fmt, args...) \
304 drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt, \
306 #define DRM_DEBUG_VBL(fmt, args...) \
308 if (unlikely(drm_debug & DRM_UT_VBL)) \
309 drm_ut_debug_printk(__func__, fmt, ##args); \
313 #define DRM_DEBUG_FIOCTL(fmt, args...) \
315 if (unlikely(drm_debug & DRM_UT_FIOCTL)) \
316 drm_ut_debug_printk(__func__, fmt, ##args); \
318 #define DRM_DEBUG_IOCTL(fmt, args...) \
320 if (unlikely(drm_debug & DRM_UT_IOCTL)) \
321 drm_ut_debug_printk(__func__, fmt, ##args); \
323 #define DRM_DEBUG_VBLANK DRM_DEBUG_VBL
324 #endif /* __DragonFly__ */
326 #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...) \
328 static DEFINE_RATELIMIT_STATE(_rs, \
329 DEFAULT_RATELIMIT_INTERVAL, \
330 DEFAULT_RATELIMIT_BURST); \
331 if (__ratelimit(&_rs)) \
332 drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level, \
333 __func__, "", fmt, ##args); \
337 * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
339 * \param fmt printf() like format string.
340 * \param arg arguments
342 #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...) \
343 DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
344 #define DRM_DEBUG_RATELIMITED(fmt, args...) \
345 DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
346 #define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...) \
347 _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
348 #define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...) \
349 DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
350 #define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...) \
351 _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
352 #define DRM_DEBUG_KMS_RATELIMITED(fmt, args...) \
353 DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
354 #define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...) \
355 _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
356 #define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...) \
357 DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
359 /* Format strings and argument splitters to simplify printing
360 * various "complex" objects
362 #define DRM_MODE_FMT "%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x"
363 #define DRM_MODE_ARG(m) \
364 (m)->base.id, (m)->name, (m)->vrefresh, (m)->clock, \
365 (m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \
366 (m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \
367 (m)->type, (m)->flags
369 #define DRM_RECT_FMT "%dx%d%+d%+d"
370 #define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1
372 /* for rect's in fixed-point format: */
373 #define DRM_RECT_FP_FMT "%d.%06ux%d.%06u%+d.%06u%+d.%06u"
374 #define DRM_RECT_FP_ARG(r) \
375 drm_rect_width(r) >> 16, ((drm_rect_width(r) & 0xffff) * 15625) >> 10, \
376 drm_rect_height(r) >> 16, ((drm_rect_height(r) & 0xffff) * 15625) >> 10, \
377 (r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \
378 (r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
382 /***********************************************************************/
383 /** \name Internal types and structures */
386 #define DRM_IF_VERSION(maj, min) (maj << 16 | min)
388 #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
389 #define DRM_DEV_UID UID_ROOT
390 #define DRM_DEV_GID GID_WHEEL
392 #define DRM_CURPROC curthread
393 #define DRM_STRUCTPROC struct thread
394 #define DRM_LOCK(dev) lockmgr(&(dev)->struct_mutex, LK_EXCLUSIVE)
395 #define DRM_UNLOCK(dev) lockmgr(&(dev)->struct_mutex, LK_RELEASE)
397 #define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS)
399 #define drm_get_device_from_kdev(_kdev) (_kdev->si_drv1)
401 int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end,
402 vm_memattr_t memattr);
403 void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end);
404 vm_page_t vm_phys_fictitious_to_vm_page(vm_paddr_t pa);
406 /* Flags and return codes for get_vblank_timestamp() driver function. */
407 #define DRM_CALLED_FROM_VBLIRQ 1
408 #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0)
410 /* get_scanout_position() return flags */
411 #define DRM_SCANOUTPOS_VALID (1 << 0)
412 #define DRM_SCANOUTPOS_IN_VBLANK (1 << 1)
413 #define DRM_SCANOUTPOS_ACCURATE (1 << 2)
416 struct drm_sysctl_info {
417 struct sysctl_ctx_list ctx;
421 /* Length for the array of resource pointers for drm_get_resource_*. */
422 #define DRM_MAX_PCI_RESOURCE 6
426 * DRM device structure. This structure represent a complete card that
427 * may contain multiple heads.
430 struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */
431 int if_version; /**< Highest interface version set */
433 /** \name Lifetime Management */
435 struct kref ref; /**< Object ref-count */
436 struct device *dev; /**< Device structure of bus-device */
437 struct drm_driver *driver; /**< DRM driver managing the device */
438 void *dev_private; /**< DRM driver private data */
439 struct drm_minor *control; /**< Control node */
440 struct drm_minor *primary; /**< Primary node */
441 struct drm_minor *render; /**< Render node */
444 /* currently active master for this device. Protected by master_mutex */
445 struct drm_master *master;
447 atomic_t unplugged; /**< Flag whether dev is dead */
448 struct inode *anon_inode; /**< inode for private address-space */
449 char *unique; /**< unique name of the device */
454 struct lock struct_mutex; /**< For others */
455 struct lock master_mutex; /**< For drm_minor::master and drm_file::is_master */
458 /** \name Usage Counters */
460 int open_count; /**< Outstanding files open, protected by drm_global_mutex. */
461 spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */
462 int buf_use; /**< Buffers in use -- cannot alloc */
463 atomic_t buf_alloc; /**< Buffer allocation in progress */
466 struct lock filelist_mutex;
467 struct list_head filelist;
469 /** \name Memory management */
471 struct list_head maplist; /**< Linked list of regions */
472 struct drm_open_hash map_hash; /**< User token hash table for maps */
474 /** \name Context handle management */
476 struct list_head ctxlist; /**< Linked list of context handles */
477 struct lock ctxlist_mutex; /**< For ctxlist */
481 struct list_head vmalist; /**< List of vmas (for debugging) */
485 /** \name DMA support */
487 struct drm_device_dma *dma; /**< Optional pointer for DMA support */
490 /** \name Context support */
493 __volatile__ long context_flag; /**< Context swapping flag */
494 int last_context; /**< Last current context */
497 /** \name VBLANK IRQ support */
503 * If true, vblank interrupt will be disabled immediately when the
504 * refcount drops to zero, as opposed to via the vblank disable
506 * This can be set to true it the hardware has a working vblank
507 * counter and the driver uses drm_vblank_on() and drm_vblank_off()
510 bool vblank_disable_immediate;
512 /* array of size num_crtcs */
513 struct drm_vblank_crtc *vblank;
515 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */
518 u32 max_vblank_count; /**< size of vblank counter register */
523 struct list_head vblank_event_list;
524 spinlock_t event_lock;
528 struct drm_agp_head *agp; /**< AGP data */
530 struct pci_dev *pdev; /**< PCI device structure */
532 struct pci_controller *hose;
535 struct virtio_device *virtdev;
537 struct drm_sg_mem *sg; /**< Scatter gather memory */
538 unsigned int num_crtcs; /**< Number of CRTCs on this device */
542 struct drm_hw_lock *lock;
545 struct drm_local_map *agp_buffer_map;
546 unsigned int agp_buffer_token;
548 struct drm_mode_config mode_config; /**< Current mode config */
550 /** \name GEM information */
552 struct lock object_name_lock;
553 struct idr object_name_idr;
554 struct drm_vma_offset_manager *vma_offset_manager;
556 int switch_power_state;
558 /* Storage of resource pointers for drm_get_resource_* */
559 struct resource *pcir[DRM_MAX_PCI_RESOURCE];
560 int pcirid[DRM_MAX_PCI_RESOURCE];
569 struct drm_sysctl_info *sysctl;
571 struct idr magic_map;
573 int unique_len; /* Length of unique field */
574 struct cdev *devnode; /* Device number for mknod */
576 struct lwkt_serialize irq_lock; /* protects irq condition checks */
578 struct sigio *buf_sigio; /* Processes waiting for SIGIO */
581 struct drm_lock_data lock; /* Information on hardware lock */
586 * drm_drv_uses_atomic_modeset - check if the driver implements
590 * This check is useful if drivers do not have DRIVER_ATOMIC set but
591 * have atomic modesetting internally implemented.
593 static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
595 return dev->mode_config.funcs->atomic_commit != NULL;
598 #include <drm/drm_irq.h>
600 #define DRM_SWITCH_POWER_ON 0
601 #define DRM_SWITCH_POWER_OFF 1
602 #define DRM_SWITCH_POWER_CHANGING 2
603 #define DRM_SWITCH_POWER_DYNAMIC_OFF 3
605 static __inline__ int drm_core_check_feature(struct drm_device *dev,
608 return ((dev->driver->driver_features & feature) ? 1 : 0);
611 static inline void drm_device_set_unplugged(struct drm_device *dev)
614 atomic_set(&dev->unplugged, 1);
617 static inline int drm_device_is_unplugged(struct drm_device *dev)
619 int ret = atomic_read(&dev->unplugged);
624 /******************************************************************/
625 /** \name Internal function definitions */
629 int drm_create_cdevs(device_t kdev);
631 d_kqfilter_t drm_kqfilter;
633 d_mmap_single_t drm_mmap_single;
635 int drm_device_detach(device_t kdev);
637 void drm_cdevpriv_dtor(void *cd);
639 int drm_add_busid_modesetting(struct drm_device *dev,
640 struct sysctl_ctx_list *ctx, struct sysctl_oid *top);
642 /* XXX glue logic, should be done in drm_pci_init(), pending drm update */
643 void drm_init_pdev(device_t dev, struct pci_dev **pdev);
644 void drm_fini_pdev(struct pci_dev **pdev);
645 void drm_print_pdev(struct pci_dev *pdev);
649 * These are exported to drivers so that they can implement fencing using
650 * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
655 /* returns true if currently okay to sleep */
656 static __inline__ bool drm_can_sleep(void)
658 if (in_atomic() || in_dbg_master() || irqs_disabled())
663 /* helper for handling conditionals in various for_each macros */
664 #define for_each_if(condition) if (!(condition)) {} else
668 void *drm_driver_data;
671 /* sysctl support (drm_sysctl.h) */
672 extern int drm_sysctl_init(struct drm_device *dev);
673 extern int drm_sysctl_cleanup(struct drm_device *dev);
674 unsigned long drm_get_resource_start(struct drm_device *dev,
675 unsigned int resource);
676 unsigned long drm_get_resource_len(struct drm_device *dev,
677 unsigned int resource);
679 int ttm_bo_mmap_single(struct drm_device *dev, vm_ooffset_t *offset,
680 vm_size_t size, struct vm_object **obj_res, int nprot);
682 int drm_gem_mmap_single(struct drm_device *dev, vm_ooffset_t *offset,
683 vm_size_t size, struct vm_object **obj_res, int nprot);
685 /* XXX: These are here only because of drm_sysctl.c */
686 extern int drm_vblank_offdelay;
687 extern unsigned int drm_timestamp_precision;
689 static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
691 return (pci_find_extcap(dev->pdev->dev.bsddev, PCIY_AGP, NULL) == 0);
693 void drm_pci_agp_destroy(struct drm_device *dev);