From patchwork Mon Jun 20 12:30:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 9187305 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 2E016607D1 for ; Mon, 20 Jun 2016 12:32:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 180FA27813 for ; Mon, 20 Jun 2016 12:32:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CDB92787D; Mon, 20 Jun 2016 12:32:53 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 B4E6727813 for ; Mon, 20 Jun 2016 12:32:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751687AbcFTMcu (ORCPT ); Mon, 20 Jun 2016 08:32:50 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:34218 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752326AbcFTMcr (ORCPT ); Mon, 20 Jun 2016 08:32:47 -0400 Received: by mail-lf0-f65.google.com with SMTP id l184so5312674lfl.1; Mon, 20 Jun 2016 05:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NQIS/r7MYxIEP+iRM+DJQQ1bgkcE0rHNsIyUZADmJkU=; b=uhIJJ8YHc+0aCP18GRspMxRmn52Fo8Uk8waq2FrATVhCucfgp4294TSmyaB2kfDxPv mDeCV2BY8GaHwsuwUoB+ClL2sk+YDK6Xc4oeIBIM26oxTDL49i07Gva7AaFX3KLLkeED yzrUb/oIHTqhwK2fCQvQmyuIRot9fzfk4BGFZcCVOlZlMkWddzgNi8T/kDIb9m7OPPic caVnV7hWmwrhaUXv8TEIyszFcpibKM1zW86pNdZbjmpM2+VApGIzxV4ZlAIoPuqnOnPO 2bpGgyVdbi1laUtHCj73Vu9xl3a1lz5u45hOmeDqJ3Odr928IgcYTONzYh2uPpDw3k6S /vzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NQIS/r7MYxIEP+iRM+DJQQ1bgkcE0rHNsIyUZADmJkU=; b=G9amEaL8yF8WgQfKIQPi0GPfc2Ikg2O4xxKeZaNwSp8pOVX8rni2v0OsFMDLT8Lqv0 xPQnkbI1er16Mbw703oRyh8KdKqymR6zd50PReT9MTQBiEJMKNn2C0yvmWKJCEt4GhQj 8pE3+m9fUYGjm7dCCehFdcyCL8id9hzojR2mae6fXKOWJl/ywVV5uPWyeTkCZwEyb4OV Dgw3OAAN2cFyxjJ5uSUQOpZ7byDo4GKiyMMSwZK2LP1WBDr61G+C1cdh5KODPno0QQUT ZP77uTYZsCyQvGraEGWwna/sApeAg9xBgxKfV4ViVWYlFp1nuyrHij4M41h8eW7bxDB6 hbGw== X-Gm-Message-State: ALyK8tJ5tLW7qvFdz/4tsh2EWJwB5LbOZWff8t5j1oe7wXU07fqMADpKEzHzAIihgMPYUQ== X-Received: by 10.46.1.163 with SMTP id f35mr3923730lji.21.1466425816867; Mon, 20 Jun 2016 05:30:16 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id u193sm4921183lfd.36.2016.06.20.05.30.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 05:30:15 -0700 (PDT) From: Ricardo Ribalda Delgado To: Pawel Osciak , Marek Szyprowski , Kyungmin Park , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hans.verkuil@cisco.com, hverkuil@xs4all.nl Cc: Ricardo Ribalda Delgado Subject: [PATCH v2 4/4] vb2: V4L2_BUF_FLAG_DONE is set after DQBUF Date: Mon, 20 Jun 2016 14:30:09 +0200 Message-Id: <1466425809-23469-4-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1466425809-23469-1-git-send-email-ricardo.ribalda@gmail.com> References: <1466425809-23469-1-git-send-email-ricardo.ribalda@gmail.com> 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 According to the doc, V4L2_BUF_FLAG_DONE is cleared after DQBUF: V4L2_BUF_FLAG_DONE 0x00000004 ... After calling the VIDIOC_QBUF or VIDIOC_DQBUF it is always cleared ... Unfortunately, it seems that videobuf2 keeps it set after DQBUF. This can be tested with vivid and dev_debug: [257604.338082] video1: VIDIOC_DQBUF: 71:33:25.00260479 index=3, type=vid-cap, flags=0x00002004, field=none, sequence=163, memory=userptr, bytesused=460800, offset/userptr=0x344b000, length=460800 This patch forces FLAG_DONE to 0 after calling DQBUF. Reported-by: Dimitrios Katsaros Signed-off-by: Ricardo Ribalda Delgado --- drivers/media/v4l2-core/videobuf2-v4l2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index ba3467468e55..9cfbb6e4bc28 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c @@ -654,6 +654,12 @@ int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking) ret = vb2_core_dqbuf(q, NULL, b, nonblocking); + /* + * After calling the VIDIOC_DQBUF V4L2_BUF_FLAG_DONE must be + * cleared. + */ + b->flags &= ~V4L2_BUF_FLAG_DONE; + return ret; } EXPORT_SYMBOL_GPL(vb2_dqbuf);