From patchwork Fri Oct 16 06:27:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junghak Sung X-Patchwork-Id: 7411041 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F2E1BEEA4 for ; Fri, 16 Oct 2015 06:27:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5EF2620A66 for ; Fri, 16 Oct 2015 06:27:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F3C020A5E for ; Fri, 16 Oct 2015 06:27:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752958AbbJPG1s (ORCPT ); Fri, 16 Oct 2015 02:27:48 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:37279 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752378AbbJPG1r (ORCPT ); Fri, 16 Oct 2015 02:27:47 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NWA00VC3VA9C370@mailout1.samsung.com> for linux-media@vger.kernel.org; Fri, 16 Oct 2015 15:27:45 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.112]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id A6.18.05272.1E890265; Fri, 16 Oct 2015 15:27:45 +0900 (KST) X-AuditID: cbfee68e-f791c6d000001498-46-562098e16f41 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 1C.26.18629.1E890265; Fri, 16 Oct 2015 15:27:45 +0900 (KST) Received: from localhost.localdomain ([10.252.83.96]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NWA001RRVA8KE70@mmp1.samsung.com>; Fri, 16 Oct 2015 15:27:45 +0900 (KST) From: Junghak Sung To: linux-media@vger.kernel.org, mchehab@osg.samsung.com, hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@iki.fi, pawel@osciak.com Cc: inki.dae@samsung.com, sw0312.kim@samsung.com, nenggun.kim@samsung.com, sangbae90.lee@samsung.com, rany.kwon@samsung.com, Junghak Sung Subject: [RFC PATCH v7 3/7] media: videobuf2: Add set_timestamp to struct vb2_queue Date: Fri, 16 Oct 2015 15:27:39 +0900 Message-id: <1444976863-3657-4-git-send-email-jh1009.sung@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1444976863-3657-1-git-send-email-jh1009.sung@samsung.com> References: <1444976863-3657-1-git-send-email-jh1009.sung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRmVeSWpSXmKPExsWyRsSkQPfhDIUwg2c/NSxOTX7GZDHp/gQW i+3HX7FbdE5cwm7Rs2Erq8XqZxUWB/p2MVlMefuT3eLftKfMFmf2r2SzOP7pIIvFjMkv2Rx4 PGZ3zGT1OPx1IYvH418v2Ty29N9l9+jbsorR4/MmOY9TXz+zB7BHcdmkpOZklqUW6dslcGWc uKpSMFWxonfhW8YGxs3SXYycHBICJhKrV29jhrDFJC7cW88GYgsJrGCUOLdcH6Zm3eQu1i5G LqD4UkaJo5eOMEE43xklfn2fCtTBwcEmoCMxebMhSFxEYAajRO/xVWBFzALLGSVOvz7FDjJK WCBU4vn+DiYQm0VAVeLEhCVgNq+Am8S/27fBBkkIKEjMmWQDEuYUcJdYfXIrM0hYCKjk6Kla iIMusUts7QuGmCIg8W3yIRaITlmJTQegfpGUOLjiBssERuEFjAyrGEVTC5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YrHtdzR 3+derXpWZ7XyLlfLrg3HsvUem6i9u1LTcEuTbRb33HtqYbr7576OKLkcrvb5plr8cq1/opLG wge+PTx8as+21bECixSyk6yfafVdPxjULvc50mTLFM4J83NfftvabGnR5PDuxbdDPHP/5SwN OnWsd+HNPZ0h6Vs03h8IsC7YtSFZiaU4I9FQi7moOBEASllsDNwCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add set_timestamp to struct vb2_queue as a flag set if vb2-core should set timestamps. Signed-off-by: Junghak Sung Signed-off-by: Geunyoung Kim Acked-by: Seung-Woo Kim Acked-by: Inki Dae --- drivers/media/v4l2-core/videobuf2-v4l2.c | 19 +++++++------------ include/media/videobuf2-core.h | 2 ++ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index b1334d6..525f4c7 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c @@ -118,8 +118,7 @@ static int __set_timestamp(struct vb2_buffer *vb, const void *pb) * For output buffers copy the timestamp if needed, * and the timecode field and flag if needed. */ - if ((q->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) == - V4L2_BUF_FLAG_TIMESTAMP_COPY) + if (q->set_timestamp) vb->timestamp = b->timestamp; vbuf->flags |= b->flags & V4L2_BUF_FLAG_TIMECODE; if (b->flags & V4L2_BUF_FLAG_TIMECODE) @@ -238,8 +237,7 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb) */ b->flags &= ~V4L2_BUFFER_MASK_FLAGS; b->flags |= q->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK; - if ((q->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) != - V4L2_BUF_FLAG_TIMESTAMP_COPY) { + if (!q->set_timestamp) { /* * For non-COPY timestamps, drop timestamp source bits * and obtain the timestamp source from the queue. @@ -404,8 +402,7 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb, /* Zero flags that the vb2 core handles */ vbuf->flags = b->flags & ~V4L2_BUFFER_MASK_FLAGS; - if ((vb->vb2_queue->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) != - V4L2_BUF_FLAG_TIMESTAMP_COPY || !V4L2_TYPE_IS_OUTPUT(b->type)) { + if (!vb->vb2_queue->set_timestamp || !V4L2_TYPE_IS_OUTPUT(b->type)) { /* * Non-COPY timestamps and non-OUTPUT queues will get * their timestamp and timestamp source flags from the @@ -723,6 +720,8 @@ int vb2_queue_init(struct vb2_queue *q) q->buf_ops = &v4l2_buf_ops; q->is_multiplanar = V4L2_TYPE_IS_MULTIPLANAR(q->type); q->is_output = V4L2_TYPE_IS_OUTPUT(q->type); + q->set_timestamp = (q->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) + == V4L2_BUF_FLAG_TIMESTAMP_COPY; return vb2_core_queue_init(q); } @@ -1080,9 +1079,7 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_ * should set timestamps if V4L2_BUF_FLAG_TIMESTAMP_COPY is set. Nobody * else is able to provide this information with the write() operation. */ - bool set_timestamp = !read && - (q->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) == - V4L2_BUF_FLAG_TIMESTAMP_COPY; + bool set_timestamp = !read && q->set_timestamp; int ret, index; dprintk(3, "mode %s, offset %ld, count %zd, %sblocking\n", @@ -1271,9 +1268,7 @@ static int vb2_thread(void *data) if (q->is_output) { prequeue = q->num_buffers; - set_timestamp = - (q->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK) == - V4L2_BUF_FLAG_TIMESTAMP_COPY; + set_timestamp = q->set_timestamp; } set_freezable(); diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index f1e7169..6ef7da7 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -431,6 +431,7 @@ struct vb2_buf_ops { * called since poll() needs to return POLLERR in that situation. * @is_multiplanar: set if buffer type is multiplanar * @is_output: set if buffer type is output + * @copy_timestamp: set if vb2-core should set timestamps * @last_buffer_dequeued: used in poll() and DQBUF to immediately return if the * last decoded buffer was already dequeued. Set for capture queues * when a buffer with the V4L2_BUF_FLAG_LAST is dequeued. @@ -480,6 +481,7 @@ struct vb2_queue { unsigned int waiting_for_buffers:1; unsigned int is_multiplanar:1; unsigned int is_output:1; + unsigned int set_timestamp:1; unsigned int last_buffer_dequeued:1; struct vb2_fileio_data *fileio;