aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drmP.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r--include/drm/drmP.h81
1 files changed, 56 insertions, 25 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 1d4a920ef7ff..04086c5be930 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -56,6 +56,7 @@
56#include <linux/mutex.h> 56#include <linux/mutex.h>
57#include <linux/io.h> 57#include <linux/io.h>
58#include <linux/slab.h> 58#include <linux/slab.h>
59#include <linux/ratelimit.h>
59#if defined(__alpha__) || defined(__powerpc__) 60#if defined(__alpha__) || defined(__powerpc__)
60#include <asm/pgtable.h> /* For pte_wrprotect */ 61#include <asm/pgtable.h> /* For pte_wrprotect */
61#endif 62#endif
@@ -136,7 +137,6 @@ int drm_err(const char *func, const char *format, ...);
136 137
137/* driver capabilities and requirements mask */ 138/* driver capabilities and requirements mask */
138#define DRIVER_USE_AGP 0x1 139#define DRIVER_USE_AGP 0x1
139#define DRIVER_REQUIRE_AGP 0x2
140#define DRIVER_PCI_DMA 0x8 140#define DRIVER_PCI_DMA 0x8
141#define DRIVER_SG 0x10 141#define DRIVER_SG 0x10
142#define DRIVER_HAVE_DMA 0x20 142#define DRIVER_HAVE_DMA 0x20
@@ -180,6 +180,22 @@ int drm_err(const char *func, const char *format, ...);
180#define DRM_ERROR(fmt, ...) \ 180#define DRM_ERROR(fmt, ...) \
181 drm_err(__func__, fmt, ##__VA_ARGS__) 181 drm_err(__func__, fmt, ##__VA_ARGS__)
182 182
183/**
184 * Rate limited error output. Like DRM_ERROR() but won't flood the log.
185 *
186 * \param fmt printf() like format string.
187 * \param arg arguments
188 */
189#define DRM_ERROR_RATELIMITED(fmt, ...) \
190({ \
191 static DEFINE_RATELIMIT_STATE(_rs, \
192 DEFAULT_RATELIMIT_INTERVAL, \
193 DEFAULT_RATELIMIT_BURST); \
194 \
195 if (__ratelimit(&_rs)) \
196 drm_err(__func__, fmt, ##__VA_ARGS__); \
197})
198
183#define DRM_INFO(fmt, ...) \ 199#define DRM_INFO(fmt, ...) \
184 printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__) 200 printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
185 201
@@ -422,7 +438,6 @@ struct drm_file {
422 struct pid *pid; 438 struct pid *pid;
423 kuid_t uid; 439 kuid_t uid;
424 drm_magic_t magic; 440 drm_magic_t magic;
425 unsigned long ioctl_count;
426 struct list_head lhead; 441 struct list_head lhead;
427 struct drm_minor *minor; 442 struct drm_minor *minor;
428 unsigned long lock_count; 443 unsigned long lock_count;
@@ -511,7 +526,7 @@ struct drm_device_dma {
511 */ 526 */
512struct drm_agp_mem { 527struct drm_agp_mem {
513 unsigned long handle; /**< handle */ 528 unsigned long handle; /**< handle */
514 DRM_AGP_MEM *memory; 529 struct agp_memory *memory;
515 unsigned long bound; /**< address */ 530 unsigned long bound; /**< address */
516 int pages; 531 int pages;
517 struct list_head head; 532 struct list_head head;
@@ -523,7 +538,7 @@ struct drm_agp_mem {
523 * \sa drm_agp_init() and drm_device::agp. 538 * \sa drm_agp_init() and drm_device::agp.
524 */ 539 */
525struct drm_agp_head { 540struct drm_agp_head {
526 DRM_AGP_KERN agp_info; /**< AGP device information */ 541 struct agp_kern_info agp_info; /**< AGP device information */
527 struct list_head memory; 542 struct list_head memory;
528 unsigned long mode; /**< AGP mode */ 543 unsigned long mode; /**< AGP mode */
529 struct agp_bridge_data *bridge; 544 struct agp_bridge_data *bridge;
@@ -607,13 +622,6 @@ struct drm_ati_pcigart_info {
607}; 622};
608 623
609/** 624/**
610 * GEM specific mm private for tracking GEM objects
611 */
612struct drm_gem_mm {
613 struct drm_vma_offset_manager vma_manager;
614};
615
616/**
617 * This structure defines the drm_mm memory object, which will be used by the 625 * This structure defines the drm_mm memory object, which will be used by the
618 * DRM for its buffer objects. 626 * DRM for its buffer objects.
619 */ 627 */
@@ -750,10 +758,6 @@ struct drm_bus {
750 int (*set_unique)(struct drm_device *dev, struct drm_master *master, 758 int (*set_unique)(struct drm_device *dev, struct drm_master *master,
751 struct drm_unique *unique); 759 struct drm_unique *unique);
752 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p); 760 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
753 /* hooks that are for PCI */
754 int (*agp_init)(struct drm_device *dev);
755 void (*agp_destroy)(struct drm_device *dev);
756
757}; 761};
758 762
759/** 763/**
@@ -841,6 +845,7 @@ struct drm_driver {
841 * 845 *
842 * \param dev DRM device. 846 * \param dev DRM device.
843 * \param crtc Id of the crtc to query. 847 * \param crtc Id of the crtc to query.
848 * \param flags Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0).
844 * \param *vpos Target location for current vertical scanout position. 849 * \param *vpos Target location for current vertical scanout position.
845 * \param *hpos Target location for current horizontal scanout position. 850 * \param *hpos Target location for current horizontal scanout position.
846 * \param *stime Target location for timestamp taken immediately before 851 * \param *stime Target location for timestamp taken immediately before
@@ -863,6 +868,7 @@ struct drm_driver {
863 * 868 *
864 */ 869 */
865 int (*get_scanout_position) (struct drm_device *dev, int crtc, 870 int (*get_scanout_position) (struct drm_device *dev, int crtc,
871 unsigned int flags,
866 int *vpos, int *hpos, ktime_t *stime, 872 int *vpos, int *hpos, ktime_t *stime,
867 ktime_t *etime); 873 ktime_t *etime);
868 874
@@ -903,7 +909,7 @@ struct drm_driver {
903 909
904 /* these have to be filled in */ 910 /* these have to be filled in */
905 911
906 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); 912 irqreturn_t(*irq_handler) (int irq, void *arg);
907 void (*irq_preinstall) (struct drm_device *dev); 913 void (*irq_preinstall) (struct drm_device *dev);
908 int (*irq_postinstall) (struct drm_device *dev); 914 int (*irq_postinstall) (struct drm_device *dev);
909 void (*irq_uninstall) (struct drm_device *dev); 915 void (*irq_uninstall) (struct drm_device *dev);
@@ -995,8 +1001,8 @@ struct drm_driver {
995 } kdriver; 1001 } kdriver;
996 struct drm_bus *bus; 1002 struct drm_bus *bus;
997 1003
998 /* List of devices hanging off this driver */ 1004 /* List of devices hanging off this driver with stealth attach. */
999 struct list_head device_list; 1005 struct list_head legacy_dev_list;
1000}; 1006};
1001 1007
1002#define DRM_MINOR_UNASSIGNED 0 1008#define DRM_MINOR_UNASSIGNED 0
@@ -1085,7 +1091,7 @@ struct drm_vblank_crtc {
1085 * may contain multiple heads. 1091 * may contain multiple heads.
1086 */ 1092 */
1087struct drm_device { 1093struct drm_device {
1088 struct list_head driver_item; /**< list of devices per driver */ 1094 struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */
1089 char *devname; /**< For /proc/interrupts */ 1095 char *devname; /**< For /proc/interrupts */
1090 int if_version; /**< Highest interface version set */ 1096 int if_version; /**< Highest interface version set */
1091 1097
@@ -1098,8 +1104,6 @@ struct drm_device {
1098 /** \name Usage Counters */ 1104 /** \name Usage Counters */
1099 /*@{ */ 1105 /*@{ */
1100 int open_count; /**< Outstanding files open */ 1106 int open_count; /**< Outstanding files open */
1101 atomic_t ioctl_count; /**< Outstanding IOCTLs pending */
1102 atomic_t vma_count; /**< Outstanding vma areas open */
1103 int buf_use; /**< Buffers in use -- cannot alloc */ 1107 int buf_use; /**< Buffers in use -- cannot alloc */
1104 atomic_t buf_alloc; /**< Buffer allocation in progress */ 1108 atomic_t buf_alloc; /**< Buffer allocation in progress */
1105 /*@} */ 1109 /*@} */
@@ -1176,7 +1180,6 @@ struct drm_device {
1176 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1180 struct drm_sg_mem *sg; /**< Scatter gather memory */
1177 unsigned int num_crtcs; /**< Number of CRTCs on this device */ 1181 unsigned int num_crtcs; /**< Number of CRTCs on this device */
1178 void *dev_private; /**< device private data */ 1182 void *dev_private; /**< device private data */
1179 void *mm_private;
1180 struct address_space *dev_mapping; 1183 struct address_space *dev_mapping;
1181 struct drm_sigdata sigdata; /**< For block_all_signals */ 1184 struct drm_sigdata sigdata; /**< For block_all_signals */
1182 sigset_t sigmask; 1185 sigset_t sigmask;
@@ -1194,6 +1197,7 @@ struct drm_device {
1194 /*@{ */ 1197 /*@{ */
1195 struct mutex object_name_lock; 1198 struct mutex object_name_lock;
1196 struct idr object_name_idr; 1199 struct idr object_name_idr;
1200 struct drm_vma_offset_manager *vma_offset_manager;
1197 /*@} */ 1201 /*@} */
1198 int switch_power_state; 1202 int switch_power_state;
1199 1203
@@ -1268,6 +1272,7 @@ extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1268 /* Memory management support (drm_memory.h) */ 1272 /* Memory management support (drm_memory.h) */
1269#include <drm/drm_memory.h> 1273#include <drm/drm_memory.h>
1270 1274
1275
1271 /* Misc. IOCTL support (drm_ioctl.h) */ 1276 /* Misc. IOCTL support (drm_ioctl.h) */
1272extern int drm_irq_by_busid(struct drm_device *dev, void *data, 1277extern int drm_irq_by_busid(struct drm_device *dev, void *data,
1273 struct drm_file *file_priv); 1278 struct drm_file *file_priv);
@@ -1398,8 +1403,10 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
1398 int crtc, int *max_error, 1403 int crtc, int *max_error,
1399 struct timeval *vblank_time, 1404 struct timeval *vblank_time,
1400 unsigned flags, 1405 unsigned flags,
1401 struct drm_crtc *refcrtc); 1406 const struct drm_crtc *refcrtc,
1402extern void drm_calc_timestamping_constants(struct drm_crtc *crtc); 1407 const struct drm_display_mode *mode);
1408extern void drm_calc_timestamping_constants(struct drm_crtc *crtc,
1409 const struct drm_display_mode *mode);
1403 1410
1404extern bool 1411extern bool
1405drm_mode_parse_command_line_for_connector(const char *mode_option, 1412drm_mode_parse_command_line_for_connector(const char *mode_option,
@@ -1461,6 +1468,30 @@ extern int drm_debugfs_create_files(const struct drm_info_list *files,
1461extern int drm_debugfs_remove_files(const struct drm_info_list *files, 1468extern int drm_debugfs_remove_files(const struct drm_info_list *files,
1462 int count, struct drm_minor *minor); 1469 int count, struct drm_minor *minor);
1463extern int drm_debugfs_cleanup(struct drm_minor *minor); 1470extern int drm_debugfs_cleanup(struct drm_minor *minor);
1471#else
1472static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1473 struct dentry *root)
1474{
1475 return 0;
1476}
1477
1478static inline int drm_debugfs_create_files(const struct drm_info_list *files,
1479 int count, struct dentry *root,
1480 struct drm_minor *minor)
1481{
1482 return 0;
1483}
1484
1485static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
1486 int count, struct drm_minor *minor)
1487{
1488 return 0;
1489}
1490
1491static inline int drm_debugfs_cleanup(struct drm_minor *minor)
1492{
1493 return 0;
1494}
1464#endif 1495#endif
1465 1496
1466 /* Info file support */ 1497 /* Info file support */
@@ -1645,6 +1676,7 @@ static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
1645 1676
1646 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); 1677 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
1647} 1678}
1679void drm_pci_agp_destroy(struct drm_device *dev);
1648 1680
1649extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); 1681extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
1650extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); 1682extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
@@ -1660,7 +1692,6 @@ extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);
1660 1692
1661/* platform section */ 1693/* platform section */
1662extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device); 1694extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
1663extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device);
1664 1695
1665/* returns true if currently okay to sleep */ 1696/* returns true if currently okay to sleep */
1666static __inline__ bool drm_can_sleep(void) 1697static __inline__ bool drm_can_sleep(void)