On Fri, Apr 22, 2016 at 05:04:04PM +0530, sourab.gupta@xxxxxxxxx wrote: > +static u64 get_current_gpu_ts(struct drm_i915_private *dev_priv) > +{ > + return ((u64)I915_READ(GT_TIMESTAMP_COUNT_UDW) << 32) | > + I915_READ(GT_TIMESTAMP_COUNT); return I915_READ64_2x32(GT_TIMESTAMP_COUNT, GT_TIMESTAMP_COUNT_UDW); > +static void i915_perf_get_clock(struct drm_i915_private *dev_priv, > + u64 *clk_mono, u64 *gpu_time, u64 *gpu_ts) > +{ > + u64 remainder, ts_interval = NSEC_PER_SEC; > + u32 gpu_freq = dev_priv->perf.timestamp_frequency; > + unsigned long flags; > + > + local_irq_save(flags); > + *clk_mono = ktime_get_mono_fast_ns(); > + *gpu_ts = get_current_gpu_ts(dev_priv); > + local_irq_restore(flags); > + > + remainder = do_div(ts_interval, gpu_freq); > + remainder *= *gpu_ts; > + do_div(remainder, gpu_freq); > + > + *gpu_time = ((*gpu_ts) * ts_interval) + remainder; > +} > + > +static void i915_perf_clock_sync_work(struct work_struct *work) > +{ Have you looked at cross-timestamps? -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx