Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2210233imm; Thu, 18 Oct 2018 10:44:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV62CZ2tsWEGrt9Qd1xGLsb35HlZTqT8Toqxi/j7LT0J8QmePiZZkNf7PMxQ/n6H0YgWQ2Yvj X-Received: by 2002:a63:3642:: with SMTP id d63-v6mr28977359pga.404.1539884643272; Thu, 18 Oct 2018 10:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539884643; cv=none; d=google.com; s=arc-20160816; b=qLmhdzv9rq6Wakes3LV1awk8bpmJeqbQ2p4U8PN2JaEHHKoqM1lGwX92CuCafPTnnP nNAV7OSmtpJd8549benGN+B0JXnlB11tfwLvAS6RvrZmshWmfqRhezz59gnzA2sTo1xx d3JdxLix6NclXj33rEQhSFgQUFji1YE+lbHAceHw6P8Ljjnkx8+yXnc7BOFxsYHNgmht sPCUD/msFG1RTjsvku52C4zF/ZscG/BoWG95i2zQP6g0xgAlJOqUCZCY2jrmjPaWhVtr ww0M7IHKyil2EDrHTgqQTsh1QRIkzgKA2cqPqYNXVyGjAB1u2zc6CcvrB6AVtnYPGpo5 upVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=drlSvie5l/iYPBNGt49LyAYrqRPCDcukZEtYDXR1Pzg=; b=TiKiwEzRHj0re9jKNQFFNwcnn4bXa1iaHV9hlzvxhrebuns+LlXBUxtpUjwAKvKjEO GIN/HVveR1duAIndXhGbU2ZAv69Aq0Mokt0tPpxZPIK0rOzTKNePGwhjSzXgnDtgP2sT O1Csj48NHQwBF5Sxq1oG7sx3Fd1G11K6t7mo3ci+T2+UZC5BJZiTzFzRSekebdJi42xg ZXVgoPhGx8iGj7sdbWpwZOGplz3sJtOgbdba3OngPIZgU/9A4474u4MxAs8vA23VR0XM 61uGMbrjIp1EDY4mcs6gVbeDaq9tFj86f7xhE9fidyxlf0v1WfE5F7bdd2vrleUgqNnG ogDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fqmkUVvc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6-v6si22487635pgw.316.2018.10.18.10.43.47; Thu, 18 Oct 2018 10:44:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fqmkUVvc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728267AbeJSBa3 (ORCPT + 99 others); Thu, 18 Oct 2018 21:30:29 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:38787 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726463AbeJSBa3 (ORCPT ); Thu, 18 Oct 2018 21:30:29 -0400 Received: by mail-oi1-f195.google.com with SMTP id u197-v6so24650904oif.5 for ; Thu, 18 Oct 2018 10:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=drlSvie5l/iYPBNGt49LyAYrqRPCDcukZEtYDXR1Pzg=; b=fqmkUVvcdZ6NG5q2gtwX8LC2RXQxBjzXIVmG1gyu8jQRtokDIdme6dPcJY7UjiSL9c l9lQ+E1DWodqnidhLYK3O8XImZLrAOXzxBWUDfes6W7LORNXyw1FAruFce/uMGmBupzH LHUTFOcstq/k0s6hESkSuiveFzIsk3gOIjuPo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=drlSvie5l/iYPBNGt49LyAYrqRPCDcukZEtYDXR1Pzg=; b=bDchSKTh3k6pxPEHdKdebVJ0OEKipe6NkA3GAF7nOyUl20XxQ4aO/ZR2kR43UMbxUg fqTfZJyKNH+HB4cXhtoGCQ+BU9ByMM7vwconOntc+Ae/LqJVaHL0vN9Z3+V7vqb6qwqN wJgOHyw6rzfqyJys5X/KQEAxikF4S99aKhWXR68lBV9Z85luhzK5QpB5szyglrNJu0/X aW89XrUN1ogz9JuWLo7i5VuYxT+1LcRH5L/a00BOzdY/ylu94IPmA0mJgvEPfikH+bBo WXuOK9xm+Z5MAlzL2Hr/FB5JmrQ4k6M7Tzr4zZfC8Kn5rtMYbBDQsBBMF3a+WwjzN1ZP 9rlQ== X-Gm-Message-State: ABuFfohmGGGk9ybKTk1/U0ipttu1tVRoaCuOjlmF1ZkTMXDT9T7OeQh2 CxSyBhgo/EtfoQSqHcX14blGhRGVwbI= X-Received: by 2002:aca:b357:: with SMTP id c84-v6mr17511433oif.266.1539883710297; Thu, 18 Oct 2018 10:28:30 -0700 (PDT) Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com. [209.85.167.175]) by smtp.gmail.com with ESMTPSA id b3-v6sm8428223oih.0.2018.10.18.10.28.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Oct 2018 10:28:27 -0700 (PDT) Received: by mail-oi1-f175.google.com with SMTP id v69-v6so24695162oif.1 for ; Thu, 18 Oct 2018 10:28:27 -0700 (PDT) X-Received: by 2002:aca:aac7:: with SMTP id t190-v6mr17615860oie.218.1539883706578; Thu, 18 Oct 2018 10:28:26 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:3406:0:0:0:0:0 with HTTP; Thu, 18 Oct 2018 10:28:06 -0700 (PDT) In-Reply-To: References: <20181017075242.21790-1-henryhsu@chromium.org> <13883852.6N9L7C0n48@avalon> <2355808.GKno8i6Ks9@avalon> From: Alexandru M Stan Date: Thu, 18 Oct 2018 10:28:06 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] media: uvcvideo: Add boottime clock support To: Tomasz Figa Cc: Laurent Pinchart , Gwendal Grignou , Heng-Ruey Hsu , Mauro Carvalho Chehab , Linux Media Mailing List , Linux Kernel Mailing List , Ricky Liang , linux-iio@vger.kernel.org, Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 17, 2018 at 9:31 PM, Tomasz Figa wrote: > On Thu, Oct 18, 2018 at 5:50 AM Laurent Pinchart > wrote: >> >> Hi Tomasz, >> >> On Wednesday, 17 October 2018 11:28:52 EEST Tomasz Figa wrote: >> > On Wed, Oct 17, 2018 at 5:02 PM Laurent Pinchart wrote: >> > > On Wednesday, 17 October 2018 10:52:42 EEST Heng-Ruey Hsu wrote: >> > >> Android requires camera timestamps to be reported with >> > >> CLOCK_BOOTTIME to sync timestamp with other sensor sources. >> > > >> > > What's the rationale behind this, why can't CLOCK_MONOTONIC work ? If the >> > > monotonic clock has shortcomings that make its use impossible for proper >> > > synchronization, then we should consider switching to CLOCK_BOOTTIME >> > > globally in V4L2, not in selected drivers only. >> > >> > CLOCK_BOOTTIME includes the time spent in suspend, while >> > CLOCK_MONOTONIC doesn't. I can imagine the former being much more >> > useful for anything that cares about the actual, long term, time >> > tracking. Especially important since suspend is a very common event on >> > Android and doesn't stop the time flow there, i.e. applications might >> > wake up the device to perform various tasks at necessary times. >> >> Sure, but this patch mentions timestamp synchronization with other sensors, >> and from that point of view, I'd like to know what is wrong with the monotonic >> clock if all devices use it. > > AFAIK the sensors mentioned there are not camera sensors, but rather > things we normally put under IIO, e.g. accelerometers, gyroscopes and > so on. I'm not sure how IIO deals with timestamps, but Android seems > to operate in the CLOCK_BOTTIME domain. Let me add some IIO folks. > > Gwendal, Alexandru, do you think you could shed some light on how we > handle IIO sensors timestamps across the kernel, Chrome OS and > Android? On our devices of interest have a specialized "sensor" that comes via IIO (from the EC, cros-ec-ring driver) that can be used to more accurately timestamp each frame (since it's recorded with very low jitter by a realtime-ish OS). In some high level userspace thing (specifically the Android Camera HAL) we try to pick the best timestamp from the IIO, whatever's closest to what the V4L stuff gives us. I guess the Android convention is for sensor timestamps to be in CLOCK_BOOTTIME (maybe because it likes sleeping so much). There's probably no advantage to using one over the other, but the important thing is that they have to be the same, otherwise the closest match logic would fail. Regards, Alexandru Stan