From patchwork Fri Sep 14 10:57:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 1457021 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 6C7B640AB5 for ; Fri, 14 Sep 2012 10:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756175Ab2INK6s (ORCPT ); Fri, 14 Sep 2012 06:58:48 -0400 Received: from ams-iport-1.cisco.com ([144.254.224.140]:57798 "EHLO ams-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757490Ab2INK6J (ORCPT ); Fri, 14 Sep 2012 06:58:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=4144; q=dns/txt; s=iport; t=1347620289; x=1348829889; h=from:to:subject:date:message-id; bh=Y/XNdLqVWpL7r+dfTI0gquTtNhV5BMGPRGkXdXbC5oU=; b=XVrH1nBRWqqVZRBnLvMoFzToJah5W1IoxIL6BIJhkh9lh+/8/1Uqp2dl uQRA58/l1UK/mzJOZkigMwOQdkpKgXntY5TzTIP+G2onHDS98Wfupm2EP B5dSACwTMxUABiF1D2mqNIAFkoT8ncohhAIr76IVKHFg8Y71oBaEO6BNk I=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EANgMU1CQ/khM/2dsb2JhbABFu3qBB4IhAQEEEgF2UVcZIodrmw+gEosVhmgDlWGJNYUDgWmCaA X-IronPort-AV: E=Sophos;i="4.80,422,1344211200"; d="scan'208";a="143813594" Received: from ams-core-3.cisco.com ([144.254.72.76]) by ams-iport-1.cisco.com with ESMTP; 14 Sep 2012 10:57:56 +0000 Received: from cobaltpc1.cisco.com (dhcp-10-54-92-107.cisco.com [10.54.92.107]) by ams-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id q8EAvqBk013688 for ; Fri, 14 Sep 2012 10:57:56 GMT From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [RFCv3 API PATCH 15/31] v4l2-core: Add new V4L2_CAP_MONOTONIC_TS capability. Date: Fri, 14 Sep 2012 12:57:30 +0200 Message-Id: <573d42b4b775afd8beeadc7a903cc2190a6f430a.1347619766.git.hans.verkuil@cisco.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1347620266-13767-1-git-send-email-hans.verkuil@cisco.com> References: <1347620266-13767-1-git-send-email-hans.verkuil@cisco.com> In-Reply-To: <7447a305817a5e6c63f089c2e1e948533f1d57ea.1347619765.git.hans.verkuil@cisco.com> References: <7447a305817a5e6c63f089c2e1e948533f1d57ea.1347619765.git.hans.verkuil@cisco.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 4c70215..fae2036 100644 --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml @@ -315,6 +315,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 292a2ef..3aad418 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 */ /*