From patchwork Wed Apr 16 19:34:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 4003921 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 674D4BFF02 for ; Wed, 16 Apr 2014 19:34:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A76D520142 for ; Wed, 16 Apr 2014 19:34:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D08B20127 for ; Wed, 16 Apr 2014 19:34:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751659AbaDPTeP (ORCPT ); Wed, 16 Apr 2014 15:34:15 -0400 Received: from bhuna.collabora.co.uk ([93.93.135.160]:46148 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751305AbaDPTeN (ORCPT ); Wed, 16 Apr 2014 15:34:13 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: nicolas) with ESMTPSA id 859ED600725 Message-ID: <1397676846.10347.11.camel@nicolas-tpx230> Subject: [PATCH] vb2: Update buffer state flags after __vb2_dqbuf From: Nicolas Dufresne Reply-To: Nicolas Dufresne To: LMML Cc: Hans Verkuil Date: Wed, 16 Apr 2014 15:34:06 -0400 Organization: Collabora Ltd. X-Mailer: Evolution 3.10.4 (3.10.4-2.fc20) Mime-Version: 1.0 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, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham 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 Previously we where updating the buffer state using __fill_v4l2_buffer before the state transition was completed through __vb2_dqbuf. This would cause the V4L2_BUF_FLAG_DONE to be set, which would mean it still queued. The spec says the dqbuf should clean the DONE flag, right not it alway set it. Signed-off-by: Nicolas Dufresne Acked-by: Laurent Pinchart --- drivers/media/v4l2-core/videobuf2-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index f9059bb..ac5026a 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1943,14 +1943,15 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool n call_vb_qop(vb, buf_finish, vb); - /* Fill buffer information for the userspace */ - __fill_v4l2_buffer(vb, b); /* Remove from videobuf queue */ list_del(&vb->queued_entry); q->queued_count--; /* go back to dequeued state */ __vb2_dqbuf(vb); + /* Fill buffer information for the userspace */ + __fill_v4l2_buffer(vb, b); + dprintk(1, "dqbuf of buffer %d, with state %d\n", vb->v4l2_buf.index, vb->state);