From patchwork Sat Jun 6 10:55:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11591137 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 399F690 for ; Sat, 6 Jun 2020 10:56:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C8752074B for ; Sat, 6 Jun 2020 10:56:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728800AbgFFK4E (ORCPT ); Sat, 6 Jun 2020 06:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728793AbgFFKz7 (ORCPT ); Sat, 6 Jun 2020 06:55:59 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99854C08C5C3 for ; Sat, 6 Jun 2020 03:55:59 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dafna) with ESMTPSA id B4E58263992 From: Dafna Hirschfeld To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com Cc: dafna.hirschfeld@collabora.com, helen.koike@collabora.com, ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com, dafna3@gmail.com, sakari.ailus@linux.intel.com, linux-rockchip@lists.infradead.org, mchehab@kernel.org, tfiga@chromium.org, skhan@linuxfoundation.org, p.zabel@pengutronix.de Subject: [PATCH v4l-utils 1/4] v4l2-ctl: vidcap: Add support for the CSC API Date: Sat, 6 Jun 2020 12:55:35 +0200 Message-Id: <20200606105538.30147-2-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200606105538.30147-1-dafna.hirschfeld@collabora.com> References: <20200606105538.30147-1-dafna.hirschfeld@collabora.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org With the CSC API, capture drivers can allow userspace to request to set the quantization or the ycbcr_enc/hsv_enc fields of the pixelformat. This patch adds supports for this feature. when calling 'v4l2-ctl --set-fmt-video' on capture devices userspace can ask to change the quantization or the ycbcr/hsv_enc of the format if the driver supports it. Signed-off-by: Dafna Hirschfeld --- utils/v4l2-compliance/v4l2-test-formats.cpp | 3 ++- utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 22 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp index e1b00f3c..085f4986 100644 --- a/utils/v4l2-compliance/v4l2-test-formats.cpp +++ b/utils/v4l2-compliance/v4l2-test-formats.cpp @@ -264,7 +264,8 @@ static int testEnumFormatsType(struct node *node, unsigned type) return fail("drivers must never set the emulated flag\n"); if (fmtdesc.flags & ~(V4L2_FMT_FLAG_COMPRESSED | V4L2_FMT_FLAG_EMULATED | V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM | - V4L2_FMT_FLAG_DYN_RESOLUTION)) + V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_CSC_YCBCR_ENC | + V4L2_FMT_FLAG_CSC_HSV_ENC | V4L2_FMT_FLAG_CSC_QUANTIZATION)) return fail("unknown flag %08x returned\n", fmtdesc.flags); if (!(fmtdesc.flags & V4L2_FMT_FLAG_COMPRESSED)) fail_on_test(fmtdesc.flags & (V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM | diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp index 80312b51..5cb529c8 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp @@ -21,6 +21,7 @@ static struct v4l2_frmsizeenum frmsize; /* list frame sizes */ static struct v4l2_frmivalenum frmival; /* list frame intervals */ static unsigned set_fmts; static __u32 width, height, pixfmt, field, flags; +static __u32 ycbcr, quantization; static __u32 bytesperline[VIDEO_MAX_PLANES]; static __u32 sizeimage[VIDEO_MAX_PLANES]; @@ -101,7 +102,7 @@ static void print_video_fields(int fd) void vidcap_cmd(int ch, char *optarg) { - __u32 colorspace, xfer_func, ycbcr, quantization; + __u32 colorspace, xfer_func; char *value, *subs; bool be_pixfmt; @@ -112,7 +113,7 @@ void vidcap_cmd(int ch, char *optarg) xfer_func, ycbcr, quantization, flags, bytesperline, sizeimage); if (!set_fmts || - (set_fmts & (FmtColorspace | FmtYCbCr | FmtQuantization | FmtXferFunc))) { + (set_fmts & (FmtColorspace | FmtXferFunc))) { vidcap_usage(); std::exit(EXIT_FAILURE); } @@ -220,6 +221,15 @@ int vidcap_get_and_update_fmt(cv4l_fd &_fd, struct v4l2_format &vfmt) vfmt.fmt.pix_mp.plane_fmt[i].sizeimage = sizeimage[i]; } + + if (set_fmts & FmtYCbCr) { + vfmt.fmt.pix_mp.flags |= V4L2_PIX_FMT_FLAG_SET_CSC; + vfmt.fmt.pix_mp.ycbcr_enc = ycbcr; + } + if (set_fmts & FmtQuantization) { + vfmt.fmt.pix_mp.flags |= V4L2_PIX_FMT_FLAG_SET_CSC; + vfmt.fmt.pix_mp.quantization = quantization; + } } else { if (set_fmts & FmtWidth) vfmt.fmt.pix.width = width; @@ -249,6 +259,14 @@ int vidcap_get_and_update_fmt(cv4l_fd &_fd, struct v4l2_format &vfmt) } if (set_fmts & FmtSizeImage) vfmt.fmt.pix.sizeimage = sizeimage[0]; + if (set_fmts & FmtYCbCr) { + vfmt.fmt.pix.flags |= V4L2_PIX_FMT_FLAG_SET_CSC; + vfmt.fmt.pix.ycbcr_enc = ycbcr; + } + if (set_fmts & FmtQuantization) { + vfmt.fmt.pix.flags |= V4L2_PIX_FMT_FLAG_SET_CSC; + vfmt.fmt.pix.quantization = quantization; + } } if ((set_fmts & FmtPixelFormat) && From patchwork Sat Jun 6 10:55:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11591139 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 C0D8D13B1 for ; Sat, 6 Jun 2020 10:56:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B32B02077D for ; Sat, 6 Jun 2020 10:56:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728802AbgFFK4G (ORCPT ); Sat, 6 Jun 2020 06:56:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728796AbgFFK4A (ORCPT ); Sat, 6 Jun 2020 06:56:00 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D23CC08C5C4 for ; Sat, 6 Jun 2020 03:56:00 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dafna) with ESMTPSA id 649DC27E7B5 From: Dafna Hirschfeld To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com Cc: dafna.hirschfeld@collabora.com, helen.koike@collabora.com, ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com, dafna3@gmail.com, sakari.ailus@linux.intel.com, linux-rockchip@lists.infradead.org, mchehab@kernel.org, tfiga@chromium.org, skhan@linuxfoundation.org, p.zabel@pengutronix.de Subject: [PATCH v4l-utils 2/4] v4l2: common: add the flags V4L2_FMT_FLAG_CSC* to the list that maps flags to str Date: Sat, 6 Jun 2020 12:55:36 +0200 Message-Id: <20200606105538.30147-3-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200606105538.30147-1-dafna.hirschfeld@collabora.com> References: <20200606105538.30147-1-dafna.hirschfeld@collabora.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Replace the array fmtdesc_def with a macro 'FMTDESC_DEF' The macro is used to to create two arrays 'fmtdesc_def_ycbcr', 'fmtdesc_def_hsv' that map the format flags to strings. The function 'fmtdesc2s' is changed to get a parameter 'is_hsv' that decides which array to use. The new CSC flags V4L2_FMT_FLAG_CSC* are added to the arries. Signed-off-by: Dafna Hirschfeld --- utils/common/v4l2-info.cpp | 24 ++++++++++++++++-------- utils/common/v4l2-info.h | 2 +- utils/v4l2-ctl/v4l2-ctl.cpp | 16 ++++++++++++---- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp index 0aac8504..73ee4252 100644 --- a/utils/common/v4l2-info.cpp +++ b/utils/common/v4l2-info.cpp @@ -365,17 +365,25 @@ std::string service2s(unsigned service) return flags2s(service, service_def); } -static const flag_def fmtdesc_def[] = { - { V4L2_FMT_FLAG_COMPRESSED, "compressed" }, - { V4L2_FMT_FLAG_EMULATED, "emulated" }, - { V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM, "continuous-bytestream" }, - { V4L2_FMT_FLAG_DYN_RESOLUTION, "dyn-resolution" }, - { 0, NULL } +#define FMTDESC_DEF(enc_type) \ +static const flag_def fmtdesc_ ## enc_type ## _def[] = { \ + { V4L2_FMT_FLAG_COMPRESSED, "compressed" }, \ + { V4L2_FMT_FLAG_EMULATED, "emulated" }, \ + { V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM, "continuous-bytestream" }, \ + { V4L2_FMT_FLAG_DYN_RESOLUTION, "dyn-resolution" }, \ + { V4L2_FMT_FLAG_CSC_YCBCR_ENC, "csc-"#enc_type }, \ + { V4L2_FMT_FLAG_CSC_QUANTIZATION, "csc-quantization" }, \ + { 0, NULL } \ }; -std::string fmtdesc2s(unsigned flags) +FMTDESC_DEF(ycbcr) +FMTDESC_DEF(hsv) + +std::string fmtdesc2s(unsigned flags, bool is_hsv) { - return flags2s(flags, fmtdesc_def); + if (is_hsv) + return flags2s(flags, fmtdesc_hsv_def); + return flags2s(flags, fmtdesc_ycbcr_def); } static const flag_def selection_targets_def[] = { diff --git a/utils/common/v4l2-info.h b/utils/common/v4l2-info.h index ce2600f0..5b34409c 100644 --- a/utils/common/v4l2-info.h +++ b/utils/common/v4l2-info.h @@ -51,7 +51,7 @@ std::string pixflags2s(unsigned flags); std::string service2s(unsigned service); /* Return v4l2_fmtdesc flags description */ -std::string fmtdesc2s(unsigned flags); +std::string fmtdesc2s(unsigned flags, bool is_hsv); /* Return selection flags description */ std::string selflags2s(__u32 flags); diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index e7b270cd..f7bc78fb 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -615,8 +615,12 @@ void print_video_formats(cv4l_fd &fd, __u32 type) do { printf("\t[%d]: '%s' (%s", fmt.index, fcc2s(fmt.pixelformat).c_str(), fmt.description); - if (fmt.flags) - printf(", %s", fmtdesc2s(fmt.flags).c_str()); + if (fmt.flags) { + bool is_hsv = fmt.pixelformat == V4L2_PIX_FMT_HSV24 || + fmt.pixelformat == V4L2_PIX_FMT_HSV32; + + printf(", %s", fmtdesc2s(fmt.flags, is_hsv).c_str()); + } printf(")\n"); } while (!fd.enum_fmt(fmt)); } @@ -634,8 +638,12 @@ void print_video_formats_ext(cv4l_fd &fd, __u32 type) do { printf("\t[%d]: '%s' (%s", fmt.index, fcc2s(fmt.pixelformat).c_str(), fmt.description); - if (fmt.flags) - printf(", %s", fmtdesc2s(fmt.flags).c_str()); + if (fmt.flags) { + bool is_hsv = fmt.pixelformat == V4L2_PIX_FMT_HSV24 || + fmt.pixelformat == V4L2_PIX_FMT_HSV32; + + printf(", %s", fmtdesc2s(fmt.flags, is_hsv).c_str()); + } printf(")\n"); if (fd.enum_framesizes(frmsize, fmt.pixelformat)) continue; From patchwork Sat Jun 6 10:55:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11591143 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 B4ABB13B1 for ; Sat, 6 Jun 2020 10:56:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A69212074B for ; Sat, 6 Jun 2020 10:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728803AbgFFK4G (ORCPT ); Sat, 6 Jun 2020 06:56:06 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46286 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728794AbgFFK4D (ORCPT ); Sat, 6 Jun 2020 06:56:03 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dafna) with ESMTPSA id 13945260258 From: Dafna Hirschfeld To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com Cc: dafna.hirschfeld@collabora.com, helen.koike@collabora.com, ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com, dafna3@gmail.com, sakari.ailus@linux.intel.com, linux-rockchip@lists.infradead.org, mchehab@kernel.org, tfiga@chromium.org, skhan@linuxfoundation.org, p.zabel@pengutronix.de Subject: [PATCH v4l-utils 3/4] v4l2-ctl: subdev: Add support for the CSC API in the subdevices Date: Sat, 6 Jun 2020 12:55:37 +0200 Message-Id: <20200606105538.30147-4-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200606105538.30147-1-dafna.hirschfeld@collabora.com> References: <20200606105538.30147-1-dafna.hirschfeld@collabora.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The CSC API allows userspace to configure the quantization and (ycbcr/hsv)_enc fields when setting the formats, so those fields are not read only in userspace. This patch adds support for this API in subevices. Signed-off-by: Dafna Hirschfeld --- utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp index c0f36eab..bc9ee101 100644 --- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp @@ -428,10 +428,14 @@ void subdev_set(cv4l_fd &_fd) fmt.format.colorspace = ffmt.colorspace; if (set_fmt & FmtXferFunc) fmt.format.xfer_func = ffmt.xfer_func; - if (set_fmt & FmtYCbCr) + if (set_fmt & FmtYCbCr) { fmt.format.ycbcr_enc = ffmt.ycbcr_enc; - if (set_fmt & FmtQuantization) + fmt.format.flags |= V4L2_MBUS_FRAMEFMT_SET_CSC; + } + if (set_fmt & FmtQuantization) { fmt.format.quantization = ffmt.quantization; + fmt.format.flags |= V4L2_MBUS_FRAMEFMT_SET_CSC; + } if (options[OptSetSubDevFormat]) printf("Note: --set-subdev-fmt is only for testing.\n" From patchwork Sat Jun 6 10:55:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11591141 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 5FCCF90 for ; Sat, 6 Jun 2020 10:56:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 52ECB2077D for ; Sat, 6 Jun 2020 10:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728807AbgFFK4G (ORCPT ); Sat, 6 Jun 2020 06:56:06 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46304 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728798AbgFFK4D (ORCPT ); Sat, 6 Jun 2020 06:56:03 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dafna) with ESMTPSA id B5B2727E950 From: Dafna Hirschfeld To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com Cc: dafna.hirschfeld@collabora.com, helen.koike@collabora.com, ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com, dafna3@gmail.com, sakari.ailus@linux.intel.com, linux-rockchip@lists.infradead.org, mchehab@kernel.org, tfiga@chromium.org, skhan@linuxfoundation.org, p.zabel@pengutronix.de Subject: [PATCH v4l-utils 4/4] v4l2-ctl: subdev: Add the flags to the list of supported mbus formats Date: Sat, 6 Jun 2020 12:55:38 +0200 Message-Id: <20200606105538.30147-5-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200606105538.30147-1-dafna.hirschfeld@collabora.com> References: <20200606105538.30147-1-dafna.hirschfeld@collabora.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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 | 17 +++++++++++++++++ utils/common/v4l2-info.h | 4 ++++ utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 10 ++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp index 73ee4252..ed4cf807 100644 --- a/utils/common/v4l2-info.cpp +++ b/utils/common/v4l2-info.cpp @@ -386,6 +386,23 @@ 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_QUANTIZATION, "csc-quantization" }, \ + { V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC, "csc-"#enc_type }, \ + { 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 bc9ee101..7fde042a 100644 --- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp @@ -573,10 +573,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) @@ -593,6 +593,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++; } }