From patchwork Mon Jun 20 12:47:22 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: 9187375 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 1D6126075F for ; Mon, 20 Jun 2016 13:06:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 092E12780C for ; Mon, 20 Jun 2016 13:06:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F17C32793B; Mon, 20 Jun 2016 13:06:52 +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 A84082780C for ; Mon, 20 Jun 2016 13:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752192AbcFTNFm (ORCPT ); Mon, 20 Jun 2016 09:05:42 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33813 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751927AbcFTNFW (ORCPT ); Mon, 20 Jun 2016 09:05:22 -0400 Received: by mail-lf0-f66.google.com with SMTP id l184so5404817lfl.1; Mon, 20 Jun 2016 06:03:05 -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; bh=qQkUNH9tiuiX4GjFf8Z6GCrOP2TPw1cvdZgdi7OKBDY=; b=DVIHwOVkKTFfM3bFF9RCdGSe109wVHJmq3ZHjFygkkpgTfwgqoIPHL5u6SbdzKk8D+ uEa1mNDNWukXB5exF8fYUpkscVUn9WNtWyFTQzPCjqdcTydX9B+wzZIDnr4nvllXPic1 L8LdKgXx0ajmkO+0uwXMBUjOQhD23uNCJDrnvyEz5o2n4YvcivpmMf3ipCOr1bYZmtdU O2BJ4kEnfYRBvXn+slWyL9B7SfSdlZhd5/KAyEyrwecNlA65KSYgBhbavJq6YUfEQcwJ zPaLNF+36NgHhHe2cI5o8o5oc5Xk/5YLCYgsPil9a5bOjKNMmGQKiOBf8yU+KZBIhAth Jt1Q== 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; bh=qQkUNH9tiuiX4GjFf8Z6GCrOP2TPw1cvdZgdi7OKBDY=; b=hUvCu8lM/pRAe7BnzBpEEBp1Orw3UwQHoWHlo51Kww/T1xexmNKHFYLCOLa/omiU/8 dlbDwjReyyJyETNU5+n8owEnFZz+azehWx97RLJqKhpZolDMqYpCsX+Dif0FJBztbn57 QjtEBzFuOz2V7wEocMAP0oHvep/45qcBVuipGqUjR3uoFwJBUQsncgElYsjty2i0t2Cl cbUNincjx6Snl5wMApgVM/v8WXC5F5cqDzvCX8EVtQ9OgUw8yjg13JRhRam9hwzF8X6+ s/F17DPfg/fWFTTRXH4abQomlcu4Wt/1ddbbxzgOn3rMMxDTHu5zWVw1oG3L+F6SX4pq ecow== X-Gm-Message-State: ALyK8tJ/CS0++Bky4+KISXlAlZh0Pittdyel0sUNEpBrtYO2t64R6qoFdD/9aJP+tamIBg== X-Received: by 10.46.71.208 with SMTP id u199mr4031276lja.17.1466426851144; Mon, 20 Jun 2016 05:47:31 -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 o7sm3661031lfg.45.2016.06.20.05.47.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 05:47:27 -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 v3 1/4] vb2: V4L2_BUF_FLAG_DONE is set after DQBUF Date: Mon, 20 Jun 2016 14:47:22 +0200 Message-Id: <1466426845-25673-1-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.8.1 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 7f366f1b0377..6d14df3d615d 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c @@ -633,6 +633,12 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, 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; }