From patchwork Fri Sep 7 13:29:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 1422211 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 13C2F3FC33 for ; Fri, 7 Sep 2012 13:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758149Ab2IGNaJ (ORCPT ); Fri, 7 Sep 2012 09:30:09 -0400 Received: from smtp-vbr2.xs4all.nl ([194.109.24.22]:4979 "EHLO smtp-vbr2.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756961Ab2IGN3m (ORCPT ); Fri, 7 Sep 2012 09:29:42 -0400 Received: from alastor.dyndns.org (166.80-203-20.nextgentel.com [80.203.20.166] (may be forged)) (authenticated bits=0) by smtp-vbr2.xs4all.nl (8.13.8/8.13.8) with ESMTP id q87DTcAq038884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 7 Sep 2012 15:29:39 +0200 (CEST) (envelope-from hverkuil@xs4all.nl) Received: from tschai.lan (tschai.lan [192.168.1.10]) (Authenticated sender: hans) by alastor.dyndns.org (Postfix) with ESMTPSA id 5902E35C000D; Fri, 7 Sep 2012 15:29:30 +0200 (CEST) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Hans Verkuil Subject: [RFCv2 API PATCH 12/28] v4l2-core: Add new V4L2_CAP_MONOTONIC_TS capability. Date: Fri, 7 Sep 2012 15:29:12 +0200 Message-Id: <86a39343d33f0f75079407d8b36202a1de4c58de.1347023744.git.hans.verkuil@cisco.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1347024568-32602-1-git-send-email-hverkuil@xs4all.nl> References: <1347024568-32602-1-git-send-email-hverkuil@xs4all.nl> In-Reply-To: References: X-Virus-Scanned: by XS4ALL Virus Scanner Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Hans Verkuil Add a new flag that tells userspace that the monotonic clock is used for timestamps and update the documentation accordingly. We decided on this new flag during the 2012 Media Workshop. Signed-off-by: Hans Verkuil Reviewed-by: Sylwester Nawrocki Acked-by: Laurent Pinchart --- Documentation/DocBook/media/v4l/io.xml | 10 +++++++--- Documentation/DocBook/media/v4l/vidioc-dqevent.xml | 3 ++- Documentation/DocBook/media/v4l/vidioc-querycap.xml | 7 +++++++ include/linux/videodev2.h | 1 + 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml index 2dc39d8..b680d66 100644 --- a/Documentation/DocBook/media/v4l/io.xml +++ b/Documentation/DocBook/media/v4l/io.xml @@ -582,10 +582,14 @@ applications when an output stream. struct timeval timestamp - For input streams this is the + This is either the system time (as returned by the gettimeofday() -function) when the first data byte was captured. For output streams -the data will not be displayed before this time, secondary to the +function) or a monotonic timestamp (as returned by the +clock_gettime(CLOCK_MONOTONIC, &ts) function). +A monotonic timestamp is used if the V4L2_CAP_MONOTONIC_TS +capability is set, otherwise the system time is used. +For input streams this is the timestamp when the first data byte was captured. +For output streams the data will not be displayed before this time, secondary to the nominal frame rate determined by the current video standard in enqueued order. Applications can for example zero this field to display frames as soon as possible. The driver stores the time at diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml index 98a856f..00757d4 100644 --- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml +++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml @@ -120,7 +120,8 @@ struct timespec timestamp - Event timestamp. + Event timestamp using the monotonic clock as returned by the + clock_gettime(CLOCK_MONOTONIC, &ts) function. u32 diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml index d5b1248..48aa7ac 100644 --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml @@ -319,6 +319,13 @@ linkend="async">asynchronous I/O methods. linkend="mmap">streaming I/O method. + V4L2_CAP_MONOTONIC_TS + 0x40000000 + The driver uses a monotonic timestamp instead of wallclock time for the + &v4l2-buffer; timestamp field. + + + V4L2_CAP_DEVICE_CAPS 0x80000000 The driver fills the device_caps diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 47d58ed..00f464d 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -290,6 +290,7 @@ struct v4l2_capability { #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ +#define V4L2_CAP_MONOTONIC_TS 0x40000000 /* uses monotonic timestamps */ #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ /*