aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_display.c
diff options
context:
space:
mode:
authorMario Kleiner <mario.kleiner.de@gmail.com>2013-10-30 00:13:07 -0400
committerDave Airlie <airlied@redhat.com>2013-11-05 20:53:42 -0500
commitd47abc585d26ce48e31a3b77d6414f507c5e9519 (patch)
tree0db7c68389c8d8a7f688482a08870901d956df37 /drivers/gpu/drm/radeon/radeon_display.c
parent8f6fce03ddaf10bfa40c7d6cd59b778d35d41800 (diff)
drm/radeon: Push get_scanout_position() timestamping into kms driver.
Move the ktime_get() clock readouts and potential preempt_disable() calls from drm core into kms driver to make it compatible with the api changes in the drm core. This should not introduce any change in functionality or behaviour in radeon-kms, just a reshuffling of code. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_display.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 0e52cc532c26..7b253815a323 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -307,7 +307,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
307 */ 307 */
308 if (update_pending && 308 if (update_pending &&
309 (DRM_SCANOUTPOS_VALID & radeon_get_crtc_scanoutpos(rdev->ddev, crtc_id, 309 (DRM_SCANOUTPOS_VALID & radeon_get_crtc_scanoutpos(rdev->ddev, crtc_id,
310 &vpos, &hpos)) && 310 &vpos, &hpos, NULL, NULL)) &&
311 ((vpos >= (99 * rdev->mode_info.crtcs[crtc_id]->base.hwmode.crtc_vdisplay)/100) || 311 ((vpos >= (99 * rdev->mode_info.crtcs[crtc_id]->base.hwmode.crtc_vdisplay)/100) ||
312 (vpos < 0 && !ASIC_IS_AVIVO(rdev)))) { 312 (vpos < 0 && !ASIC_IS_AVIVO(rdev)))) {
313 /* crtc didn't flip in this target vblank interval, 313 /* crtc didn't flip in this target vblank interval,
@@ -1596,12 +1596,17 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
1596} 1596}
1597 1597
1598/* 1598/*
1599 * Retrieve current video scanout position of crtc on a given gpu. 1599 * Retrieve current video scanout position of crtc on a given gpu, and
1600 * an optional accurate timestamp of when query happened.
1600 * 1601 *
1601 * \param dev Device to query. 1602 * \param dev Device to query.
1602 * \param crtc Crtc to query. 1603 * \param crtc Crtc to query.
1603 * \param *vpos Location where vertical scanout position should be stored. 1604 * \param *vpos Location where vertical scanout position should be stored.
1604 * \param *hpos Location where horizontal scanout position should go. 1605 * \param *hpos Location where horizontal scanout position should go.
1606 * \param *stime Target location for timestamp taken immediately before
1607 * scanout position query. Can be NULL to skip timestamp.
1608 * \param *etime Target location for timestamp taken immediately after
1609 * scanout position query. Can be NULL to skip timestamp.
1605 * 1610 *
1606 * Returns vpos as a positive number while in active scanout area. 1611 * Returns vpos as a positive number while in active scanout area.
1607 * Returns vpos as a negative number inside vblank, counting the number 1612 * Returns vpos as a negative number inside vblank, counting the number
@@ -1617,7 +1622,8 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
1617 * unknown small number of scanlines wrt. real scanout position. 1622 * unknown small number of scanlines wrt. real scanout position.
1618 * 1623 *
1619 */ 1624 */
1620int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, int *vpos, int *hpos) 1625int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, int *vpos, int *hpos,
1626 ktime_t *stime, ktime_t *etime)
1621{ 1627{
1622 u32 stat_crtc = 0, vbl = 0, position = 0; 1628 u32 stat_crtc = 0, vbl = 0, position = 0;
1623 int vbl_start, vbl_end, vtotal, ret = 0; 1629 int vbl_start, vbl_end, vtotal, ret = 0;
@@ -1625,6 +1631,12 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, int *vpos, int
1625 1631
1626 struct radeon_device *rdev = dev->dev_private; 1632 struct radeon_device *rdev = dev->dev_private;
1627 1633
1634 /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */
1635
1636 /* Get optional system timestamp before query. */
1637 if (stime)
1638 *stime = ktime_get();
1639
1628 if (ASIC_IS_DCE4(rdev)) { 1640 if (ASIC_IS_DCE4(rdev)) {
1629 if (crtc == 0) { 1641 if (crtc == 0) {
1630 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END + 1642 vbl = RREG32(EVERGREEN_CRTC_V_BLANK_START_END +
@@ -1707,6 +1719,12 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, int *vpos, int
1707 } 1719 }
1708 } 1720 }
1709 1721
1722 /* Get optional system timestamp after query. */
1723 if (etime)
1724 *etime = ktime_get();
1725
1726 /* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */
1727
1710 /* Decode into vertical and horizontal scanout position. */ 1728 /* Decode into vertical and horizontal scanout position. */
1711 *vpos = position & 0x1fff; 1729 *vpos = position & 0x1fff;
1712 *hpos = (position >> 16) & 0x1fff; 1730 *hpos = (position >> 16) & 0x1fff;