From patchwork Fri Jul 3 18:02:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11642605 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7244B6C1 for ; Fri, 3 Jul 2020 18:03:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C13421D79 for ; Fri, 3 Jul 2020 18:03:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rb9CZgcr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C13421D79 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RBaGORb3E8g4jSyRjl70lMCA6oHkXsplhRYtDA/XwJ0=; b=rb9CZgcrWNwLLp5pb1Vcylr5Mi CkOH2eBbpCQrX8JexxvujZQdN+yM0tG55nCy2kUEMLI7nkaP+fEz2gL/dg1DhpkWjmsIJ313h6Q9G ZKtzc3iiBTPhHsBIInKhkgUPGZIb9BNcFBvN0nQcDmOqbMcP2SlBZtzHNtmXUwW6aEs4doxuwCAA8 ZWBLE4uak8t8N5x8woiPxBAuajMLgs/JCUtOi8MzrsJ385gKbHv6PqDpv8zzXT+DM2Tqe8aBl0tNF kSUvc9TnmUb2+WQ5ADOcNUAHdeA/w37yuVzX7JLQIrzX7cB4KA/VHV1RUYk8voPrOhKSzU0UuQYRL D/YFCTng==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrQ1d-0003LB-H2; Fri, 03 Jul 2020 18:03:01 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrQ1V-0003G8-8M for linux-rockchip@lists.infradead.org; Fri, 03 Jul 2020 18:02:56 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dafna) with ESMTPSA id F09342A6502 From: Dafna Hirschfeld To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com Subject: [PATCH v4l-utils v5 4/4] v4l2-ctl: subdev: Add the flags to the list of supported mbus formats Date: Fri, 3 Jul 2020 20:02:39 +0200 Message-Id: <20200703180239.25841-5-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200703180239.25841-1-dafna.hirschfeld@collabora.com> References: <20200703180239.25841-1-dafna.hirschfeld@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200703_140253_440866_3B6807FA X-CRM114-Status: GOOD ( 13.30 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [46.235.227.227 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mchehab@kernel.org, dafna.hirschfeld@collabora.com, dafna3@gmail.com, tfiga@chromium.org, hverkuil@xs4all.nl, linux-rockchip@lists.infradead.org, helen.koike@collabora.com, sakari.ailus@linux.intel.com, kernel@collabora.com, ezequiel@collabora.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Add a new function mbus2s to that prints a descriptive string of the supported flags of the the v4l2_subdev_mbus_code_enum Use this function in the print_mbus_code function. Also add a macro MBUS_DEF(enc_type) to create the two arries 'mbus_hsv_def' and mbus_ycbcr_def' that maps flags to string according to the enc_type (ycbcr/hsv) Signed-off-by: Dafna Hirschfeld --- utils/common/v4l2-info.cpp | 19 +++++++++++++++++++ utils/common/v4l2-info.h | 4 ++++ utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 10 ++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp index a8fa6236..67690f61 100644 --- a/utils/common/v4l2-info.cpp +++ b/utils/common/v4l2-info.cpp @@ -390,6 +390,25 @@ std::string fmtdesc2s(unsigned flags, bool is_hsv) return flags2s(flags, fmtdesc_ycbcr_def); } +#define MBUS_DEF(enc_type) \ +static const flag_def mbus_ ## enc_type ## _def[] = { \ + { V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE, "csc-colorspace" }, \ + { V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC, "csc-"#enc_type }, \ + { V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION, "csc-quantization" }, \ + { V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC, "csc-xfer-func" }, \ + { 0, NULL } \ +}; + +MBUS_DEF(ycbcr) +MBUS_DEF(hsv) + +std::string mbus2s(unsigned flags, bool is_hsv) +{ + if (is_hsv) + return flags2s(flags, mbus_hsv_def); + return flags2s(flags, mbus_ycbcr_def); +} + static const flag_def selection_targets_def[] = { { V4L2_SEL_TGT_CROP_ACTIVE, "crop" }, { V4L2_SEL_TGT_CROP_DEFAULT, "crop_default" }, diff --git a/utils/common/v4l2-info.h b/utils/common/v4l2-info.h index 5b34409c..97c1e64a 100644 --- a/utils/common/v4l2-info.h +++ b/utils/common/v4l2-info.h @@ -8,6 +8,7 @@ #include #include +#include /* Print capability information */ void v4l2_info_capability(const v4l2_capability &cap); @@ -50,6 +51,9 @@ std::string pixflags2s(unsigned flags); /* Return sliced vbi services description */ std::string service2s(unsigned service); +/* Return v4l2_subdev_mbus_code_enum flags description */ +std::string mbus2s(unsigned flags, bool is_hsv); + /* Return v4l2_fmtdesc flags description */ std::string fmtdesc2s(unsigned flags, bool is_hsv); diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp index c6ec21a9..6f712af2 100644 --- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp @@ -577,10 +577,10 @@ static void print_mbus_code(__u32 code) if (mbus_names[i].code == code) break; if (mbus_names[i].name) - printf("\t0x%04x: MEDIA_BUS_FMT_%s\n", + printf("\t0x%04x: MEDIA_BUS_FMT_%s", mbus_names[i].code, mbus_names[i].name); else - printf("\t0x%04x\n", code); + printf("\t0x%04x", code); } static void print_mbus_codes(int fd, __u32 pad) @@ -597,6 +597,12 @@ static void print_mbus_codes(int fd, __u32 pad) if (ret) break; print_mbus_code(mbus_code.code); + if (mbus_code.flags) { + bool is_hsv = mbus_code.code == MEDIA_BUS_FMT_AHSV8888_1X32; + + printf(", %s", mbus2s(mbus_code.flags, is_hsv).c_str()); + } + printf("\n"); mbus_code.index++; } }