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.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 274eaaa15c36..2b3398004aa5 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 */
@@ -1284,11 +1363,22 @@ extern int drm_wait_vblank(struct drm_device *dev, void *data,
1284 struct drm_file *filp); 1363 struct drm_file *filp);
1285extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); 1364extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
1286extern u32 drm_vblank_count(struct drm_device *dev, int crtc); 1365extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1366extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,
1367 struct timeval *vblanktime);
1287extern void drm_handle_vblank(struct drm_device *dev, int crtc); 1368extern void drm_handle_vblank(struct drm_device *dev, int crtc);
1288extern int drm_vblank_get(struct drm_device *dev, int crtc); 1369extern int drm_vblank_get(struct drm_device *dev, int crtc);
1289extern void drm_vblank_put(struct drm_device *dev, int crtc); 1370extern void drm_vblank_put(struct drm_device *dev, int crtc);
1290extern void drm_vblank_off(struct drm_device *dev, int crtc); 1371extern void drm_vblank_off(struct drm_device *dev, int crtc);
1291extern void drm_vblank_cleanup(struct drm_device *dev); 1372extern void drm_vblank_cleanup(struct drm_device *dev);
1373extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
1374 struct timeval *tvblank, unsigned flags);
1375extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
1376 int crtc, int *max_error,
1377 struct timeval *vblank_time,
1378 unsigned flags,
1379 struct drm_crtc *refcrtc);
1380extern void drm_calc_timestamping_constants(struct drm_crtc *crtc);
1381
1292/* Modesetting support */ 1382/* Modesetting support */
1293extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); 1383extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
1294extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); 1384extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc);
@@ -1340,6 +1430,9 @@ extern void drm_put_dev(struct drm_device *dev);
1340extern int drm_put_minor(struct drm_minor **minor); 1430extern int drm_put_minor(struct drm_minor **minor);
1341extern unsigned int drm_debug; 1431extern unsigned int drm_debug;
1342 1432
1433extern unsigned int drm_vblank_offdelay;
1434extern unsigned int drm_timestamp_precision;
1435
1343extern struct class *drm_class; 1436extern struct class *drm_class;
1344extern struct proc_dir_entry *drm_proc_root; 1437extern struct proc_dir_entry *drm_proc_root;
1345extern struct dentry *drm_debugfs_root; 1438extern struct dentry *drm_debugfs_root;