From patchwork Tue May 12 14:41:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien DESSENNE X-Patchwork-Id: 29627 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1YsBNU-0004RM-AD; Tue, 12 May 2015 16:41:48 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-5) with esmtp id 1YsBNR-0008QZ-8s; Tue, 12 May 2015 16:41:47 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932826AbbELOln (ORCPT + 1 other); Tue, 12 May 2015 10:41:43 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:36337 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932509AbbELOlm (ORCPT ); Tue, 12 May 2015 10:41:42 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id t4CEcIui014599; Tue, 12 May 2015 16:41:40 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 1ubfh99dj8-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 12 May 2015 16:41:40 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D056E42; Tue, 12 May 2015 14:41:37 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BB94D56C0; Tue, 12 May 2015 14:41:37 +0000 (GMT) Received: from localhost (10.201.23.25) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 12 May 2015 16:41:37 +0200 From: Fabien Dessenne To: CC: Benjamin Gaignard , Subject: [PATCH] v4l2-compliance: test SELECTION only for the supported buf_type Date: Tue, 12 May 2015 16:41:35 +0200 Message-ID: <1431441695-26404-1-git-send-email-fabien.dessenne@st.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.201.23.25] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151, 1.0.33, 0.0.0000 definitions=2015-05-12_05:2015-05-12, 2015-05-12, 1970-01-01 signatures=0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.5.12.143316 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, WEBMAIL_SOURCE 0, WEBMAIL_XOIP 0, WEBMAIL_X_IP_HDR 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_XOIP 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __STOCK_PHRASE_24 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' testBasicSelection defines which of capture and output supports crop (resp. compose). testBasicCrop (resp. testBasicCompose) shall be run only for the supported buf_type. Change-Id: I0a81e826eb7bc8a318a9d833426d802fedce46c9 Signed-off-by: Fabien Dessenne --- utils/v4l2-compliance/v4l2-test-formats.cpp | 40 +++++++++++++++++------------ 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp index 1cffd65..23107c3 100644 --- a/utils/v4l2-compliance/v4l2-test-formats.cpp +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp @@ -1251,13 +1251,16 @@ static int testLegacyCrop(struct node *node) int testCropping(struct node *node) { - int ret = ENOTTY; + int retCap, retOut; + + retCap = ENOTTY; + retOut = ENOTTY; fail_on_test(testLegacyCrop(node)); if (node->can_capture && node->is_video) - ret = testBasicSelection(node, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_SEL_TGT_CROP); + retCap = testBasicSelection(node, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_SEL_TGT_CROP); if (node->can_output && node->is_video) - ret = testBasicSelection(node, V4L2_BUF_TYPE_VIDEO_OUTPUT, V4L2_SEL_TGT_CROP); + retOut = testBasicSelection(node, V4L2_BUF_TYPE_VIDEO_OUTPUT, V4L2_SEL_TGT_CROP); if ((!node->can_capture && !node->can_output) || !node->is_video) { struct v4l2_selection sel = { V4L2_BUF_TYPE_VIDEO_CAPTURE, @@ -1269,14 +1272,15 @@ int testCropping(struct node *node) fail_on_test(doioctl(node, VIDIOC_G_SELECTION, &sel) != ENOTTY); fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel) != ENOTTY); } - if (ret) - return ret; + if (retCap && retOut) + return retCap; - if (node->can_capture) + if (!retCap) fail_on_test(testBasicCrop(node, V4L2_BUF_TYPE_VIDEO_CAPTURE)); - if (node->can_output) + if (!retOut) fail_on_test(testBasicCrop(node, V4L2_BUF_TYPE_VIDEO_OUTPUT)); - return ret; + + return 0; } static int testBasicCompose(struct node *node, unsigned type) @@ -1321,12 +1325,15 @@ static int testBasicCompose(struct node *node, unsigned type) int testComposing(struct node *node) { - int ret = ENOTTY; + int retCap, retOut; + + retCap = ENOTTY; + retOut = ENOTTY; if (node->can_capture && node->is_video) - ret = testBasicSelection(node, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_SEL_TGT_COMPOSE); + retCap = testBasicSelection(node, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_SEL_TGT_COMPOSE); if (node->can_output && node->is_video) - ret = testBasicSelection(node, V4L2_BUF_TYPE_VIDEO_OUTPUT, V4L2_SEL_TGT_COMPOSE); + retOut = testBasicSelection(node, V4L2_BUF_TYPE_VIDEO_OUTPUT, V4L2_SEL_TGT_COMPOSE); if ((!node->can_capture && !node->can_output) || !node->is_video) { struct v4l2_selection sel = { V4L2_BUF_TYPE_VIDEO_OUTPUT, @@ -1338,14 +1345,15 @@ int testComposing(struct node *node) fail_on_test(doioctl(node, VIDIOC_G_SELECTION, &sel) != ENOTTY); fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel) != ENOTTY); } - if (ret) - return ret; + if (retCap && retOut) + return retCap; - if (node->can_capture) + if (retCap) fail_on_test(testBasicCompose(node, V4L2_BUF_TYPE_VIDEO_CAPTURE)); - if (node->can_output) + if (retOut) fail_on_test(testBasicCompose(node, V4L2_BUF_TYPE_VIDEO_OUTPUT)); - return ret; + + return 0; } static int testBasicScaling(struct node *node, const struct v4l2_format &cur)