aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drmP.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drmP.h')
-rw-r--r--drivers/char/drm/drmP.h133
1 files changed, 94 insertions, 39 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 6540948d5176..ecee3547a13f 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -100,10 +100,8 @@ struct drm_device;
100#define DRIVER_HAVE_DMA 0x20 100#define DRIVER_HAVE_DMA 0x20
101#define DRIVER_HAVE_IRQ 0x40 101#define DRIVER_HAVE_IRQ 0x40
102#define DRIVER_IRQ_SHARED 0x80 102#define DRIVER_IRQ_SHARED 0x80
103#define DRIVER_IRQ_VBL 0x100
104#define DRIVER_DMA_QUEUE 0x200 103#define DRIVER_DMA_QUEUE 0x200
105#define DRIVER_FB_DMA 0x400 104#define DRIVER_FB_DMA 0x400
106#define DRIVER_IRQ_VBL2 0x800
107 105
108/***********************************************************************/ 106/***********************************************************************/
109/** \name Begin the DRM... */ 107/** \name Begin the DRM... */
@@ -379,13 +377,12 @@ struct drm_buf_entry {
379struct drm_file { 377struct drm_file {
380 int authenticated; 378 int authenticated;
381 int master; 379 int master;
382 int minor;
383 pid_t pid; 380 pid_t pid;
384 uid_t uid; 381 uid_t uid;
385 drm_magic_t magic; 382 drm_magic_t magic;
386 unsigned long ioctl_count; 383 unsigned long ioctl_count;
387 struct list_head lhead; 384 struct list_head lhead;
388 struct drm_head *head; 385 struct drm_minor *minor;
389 int remove_auth_on_close; 386 int remove_auth_on_close;
390 unsigned long lock_count; 387 unsigned long lock_count;
391 struct file *filp; 388 struct file *filp;
@@ -580,10 +577,52 @@ struct drm_driver {
580 int (*context_dtor) (struct drm_device *dev, int context); 577 int (*context_dtor) (struct drm_device *dev, int context);
581 int (*kernel_context_switch) (struct drm_device *dev, int old, 578 int (*kernel_context_switch) (struct drm_device *dev, int old,
582 int new); 579 int new);
583 void (*kernel_context_switch_unlock) (struct drm_device *dev); 580 void (*kernel_context_switch_unlock) (struct drm_device * dev);
584 int (*vblank_wait) (struct drm_device *dev, unsigned int *sequence); 581 /**
585 int (*vblank_wait2) (struct drm_device *dev, unsigned int *sequence); 582 * get_vblank_counter - get raw hardware vblank counter
586 int (*dri_library_name) (struct drm_device *dev, char *buf); 583 * @dev: DRM device
584 * @crtc: counter to fetch
585 *
586 * Driver callback for fetching a raw hardware vblank counter
587 * for @crtc. If a device doesn't have a hardware counter, the
588 * driver can simply return the value of drm_vblank_count and
589 * make the enable_vblank() and disable_vblank() hooks into no-ops,
590 * leaving interrupts enabled at all times.
591 *
592 * Wraparound handling and loss of events due to modesetting is dealt
593 * with in the DRM core code.
594 *
595 * RETURNS
596 * Raw vblank counter value.
597 */
598 u32 (*get_vblank_counter) (struct drm_device *dev, int crtc);
599
600 /**
601 * enable_vblank - enable vblank interrupt events
602 * @dev: DRM device
603 * @crtc: which irq to enable
604 *
605 * Enable vblank interrupts for @crtc. If the device doesn't have
606 * a hardware vblank counter, this routine should be a no-op, since
607 * interrupts will have to stay on to keep the count accurate.
608 *
609 * RETURNS
610 * Zero on success, appropriate errno if the given @crtc's vblank
611 * interrupt cannot be enabled.
612 */
613 int (*enable_vblank) (struct drm_device *dev, int crtc);
614
615 /**
616 * disable_vblank - disable vblank interrupt events
617 * @dev: DRM device
618 * @crtc: which irq to enable
619 *
620 * Disable vblank interrupts for @crtc. If the device doesn't have
621 * a hardware vblank counter, this routine should be a no-op, since
622 * interrupts will have to stay on to keep the count accurate.
623 */
624 void (*disable_vblank) (struct drm_device *dev, int crtc);
625 int (*dri_library_name) (struct drm_device *dev, char * buf);
587 626
588 /** 627 /**
589 * Called by \c drm_device_is_agp. Typically used to determine if a 628 * Called by \c drm_device_is_agp. Typically used to determine if a
@@ -602,7 +641,7 @@ struct drm_driver {
602 641
603 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); 642 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
604 void (*irq_preinstall) (struct drm_device *dev); 643 void (*irq_preinstall) (struct drm_device *dev);
605 void (*irq_postinstall) (struct drm_device *dev); 644 int (*irq_postinstall) (struct drm_device *dev);
606 void (*irq_uninstall) (struct drm_device *dev); 645 void (*irq_uninstall) (struct drm_device *dev);
607 void (*reclaim_buffers) (struct drm_device *dev, 646 void (*reclaim_buffers) (struct drm_device *dev,
608 struct drm_file * file_priv); 647 struct drm_file * file_priv);
@@ -630,16 +669,19 @@ struct drm_driver {
630 struct pci_driver pci_driver; 669 struct pci_driver pci_driver;
631}; 670};
632 671
672#define DRM_MINOR_UNASSIGNED 0
673#define DRM_MINOR_LEGACY 1
674
633/** 675/**
634 * DRM head structure. This structure represent a video head on a card 676 * DRM minor structure. This structure represents a drm minor number.
635 * that may contain multiple heads. Embed one per head of these in the
636 * private drm_device structure.
637 */ 677 */
638struct drm_head { 678struct drm_minor {
639 int minor; /**< Minor device number */ 679 int index; /**< Minor device number */
680 int type; /**< Control or render */
681 dev_t device; /**< Device number for mknod */
682 struct device kdev; /**< Linux device */
640 struct drm_device *dev; 683 struct drm_device *dev;
641 struct proc_dir_entry *dev_root; /**< proc directory entry */ 684 struct proc_dir_entry *dev_root; /**< proc directory entry */
642 dev_t device; /**< Device number for mknod */
643}; 685};
644 686
645/** 687/**
@@ -647,7 +689,6 @@ struct drm_head {
647 * may contain multiple heads. 689 * may contain multiple heads.
648 */ 690 */
649struct drm_device { 691struct drm_device {
650 struct device dev; /**< Linux device */
651 char *unique; /**< Unique identifier: e.g., busid */ 692 char *unique; /**< Unique identifier: e.g., busid */
652 int unique_len; /**< Length of unique field */ 693 int unique_len; /**< Length of unique field */
653 char *devname; /**< For /proc/interrupts */ 694 char *devname; /**< For /proc/interrupts */
@@ -729,13 +770,21 @@ struct drm_device {
729 /** \name VBLANK IRQ support */ 770 /** \name VBLANK IRQ support */
730 /*@{ */ 771 /*@{ */
731 772
732 wait_queue_head_t vbl_queue; /**< VBLANK wait queue */ 773 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */
733 atomic_t vbl_received; 774 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */
734 atomic_t vbl_received2; /**< number of secondary VBLANK interrupts */
735 spinlock_t vbl_lock; 775 spinlock_t vbl_lock;
736 struct list_head vbl_sigs; /**< signal list to send on VBLANK */ 776 struct list_head *vbl_sigs; /**< signal list to send on VBLANK */
737 struct list_head vbl_sigs2; /**< signals to send on secondary VBLANK */ 777 atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/
738 unsigned int vbl_pending; 778 atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */
779 u32 *last_vblank; /* protected by dev->vbl_lock, used */
780 /* for wraparound handling */
781 u32 *vblank_offset; /* used to track how many vblanks */
782 int *vblank_enabled; /* so we don't call enable more than
783 once per disable */
784 u32 *vblank_premodeset; /* were lost during modeset */
785 struct timer_list vblank_disable_timer;
786
787 unsigned long max_vblank_count; /**< size of vblank counter register */
739 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ 788 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */
740 void (*locked_tasklet_func)(struct drm_device *dev); 789 void (*locked_tasklet_func)(struct drm_device *dev);
741 790
@@ -755,6 +804,7 @@ struct drm_device {
755#ifdef __alpha__ 804#ifdef __alpha__
756 struct pci_controller *hose; 805 struct pci_controller *hose;
757#endif 806#endif
807 int num_crtcs; /**< Number of CRTCs on this device */
758 struct drm_sg_mem *sg; /**< Scatter gather memory */ 808 struct drm_sg_mem *sg; /**< Scatter gather memory */
759 void *dev_private; /**< device private data */ 809 void *dev_private; /**< device private data */
760 struct drm_sigdata sigdata; /**< For block_all_signals */ 810 struct drm_sigdata sigdata; /**< For block_all_signals */
@@ -763,7 +813,7 @@ struct drm_device {
763 struct drm_driver *driver; 813 struct drm_driver *driver;
764 drm_local_map_t *agp_buffer_map; 814 drm_local_map_t *agp_buffer_map;
765 unsigned int agp_buffer_token; 815 unsigned int agp_buffer_token;
766 struct drm_head primary; /**< primary screen head */ 816 struct drm_minor *primary; /**< render type primary screen head */
767 817
768 /** \name Drawable information */ 818 /** \name Drawable information */
769 /*@{ */ 819 /*@{ */
@@ -989,11 +1039,19 @@ extern void drm_driver_irq_preinstall(struct drm_device *dev);
989extern void drm_driver_irq_postinstall(struct drm_device *dev); 1039extern void drm_driver_irq_postinstall(struct drm_device *dev);
990extern void drm_driver_irq_uninstall(struct drm_device *dev); 1040extern void drm_driver_irq_uninstall(struct drm_device *dev);
991 1041
992extern int drm_wait_vblank(struct drm_device *dev, void *data, 1042extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
993 struct drm_file *file_priv); 1043extern int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *filp);
994extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); 1044extern int drm_vblank_wait(struct drm_device * dev, unsigned int *vbl_seq);
995extern void drm_vbl_send_signals(struct drm_device *dev);
996extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*)); 1045extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*));
1046extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1047extern void drm_update_vblank_count(struct drm_device *dev, int crtc);
1048extern void drm_handle_vblank(struct drm_device *dev, int crtc);
1049extern int drm_vblank_get(struct drm_device *dev, int crtc);
1050extern void drm_vblank_put(struct drm_device *dev, int crtc);
1051
1052 /* Modesetting support */
1053extern int drm_modeset_ctl(struct drm_device *dev, void *data,
1054 struct drm_file *file_priv);
997 1055
998 /* AGP/GART support (drm_agpsupport.h) */ 1056 /* AGP/GART support (drm_agpsupport.h) */
999extern struct drm_agp_head *drm_agp_init(struct drm_device *dev); 1057extern struct drm_agp_head *drm_agp_init(struct drm_device *dev);
@@ -1030,23 +1088,20 @@ extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
1030extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1088extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
1031 struct drm_driver *driver); 1089 struct drm_driver *driver);
1032extern int drm_put_dev(struct drm_device *dev); 1090extern int drm_put_dev(struct drm_device *dev);
1033extern int drm_put_head(struct drm_head *head); 1091extern int drm_put_minor(struct drm_minor **minor);
1034extern unsigned int drm_debug; 1092extern unsigned int drm_debug;
1035extern unsigned int drm_cards_limit; 1093
1036extern struct drm_head **drm_heads;
1037extern struct class *drm_class; 1094extern struct class *drm_class;
1038extern struct proc_dir_entry *drm_proc_root; 1095extern struct proc_dir_entry *drm_proc_root;
1039 1096
1097extern struct idr drm_minors_idr;
1098
1040extern drm_local_map_t *drm_getsarea(struct drm_device *dev); 1099extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
1041 1100
1042 /* Proc support (drm_proc.h) */ 1101 /* Proc support (drm_proc.h) */
1043extern int drm_proc_init(struct drm_device *dev, 1102extern int drm_proc_init(struct drm_minor *minor, int minor_id,
1044 int minor, 1103 struct proc_dir_entry *root);
1045 struct proc_dir_entry *root, 1104extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
1046 struct proc_dir_entry **dev_root);
1047extern int drm_proc_cleanup(int minor,
1048 struct proc_dir_entry *root,
1049 struct proc_dir_entry *dev_root);
1050 1105
1051 /* Scatter Gather Support (drm_scatter.h) */ 1106 /* Scatter Gather Support (drm_scatter.h) */
1052extern void drm_sg_cleanup(struct drm_sg_mem * entry); 1107extern void drm_sg_cleanup(struct drm_sg_mem * entry);
@@ -1071,8 +1126,8 @@ extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1071struct drm_sysfs_class; 1126struct drm_sysfs_class;
1072extern struct class *drm_sysfs_create(struct module *owner, char *name); 1127extern struct class *drm_sysfs_create(struct module *owner, char *name);
1073extern void drm_sysfs_destroy(void); 1128extern void drm_sysfs_destroy(void);
1074extern int drm_sysfs_device_add(struct drm_device *dev, struct drm_head *head); 1129extern int drm_sysfs_device_add(struct drm_minor *minor);
1075extern void drm_sysfs_device_remove(struct drm_device *dev); 1130extern void drm_sysfs_device_remove(struct drm_minor *minor);
1076 1131
1077/* 1132/*
1078 * Basic memory manager support (drm_mm.c) 1133 * Basic memory manager support (drm_mm.c)