diff options
Diffstat (limited to 'include/drm/drmP.h')
| -rw-r--r-- | include/drm/drmP.h | 102 |
1 files changed, 98 insertions, 4 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 274eaaa15c36..a4694c610330 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -683,6 +683,21 @@ struct drm_master { | |||
| 683 | void *driver_priv; /**< Private structure for driver to use */ | 683 | void *driver_priv; /**< Private structure for driver to use */ |
| 684 | }; | 684 | }; |
| 685 | 685 | ||
| 686 | /* Size of ringbuffer for vblank timestamps. Just double-buffer | ||
| 687 | * in initial implementation. | ||
| 688 | */ | ||
| 689 | #define DRM_VBLANKTIME_RBSIZE 2 | ||
| 690 | |||
| 691 | /* Flags and return codes for get_vblank_timestamp() driver function. */ | ||
| 692 | #define DRM_CALLED_FROM_VBLIRQ 1 | ||
| 693 | #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) | ||
| 694 | #define DRM_VBLANKTIME_INVBL (1 << 1) | ||
| 695 | |||
| 696 | /* get_scanout_position() return flags */ | ||
| 697 | #define DRM_SCANOUTPOS_VALID (1 << 0) | ||
| 698 | #define DRM_SCANOUTPOS_INVBL (1 << 1) | ||
| 699 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) | ||
| 700 | |||
| 686 | /** | 701 | /** |
| 687 | * DRM driver structure. This structure represent the common code for | 702 | * DRM driver structure. This structure represent the common code for |
| 688 | * a family of cards. There will one drm_device for each card present | 703 | * a family of cards. There will one drm_device for each card present |
| @@ -760,6 +775,68 @@ struct drm_driver { | |||
| 760 | */ | 775 | */ |
| 761 | int (*device_is_agp) (struct drm_device *dev); | 776 | int (*device_is_agp) (struct drm_device *dev); |
| 762 | 777 | ||
| 778 | /** | ||
| 779 | * Called by vblank timestamping code. | ||
| 780 | * | ||
| 781 | * Return the current display scanout position from a crtc. | ||
| 782 | * | ||
| 783 | * \param dev DRM device. | ||
| 784 | * \param crtc Id of the crtc to query. | ||
| 785 | * \param *vpos Target location for current vertical scanout position. | ||
| 786 | * \param *hpos Target location for current horizontal scanout position. | ||
| 787 | * | ||
| 788 | * Returns vpos as a positive number while in active scanout area. | ||
| 789 | * Returns vpos as a negative number inside vblank, counting the number | ||
| 790 | * of scanlines to go until end of vblank, e.g., -1 means "one scanline | ||
| 791 | * until start of active scanout / end of vblank." | ||
| 792 | * | ||
| 793 | * \return Flags, or'ed together as follows: | ||
| 794 | * | ||
| 795 | * DRM_SCANOUTPOS_VALID = Query successfull. | ||
| 796 | * DRM_SCANOUTPOS_INVBL = Inside vblank. | ||
| 797 | * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of | ||
| 798 | * this flag means that returned position may be offset by a constant | ||
| 799 | * but unknown small number of scanlines wrt. real scanout position. | ||
| 800 | * | ||
| 801 | */ | ||
| 802 | int (*get_scanout_position) (struct drm_device *dev, int crtc, | ||
| 803 | int *vpos, int *hpos); | ||
| 804 | |||
| 805 | /** | ||
| 806 | * Called by \c drm_get_last_vbltimestamp. Should return a precise | ||
| 807 | * timestamp when the most recent VBLANK interval ended or will end. | ||
| 808 | * | ||
| 809 | * Specifically, the timestamp in @vblank_time should correspond as | ||
| 810 | * closely as possible to the time when the first video scanline of | ||
| 811 | * the video frame after the end of VBLANK will start scanning out, | ||
| 812 | * the time immmediately after end of the VBLANK interval. If the | ||
| 813 | * @crtc is currently inside VBLANK, this will be a time in the future. | ||
| 814 | * If the @crtc is currently scanning out a frame, this will be the | ||
| 815 | * past start time of the current scanout. This is meant to adhere | ||
| 816 | * to the OpenML OML_sync_control extension specification. | ||
| 817 | * | ||
| 818 | * \param dev dev DRM device handle. | ||
| 819 | * \param crtc crtc for which timestamp should be returned. | ||
| 820 | * \param *max_error Maximum allowable timestamp error in nanoseconds. | ||
| 821 | * Implementation should strive to provide timestamp | ||
| 822 | * with an error of at most *max_error nanoseconds. | ||
| 823 | * Returns true upper bound on error for timestamp. | ||
| 824 | * \param *vblank_time Target location for returned vblank timestamp. | ||
| 825 | * \param flags 0 = Defaults, no special treatment needed. | ||
| 826 | * \param DRM_CALLED_FROM_VBLIRQ = Function is called from vblank | ||
| 827 | * irq handler. Some drivers need to apply some workarounds | ||
| 828 | * for gpu-specific vblank irq quirks if flag is set. | ||
| 829 | * | ||
| 830 | * \returns | ||
| 831 | * Zero if timestamping isn't supported in current display mode or a | ||
| 832 | * negative number on failure. A positive status code on success, | ||
| 833 | * which describes how the vblank_time timestamp was computed. | ||
| 834 | */ | ||
| 835 | int (*get_vblank_timestamp) (struct drm_device *dev, int crtc, | ||
| 836 | int *max_error, | ||
| 837 | struct timeval *vblank_time, | ||
| 838 | unsigned flags); | ||
| 839 | |||
| 763 | /* these have to be filled in */ | 840 | /* these have to be filled in */ |
| 764 | 841 | ||
| 765 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); | 842 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
| @@ -983,6 +1060,8 @@ struct drm_device { | |||
| 983 | 1060 | ||
| 984 | wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ | 1061 | wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ |
| 985 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ | 1062 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ |
| 1063 | struct timeval *_vblank_time; /**< timestamp of current vblank_count (drivers must alloc right number of fields) */ | ||
| 1064 | spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ | ||
| 986 | spinlock_t vbl_lock; | 1065 | spinlock_t vbl_lock; |
| 987 | atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ | 1066 | atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ |
| 988 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ | 1067 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ |
| @@ -1041,12 +1120,14 @@ struct drm_device { | |||
| 1041 | /*@{ */ | 1120 | /*@{ */ |
| 1042 | spinlock_t object_name_lock; | 1121 | spinlock_t object_name_lock; |
| 1043 | struct idr object_name_idr; | 1122 | struct idr object_name_idr; |
| 1044 | uint32_t invalidate_domains; /* domains pending invalidation */ | ||
| 1045 | uint32_t flush_domains; /* domains pending flush */ | ||
| 1046 | /*@} */ | 1123 | /*@} */ |
| 1047 | 1124 | int switch_power_state; | |
| 1048 | }; | 1125 | }; |
| 1049 | 1126 | ||
| 1127 | #define DRM_SWITCH_POWER_ON 0 | ||
| 1128 | #define DRM_SWITCH_POWER_OFF 1 | ||
| 1129 | #define DRM_SWITCH_POWER_CHANGING 2 | ||
| 1130 | |||
| 1050 | static __inline__ int drm_core_check_feature(struct drm_device *dev, | 1131 | static __inline__ int drm_core_check_feature(struct drm_device *dev, |
| 1051 | int feature) | 1132 | int feature) |
| 1052 | { | 1133 | { |
| @@ -1284,11 +1365,22 @@ extern int drm_wait_vblank(struct drm_device *dev, void *data, | |||
| 1284 | struct drm_file *filp); | 1365 | struct drm_file *filp); |
| 1285 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); | 1366 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); |
| 1286 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); | 1367 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); |
| 1368 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, | ||
| 1369 | struct timeval *vblanktime); | ||
| 1287 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); | 1370 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); |
| 1288 | extern int drm_vblank_get(struct drm_device *dev, int crtc); | 1371 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
| 1289 | extern void drm_vblank_put(struct drm_device *dev, int crtc); | 1372 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
| 1290 | extern void drm_vblank_off(struct drm_device *dev, int crtc); | 1373 | extern void drm_vblank_off(struct drm_device *dev, int crtc); |
| 1291 | extern void drm_vblank_cleanup(struct drm_device *dev); | 1374 | extern void drm_vblank_cleanup(struct drm_device *dev); |
| 1375 | extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc, | ||
| 1376 | struct timeval *tvblank, unsigned flags); | ||
| 1377 | extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, | ||
| 1378 | int crtc, int *max_error, | ||
| 1379 | struct timeval *vblank_time, | ||
| 1380 | unsigned flags, | ||
| 1381 | struct drm_crtc *refcrtc); | ||
| 1382 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc); | ||
| 1383 | |||
| 1292 | /* Modesetting support */ | 1384 | /* Modesetting support */ |
| 1293 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); | 1385 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
| 1294 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); | 1386 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); |
| @@ -1321,7 +1413,6 @@ extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, | |||
| 1321 | extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); | 1413 | extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); |
| 1322 | extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, | 1414 | extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, |
| 1323 | struct drm_file *file_priv); | 1415 | struct drm_file *file_priv); |
| 1324 | extern void drm_agp_chipset_flush(struct drm_device *dev); | ||
| 1325 | 1416 | ||
| 1326 | /* Stub support (drm_stub.h) */ | 1417 | /* Stub support (drm_stub.h) */ |
| 1327 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, | 1418 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
| @@ -1340,6 +1431,9 @@ extern void drm_put_dev(struct drm_device *dev); | |||
| 1340 | extern int drm_put_minor(struct drm_minor **minor); | 1431 | extern int drm_put_minor(struct drm_minor **minor); |
| 1341 | extern unsigned int drm_debug; | 1432 | extern unsigned int drm_debug; |
| 1342 | 1433 | ||
| 1434 | extern unsigned int drm_vblank_offdelay; | ||
| 1435 | extern unsigned int drm_timestamp_precision; | ||
| 1436 | |||
| 1343 | extern struct class *drm_class; | 1437 | extern struct class *drm_class; |
| 1344 | extern struct proc_dir_entry *drm_proc_root; | 1438 | extern struct proc_dir_entry *drm_proc_root; |
| 1345 | extern struct dentry *drm_debugfs_root; | 1439 | extern struct dentry *drm_debugfs_root; |
