|
@@ -219,7 +219,7 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
|
|
|
for (i = 0; i < num_crtcs; i++)
|
|
|
init_waitqueue_head(&dev->vblank[i].queue);
|
|
|
|
|
|
- DRM_INFO("Supports vblank timestamp caching Rev 1 (10.10.2010).\n");
|
|
|
+ DRM_INFO("Supports vblank timestamp caching Rev 2 (21.10.2013).\n");
|
|
|
|
|
|
/* Driver specific high-precision vblank timestamping supported? */
|
|
|
if (dev->driver->get_vblank_timestamp)
|
|
@@ -586,14 +586,17 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,
|
|
|
* code gets preempted or delayed for some reason.
|
|
|
*/
|
|
|
for (i = 0; i < DRM_TIMESTAMP_MAXRETRIES; i++) {
|
|
|
- /* Get system timestamp before query. */
|
|
|
- stime = ktime_get();
|
|
|
-
|
|
|
- /* Get vertical and horizontal scanout pos. vpos, hpos. */
|
|
|
- vbl_status = dev->driver->get_scanout_position(dev, crtc, &vpos, &hpos);
|
|
|
+ /*
|
|
|
+ * Get vertical and horizontal scanout position vpos, hpos,
|
|
|
+ * and bounding timestamps stime, etime, pre/post query.
|
|
|
+ */
|
|
|
+ vbl_status = dev->driver->get_scanout_position(dev, crtc, &vpos,
|
|
|
+ &hpos, &stime, &etime);
|
|
|
|
|
|
- /* Get system timestamp after query. */
|
|
|
- etime = ktime_get();
|
|
|
+ /*
|
|
|
+ * Get correction for CLOCK_MONOTONIC -> CLOCK_REALTIME if
|
|
|
+ * CLOCK_REALTIME is requested.
|
|
|
+ */
|
|
|
if (!drm_timestamp_monotonic)
|
|
|
mono_time_offset = ktime_get_monotonic_offset();
|
|
|
|
|
@@ -604,6 +607,7 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,
|
|
|
return -EIO;
|
|
|
}
|
|
|
|
|
|
+ /* Compute uncertainty in timestamp of scanout position query. */
|
|
|
duration_ns = ktime_to_ns(etime) - ktime_to_ns(stime);
|
|
|
|
|
|
/* Accept result with < max_error nsecs timing uncertainty. */
|