From patchwork Fri Dec 8 14:01:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 10102577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2B4BC60329 for ; Fri, 8 Dec 2017 14:01:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20FE028BF3 for ; Fri, 8 Dec 2017 14:01:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 144C028CCB; Fri, 8 Dec 2017 14:01:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 974F228BF3 for ; Fri, 8 Dec 2017 14:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753792AbdLHOBk (ORCPT ); Fri, 8 Dec 2017 09:01:40 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:57205 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753691AbdLHOBk (ORCPT ); Fri, 8 Dec 2017 09:01:40 -0500 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.84_2) (envelope-from ) id 1eNJDe-0001me-Or; Fri, 08 Dec 2017 15:01:38 +0100 From: Philipp Zabel To: linux-media@vger.kernel.org Cc: Pawel Osciak , Marek Szyprowski , Kyungmin Park , kernel@pengutronix.de, Philipp Zabel Subject: [PATCH] [media] vb2: clear V4L2_BUF_FLAG_LAST when filling vb2_buffer Date: Fri, 8 Dec 2017 15:01:28 +0100 Message-Id: <20171208140128.19740-1-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.11.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP V4L2_BUF_FLAG_LAST is a signal from the driver to userspace for buffers on the capture queue. When userspace queues back a capture buffer with the flag set, we should clear it. Otherwise, if userspace restarts streaming after EOS, without reallocating the buffers, mem2mem devices will erroneously signal EOS prematurely, as soon as the already flagged buffer is dequeued. Signed-off-by: Philipp Zabel --- drivers/media/v4l2-core/videobuf2-v4l2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index 4075314a69893..fac3cd6f901d5 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c @@ -434,6 +434,8 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb, } else { /* Zero any output buffer flags as this is a capture buffer */ vbuf->flags &= ~V4L2_BUFFER_OUT_FLAGS; + /* Zero last flag, this is a signal from driver to userspace */ + vbuf->flags &= ~V4L2_BUF_FLAG_LAST; } return 0;