public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sta2x11: use monotonic timestamp
@ 2015-05-07  6:22 Hans Verkuil
  2015-05-07  6:27 ` Hans Verkuil
  2015-05-07  6:33 ` Hans Verkuil
  0 siblings, 2 replies; 4+ messages in thread
From: Hans Verkuil @ 2015-05-07  6:22 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Sakari Ailus

V4L2 drivers should use MONOTONIC timestamps instead of gettimeofday, which is
affected by daylight savings time.

diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c b/drivers/media/pci/sta2x11/sta2x11_vip.c
index d384a6b..59b3a36 100644
--- a/drivers/media/pci/sta2x11/sta2x11_vip.c
+++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
@@ -813,7 +813,7 @@ static irqreturn_t vip_irq(int irq, struct sta2x11_vip *vip)
 		/* Disable acquisition */
 		reg_write(vip, DVP_CTL, reg_read(vip, DVP_CTL) & ~DVP_CTL_ENA);
 		/* Remove the active buffer from the list */
-		do_gettimeofday(&vip->active->vb.v4l2_buf.timestamp);
+		v4l2_get_timestamp(&vip->active->vb.v4l2_buf.timestamp);
 		vip->active->vb.v4l2_buf.sequence = vip->sequence++;
 		vb2_buffer_done(&vip->active->vb, VB2_BUF_STATE_DONE);
 	}
@@ -864,6 +864,7 @@ static int sta2x11_vip_init_buffer(struct sta2x11_vip *vip)
 	vip->vb_vidq.buf_struct_size = sizeof(struct vip_buffer);
 	vip->vb_vidq.ops = &vip_video_qops;
 	vip->vb_vidq.mem_ops = &vb2_dma_contig_memops;
+	vip->vb_vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
 	err = vb2_queue_init(&vip->vb_vidq);
 	if (err)
 		return err;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sta2x11: use monotonic timestamp
  2015-05-07  6:22 [PATCH] sta2x11: use monotonic timestamp Hans Verkuil
@ 2015-05-07  6:27 ` Hans Verkuil
  2015-05-07 12:21   ` Federico Vaga
  2015-05-07  6:33 ` Hans Verkuil
  1 sibling, 1 reply; 4+ messages in thread
From: Hans Verkuil @ 2015-05-07  6:27 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Sakari Ailus, Federico Vaga

Added Federico to the CC-list.

On 05/07/2015 08:22 AM, Hans Verkuil wrote:
> V4L2 drivers should use MONOTONIC timestamps instead of gettimeofday, which is
> affected by daylight savings time.
> 
> diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c b/drivers/media/pci/sta2x11/sta2x11_vip.c
> index d384a6b..59b3a36 100644
> --- a/drivers/media/pci/sta2x11/sta2x11_vip.c
> +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
> @@ -813,7 +813,7 @@ static irqreturn_t vip_irq(int irq, struct sta2x11_vip *vip)
>  		/* Disable acquisition */
>  		reg_write(vip, DVP_CTL, reg_read(vip, DVP_CTL) & ~DVP_CTL_ENA);
>  		/* Remove the active buffer from the list */
> -		do_gettimeofday(&vip->active->vb.v4l2_buf.timestamp);
> +		v4l2_get_timestamp(&vip->active->vb.v4l2_buf.timestamp);
>  		vip->active->vb.v4l2_buf.sequence = vip->sequence++;
>  		vb2_buffer_done(&vip->active->vb, VB2_BUF_STATE_DONE);
>  	}
> @@ -864,6 +864,7 @@ static int sta2x11_vip_init_buffer(struct sta2x11_vip *vip)
>  	vip->vb_vidq.buf_struct_size = sizeof(struct vip_buffer);
>  	vip->vb_vidq.ops = &vip_video_qops;
>  	vip->vb_vidq.mem_ops = &vb2_dma_contig_memops;
> +	vip->vb_vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
>  	err = vb2_queue_init(&vip->vb_vidq);
>  	if (err)
>  		return err;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sta2x11: use monotonic timestamp
  2015-05-07  6:22 [PATCH] sta2x11: use monotonic timestamp Hans Verkuil
  2015-05-07  6:27 ` Hans Verkuil
@ 2015-05-07  6:33 ` Hans Verkuil
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2015-05-07  6:33 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Sakari Ailus

On 05/07/2015 08:22 AM, Hans Verkuil wrote:
> V4L2 drivers should use MONOTONIC timestamps instead of gettimeofday, which is
> affected by daylight savings time.
> 

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

> diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c b/drivers/media/pci/sta2x11/sta2x11_vip.c
> index d384a6b..59b3a36 100644
> --- a/drivers/media/pci/sta2x11/sta2x11_vip.c
> +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
> @@ -813,7 +813,7 @@ static irqreturn_t vip_irq(int irq, struct sta2x11_vip *vip)
>  		/* Disable acquisition */
>  		reg_write(vip, DVP_CTL, reg_read(vip, DVP_CTL) & ~DVP_CTL_ENA);
>  		/* Remove the active buffer from the list */
> -		do_gettimeofday(&vip->active->vb.v4l2_buf.timestamp);
> +		v4l2_get_timestamp(&vip->active->vb.v4l2_buf.timestamp);
>  		vip->active->vb.v4l2_buf.sequence = vip->sequence++;
>  		vb2_buffer_done(&vip->active->vb, VB2_BUF_STATE_DONE);
>  	}
> @@ -864,6 +864,7 @@ static int sta2x11_vip_init_buffer(struct sta2x11_vip *vip)
>  	vip->vb_vidq.buf_struct_size = sizeof(struct vip_buffer);
>  	vip->vb_vidq.ops = &vip_video_qops;
>  	vip->vb_vidq.mem_ops = &vb2_dma_contig_memops;
> +	vip->vb_vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
>  	err = vb2_queue_init(&vip->vb_vidq);
>  	if (err)
>  		return err;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sta2x11: use monotonic timestamp
  2015-05-07  6:27 ` Hans Verkuil
@ 2015-05-07 12:21   ` Federico Vaga
  0 siblings, 0 replies; 4+ messages in thread
From: Federico Vaga @ 2015-05-07 12:21 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Linux Media Mailing List, Sakari Ailus

On Thursday 07 May 2015 08:27:20 Hans Verkuil wrote:
> Added Federico to the CC-list.

Fine for me 

Acked-by: Federico Vaga <federico.vaga@gmail.com>

> On 05/07/2015 08:22 AM, Hans Verkuil wrote:
> > V4L2 drivers should use MONOTONIC timestamps instead of gettimeofday,
> > which is affected by daylight savings time.
> > 
> > diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c
> > b/drivers/media/pci/sta2x11/sta2x11_vip.c index d384a6b..59b3a36 100644
> > --- a/drivers/media/pci/sta2x11/sta2x11_vip.c
> > +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
> > @@ -813,7 +813,7 @@ static irqreturn_t vip_irq(int irq, struct sta2x11_vip
> > *vip)> 
> >  		/* Disable acquisition */
> >  		reg_write(vip, DVP_CTL, reg_read(vip, DVP_CTL) & ~DVP_CTL_ENA);
> >  		/* Remove the active buffer from the list */
> > 
> > -		do_gettimeofday(&vip->active->vb.v4l2_buf.timestamp);
> > +		v4l2_get_timestamp(&vip->active->vb.v4l2_buf.timestamp);
> > 
> >  		vip->active->vb.v4l2_buf.sequence = vip->sequence++;
> >  		vb2_buffer_done(&vip->active->vb, VB2_BUF_STATE_DONE);
> >  	
> >  	}
> > 
> > @@ -864,6 +864,7 @@ static int sta2x11_vip_init_buffer(struct sta2x11_vip
> > *vip)> 
> >  	vip->vb_vidq.buf_struct_size = sizeof(struct vip_buffer);
> >  	vip->vb_vidq.ops = &vip_video_qops;
> >  	vip->vb_vidq.mem_ops = &vb2_dma_contig_memops;
> > 
> > +	vip->vb_vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
> > 
> >  	err = vb2_queue_init(&vip->vb_vidq);
> >  	if (err)
> >  	
> >  		return err;
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-media" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Federico Vaga

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-07 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-07  6:22 [PATCH] sta2x11: use monotonic timestamp Hans Verkuil
2015-05-07  6:27 ` Hans Verkuil
2015-05-07 12:21   ` Federico Vaga
2015-05-07  6:33 ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox