aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
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
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')
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c24
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c2
4 files changed, 26 insertions, 6 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;
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index dfd4149a43b6..aab24173d2e9 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -107,7 +107,8 @@ int radeon_gem_object_open(struct drm_gem_object *obj,
107void radeon_gem_object_close(struct drm_gem_object *obj, 107void radeon_gem_object_close(struct drm_gem_object *obj,
108 struct drm_file *file_priv); 108 struct drm_file *file_priv);
109extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, 109extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc,
110 int *vpos, int *hpos); 110 int *vpos, int *hpos, ktime_t *stime,
111 ktime_t *etime);
111extern const struct drm_ioctl_desc radeon_ioctls_kms[]; 112extern const struct drm_ioctl_desc radeon_ioctls_kms[];
112extern int radeon_max_kms_ioctl; 113extern int radeon_max_kms_ioctl;
113int radeon_mmap(struct file *filp, struct vm_area_struct *vma); 114int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 8b4e712c1e5c..3f0dd664af90 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -766,7 +766,8 @@ extern int radeon_crtc_cursor_move(struct drm_crtc *crtc,
766 int x, int y); 766 int x, int y);
767 767
768extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc, 768extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc,
769 int *vpos, int *hpos); 769 int *vpos, int *hpos, ktime_t *stime,
770 ktime_t *etime);
770 771
771extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev); 772extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
772extern struct edid * 773extern struct edid *
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 2baa0fa75e36..981fd06e1f9a 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -1487,7 +1487,7 @@ static bool radeon_pm_in_vbl(struct radeon_device *rdev)
1487 */ 1487 */
1488 for (crtc = 0; (crtc < rdev->num_crtc) && in_vbl; crtc++) { 1488 for (crtc = 0; (crtc < rdev->num_crtc) && in_vbl; crtc++) {
1489 if (rdev->pm.active_crtcs & (1 << crtc)) { 1489 if (rdev->pm.active_crtcs & (1 << crtc)) {
1490 vbl_status = radeon_get_crtc_scanoutpos(rdev->ddev, crtc, &vpos, &hpos); 1490 vbl_status = radeon_get_crtc_scanoutpos(rdev->ddev, crtc, &vpos, &hpos, NULL, NULL);
1491 if ((vbl_status & DRM_SCANOUTPOS_VALID) && 1491 if ((vbl_status & DRM_SCANOUTPOS_VALID) &&
1492 !(vbl_status & DRM_SCANOUTPOS_INVBL)) 1492 !(vbl_status & DRM_SCANOUTPOS_INVBL))
1493 in_vbl = false; 1493 in_vbl = false;