Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / drivers / gpu / drm / drm_irq.c
index f9af048828ea16136752a29b982ae28add4ff226..64c34d5876ffc7c8378b3df4a389db203dd1c576 100644 (file)
@@ -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)
@@ -455,8 +455,8 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc)
        /* Dot clock in Hz: */
        dotclock = (u64) crtc->hwmode.clock * 1000;
 
-       /* Fields of interlaced scanout modes are only halve a frame duration.
-        * Double the dotclock to get halve the frame-/line-/pixelduration.
+       /* Fields of interlaced scanout modes are only half a frame duration.
+        * Double the dotclock to get half the frame-/line-/pixelduration.
         */
        if (crtc->hwmode.flags & DRM_MODE_FLAG_INTERLACE)
                dotclock *= 2;
@@ -586,24 +586,20 @@ 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++) {
-               /* Disable preemption to make it very likely to
-                * succeed in the first iteration even on PREEMPT_RT kernel.
+               /*
+                * Get vertical and horizontal scanout position vpos, hpos,
+                * and bounding timestamps stime, etime, pre/post query.
                 */
-               preempt_disable();
+               vbl_status = dev->driver->get_scanout_position(dev, crtc, &vpos,
+                                                              &hpos, &stime, &etime);
 
-               /* 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 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();
 
-               preempt_enable();
-
                /* Return as no-op if scanout query unsupported or failed. */
                if (!(vbl_status & DRM_SCANOUTPOS_VALID)) {
                        DRM_DEBUG("crtc %d : scanoutpos query failed [%d].\n",
@@ -611,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. */