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.h111
1 files changed, 46 insertions, 65 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index b46fb45f2cca..1d4a920ef7ff 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -150,6 +150,7 @@ int drm_err(const char *func, const char *format, ...);
150#define DRIVER_BUS_PCI 0x1 150#define DRIVER_BUS_PCI 0x1
151#define DRIVER_BUS_PLATFORM 0x2 151#define DRIVER_BUS_PLATFORM 0x2
152#define DRIVER_BUS_USB 0x3 152#define DRIVER_BUS_USB 0x3
153#define DRIVER_BUS_HOST1X 0x4
153 154
154/***********************************************************************/ 155/***********************************************************************/
155/** \name Begin the DRM... */ 156/** \name Begin the DRM... */
@@ -412,7 +413,12 @@ struct drm_prime_file_private {
412 413
413/** File private data */ 414/** File private data */
414struct drm_file { 415struct drm_file {
415 int authenticated; 416 unsigned always_authenticated :1;
417 unsigned authenticated :1;
418 unsigned is_master :1; /* this file private is a master for a minor */
419 /* true when the client has asked us to expose stereo 3D mode flags */
420 unsigned stereo_allowed :1;
421
416 struct pid *pid; 422 struct pid *pid;
417 kuid_t uid; 423 kuid_t uid;
418 drm_magic_t magic; 424 drm_magic_t magic;
@@ -429,10 +435,8 @@ struct drm_file {
429 struct file *filp; 435 struct file *filp;
430 void *driver_priv; 436 void *driver_priv;
431 437
432 int is_master; /* this file private is a master for a minor */
433 struct drm_master *master; /* master this node is currently associated with 438 struct drm_master *master; /* master this node is currently associated with
434 N.B. not always minor->master */ 439 N.B. not always minor->master */
435
436 /** 440 /**
437 * fbs - List of framebuffers associated with this file. 441 * fbs - List of framebuffers associated with this file.
438 * 442 *
@@ -667,8 +671,6 @@ struct drm_gem_object {
667 uint32_t pending_read_domains; 671 uint32_t pending_read_domains;
668 uint32_t pending_write_domain; 672 uint32_t pending_write_domain;
669 673
670 void *driver_private;
671
672 /** 674 /**
673 * dma_buf - dma buf associated with this GEM object 675 * dma_buf - dma buf associated with this GEM object
674 * 676 *
@@ -834,12 +836,17 @@ struct drm_driver {
834 /** 836 /**
835 * Called by vblank timestamping code. 837 * Called by vblank timestamping code.
836 * 838 *
837 * Return the current display scanout position from a crtc. 839 * Return the current display scanout position from a crtc, and an
840 * optional accurate ktime_get timestamp of when position was measured.
838 * 841 *
839 * \param dev DRM device. 842 * \param dev DRM device.
840 * \param crtc Id of the crtc to query. 843 * \param crtc Id of the crtc to query.
841 * \param *vpos Target location for current vertical scanout position. 844 * \param *vpos Target location for current vertical scanout position.
842 * \param *hpos Target location for current horizontal scanout position. 845 * \param *hpos Target location for current horizontal scanout position.
846 * \param *stime Target location for timestamp taken immediately before
847 * scanout position query. Can be NULL to skip timestamp.
848 * \param *etime Target location for timestamp taken immediately after
849 * scanout position query. Can be NULL to skip timestamp.
843 * 850 *
844 * Returns vpos as a positive number while in active scanout area. 851 * Returns vpos as a positive number while in active scanout area.
845 * Returns vpos as a negative number inside vblank, counting the number 852 * Returns vpos as a negative number inside vblank, counting the number
@@ -856,7 +863,8 @@ struct drm_driver {
856 * 863 *
857 */ 864 */
858 int (*get_scanout_position) (struct drm_device *dev, int crtc, 865 int (*get_scanout_position) (struct drm_device *dev, int crtc,
859 int *vpos, int *hpos); 866 int *vpos, int *hpos, ktime_t *stime,
867 ktime_t *etime);
860 868
861 /** 869 /**
862 * Called by \c drm_get_last_vbltimestamp. Should return a precise 870 * Called by \c drm_get_last_vbltimestamp. Should return a precise
@@ -922,7 +930,6 @@ struct drm_driver {
922 * 930 *
923 * Returns 0 on success. 931 * Returns 0 on success.
924 */ 932 */
925 int (*gem_init_object) (struct drm_gem_object *obj);
926 void (*gem_free_object) (struct drm_gem_object *obj); 933 void (*gem_free_object) (struct drm_gem_object *obj);
927 int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); 934 int (*gem_open_object) (struct drm_gem_object *, struct drm_file *);
928 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); 935 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *);
@@ -997,27 +1004,6 @@ struct drm_driver {
997#define DRM_MINOR_CONTROL 2 1004#define DRM_MINOR_CONTROL 2
998#define DRM_MINOR_RENDER 3 1005#define DRM_MINOR_RENDER 3
999 1006
1000
1001/**
1002 * debugfs node list. This structure represents a debugfs file to
1003 * be created by the drm core
1004 */
1005struct drm_debugfs_list {
1006 const char *name; /** file name */
1007 int (*show)(struct seq_file*, void*); /** show callback */
1008 u32 driver_features; /**< Required driver features for this entry */
1009};
1010
1011/**
1012 * debugfs node structure. This structure represents a debugfs file.
1013 */
1014struct drm_debugfs_node {
1015 struct list_head list;
1016 struct drm_minor *minor;
1017 struct drm_debugfs_list *debugfs_ent;
1018 struct dentry *dent;
1019};
1020
1021/** 1007/**
1022 * Info file list entry. This structure represents a debugfs or proc file to 1008 * Info file list entry. This structure represents a debugfs or proc file to
1023 * be created by the drm core 1009 * be created by the drm core
@@ -1046,7 +1032,7 @@ struct drm_minor {
1046 int index; /**< Minor device number */ 1032 int index; /**< Minor device number */
1047 int type; /**< Control or render */ 1033 int type; /**< Control or render */
1048 dev_t device; /**< Device number for mknod */ 1034 dev_t device; /**< Device number for mknod */
1049 struct device kdev; /**< Linux device */ 1035 struct device *kdev; /**< Linux device */
1050 struct drm_device *dev; 1036 struct drm_device *dev;
1051 1037
1052 struct dentry *debugfs_root; 1038 struct dentry *debugfs_root;
@@ -1081,6 +1067,19 @@ struct drm_pending_vblank_event {
1081 struct drm_event_vblank event; 1067 struct drm_event_vblank event;
1082}; 1068};
1083 1069
1070struct drm_vblank_crtc {
1071 wait_queue_head_t queue; /**< VBLANK wait queue */
1072 struct timeval time[DRM_VBLANKTIME_RBSIZE]; /**< timestamp of current count */
1073 atomic_t count; /**< number of VBLANK interrupts */
1074 atomic_t refcount; /* number of users of vblank interruptsper crtc */
1075 u32 last; /* protected by dev->vbl_lock, used */
1076 /* for wraparound handling */
1077 u32 last_wait; /* Last vblank seqno waited per CRTC */
1078 unsigned int inmodeset; /* Display driver is setting mode */
1079 bool enabled; /* so we don't call enable more than
1080 once per disable */
1081};
1082
1084/** 1083/**
1085 * DRM device structure. This structure represent a complete card that 1084 * DRM device structure. This structure represent a complete card that
1086 * may contain multiple heads. 1085 * may contain multiple heads.
@@ -1105,25 +1104,16 @@ struct drm_device {
1105 atomic_t buf_alloc; /**< Buffer allocation in progress */ 1104 atomic_t buf_alloc; /**< Buffer allocation in progress */
1106 /*@} */ 1105 /*@} */
1107 1106
1108 /** \name Performance counters */
1109 /*@{ */
1110 unsigned long counters;
1111 enum drm_stat_type types[15];
1112 atomic_t counts[15];
1113 /*@} */
1114
1115 struct list_head filelist; 1107 struct list_head filelist;
1116 1108
1117 /** \name Memory management */ 1109 /** \name Memory management */
1118 /*@{ */ 1110 /*@{ */
1119 struct list_head maplist; /**< Linked list of regions */ 1111 struct list_head maplist; /**< Linked list of regions */
1120 int map_count; /**< Number of mappable regions */
1121 struct drm_open_hash map_hash; /**< User token hash table for maps */ 1112 struct drm_open_hash map_hash; /**< User token hash table for maps */
1122 1113
1123 /** \name Context handle management */ 1114 /** \name Context handle management */
1124 /*@{ */ 1115 /*@{ */
1125 struct list_head ctxlist; /**< Linked list of context handles */ 1116 struct list_head ctxlist; /**< Linked list of context handles */
1126 int ctx_count; /**< Number of context handles */
1127 struct mutex ctxlist_mutex; /**< For ctxlist */ 1117 struct mutex ctxlist_mutex; /**< For ctxlist */
1128 1118
1129 struct idr ctx_idr; 1119 struct idr ctx_idr;
@@ -1139,12 +1129,11 @@ struct drm_device {
1139 1129
1140 /** \name Context support */ 1130 /** \name Context support */
1141 /*@{ */ 1131 /*@{ */
1142 int irq_enabled; /**< True if irq handler is enabled */ 1132 bool irq_enabled; /**< True if irq handler is enabled */
1143 __volatile__ long context_flag; /**< Context swapping flag */ 1133 __volatile__ long context_flag; /**< Context swapping flag */
1144 int last_context; /**< Last current context */ 1134 int last_context; /**< Last current context */
1145 /*@} */ 1135 /*@} */
1146 1136
1147 struct work_struct work;
1148 /** \name VBLANK IRQ support */ 1137 /** \name VBLANK IRQ support */
1149 /*@{ */ 1138 /*@{ */
1150 1139
@@ -1154,20 +1143,13 @@ struct drm_device {
1154 * Once the modeset ioctl *has* been called though, we can safely 1143 * Once the modeset ioctl *has* been called though, we can safely
1155 * disable them when unused. 1144 * disable them when unused.
1156 */ 1145 */
1157 int vblank_disable_allowed; 1146 bool vblank_disable_allowed;
1147
1148 /* array of size num_crtcs */
1149 struct drm_vblank_crtc *vblank;
1158 1150
1159 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */
1160 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */
1161 struct timeval *_vblank_time; /**< timestamp of current vblank_count (drivers must alloc right number of fields) */
1162 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ 1151 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */
1163 spinlock_t vbl_lock; 1152 spinlock_t vbl_lock;
1164 atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */
1165 u32 *last_vblank; /* protected by dev->vbl_lock, used */
1166 /* for wraparound handling */
1167 int *vblank_enabled; /* so we don't call enable more than
1168 once per disable */
1169 int *vblank_inmodeset; /* Display driver is setting mode */
1170 u32 *last_vblank_wait; /* Last vblank seqno waited per CRTC */
1171 struct timer_list vblank_disable_timer; 1153 struct timer_list vblank_disable_timer;
1172 1154
1173 u32 max_vblank_count; /**< size of vblank counter register */ 1155 u32 max_vblank_count; /**< size of vblank counter register */
@@ -1184,8 +1166,6 @@ struct drm_device {
1184 1166
1185 struct device *dev; /**< Device structure */ 1167 struct device *dev; /**< Device structure */
1186 struct pci_dev *pdev; /**< PCI device structure */ 1168 struct pci_dev *pdev; /**< PCI device structure */
1187 int pci_vendor; /**< PCI vendor id */
1188 int pci_device; /**< PCI device id */
1189#ifdef __alpha__ 1169#ifdef __alpha__
1190 struct pci_controller *hose; 1170 struct pci_controller *hose;
1191#endif 1171#endif
@@ -1303,6 +1283,8 @@ extern int drm_getstats(struct drm_device *dev, void *data,
1303 struct drm_file *file_priv); 1283 struct drm_file *file_priv);
1304extern int drm_getcap(struct drm_device *dev, void *data, 1284extern int drm_getcap(struct drm_device *dev, void *data,
1305 struct drm_file *file_priv); 1285 struct drm_file *file_priv);
1286extern int drm_setclientcap(struct drm_device *dev, void *data,
1287 struct drm_file *file_priv);
1306extern int drm_setversion(struct drm_device *dev, void *data, 1288extern int drm_setversion(struct drm_device *dev, void *data,
1307 struct drm_file *file_priv); 1289 struct drm_file *file_priv);
1308extern int drm_noop(struct drm_device *dev, void *data, 1290extern int drm_noop(struct drm_device *dev, void *data,
@@ -1454,7 +1436,6 @@ extern struct drm_master *drm_master_get(struct drm_master *master);
1454extern void drm_master_put(struct drm_master **master); 1436extern void drm_master_put(struct drm_master **master);
1455 1437
1456extern void drm_put_dev(struct drm_device *dev); 1438extern void drm_put_dev(struct drm_device *dev);
1457extern int drm_put_minor(struct drm_minor **minor);
1458extern void drm_unplug_dev(struct drm_device *dev); 1439extern void drm_unplug_dev(struct drm_device *dev);
1459extern unsigned int drm_debug; 1440extern unsigned int drm_debug;
1460extern unsigned int drm_rnodes; 1441extern unsigned int drm_rnodes;
@@ -1474,10 +1455,11 @@ extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1474#if defined(CONFIG_DEBUG_FS) 1455#if defined(CONFIG_DEBUG_FS)
1475extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, 1456extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1476 struct dentry *root); 1457 struct dentry *root);
1477extern int drm_debugfs_create_files(struct drm_info_list *files, int count, 1458extern int drm_debugfs_create_files(const struct drm_info_list *files,
1478 struct dentry *root, struct drm_minor *minor); 1459 int count, struct dentry *root,
1479extern int drm_debugfs_remove_files(struct drm_info_list *files, int count, 1460 struct drm_minor *minor);
1480 struct drm_minor *minor); 1461extern int drm_debugfs_remove_files(const struct drm_info_list *files,
1462 int count, struct drm_minor *minor);
1481extern int drm_debugfs_cleanup(struct drm_minor *minor); 1463extern int drm_debugfs_cleanup(struct drm_minor *minor);
1482#endif 1464#endif
1483 1465
@@ -1556,8 +1538,6 @@ int drm_gem_init(struct drm_device *dev);
1556void drm_gem_destroy(struct drm_device *dev); 1538void drm_gem_destroy(struct drm_device *dev);
1557void drm_gem_object_release(struct drm_gem_object *obj); 1539void drm_gem_object_release(struct drm_gem_object *obj);
1558void drm_gem_object_free(struct kref *kref); 1540void drm_gem_object_free(struct kref *kref);
1559struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1560 size_t size);
1561int drm_gem_object_init(struct drm_device *dev, 1541int drm_gem_object_init(struct drm_device *dev,
1562 struct drm_gem_object *obj, size_t size); 1542 struct drm_gem_object *obj, size_t size);
1563void drm_gem_private_object_init(struct drm_device *dev, 1543void drm_gem_private_object_init(struct drm_device *dev,
@@ -1645,10 +1625,11 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1645 1625
1646#include <drm/drm_mem_util.h> 1626#include <drm/drm_mem_util.h>
1647 1627
1648extern int drm_fill_in_dev(struct drm_device *dev, 1628struct drm_device *drm_dev_alloc(struct drm_driver *driver,
1649 const struct pci_device_id *ent, 1629 struct device *parent);
1650 struct drm_driver *driver); 1630void drm_dev_free(struct drm_device *dev);
1651int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); 1631int drm_dev_register(struct drm_device *dev, unsigned long flags);
1632void drm_dev_unregister(struct drm_device *dev);
1652/*@}*/ 1633/*@}*/
1653 1634
1654/* PCI section */ 1635/* PCI section */