mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Ricardo Ribalda <ribalda@chromium.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Tomasz Figa <tfiga@chromium.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Yunke Cao <yunkec@google.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 6/6] media: uvcvideo: Only do uvc_video_get_time() if needed
Date: Mon, 18 May 2026 11:02:27 +0200	[thread overview]
Message-ID: <17e2f68d-c414-471f-8705-80ff7c206fdc@kernel.org> (raw)
In-Reply-To: <20260513-uvc-hwtimestamp-v3-6-7a64838b0b02@chromium.org>

Hi,

On 13-May-26 1:49 PM, Ricardo Ribalda wrote:
> There is no need to calculate the current time if the sample is going to
> be filtered.
> 
> Move the assignment close to uvc_video_clock_add_sample().
> 
> Suggested-by: Hans de Goede <hansg@kernel.org>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

Regards,

Hans


> ---
>  drivers/media/usb/uvc/uvc_video.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index 6794031cd0fb..1cc86a18b2bb 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -645,8 +645,6 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf,
>  	if (stream->dev->quirks & UVC_QUIRK_INVALID_DEVICE_SOF)
>  		sample.dev_sof = sample.host_sof;
>  
> -	sample.host_time = uvc_video_get_time();
> -
>  	/*
>  	 * The UVC specification allows device implementations that can't obtain
>  	 * the USB frame number to keep their own frame counters as long as they
> @@ -687,6 +685,9 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf,
>  	    (UVC_MIN_HW_TIMESTAMP_DIFF / stream->clock.size))
>  		return;
>  
> +	/* This is expensive, only do it if the sample will be added. */
> +	sample.host_time = uvc_video_get_time();
> +
>  	uvc_video_clock_add_sample(&stream->clock, &sample);
>  	stream->clock.last_sof_processed = sample.dev_sof;
>  }
> 


  parent reply	other threads:[~2026-05-18  9:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 11:49 [PATCH v3 0/6] media: uvcvideo: Fixes for hw timestamping Ricardo Ribalda
2026-05-13 11:49 ` [PATCH v3 1/6] media: uvcvideo: Fix dev_sof filtering in hw timestamp Ricardo Ribalda
2026-05-13 11:49 ` [PATCH v3 2/6] media: uvcvideo: Use hw timestaming if the clock buffer is full Ricardo Ribalda
2026-05-13 11:49 ` [PATCH v3 3/6] media: uvcvideo: Relax the constrains for interpolating the hw clock Ricardo Ribalda
2026-05-13 11:49 ` [PATCH v3 4/6] media: uvcvideo: Do not add clock samples with small sof delta Ricardo Ribalda
2026-05-13 11:51   ` Ricardo Ribalda
2026-05-13 11:49 ` [PATCH v3 5/6] media: uvcvideo: Do not add samples if dev_sof has not changed Ricardo Ribalda
2026-05-18  9:02   ` Hans de Goede
2026-05-13 11:49 ` [PATCH v3 6/6] media: uvcvideo: Only do uvc_video_get_time() if needed Ricardo Ribalda
2026-05-14  9:37   ` Yunke Cao
2026-05-18  9:02   ` Hans de Goede [this message]
2026-05-18  9:06 ` [PATCH v3 0/6] media: uvcvideo: Fixes for hw timestamping Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17e2f68d-c414-471f-8705-80ff7c206fdc@kernel.org \
    --to=hansg@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=senozhatsky@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=yunkec@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®