From patchwork Mon Jun 20 12:23:56 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: 9187301 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 2196E6075F for ; Mon, 20 Jun 2016 12:26:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B5572766D for ; Mon, 20 Jun 2016 12:26:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F23E02774A; Mon, 20 Jun 2016 12:26:02 +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 B26B22766D for ; Mon, 20 Jun 2016 12:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753576AbcFTMZM (ORCPT ); Mon, 20 Jun 2016 08:25:12 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35827 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbcFTMZJ (ORCPT ); Mon, 20 Jun 2016 08:25:09 -0400 Received: by mail-lf0-f66.google.com with SMTP id w130so5295749lfd.2 for ; Mon, 20 Jun 2016 05:24:00 -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=LuDFO78MHaGPcJ8wkX/gGfGn5wD+FAnX6dgDBGMPWJg=; b=t73W+V7ueT6ZtzmSvgvLb7qzTaVHf+gkt4WFefLonAmPglENHd1OooTCOPh5j6BFoB GFOBou4JI2sRNFzWgqaDcd7q5Sitm3xaGIbzNPSG8SpATL24TYuQV6GCsQmYobIFm01w eIx7tDcma3mPUz3wzgUB4tp020E68fcOKuLdndPIp1dQT+pehp13J8fdajMfMBWXpxE8 1lESRHUc+WJS+gtayY7cDIkhXYCB9ZM9JEkxZs8472ZL9kJ1xVW9lKEs4jKEiBuJtXcf 49ym0r+Ljt3Xtp5LKrAhzm8ffRuvLS4JVxa2tpXnri+G1K/iaDrTpRfZF8X0L0dZIMqI YFdQ== 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=LuDFO78MHaGPcJ8wkX/gGfGn5wD+FAnX6dgDBGMPWJg=; b=egHkmj3rj8ICSteiiu3hABP/U7NScrnFbU9gLpgl252RuyjFLcOn6C5s4FfiJP+7TC nP9z9PDNxQGOXcQ4C2RNFqkvPE/u3crGuuwq+ZdzOtLzlogT50N6Uc+5d0+3R0+e3cLr TmeB2k4YkZx+/w7Gz86ZrRufVIcgXWvNGMJLLo2AMPAs6hVenoN2TpGisDMmM5lbjlmH UoQTy9DklI1cJjsBKU70OX3i5UavRKz4yYxuG2EdTi1WRAtTxqk/rP56bCCtQ+sg8xaR Qo6UhiLLXqfb8FLKmxr5+BX/8Xk1IqtaKtoCDEgJLO6ZdQokKYdzDnWZ7KKt/Ja7Y5KJ 0gqw== X-Gm-Message-State: ALyK8tLw7z8h+RP6367TUBD//lowH2t1cjyC9xanikKXZANB8qBIhL1fB2PtXiJsbHy/Ew== X-Received: by 10.25.19.74 with SMTP id j71mr3162749lfi.44.1466425439665; Mon, 20 Jun 2016 05:23:59 -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 t10sm6022803lfd.18.2016.06.20.05.23.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 05:23:58 -0700 (PDT) From: Ricardo Ribalda Delgado To: linux-media@vger.kernel.org, Hans Verkuil , hans.verkuil@cisco.com Cc: Ricardo Ribalda Delgado Subject: [PATCH] v4l2-compliance: Check V4L2_BUF_FLAG_DONE Date: Mon, 20 Jun 2016 14:23:56 +0200 Message-Id: <1466425436-18705-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 and QBUF: V4L2_BUF_FLAG_DONE 0x00000004 ... After calling the VIDIOC_QBUF or VIDIOC_DQBUF it is always cleared .. This patch implements this check. Signed-off-by: Ricardo Ribalda Delgado --- Hello Hans! Maybe you do not want to add this check to every dqbuf/qbuf in the code. Please let me know to make a v2 of this patch. Thanks! utils/v4l2-compliance/v4l2-test-buffers.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index 6c5ed5579f12..4d25870942bd 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -719,7 +719,9 @@ static int captureBufs(struct node *node, const cv4l_queue &q, fail_on_test(memcmp(&buf.g_timecode(), &orig_buf.timecode, sizeof(orig_buf.timecode))); } + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); fail_on_test(buf.qbuf(node)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); if (--count == 0) break; } @@ -746,7 +748,9 @@ static int captureBufs(struct node *node, const cv4l_queue &q, fail_on_test(memcmp(&buf.g_timecode(), &orig_buf.timecode, sizeof(orig_buf.timecode))); } + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); fail_on_test(buf.qbuf(node)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); } if (use_poll) fcntl(node->g_fd(), F_SETFL, fd_flags); @@ -778,6 +782,7 @@ static int setupM2M(struct node *node, cv4l_queue &q) fail_on_test(buf.querybuf(node, i)); fail_on_test(buf.qbuf(node)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); } if (v4l_type_is_video(q.g_type())) { cv4l_fmt fmt(q.g_type()); @@ -828,6 +833,7 @@ static int bufferOutputErrorTest(struct node *node, const buffer &orig_buf) } } fail_on_test(buf.qbuf(node, false)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); for (unsigned p = 0; p < buf.g_num_planes(); p++) { fail_on_test(buf.g_bytesused(p) != buf.g_length(p)); fail_on_test(buf.g_data_offset(p)); @@ -864,6 +870,7 @@ static int setupMmap(struct node *node, cv4l_queue &q) } fail_on_test(buf.qbuf(node)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); fail_on_test(!buf.qbuf(node)); fail_on_test(!buf.prepare_buf(node)); // Test with invalid buffer index @@ -926,6 +933,7 @@ int testMmap(struct node *node, unsigned frame_count) fail_on_test(buf.querybuf(node, i)); fail_on_test(buf.qbuf(node)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); } // calling STREAMOFF... fail_on_test(node->streamoff(q.g_type())); @@ -936,6 +944,7 @@ int testMmap(struct node *node, unsigned frame_count) fail_on_test(buf.querybuf(node, i)); fail_on_test(buf.qbuf(node)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); } // Now request buffers again, freeing the old buffers. // Good check for whether all the internal vb2 calls are in @@ -1041,6 +1050,7 @@ static int setupUserPtr(struct node *node, cv4l_queue &q) } fail_on_test(buf.qbuf(node)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); fail_on_test(buf.querybuf(node, i)); fail_on_test(buf.check(q, Queued, i)); } @@ -1142,6 +1152,7 @@ static int setupDmaBuf(struct node *expbuf_node, struct node *node, } fail_on_test(buf.qbuf(node)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); fail_on_test(buf.querybuf(node, i)); fail_on_test(buf.check(q, Queued, i)); } @@ -1319,6 +1330,7 @@ static int testStreaming(struct node *node, unsigned frame_count) if (alternate) field ^= 1; fail_on_test(node->qbuf(buf)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); } fail_on_test(node->streamon()); @@ -1327,10 +1339,12 @@ static int testStreaming(struct node *node, unsigned frame_count) buftype2s(q.g_type()).c_str(), buf.g_sequence(), field2s(buf.g_field()).c_str()); fflush(stdout); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); buf.s_field(field); if (alternate) field ^= 1; fail_on_test(node->qbuf(buf)); + fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE); if (frame_count-- == 0) break; }