From patchwork Thu Nov 9 21:02:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 163596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp707188vqs; Thu, 9 Nov 2023 13:07:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHf1xzhrc5+0tpK5hYXVFgxvxzW3Pjflg2XyLHEI5C5zPa3rCHe6I/nuouFTWbM9hixKHK+ X-Received: by 2002:a17:90b:4d0f:b0:283:84c:3862 with SMTP id mw15-20020a17090b4d0f00b00283084c3862mr243392pjb.0.1699564022277; Thu, 09 Nov 2023 13:07:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699564022; cv=none; d=google.com; s=arc-20160816; b=uLAnlMRAiZZvO573AY3RF33T0vocOm83VHiSVvAbNgT9xr+uNfG9RwG1ugnKR5wD+M r9m98I/zVi/qvDsFhJ0Qw2pq2gEg3o5J9x+ZVxEc21FpGI3xaN9eLCAD94vvSMXK+EBx K+3AuiQ/vDuT1gpOzsq/e81dPrkiA8eqwAD1Iw9AYTJ/Ih+0Y8IPKowu0L3/UL5w+l9/ ZJBpjPVCztwi8S0coGs++dMX6f6nsOsB5oHlDumHBlmxpLQlca+xELcz6p6SDFzQ45n7 kO6e7U5QxIukN7wtubSRvZIoq+rX/ZZtBTzTkqv9Odxm2PFrMm7U91gUsx8ncmajg/7J weng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IIOiysGUuMBwp9XLKgjo+MYlVgAhCsEbgGYVgJ9T05I=; fh=CGD8sPkE9LFVktNEez1cSTZ9bW97xSrzpPiSAFxWsOU=; b=CFC0DOA7wuTx7971Hc7ZEVXyusTnZ2O5JqlUwr1osNKaRY6mysoqr8EmvgKL8L1yvX UaIX5b6kM2CNXqPLOtx083qf9udD6yi5taGujmtDW2jaW2AzkVkg4cqxsnEF5PT/0UBl nvWkJx780iUekABD6SafIP3sHKeXHCyxoQO80ni8M4PSMrbkO10p2X4cyOtwVk4agnw5 8HIBpH2dM6d9DKEZW5X2CtRuJZEVKeIq3l8ITYPMTaUK9eTxDYpO2znRt/1wytI7Q63s z4ls85Agq3K/xoU6fXwtiPuXb1qwF5CzhB25Ag5ZuYWLUWXs33m2M2A+FkERf8h0/WHV IefQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=HM8Gwce6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id t6-20020a17090aba8600b00280470736besi2556068pjr.182.2023.11.09.13.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 13:07:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=HM8Gwce6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8D5FF8032FA3; Thu, 9 Nov 2023 13:06:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345347AbjKIVDv (ORCPT + 30 others); Thu, 9 Nov 2023 16:03:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231565AbjKIVDk (ORCPT ); Thu, 9 Nov 2023 16:03:40 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D42FB44A4; Thu, 9 Nov 2023 13:03:37 -0800 (PST) Received: from umang.jain (unknown [103.251.226.64]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A004124F; Thu, 9 Nov 2023 22:03:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699563794; bh=Mh31DkmOj8nOlnWumZDplffgxl2AVkvRhZuE0/1Yjnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HM8Gwce6FhFbVLbWEjKZfsRdfd/2tifTiwj8W/p6UfnlhLmh0aT5lAq32lxodjmg6 CnwK1LGSttYgkMJDRQHzMMAgqW8+WEmUPWmpXzOT0UOREtFL6k1fgFYPrS1+qQ6uYE JEJLbM1x+dYVOTaiIK8TE5J5+PXVxDZ6aP35p8Mc= From: Umang Jain To: linux-media@vger.kernel.org, kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev Cc: Dave Stevenson , Kieran Bingham , Laurent Pinchart , "Ricardo B . Marliere" , Dan Carpenter , Stefan Wahren , Naushir Patuck , Umang Jain Subject: [PATCH v2 07/15] media: uapi: v4l2-core: Add ISP statistics output V4L2 fourcc type Date: Thu, 9 Nov 2023 16:02:59 -0500 Message-ID: <20231109210309.638594-8-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231109210309.638594-1-umang.jain@ideasonboard.com> References: <20231109210309.638594-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 09 Nov 2023 13:06:42 -0800 (PST) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782122043684803847 X-GMAIL-MSGID: 1782122043684803847 From: Naushir Patuck Add V4L2_META_FMT_BCM2835_ISP_STATS V4L2 format type. This new format will be used by the bcm2835-isp device to return out ISP statistics for 3A. Signed-off-by: Naushir Patuck Signed-off-by: Umang Jain --- .../userspace-api/media/v4l/meta-formats.rst | 1 + .../v4l/pixfmt-meta-bcm2835-isp-stats.rst | 32 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 35 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-meta-bcm2835-isp-stats.rst diff --git a/Documentation/userspace-api/media/v4l/meta-formats.rst b/Documentation/userspace-api/media/v4l/meta-formats.rst index 919f595576b9..534542f235bc 100644 --- a/Documentation/userspace-api/media/v4l/meta-formats.rst +++ b/Documentation/userspace-api/media/v4l/meta-formats.rst @@ -12,6 +12,7 @@ These formats are used for the :ref:`metadata` interface only. .. toctree:: :maxdepth: 1 + pixfmt-meta-bcm2835-isp-stats metafmt-d4xx metafmt-intel-ipu3 metafmt-rkisp1 diff --git a/Documentation/userspace-api/media/v4l/pixfmt-meta-bcm2835-isp-stats.rst b/Documentation/userspace-api/media/v4l/pixfmt-meta-bcm2835-isp-stats.rst new file mode 100644 index 000000000000..2219235e0ecb --- /dev/null +++ b/Documentation/userspace-api/media/v4l/pixfmt-meta-bcm2835-isp-stats.rst @@ -0,0 +1,32 @@ +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later +.. _v4l2-meta-fmt-bcm2835-isp-stats: + ++***************************************** +V4L2_META_FMT_BCM2835_ISP_STATS ('BSTA') +***************************************** + +BCM2835 ISP Statistics + +Description +=========== + +The BCM2835 ISP hardware calculate image statistics for an input Bayer frame. +These statistics are obtained from the "bcm2835-isp0-capture3" device node +using the :c:type:`v4l2_meta_format` interface. They are formatted as described +by the :c:type:`bcm2835_isp_stats` structure below. + +.. code-block:: c + + #define DEFAULT_AWB_REGIONS_X 16 + #define DEFAULT_AWB_REGIONS_Y 12 + + #define NUM_HISTOGRAMS 2 + #define NUM_HISTOGRAM_BINS 128 + #define AWB_REGIONS (DEFAULT_AWB_REGIONS_X * DEFAULT_AWB_REGIONS_Y) + #define FLOATING_REGIONS 16 + #define AGC_REGIONS 16 + #define FOCUS_REGIONS 12 + +.. kernel-doc:: include/uapi/linux/bcm2835-isp.h + :functions: bcm2835_isp_stats_hist bcm2835_isp_stats_region + bcm2835_isp_stats_focus bcm2835_isp_stats diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 7f29886568b8..6f0f0f6526c9 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1463,6 +1463,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_META_FMT_GENERIC_CSI2_20: descr = "8b Generic Meta, 20b CSI-2"; break; case V4L2_META_FMT_GENERIC_CSI2_24: descr = "8b Generic Meta, 24b CSI-2"; break; case V4L2_META_FMT_GENERIC_CSI2_2_24: descr = "2x8b Generic Meta, 24b CSI-2"; break; + case V4L2_META_FMT_BCM2835_ISP_STATS: descr = "BCM2835 ISP Image Statistics"; break; default: /* Compressed formats */ diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 85b60199c618..eddaea8598db 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -836,6 +836,7 @@ struct v4l2_pix_format { #define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */ #define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */ #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D') /* Vivid Metadata */ +#define V4L2_META_FMT_BCM2835_ISP_STATS v4l2_fourcc('B', 'S', 'T', 'A') /* BCM2835 ISP image statistics output */ /* Vendor specific - used for RK_ISP1 camera sub-system */ #define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */