aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-09-10 11:36:10 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-09-11 07:38:48 -0400
commitfb446a1acdb981921de06bfde3a2178da7174481 (patch)
tree7ad2ab06442121ff46e4590437e1a3c69bff0181
parent855d30b402b91f09c90f65c34ec91debaae8cf3a (diff)
drm: Simplify return value of drm_get_last_vbltimestamp
Imo u32 hints at a register value, but in reality all callers only care whether the sampled timestamp is precise or not. So give them just a bool. Also move the declaration out of drmP.h, it's only used in drm_irq.c. v2: Also drop the EXPORT_SYMBOL, spotted by Mario. Cc: Mario Kleiner <mario.kleiner.de@gmail.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
-rw-r--r--drivers/gpu/drm/drm_irq.c25
-rw-r--r--include/drm/drmP.h2
2 files changed, 15 insertions, 12 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index ad699b729278..15f748c7fa7e 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -55,6 +55,10 @@
55 */ 55 */
56#define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000 56#define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000
57 57
58static bool
59drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
60 struct timeval *tvblank, unsigned flags);
61
58/** 62/**
59 * drm_update_vblank_count - update the master vblank counter 63 * drm_update_vblank_count - update the master vblank counter
60 * @dev: DRM device 64 * @dev: DRM device
@@ -74,7 +78,8 @@
74static void drm_update_vblank_count(struct drm_device *dev, int crtc) 78static void drm_update_vblank_count(struct drm_device *dev, int crtc)
75{ 79{
76 struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; 80 struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
77 u32 cur_vblank, diff, tslot, rc; 81 u32 cur_vblank, diff, tslot;
82 bool rc;
78 struct timeval t_vblank; 83 struct timeval t_vblank;
79 84
80 /* 85 /*
@@ -132,7 +137,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
132 unsigned long irqflags; 137 unsigned long irqflags;
133 u32 vblcount; 138 u32 vblcount;
134 s64 diff_ns; 139 s64 diff_ns;
135 int vblrc; 140 bool vblrc;
136 struct timeval tvblank; 141 struct timeval tvblank;
137 int count = DRM_TIMESTAMP_MAXRETRIES; 142 int count = DRM_TIMESTAMP_MAXRETRIES;
138 143
@@ -156,7 +161,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
156 * vblank interrupt is disabled. 161 * vblank interrupt is disabled.
157 */ 162 */
158 if (!vblank->enabled && 163 if (!vblank->enabled &&
159 drm_get_last_vbltimestamp(dev, crtc, &tvblank, 0) > 0) { 164 drm_get_last_vbltimestamp(dev, crtc, &tvblank, 0)) {
160 drm_update_vblank_count(dev, crtc); 165 drm_update_vblank_count(dev, crtc);
161 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); 166 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);
162 return; 167 return;
@@ -204,7 +209,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
204 * available. In that case we can't account for this and just 209 * available. In that case we can't account for this and just
205 * hope for the best. 210 * hope for the best.
206 */ 211 */
207 if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) { 212 if (vblrc && (abs64(diff_ns) > 1000000)) {
208 /* Store new timestamp in ringbuffer. */ 213 /* Store new timestamp in ringbuffer. */
209 vblanktimestamp(dev, crtc, vblcount + 1) = tvblank; 214 vblanktimestamp(dev, crtc, vblcount + 1) = tvblank;
210 215
@@ -781,10 +786,11 @@ static struct timeval get_drm_timestamp(void)
781 * call, i.e., it isn't very precisely locked to the true vblank. 786 * call, i.e., it isn't very precisely locked to the true vblank.
782 * 787 *
783 * Returns: 788 * Returns:
784 * Non-zero if timestamp is considered to be very precise, zero otherwise. 789 * True if timestamp is considered to be very precise, false otherwise.
785 */ 790 */
786u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc, 791static bool
787 struct timeval *tvblank, unsigned flags) 792drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
793 struct timeval *tvblank, unsigned flags)
788{ 794{
789 int ret; 795 int ret;
790 796
@@ -796,7 +802,7 @@ u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
796 ret = dev->driver->get_vblank_timestamp(dev, crtc, &max_error, 802 ret = dev->driver->get_vblank_timestamp(dev, crtc, &max_error,
797 tvblank, flags); 803 tvblank, flags);
798 if (ret > 0) 804 if (ret > 0)
799 return (u32) ret; 805 return true;
800 } 806 }
801 807
802 /* GPU high precision timestamp query unsupported or failed. 808 /* GPU high precision timestamp query unsupported or failed.
@@ -804,9 +810,8 @@ u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
804 */ 810 */
805 *tvblank = get_drm_timestamp(); 811 *tvblank = get_drm_timestamp();
806 812
807 return 0; 813 return false;
808} 814}
809EXPORT_SYMBOL(drm_get_last_vbltimestamp);
810 815
811/** 816/**
812 * drm_vblank_count - retrieve "cooked" vblank counter value 817 * drm_vblank_count - retrieve "cooked" vblank counter value
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 17a5c10474bd..a97307525c2d 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1320,8 +1320,6 @@ extern void drm_crtc_vblank_off(struct drm_crtc *crtc);
1320extern void drm_crtc_vblank_on(struct drm_crtc *crtc); 1320extern void drm_crtc_vblank_on(struct drm_crtc *crtc);
1321extern void drm_vblank_cleanup(struct drm_device *dev); 1321extern void drm_vblank_cleanup(struct drm_device *dev);
1322 1322
1323extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
1324 struct timeval *tvblank, unsigned flags);
1325extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, 1323extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
1326 int crtc, int *max_error, 1324 int crtc, int *max_error,
1327 struct timeval *vblank_time, 1325 struct timeval *vblank_time,