[Intel-gfx] [PATCH 16/19] drm: Store the vblank timestamp when adjusting the counter during disable
Daniel Vetter
daniel at ffwll.ch
Wed Aug 6 15:12:08 CEST 2014
On Wed, Aug 06, 2014 at 02:49:59PM +0300, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> During vblank disable the code tries to guess based on the
> timestamps whether we just missed one vblank or not. And if so
> it increments the counter. However it forgets to store the new
> timestamp to the approriate slot in our timestamp ring buffer.
> So anyone querying the timestamp for the resulting sequence
> number would get a stale timestamp. Fix it up by storing the
> new timestamp.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> drivers/gpu/drm/drm_irq.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 67507a4..e927e5f 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -203,6 +203,13 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
> * hope for the best.
> */
> if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) {
We should use DRM_REDUNDANT_VBLIRQ_THRESH_NS here for symmtry. With that
addressed this is Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> + /* Store new timestamp in ringbuffer. */
> + vblanktimestamp(dev, crtc, vblcount + 1) = tvblank;
> +
> + /* Increment cooked vblank count. This also atomically commits
> + * the timestamp computed above.
> + */
> + smp_mb__before_atomic();
> atomic_inc(&vblank->count);
> smp_mb__after_atomic();
> }
> --
> 1.8.5.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list