From patchwork Fri Jul 3 10:20:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 6713891 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 55A15C05AC for ; Fri, 3 Jul 2015 10:21:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81E0A207E7 for ; Fri, 3 Jul 2015 10:21:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93850207E4 for ; Fri, 3 Jul 2015 10:21:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754407AbbGCKV0 (ORCPT ); Fri, 3 Jul 2015 06:21:26 -0400 Received: from mga03.intel.com ([134.134.136.65]:49947 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754330AbbGCKVY (ORCPT ); Fri, 3 Jul 2015 06:21:24 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 03 Jul 2015 03:21:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,399,1432623600"; d="scan'208";a="739956481" Received: from kekkonen.tm.intel.com (HELO kekkonen.fi.intel.com) ([10.237.55.5]) by fmsmga001.fm.intel.com with ESMTP; 03 Jul 2015 03:21:22 -0700 Received: by kekkonen.fi.intel.com (Postfix, from userid 1002) id 8352A21E04; Fri, 3 Jul 2015 13:20:10 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, mchehab@osg.samsung.com Subject: [PATCH 1/1] vb2: Only requeue buffers immediately once streaming is started Date: Fri, 3 Jul 2015 13:20:10 +0300 Message-Id: <1435918810-21180-1-git-send-email-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.1.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Buffers can be returned back to videobuf2 in driver's streamon handler. In this case vb2_buffer_done() with buffer state VB2_BUF_STATE_QUEUED will cause the driver's buf_queue vb2 operation to be called, queueing the same buffer again only to be returned to videobuf2 using vb2_buffer_done() and so on. Instead of using q->start_streamin_called to judge whether to return the buffer to the driver immediately, use q->streaming which is set only after the driver's start_streaming() vb2 operation is called. Fixes: ce0eff016f72 ("[media] vb2: allow requeuing buffers while streaming") Signed-off-by: Sakari Ailus Cc: stable@vger.kernel.org # for v4.1 --- drivers/media/v4l2-core/videobuf2-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 1a096a6..6957078 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1208,7 +1208,7 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) spin_unlock_irqrestore(&q->done_lock, flags); if (state == VB2_BUF_STATE_QUEUED) { - if (q->start_streaming_called) + if (q->streaming) __enqueue_in_driver(vb); return; }