diff options
Diffstat (limited to 'drivers/gpu/drm/drm_irq.c')
-rw-r--r-- | drivers/gpu/drm/drm_irq.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 0de123afdb34..08ba1209228e 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -542,8 +542,8 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, | |||
542 | const struct drm_crtc *refcrtc, | 542 | const struct drm_crtc *refcrtc, |
543 | const struct drm_display_mode *mode) | 543 | const struct drm_display_mode *mode) |
544 | { | 544 | { |
545 | ktime_t stime, etime, mono_time_offset; | ||
546 | struct timeval tv_etime; | 545 | struct timeval tv_etime; |
546 | ktime_t stime, etime; | ||
547 | int vbl_status; | 547 | int vbl_status; |
548 | int vpos, hpos, i; | 548 | int vpos, hpos, i; |
549 | int framedur_ns, linedur_ns, pixeldur_ns, delta_ns, duration_ns; | 549 | int framedur_ns, linedur_ns, pixeldur_ns, delta_ns, duration_ns; |
@@ -588,13 +588,6 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, | |||
588 | vbl_status = dev->driver->get_scanout_position(dev, crtc, flags, &vpos, | 588 | vbl_status = dev->driver->get_scanout_position(dev, crtc, flags, &vpos, |
589 | &hpos, &stime, &etime); | 589 | &hpos, &stime, &etime); |
590 | 590 | ||
591 | /* | ||
592 | * Get correction for CLOCK_MONOTONIC -> CLOCK_REALTIME if | ||
593 | * CLOCK_REALTIME is requested. | ||
594 | */ | ||
595 | if (!drm_timestamp_monotonic) | ||
596 | mono_time_offset = ktime_get_monotonic_offset(); | ||
597 | |||
598 | /* Return as no-op if scanout query unsupported or failed. */ | 591 | /* Return as no-op if scanout query unsupported or failed. */ |
599 | if (!(vbl_status & DRM_SCANOUTPOS_VALID)) { | 592 | if (!(vbl_status & DRM_SCANOUTPOS_VALID)) { |
600 | DRM_DEBUG("crtc %d : scanoutpos query failed [%d].\n", | 593 | DRM_DEBUG("crtc %d : scanoutpos query failed [%d].\n", |
@@ -633,7 +626,7 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, | |||
633 | delta_ns = vpos * linedur_ns + hpos * pixeldur_ns; | 626 | delta_ns = vpos * linedur_ns + hpos * pixeldur_ns; |
634 | 627 | ||
635 | if (!drm_timestamp_monotonic) | 628 | if (!drm_timestamp_monotonic) |
636 | etime = ktime_sub(etime, mono_time_offset); | 629 | etime = ktime_mono_to_real(etime); |
637 | 630 | ||
638 | /* save this only for debugging purposes */ | 631 | /* save this only for debugging purposes */ |
639 | tv_etime = ktime_to_timeval(etime); | 632 | tv_etime = ktime_to_timeval(etime); |
@@ -664,10 +657,7 @@ static struct timeval get_drm_timestamp(void) | |||
664 | { | 657 | { |
665 | ktime_t now; | 658 | ktime_t now; |
666 | 659 | ||
667 | now = ktime_get(); | 660 | now = drm_timestamp_monotonic ? ktime_get() : ktime_get_real(); |
668 | if (!drm_timestamp_monotonic) | ||
669 | now = ktime_sub(now, ktime_get_monotonic_offset()); | ||
670 | |||
671 | return ktime_to_timeval(now); | 661 | return ktime_to_timeval(now); |
672 | } | 662 | } |
673 | 663 | ||