From patchwork Thu Nov 15 22:06:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 1752041 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 AE3BC3FC8A for ; Thu, 15 Nov 2012 22:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751565Ab2KOWGy (ORCPT ); Thu, 15 Nov 2012 17:06:54 -0500 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:38737 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750939Ab2KOWGv (ORCPT ); Thu, 15 Nov 2012 17:06:51 -0500 Received: from salottisipuli.retiisi.org.uk (salottisipuli.retiisi.org.uk [IPv6:2001:1bc8:102:6d9a::83:2]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id 8BA726009F; Fri, 16 Nov 2012 00:06:49 +0200 (EET) Received: by salottisipuli.retiisi.org.uk (Postfix, from userid 1000) id AFCAF22B05; Fri, 16 Nov 2012 00:06:48 +0200 (EET) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com Subject: [PATCH 1/4] v4l: Define video buffer flags for timestamp types Date: Fri, 16 Nov 2012 00:06:44 +0200 Message-Id: <1353017207-370-1-git-send-email-sakari.ailus@iki.fi> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <20121115220627.GB29863@valkosipuli.retiisi.org.uk> References: <20121115220627.GB29863@valkosipuli.retiisi.org.uk> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Define video buffer flags for different timestamp types. Everything up to now have used either realtime clock or monotonic clock, without a way to tell which clock the timestamp was taken from. Signed-off-by: Sakari Ailus Acked-by: Laurent Pinchart --- Documentation/DocBook/media/v4l/io.xml | 25 +++++++++++++++++++++++++ include/uapi/linux/videodev2.h | 4 ++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml index 7e2f3d7..d598f2c 100644 --- a/Documentation/DocBook/media/v4l/io.xml +++ b/Documentation/DocBook/media/v4l/io.xml @@ -938,6 +938,31 @@ Typically applications shall use this flag for output buffers if the data in this buffer has not been created by the CPU but by some DMA-capable unit, in which case caches have not been used. + + V4L2_BUF_FLAG_TIMESTAMP_MASK + 0xe000 + Mask for timestamp types below. To test the + timestamp type, mask out bits not belonging to timestamp + type by performing a logical and operation with buffer + flags and timestamp mask. + + + V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN + 0x0000 + Unknown timestamp type. This type is used by + drivers before Linux 3.8 and may be either monotonic (see + below) or realtime. Monotonic clock has been favoured in + embedded systems whereas most of the drivers use the + realtime clock. + + + V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC + 0x2000 + The buffer timestamp has been taken from the + CLOCK_MONOTONIC clock. To access the + same clock outside V4L2, use clock_gettime(2) + . + diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2fff7ff..410ea9f 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -686,6 +686,10 @@ struct v4l2_buffer { /* Cache handling flags */ #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 #define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000 +/* Timestamp type */ +#define V4L2_BUF_FLAG_TIMESTAMP_MASK 0xe000 +#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x0000 +#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x2000 /* * O V E R L A Y P R E V I E W