From patchwork Tue Nov 3 10:16:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junghak Sung X-Patchwork-Id: 7541341 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 424BD9F399 for ; Tue, 3 Nov 2015 10:16:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43EC520527 for ; Tue, 3 Nov 2015 10:16:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2EE2320522 for ; Tue, 3 Nov 2015 10:16:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751851AbbKCKQs (ORCPT ); Tue, 3 Nov 2015 05:16:48 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:53311 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751016AbbKCKQq (ORCPT ); Tue, 3 Nov 2015 05:16:46 -0500 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NX8030Y7HVWSL10@mailout2.samsung.com> for linux-media@vger.kernel.org; Tue, 03 Nov 2015 19:16:44 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.115]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 97.03.05284.C8988365; Tue, 3 Nov 2015 19:16:44 +0900 (KST) X-AuditID: cbfee68f-f796f6d0000014a4-e8-5638898c752b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 5B.D3.18629.C8988365; Tue, 3 Nov 2015 19:16:44 +0900 (KST) Received: from localhost.localdomain ([10.252.83.96]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NX8008Z8HVVS340@mmp2.samsung.com>; Tue, 03 Nov 2015 19:16:43 +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 v9 2/6] media: videobuf2: Add set_timestamp to struct vb2_queue Date: Tue, 03 Nov 2015 19:16:38 +0900 Message-id: <1446545802-28496-3-git-send-email-jh1009.sung@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1446545802-28496-1-git-send-email-jh1009.sung@samsung.com> References: <1446545802-28496-1-git-send-email-jh1009.sung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRmVeSWpSXmKPExsWyRsSkWLen0yLM4NAhEYtTk58xWUy6P4HF YvvxV+wWnROXsFv0bNjKarH6WYXFgb5dTBZT3v5kt/g37SmzxZn9K9ksjn86yGIxY/JLNgce j9kdM1k9Dn9dyOLx+NdLNo8t/XfZPfq2rGL0+LxJzuPU18/sAexRXDYpqTmZZalF+nYJXBln 1pxmLbisWHH66ynWBsYn0l2MnBwSAiYSG7duYYWwxSQu3FvP1sXIxSEksIJRYtXWGSwwRRs2 7mAGsYUEZjFKHPoUD1H0nVGif+1y9i5GDg42AR2JyZsNQeIiAjMYJXqPr2ICcZgFljNKnH59 ih2kW1ggVGLniTlgk1gEVCU+fe4Ci/MKuEvcf/EcbJCEgILEnEk2ICangIdE/99SiL3uEi+m HwE7TkLgGrvEkks9rBBjBCS+TT7EAtEqK7HpADPEzZISB1fcYJnAKLyAkWEVo2hqQXJB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WgTTx8TBKdXAWJp+d7Xm hW2TFQpO37Cdve3ujk1lzxLPGl5pXrvfQf1Rj3Pyix+u5Xdnv5u713aOgdPrmjuzyzefPXlE QHf/nRWfi8vbf/OymW+9Uav9eE1cZbfGlnPNDleZhaYs4bm19++0hwfari2/Zvn9/XkJxV6j B7PsWPfuzGibtl2p4PDtvVW8nxeyvudRYinOSDTUYi4qTgQAqERADNwCAAA= 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 | 20 +++++++------------- include/media/videobuf2-core.h | 2 ++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index 93e16375..d254452 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c @@ -118,10 +118,8 @@ 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 = timeval_to_ns(&b->timestamp); - } vbuf->flags |= b->flags & V4L2_BUF_FLAG_TIMECODE; if (b->flags & V4L2_BUF_FLAG_TIMECODE) vbuf->timecode = b->timecode; @@ -239,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 +401,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 +719,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 +1078,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 +1267,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 6404f81..b73a28a 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;