From patchwork Fri Feb 18 08:09:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 12751056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B3D7C433EF for ; Fri, 18 Feb 2022 08:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232327AbiBRIJs (ORCPT ); Fri, 18 Feb 2022 03:09:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229938AbiBRIJr (ORCPT ); Fri, 18 Feb 2022 03:09:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E94534644 for ; Fri, 18 Feb 2022 00:09:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2292B820E8 for ; Fri, 18 Feb 2022 08:09:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EB76C340E9; Fri, 18 Feb 2022 08:09:27 +0000 (UTC) Message-ID: Date: Fri, 18 Feb 2022 09:09:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Content-Language: en-US To: Linux Media Mailing List Cc: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Stanimir Varbanov From: Hans Verkuil Subject: [PATCHv2] v4l2-compliance: only check function if an MC is present Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The codec tests checked if the function of the device as reported by the media controller is that of an de/encoder. But that test was also done for codecs without a MC, and then it fails. So only do this test if an MC was found. Also test that stateless codecs always have a MC since it is required for such codecs. Signed-off-by: Hans Verkuil Tested-by: NĂ­colas F. R. A. Prado Tested-by: Stanimir Varbanov --- Nicolas, Stanimir, can you test? This is an improved version of the patch fixing the function test for codecs. --- utils/v4l2-compliance/v4l2-compliance.cpp | 1 + utils/v4l2-compliance/v4l2-compliance.h | 1 + utils/v4l2-compliance/v4l2-test-codecs.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index c53a55ba..8d0e94e9 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -998,6 +998,7 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_ if (!node.is_v4l2()) driver = mdinfo.driver; node.media_bus_info = mdinfo.bus_info; + node.has_media = true; } } diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h index 7255161f..507187eb 100644 --- a/utils/v4l2-compliance/v4l2-compliance.h +++ b/utils/v4l2-compliance/v4l2-compliance.h @@ -120,6 +120,7 @@ struct base_node { struct node *node2; /* second open filehandle */ bool has_outputs; bool has_inputs; + bool has_media; unsigned tuners; unsigned modulators; unsigned inputs; diff --git a/utils/v4l2-compliance/v4l2-test-codecs.cpp b/utils/v4l2-compliance/v4l2-test-codecs.cpp index 22175eef..1d76a17c 100644 --- a/utils/v4l2-compliance/v4l2-test-codecs.cpp +++ b/utils/v4l2-compliance/v4l2-test-codecs.cpp @@ -31,7 +31,8 @@ int testEncoder(struct node *node) bool is_encoder = node->codec_mask & (STATEFUL_ENCODER | JPEG_ENCODER); int ret; - if (IS_ENCODER(node)) + fail_on_test((node->codec_mask & STATELESS_ENCODER) && !node->has_media); + if (IS_ENCODER(node) && node->has_media) fail_on_test(node->function != MEDIA_ENT_F_PROC_VIDEO_ENCODER); memset(&cmd, 0xff, sizeof(cmd)); memset(&cmd.raw, 0, sizeof(cmd.raw)); @@ -100,7 +101,8 @@ int testDecoder(struct node *node) bool is_decoder = node->codec_mask & (STATEFUL_DECODER | JPEG_DECODER); int ret; - if (IS_DECODER(node)) + fail_on_test((node->codec_mask & STATELESS_DECODER) && !node->has_media); + if (IS_DECODER(node) && node->has_media) fail_on_test(node->function != MEDIA_ENT_F_PROC_VIDEO_DECODER); memset(&cmd, 0xff, sizeof(cmd)); memset(&cmd.raw, 0, sizeof(cmd.raw));