From patchwork Wed May 19 10:19:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 12322 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 28158C31FB for ; Wed, 19 May 2021 10:20:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D7F8D602B2; Wed, 19 May 2021 12:20:08 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="R+vI+518"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E061602B2 for ; Wed, 19 May 2021 12:20:06 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.105]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 064658DF; Wed, 19 May 2021 12:20:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1621419605; bh=nVf/0VFxjKLKLaOsbtkcaV4Z3txAKonpYWxgzhDW7vw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R+vI+518Kil3xnVTYpQuwSj4SmsMHwfAIvYxSRu5str3fLLJOS3rp6Dqd812V4laH O5kB/W7TITv1tomUIGICqzzcgnUja9i9Rr5ohUSCq7uPjW9mHc732pXAea6VLWpci0 aj5juRqwf126PV0s7q6dX712a2tXT1xvskvL+yr8= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Wed, 19 May 2021 15:49:48 +0530 Message-Id: <20210519101954.77711-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210519101954.77711-1-umang.jain@ideasonboard.com> References: <20210519101954.77711-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/7] ipa: Move core IPA interface documentation to a .cpp file X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Moving the core.mojom documentation to its corresponding .cpp file (core_ipa_interface.cpp). This will allow Doxygen to generate the documentation for IPABuffer, IPASettings and IPAStream structures. Since the .mojom files are placed in include/ directory, the .cpp file will live in $sourcedir/src/libcamera/ipa/ - which can also contain documentation for other mojom generated IPA interfaces in subsequent commit. Also, fix the Doxygen warning for the above IPA structs regarding their constructors not being documented. Signed-off-by: Umang Jain Acked-by: Kieran Bingham --- Documentation/Doxyfile.in | 8 +- Documentation/meson.build | 1 + include/libcamera/ipa/core.mojom | 72 ---------------- src/libcamera/ipa/core_ipa_interface.cpp | 105 +++++++++++++++++++++++ src/libcamera/ipa/meson.build | 5 ++ src/libcamera/meson.build | 1 + 6 files changed, 118 insertions(+), 74 deletions(-) create mode 100644 src/libcamera/ipa/core_ipa_interface.cpp create mode 100644 src/libcamera/ipa/meson.build diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in index af006724..f4d578fa 100644 --- a/Documentation/Doxyfile.in +++ b/Documentation/Doxyfile.in @@ -844,7 +844,6 @@ EXCLUDE = @TOP_SRCDIR@/include/libcamera/span.h \ @TOP_SRCDIR@/src/libcamera/pipeline/ \ @TOP_SRCDIR@/src/libcamera/tracepoints.cpp \ @TOP_BUILDDIR@/include/libcamera/internal/tracepoints.h \ - @TOP_BUILDDIR@/include/libcamera/ipa/ \ @TOP_BUILDDIR@/src/libcamera/proxy/ # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or @@ -861,7 +860,12 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = @TOP_BUILDDIR@/include/libcamera/ipa/*_serializer.h \ + @TOP_BUILDDIR@/include/libcamera/ipa/*_proxy.h \ + @TOP_BUILDDIR@/include/libcamera/ipa/raspberrypi_*.h \ + @TOP_BUILDDIR@/include/libcamera/ipa/vimc_*.h \ + @TOP_BUILDDIR@/include/libcamera/ipa/rkisp1_*.h \ + @TOP_BUILDDIR@/include/libcamera/ipa/ipu3_*.h \ # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the diff --git a/Documentation/meson.build b/Documentation/meson.build index c8521574..9ecf4dfc 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -24,6 +24,7 @@ if doxygen.found() and dot.found() doxyfile, libcamera_internal_headers, libcamera_ipa_headers, + libcamera_ipa_interfaces, libcamera_public_headers, libcamera_sources, libipa_headers, diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index 6caaa63e..e49815d8 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -94,88 +94,16 @@ module libcamera; uint32 maxFrameLength; }; -/** - * \struct IPABuffer - * \brief Buffer information for the IPA interface - * - * The IPABuffer structure associates buffer memory with a unique ID. It is - * used to map buffers to the IPA with IPAInterface::mapBuffers(), after which - * buffers will be identified by their ID in the IPA interface. - */ - -/** - * \var IPABuffer::id - * \brief The buffer unique ID - * - * Buffers mapped to the IPA are identified by numerical unique IDs. The IDs - * are chosen by the pipeline handler to fulfil the following constraints: - * - * - IDs shall be positive integers different than zero - * - IDs shall be unique among all mapped buffers - * - * When buffers are unmapped with IPAInterface::unmapBuffers() their IDs are - * freed and may be reused for new buffer mappings. - */ - -/** - * \var IPABuffer::planes - * \brief The buffer planes description - * - * Stores the dmabuf handle and length for each plane of the buffer. - */ - struct IPABuffer { uint32 id; [hasFd] array planes; }; -/** - * \struct IPASettings - * \brief IPA interface initialization settings - * - * The IPASettings structure stores data passed to the IPAInterface::init() - * function. The data contains settings that don't depend on a particular camera - * or pipeline configuration and are valid for the whole life time of the IPA - * interface. - */ - -/** - * \var IPASettings::configurationFile - * \brief The name of the IPA configuration file - * - * This field may be an empty string if the IPA doesn't require a configuration - * file. - */ - - /** - * \var IPASettings::sensorModel - * \brief The sensor model name - * - * Provides the sensor model name to the IPA. - */ struct IPASettings { string configurationFile; string sensorModel; }; -/** - * \struct IPAStream - * \brief Stream configuration for the IPA interface - * - * The IPAStream structure stores stream configuration parameters needed by the - * IPAInterface::configure() method. It mirrors the StreamConfiguration class - * that is not suitable for this purpose due to not being serializable. - */ - -/** - * \var IPAStream::pixelFormat - * \brief The stream pixel format - */ - -/** - * \var IPAStream::size - * \brief The stream size in pixels - */ struct IPAStream { uint32 pixelFormat; Size size; diff --git a/src/libcamera/ipa/core_ipa_interface.cpp b/src/libcamera/ipa/core_ipa_interface.cpp new file mode 100644 index 00000000..fe1ecce6 --- /dev/null +++ b/src/libcamera/ipa/core_ipa_interface.cpp @@ -0,0 +1,105 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Google Inc. + * + * core_ipa_interface.cpp - Docs file for core.mojom generated header + */ + +namespace libcamera { + +/** + * \struct IPABuffer + * \brief Buffer information for the IPA interface + * + * The IPABuffer structure associates buffer memory with a unique ID. It is + * used to map buffers to the IPA with IPAInterface::mapBuffers(), after which + * buffers will be identified by their ID in the IPA interface. + */ + +/** + * \fn IPABuffer::IPABuffer(uint32_t id, const std::vector &planes) + * \param[in] id + * \param[in] planes + * \sa id and planes + */ + +/** + * \var IPABuffer::id + * \brief The buffer unique ID + * + * Buffers mapped to the IPA are identified by numerical unique IDs. The IDs + * are chosen by the pipeline handler to fulfil the following constraints: + * + * - IDs shall be positive integers different than zero + * - IDs shall be unique among all mapped buffers + * + * When buffers are unmapped with IPAInterface::unmapBuffers() their IDs are + * freed and may be reused for new buffer mappings. + */ + +/** + * \var IPABuffer::planes + * \brief The buffer planes description + * + * Stores the dmabuf handle and length for each plane of the buffer. + */ + +/** + * \struct IPASettings + * \brief IPA interface initialization settings + * + * The IPASettings structure stores data passed to the IPAInterface::init() + * function. The data contains settings that don't depend on a particular camera + * or pipeline configuration and are valid for the whole life time of the IPA + * interface. + */ + +/** + * \fn IPASettings::IPASettings(const std::string &configurationFile, const std::string &sensorModel) + * \param[in] configurationFile + * \param[in] sensorModel + * \sa configurationFile and sensorModel + */ + +/** + * \var IPASettings::configurationFile + * \brief The name of the IPA configuration file + * + * This field may be an empty string if the IPA doesn't require a configuration + * file. + */ + +/** + * \var IPASettings::sensorModel + * \brief The sensor model name + * + * Provides the sensor model name to the IPA. + */ + +/** + * \struct IPAStream + * \brief Stream configuration for the IPA interface + * + * The IPAStream structure stores stream configuration parameters needed by the + * IPAInterface::configure() method. It mirrors the StreamConfiguration class + * that is not suitable for this purpose due to not being serializable. + */ + +/** + * \fn IPAStream::IPAStream(uint32_t pixelFormat, const Size &size) + * \param[in] pixelFormat + * \param[in] size + * \sa pixelFormat and size + */ + +/** + * \var IPAStream::pixelFormat + * \brief The stream pixel format + */ + +/** + * \var IPAStream::size + * \brief The stream size in pixels + */ + +} /* namespace libcamera */ diff --git a/src/libcamera/ipa/meson.build b/src/libcamera/ipa/meson.build new file mode 100644 index 00000000..0a16d197 --- /dev/null +++ b/src/libcamera/ipa/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +libcamera_ipa_interfaces = files([ + 'core_ipa_interface.cpp', +]) diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 7bc59b84..61b5fe21 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -67,6 +67,7 @@ includes = [ libcamera_includes, ] +subdir('ipa') subdir('pipeline') subdir('proxy') From patchwork Wed May 19 10:19:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 12323 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 31F44C31FB for ; Wed, 19 May 2021 10:20:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 36A7268924; Wed, 19 May 2021 12:20:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="eYQ7y2WU"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 77E4D602B2 for ; Wed, 19 May 2021 12:20:08 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.105]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2B5A245E; Wed, 19 May 2021 12:20:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1621419608; bh=NyZGhRujvDOzzkpY7R3W9PidphlIVJ/Q6ZoQNb+ZTbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYQ7y2WUcIN6NgWnVBuduqJkzd/d68ZnUejIgbsWjdGFD1zCZlYrDGceRre/+nGZ3 0E3vT8a+CEZH/yOWbSAmsXKV3aj8ibugT7NNcYEUEOSmL/DklER0/WAXkyhHj5jJge 2bA+2N1QANQN6j2BkCFTaIXUokmlEaXfZFgBPx24= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Wed, 19 May 2021 15:49:49 +0530 Message-Id: <20210519101954.77711-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210519101954.77711-1-umang.jain@ideasonboard.com> References: <20210519101954.77711-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/7] ipa: mojom: Move CameraSensorInfo struct exclusively to IPA IPC X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" CameraSensorInfo structure is designed to pass in camera sensor related information from pipeline-handler to IPA. Since the pipeline-handler and IPA are connected via mojom IPC IPA interface, the interface itself provides a more suitable placement of CameraSensorInfo, instead of camera_sensor.h (which is a libcamera internal header ultimately, at this point). As CameraSensorInfo is already defined in core.mojom, it is just a matter of removing [skipHeader] tag to allow code-generation of CameraSensorInfo. Finally, update header paths to include CameraSensorInfo definition from IPA interfaces instead of "libcamera/internal/camera_sensor.h". Signed-off-by: Umang Jain Signed-off-by: Paul Elder Reviewed-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- include/libcamera/internal/camera_sensor.h | 17 +-- include/libcamera/ipa/core.mojom | 2 +- include/libcamera/ipa/ipa_interface.h | 2 - src/ipa/raspberrypi/raspberrypi.cpp | 1 - src/libcamera/camera_sensor.cpp | 111 ----------------- src/libcamera/ipa/core_ipa_interface.cpp | 131 +++++++++++++++++++++ 6 files changed, 133 insertions(+), 131 deletions(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 2a5c51a1..0905ebfa 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -14,6 +14,7 @@ #include #include #include +#include #include "libcamera/internal/formats.h" #include "libcamera/internal/log.h" @@ -24,22 +25,6 @@ namespace libcamera { class BayerFormat; class MediaEntity; -struct CameraSensorInfo { - std::string model; - - uint32_t bitsPerPixel; - - Size activeAreaSize; - Rectangle analogCrop; - Size outputSize; - - uint64_t pixelRate; - uint32_t lineLength; - - uint32_t minFrameLength; - uint32_t maxFrameLength; -}; - class CameraSensor : protected Loggable { public: diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index e49815d8..b95b3dc4 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -78,7 +78,7 @@ module libcamera; uint32 height; }; -[skipHeader] struct CameraSensorInfo { +struct CameraSensorInfo { string model; uint32 bitsPerPixel; diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h index dfe1b40a..4aefaa71 100644 --- a/include/libcamera/ipa/ipa_interface.h +++ b/include/libcamera/ipa/ipa_interface.h @@ -18,8 +18,6 @@ #include #include -#include "libcamera/internal/camera_sensor.h" - namespace libcamera { /* diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 52d91db2..87774500 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -25,7 +25,6 @@ #include #include "libcamera/internal/buffer.h" -#include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/log.h" #include diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index eb84d9eb..170de827 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -33,117 +33,6 @@ namespace libcamera { LOG_DEFINE_CATEGORY(CameraSensor) -/** - * \struct CameraSensorInfo - * \brief Report the image sensor characteristics - * - * The structure reports image sensor characteristics used by IPA modules to - * tune their algorithms based on the image sensor model currently in use and - * its configuration. - * - * The reported information describes the sensor's intrinsics characteristics, - * such as its pixel array size and the sensor model name, as well as - * information relative to the currently configured mode, such as the produced - * image size and the bit depth of the requested image format. - * - * Instances of this structure are meant to be assembled by the CameraSensor - * class by inspecting the sensor static properties as well as information - * relative to the current configuration. - */ - -/** - * \var CameraSensorInfo::model - * \brief The image sensor model name - * - * The sensor model name is a free-formed string that uniquely identifies the - * sensor model. - */ - -/** - * \var CameraSensorInfo::bitsPerPixel - * \brief The number of bits per pixel of the image format produced by the - * image sensor - */ - -/** - * \var CameraSensorInfo::activeAreaSize - * \brief The size of the pixel array active area of the sensor - */ - -/** - * \var CameraSensorInfo::analogCrop - * \brief The portion of the pixel array active area which is read-out and - * processed - * - * The analog crop rectangle top-left corner is defined as the displacement - * from the top-left corner of the pixel array active area. The rectangle - * horizontal and vertical sizes define the portion of the pixel array which - * is read-out and provided to the sensor's internal processing pipeline, before - * any pixel sub-sampling method, such as pixel binning, skipping and averaging - * take place. - */ - -/** - * \var CameraSensorInfo::outputSize - * \brief The size of the images produced by the camera sensor - * - * The output image size defines the horizontal and vertical sizes of the images - * produced by the image sensor. The output image size is defined as the end - * result of the sensor's internal image processing pipeline stages, applied on - * the pixel array portion defined by the analog crop rectangle. Each image - * processing stage that performs pixel sub-sampling techniques, such as pixel - * binning or skipping, or perform any additional digital scaling concur in the - * definition of the output image size. - */ - -/** - * \var CameraSensorInfo::pixelRate - * \brief The number of pixels produced in a second - * - * To obtain the read-out time in seconds of a full line: - * - * \verbatim - lineDuration(s) = lineLength(pixels) / pixelRate(pixels per second) - \endverbatim - */ - -/** - * \var CameraSensorInfo::lineLength - * \brief Total line length in pixels - * - * The total line length in pixel clock periods, including blanking. - */ - -/** - * \var CameraSensorInfo::minFrameLength - * \brief The minimum allowable frame length in units of lines - * - * The sensor frame length comprises of active output lines and blanking lines - * in a frame. The minimum frame length value dictates the minimum allowable - * frame duration of the sensor mode. - * - * To obtain the minimum frame duration: - * - * \verbatim - frameDuration(s) = minFrameLength(lines) * lineLength(pixels) / pixelRate(pixels per second) - \endverbatim - */ - -/** - * \var CameraSensorInfo::maxFrameLength - * \brief The maximum allowable frame length in units of lines - * - * The sensor frame length comprises of active output lines and blanking lines - * in a frame. The maximum frame length value dictates the maximum allowable - * frame duration of the sensor mode. - * - * To obtain the maximum frame duration: - * - * \verbatim - frameDuration(s) = maxFrameLength(lines) * lineLength(pixels) / pixelRate(pixels per second) - \endverbatim - */ - /** * \class CameraSensor * \brief A camera sensor based on V4L2 subdevices diff --git a/src/libcamera/ipa/core_ipa_interface.cpp b/src/libcamera/ipa/core_ipa_interface.cpp index fe1ecce6..def8d184 100644 --- a/src/libcamera/ipa/core_ipa_interface.cpp +++ b/src/libcamera/ipa/core_ipa_interface.cpp @@ -102,4 +102,135 @@ namespace libcamera { * \brief The stream size in pixels */ +/** + * \struct CameraSensorInfo + * \brief Report the image sensor characteristics + * + * The structure reports image sensor characteristics used by IPA modules to + * tune their algorithms based on the image sensor model currently in use and + * its configuration. + * + * The reported information describes the sensor's intrinsics characteristics, + * such as its pixel array size and the sensor model name, as well as + * information relative to the currently configured mode, such as the produced + * image size and the bit depth of the requested image format. + * + * Instances of this structure are meant to be assembled by the CameraSensor + * class by inspecting the sensor static properties as well as information + * relative to the current configuration. + */ + +/** + * \fn CameraSensorInfo::CameraSensorInfo(const std::string &model, + uint32_t bitsPerPixel, + const Size &activeAreaSize, + const Rectangle &analogCrop, + const Size &outputSize, + uint64_t pixelRate, + uint32_t lineLength, + uint32_t minFrameLength, + uint32_t maxFrameLength) + * \param[in] model + * \param[in] bitsPerPixel + * \param[in] activeAreaSize + * \param[in] analogCrop + * \param[in] outputSize + * \param[in] pixelRate + * \param[in] lineLength + * \param[in] minFrameLength + * \param[in] maxFrameLength + */ + +/** + * \var CameraSensorInfo::model + * \brief The image sensor model name + * + * The sensor model name is a free-formed string that uniquely identifies the + * sensor model. + */ + +/** + * \var CameraSensorInfo::bitsPerPixel + * \brief The number of bits per pixel of the image format produced by the + * image sensor + */ + +/** + * \var CameraSensorInfo::activeAreaSize + * \brief The size of the pixel array active area of the sensor + */ + +/** + * \var CameraSensorInfo::analogCrop + * \brief The portion of the pixel array active area which is read-out and + * processed + * + * The analog crop rectangle top-left corner is defined as the displacement + * from the top-left corner of the pixel array active area. The rectangle + * horizontal and vertical sizes define the portion of the pixel array which + * is read-out and provided to the sensor's internal processing pipeline, before + * any pixel sub-sampling method, such as pixel binning, skipping and averaging + * take place. + */ + +/** + * \var CameraSensorInfo::outputSize + * \brief The size of the images produced by the camera sensor + * + * The output image size defines the horizontal and vertical sizes of the images + * produced by the image sensor. The output image size is defined as the end + * result of the sensor's internal image processing pipeline stages, applied on + * the pixel array portion defined by the analog crop rectangle. Each image + * processing stage that performs pixel sub-sampling techniques, such as pixel + * binning or skipping, or perform any additional digital scaling concur in the + * definition of the output image size. + */ + +/** + * \var CameraSensorInfo::pixelRate + * \brief The number of pixels produced in a second + * + * To obtain the read-out time in seconds of a full line: + * + * \verbatim + lineDuration(s) = lineLength(pixels) / pixelRate(pixels per second) + \endverbatim + */ + +/** + * \var CameraSensorInfo::lineLength + * \brief Total line length in pixels + * + * The total line length in pixel clock periods, including blanking. + */ + +/** + * \var CameraSensorInfo::minFrameLength + * \brief The minimum allowable frame length in units of lines + * + * The sensor frame length comprises of active output lines and blanking lines + * in a frame. The minimum frame length value dictates the minimum allowable + * frame duration of the sensor mode. + * + * To obtain the minimum frame duration: + * + * \verbatim + frameDuration(s) = minFrameLength(lines) * lineLength(pixels) / pixelRate(pixels per second) + \endverbatim + */ + +/** + * \var CameraSensorInfo::maxFrameLength + * \brief The maximum allowable frame length in units of lines + * + * The sensor frame length comprises of active output lines and blanking lines + * in a frame. The maximum frame length value dictates the maximum allowable + * frame duration of the sensor mode. + * + * To obtain the maximum frame duration: + * + * \verbatim + frameDuration(s) = maxFrameLength(lines) * lineLength(pixels) / pixelRate(pixels per second) + \endverbatim + */ } /* namespace libcamera */ From patchwork Wed May 19 10:19:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 12324 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 6985CC31FB for ; Wed, 19 May 2021 10:20:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 25FBD68928; Wed, 19 May 2021 12:20:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JrTu0vM8"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 97BFD68918 for ; Wed, 19 May 2021 12:20:10 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.105]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 82CE845E; Wed, 19 May 2021 12:20:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1621419610; bh=Lv7Koz8WivmPy+vBsR6BUpDX4GRkQayQCSlaw76L3cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JrTu0vM8j6WCGK5ar7iQuUlfHd4SxlzRYMr4TrDNqHne7UAuq5M4dwadsuU7aphzk EZKppLE12rQ+XN4zuHZ5T2RS6KBatZycytVf00A3K3ys4P1LnuMS3RN4bDc/+fnS2d rnw1Y6EQEWGOtUEWi/nChR8HN0SGYqZ3cy3d6Gpk= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Wed, 19 May 2021 15:49:50 +0530 Message-Id: <20210519101954.77711-4-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210519101954.77711-1-umang.jain@ideasonboard.com> References: <20210519101954.77711-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/7] ipa: ipc: Rename CameraSensorInfo to IPACameraSensorInfo X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This matches the naming convention for IPA IPC. Signed-off-by: Umang Jain Acked-by: Paul Elder Reviewed-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- Documentation/guides/ipa.rst | 8 ++-- include/libcamera/internal/camera_sensor.h | 2 +- include/libcamera/ipa/core.mojom | 2 +- include/libcamera/ipa/raspberrypi.mojom | 2 +- include/libcamera/ipa/rkisp1.mojom | 2 +- src/ipa/ipu3/ipu3_agc.cpp | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 8 ++-- src/ipa/rkisp1/rkisp1.cpp | 6 +-- src/libcamera/camera_sensor.cpp | 6 +-- src/libcamera/ipa/core_ipa_interface.cpp | 38 +++++++++---------- src/libcamera/pipeline/ipu3/ipu3.cpp | 4 +- .../pipeline/raspberrypi/raspberrypi.cpp | 4 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +- 13 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Documentation/guides/ipa.rst b/Documentation/guides/ipa.rst index cbffbd9a..6d460e13 100644 --- a/Documentation/guides/ipa.rst +++ b/Documentation/guides/ipa.rst @@ -74,7 +74,7 @@ serialization, any custom data containers must be defined with the mojo IDL. The following list of libcamera objects are supported in the interface definition, and may be used as function parameter types or struct field types: -- libcamera.CameraSensorInfo +- libcamera.IPACameraSensorInfo - libcamera.ControlInfoMap - libcamera.ControlList - libcamera.FileDescriptor @@ -208,7 +208,7 @@ The following is an example of a main interface definition: start() => (int32 ret); stop(); - configure(libcamera.CameraSensorInfo sensorInfo, + configure(libcamera.IPACameraSensorInfo sensorInfo, map streamConfig, map entityControls, ConfigInput ipaConfig) @@ -470,7 +470,7 @@ definition: .. code-block:: none - configure(libcamera.CameraSensorInfo sensorInfo, + configure(libcamera.IPACameraSensorInfo sensorInfo, uint32 exampleNumber, map streamConfig, map entityControls, @@ -481,7 +481,7 @@ We will need to implement a function with the following function signature: .. code-block:: C++ - int configure(const CameraSensorInfo &sensorInfo, + int configure(const IPACameraSensorInfo &sensorInfo, uint32_t exampleNumber, const std::map &streamConfig, const std::map &entityControls, diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 0905ebfa..cf6c1c1e 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -51,7 +51,7 @@ public: V4L2Subdevice *device() { return subdev_.get(); } const ControlList &properties() const { return properties_; } - int sensorInfo(CameraSensorInfo *info) const; + int sensorInfo(IPACameraSensorInfo *info) const; void updateControlInfo(); diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index b95b3dc4..34a799c2 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -78,7 +78,7 @@ module libcamera; uint32 height; }; -struct CameraSensorInfo { +struct IPACameraSensorInfo { string model; uint32 bitsPerPixel; diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index 42321bee..0a21f453 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -63,7 +63,7 @@ interface IPARPiInterface { * The \a ipaConfig and \a controls parameters carry data passed by the * pipeline handler to the IPA and back. */ - configure(libcamera.CameraSensorInfo sensorInfo, + configure(libcamera.IPACameraSensorInfo sensorInfo, map streamConfig, map entityControls, IPAConfig ipaConfig) diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom index cca871a0..66a4607c 100644 --- a/include/libcamera/ipa/rkisp1.mojom +++ b/include/libcamera/ipa/rkisp1.mojom @@ -29,7 +29,7 @@ interface IPARkISP1Interface { start() => (int32 ret); stop(); - configure(libcamera.CameraSensorInfo sensorInfo, + configure(libcamera.IPACameraSensorInfo sensorInfo, map streamConfig, map entityControls) => (int32 ret); diff --git a/src/ipa/ipu3/ipu3_agc.cpp b/src/ipa/ipu3/ipu3_agc.cpp index ca54d89a..8bae423f 100644 --- a/src/ipa/ipu3/ipu3_agc.cpp +++ b/src/ipa/ipu3/ipu3_agc.cpp @@ -39,7 +39,7 @@ static constexpr uint32_t kMaxGain = kMaxISO / 100; static constexpr uint32_t kMinExposure = 1; static constexpr uint32_t kMaxExposure = 1976; -/* \todo those should be get from CameraSensorInfo ! */ +/* \todo those should be got from IPACameraSensorInfo ! */ /* line duration in microseconds */ static constexpr double kLineDuration = 16.8; static constexpr double kMaxExposureTime = kMaxExposure * kLineDuration; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 87774500..e5bb8159 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -89,7 +89,7 @@ public: void start(const ControlList &controls, ipa::RPi::StartConfig *startConfig) override; void stop() override {} - int configure(const CameraSensorInfo &sensorInfo, + int configure(const IPACameraSensorInfo &sensorInfo, const std::map &streamConfig, const std::map &entityControls, const ipa::RPi::IPAConfig &data, @@ -101,7 +101,7 @@ public: void signalIspPrepare(const ipa::RPi::ISPConfig &data) override; private: - void setMode(const CameraSensorInfo &sensorInfo); + void setMode(const IPACameraSensorInfo &sensorInfo); bool validateSensorControls(); bool validateIspControls(); void queueRequest(const ControlList &controls); @@ -278,7 +278,7 @@ void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConf lastRunTimestamp_ = 0; } -void IPARPi::setMode(const CameraSensorInfo &sensorInfo) +void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo) { mode_.bitdepth = sensorInfo.bitsPerPixel; mode_.width = sensorInfo.outputSize.width; @@ -323,7 +323,7 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo) mode_.max_frame_length = sensorInfo.maxFrameLength; } -int IPARPi::configure(const CameraSensorInfo &sensorInfo, +int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, [[maybe_unused]] const std::map &streamConfig, const std::map &entityControls, const ipa::RPi::IPAConfig &ipaConfig, diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 6d45673c..b47ea324 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -37,7 +37,7 @@ public: int start() override; void stop() override {} - int configure(const CameraSensorInfo &info, + int configure(const IPACameraSensorInfo &info, const std::map &streamConfig, const std::map &entityControls) override; void mapBuffers(const std::vector &buffers) override; @@ -90,12 +90,12 @@ int IPARkISP1::start() } /** - * \todo The RkISP1 pipeline currently provides an empty CameraSensorInfo + * \todo The RkISP1 pipeline currently provides an empty IPACameraSensorInfo * if the connected sensor does not provide enough information to properly * assemble one. Make sure the reported sensor information are relevant * before accessing them. */ -int IPARkISP1::configure([[maybe_unused]] const CameraSensorInfo &info, +int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info, [[maybe_unused]] const std::map &streamConfig, const std::map &entityControls) { diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 170de827..0fb8a258 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -205,7 +205,7 @@ int CameraSensor::validateSensorDriver() * * Failures in reading any of the targets are not deemed to be fatal, * but some properties and features, like constructing a - * CameraSensorInfo for the IPA module, won't be supported. + * IPACameraSensorInfo for the IPA module, won't be supported. * * \todo Make support for selection targets mandatory as soon as all * test platforms have been updated. @@ -674,7 +674,7 @@ int CameraSensor::setControls(ControlList *ctrls) * * \return 0 on success, a negative error code otherwise */ -int CameraSensor::sensorInfo(CameraSensorInfo *info) const +int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const { if (!bayerFormat_) return -EINVAL; @@ -701,7 +701,7 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const } /* - * CameraSensorInfo::analogCrop::x and CameraSensorInfo::analogCrop::y + * IPACameraSensorInfo::analogCrop::x and IPACameraSensorInfo::analogCrop::y * are defined relatively to the active pixel area, while V4L2's * TGT_CROP target is defined in respect to the full pixel array. * diff --git a/src/libcamera/ipa/core_ipa_interface.cpp b/src/libcamera/ipa/core_ipa_interface.cpp index def8d184..15d61d91 100644 --- a/src/libcamera/ipa/core_ipa_interface.cpp +++ b/src/libcamera/ipa/core_ipa_interface.cpp @@ -103,7 +103,7 @@ namespace libcamera { */ /** - * \struct CameraSensorInfo + * \struct IPACameraSensorInfo * \brief Report the image sensor characteristics * * The structure reports image sensor characteristics used by IPA modules to @@ -121,15 +121,15 @@ namespace libcamera { */ /** - * \fn CameraSensorInfo::CameraSensorInfo(const std::string &model, - uint32_t bitsPerPixel, - const Size &activeAreaSize, - const Rectangle &analogCrop, - const Size &outputSize, - uint64_t pixelRate, - uint32_t lineLength, - uint32_t minFrameLength, - uint32_t maxFrameLength) + * \fn IPACameraSensorInfo::IPACameraSensorInfo(const std::string &model, + uint32_t bitsPerPixel, + const Size &activeAreaSize, + const Rectangle &analogCrop, + const Size &outputSize, + uint64_t pixelRate, + uint32_t lineLength, + uint32_t minFrameLength, + uint32_t maxFrameLength) * \param[in] model * \param[in] bitsPerPixel * \param[in] activeAreaSize @@ -142,7 +142,7 @@ namespace libcamera { */ /** - * \var CameraSensorInfo::model + * \var IPACameraSensorInfo::model * \brief The image sensor model name * * The sensor model name is a free-formed string that uniquely identifies the @@ -150,18 +150,18 @@ namespace libcamera { */ /** - * \var CameraSensorInfo::bitsPerPixel + * \var IPACameraSensorInfo::bitsPerPixel * \brief The number of bits per pixel of the image format produced by the * image sensor */ /** - * \var CameraSensorInfo::activeAreaSize + * \var IPACameraSensorInfo::activeAreaSize * \brief The size of the pixel array active area of the sensor */ /** - * \var CameraSensorInfo::analogCrop + * \var IPACameraSensorInfo::analogCrop * \brief The portion of the pixel array active area which is read-out and * processed * @@ -174,7 +174,7 @@ namespace libcamera { */ /** - * \var CameraSensorInfo::outputSize + * \var IPACameraSensorInfo::outputSize * \brief The size of the images produced by the camera sensor * * The output image size defines the horizontal and vertical sizes of the images @@ -187,7 +187,7 @@ namespace libcamera { */ /** - * \var CameraSensorInfo::pixelRate + * \var IPACameraSensorInfo::pixelRate * \brief The number of pixels produced in a second * * To obtain the read-out time in seconds of a full line: @@ -198,14 +198,14 @@ namespace libcamera { */ /** - * \var CameraSensorInfo::lineLength + * \var IPACameraSensorInfo::lineLength * \brief Total line length in pixels * * The total line length in pixel clock periods, including blanking. */ /** - * \var CameraSensorInfo::minFrameLength + * \var IPACameraSensorInfo::minFrameLength * \brief The minimum allowable frame length in units of lines * * The sensor frame length comprises of active output lines and blanking lines @@ -220,7 +220,7 @@ namespace libcamera { */ /** - * \var CameraSensorInfo::maxFrameLength + * \var IPACameraSensorInfo::maxFrameLength * \brief The maximum allowable frame length in units of lines * * The sensor frame length comprises of active output lines and blanking lines diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index ade8ffbd..98c6160f 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -544,7 +544,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) if (ret) return ret; - CameraSensorInfo sensorInfo; + IPACameraSensorInfo sensorInfo; cio2->sensor()->sensorInfo(&sensorInfo); data->cropRegion_ = sensorInfo.analogCrop; @@ -883,7 +883,7 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) if (ret) return ret; - CameraSensorInfo sensorInfo{}; + IPACameraSensorInfo sensorInfo{}; ret = sensor->sensorInfo(&sensorInfo); if (ret) return ret; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 6fbdba04..f2a94dc0 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -211,7 +211,7 @@ public: BayerFormat::Order nativeBayerOrder_; /* For handling digital zoom. */ - CameraSensorInfo sensorInfo_; + IPACameraSensorInfo sensorInfo_; Rectangle ispCrop_; /* crop in ISP (camera mode) pixels */ Rectangle scalerCrop_; /* crop in sensor native pixels */ bool updateScalerCrop_; @@ -1275,7 +1275,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) ipaConfig.lsTableHandle = lsTable_; } - /* We store the CameraSensorInfo for digital zoom calculations. */ + /* We store the IPACameraSensorInfo for digital zoom calculations. */ int ret = sensor_->sensorInfo(&sensorInfo_); if (ret) { LOG(RPI, Error) << "Failed to retrieve camera sensor info"; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index adebe8b5..6699839c 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -648,7 +648,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) return ret; /* Inform IPA of stream configuration and sensor controls. */ - CameraSensorInfo sensorInfo = {}; + IPACameraSensorInfo sensorInfo = {}; ret = data->sensor_->sensorInfo(&sensorInfo); if (ret) { /* \todo Turn this into a hard failure. */ From patchwork Wed May 19 10:19:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 12325 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 85B39C31FB for ; Wed, 19 May 2021 10:20:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 418656891E; Wed, 19 May 2021 12:20:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="puPbubmg"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B6BFB68918 for ; Wed, 19 May 2021 12:20:15 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.105]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BBB3945E; Wed, 19 May 2021 12:20:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1621419615; bh=FyDg5UPDzNOPZXc4pGyBWpj87DQtFuA7y9XGm7uPKLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=puPbubmg2XLD2xGHr2cv3h1oVBe0n+ARX1coZL45KdBM7U5hEYcy7zMkik8c/RyAv ckwPNg6pH8HQeLyTHHUqS71c63Fex7tvwsKROMJXEZTSQESWfsdrWp7xeRdpA/1IAf b/kKDh3Pf6D8oNRkxUo+4w+oPIrMiRmoQP2sxtmE= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Wed, 19 May 2021 15:49:52 +0530 Message-Id: <20210519101954.77711-6-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210519101954.77711-1-umang.jain@ideasonboard.com> References: <20210519101954.77711-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 5/7] ipa: ipu3: Introduce IPAConfigInfo in IPC X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" IPAConfigInfo is a consolidated data structure passed from IPU3 pipeline-handler to IPU3 IPA. The structure can be extended with additional parameters to accommodate the requirements of multiple IPU3 IPA modules. Adapt the in-tree IPU3 IPA to use IPAConfigInfo as well. Signed-off-by: Umang Jain Reviewed-by: Paul Elder Reviewed-by: Jean-Michel Hautbois Reviewed-by: Jacopo Mondi --- include/libcamera/ipa/ipu3.mojom | 10 ++++++++-- src/ipa/ipu3/ipu3.cpp | 14 ++++++-------- src/libcamera/pipeline/ipu3/ipu3.cpp | 10 +++++++--- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index a717b1e6..e78f9cbb 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -25,13 +25,19 @@ struct IPU3Action { libcamera.ControlList controls; }; +struct IPAConfigInfo { + libcamera.IPACameraSensorInfo sensorInfo; + map entityControls; + libcamera.Size bdsOutputSize; + libcamera.Size iif; +}; + interface IPAIPU3Interface { init(libcamera.IPASettings settings) => (int32 ret); start() => (int32 ret); stop(); - configure(map entityControls, - libcamera.Size bdsOutputSize) => (); + configure(IPAConfigInfo configInfo) => (); mapBuffers(array buffers); unmapBuffers(array ids); diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index f5343547..769c24d3 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -43,8 +43,7 @@ public: int start() override; void stop() override {} - void configure(const std::map &entityControls, - const Size &bdsOutputSize) override; + void configure(const IPAConfigInfo &configInfo) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; @@ -139,13 +138,12 @@ void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize) << (int)bdsGrid_.height << " << " << (int)bdsGrid_.block_height_log2 << ")"; } -void IPAIPU3::configure(const std::map &entityControls, - const Size &bdsOutputSize) +void IPAIPU3::configure(const IPAConfigInfo &configInfo) { - if (entityControls.empty()) + if (configInfo.entityControls.empty()) return; - ctrls_ = entityControls.at(0); + ctrls_ = configInfo.entityControls.at(0); const auto itExp = ctrls_.find(V4L2_CID_EXPOSURE); if (itExp == ctrls_.end()) { @@ -169,10 +167,10 @@ void IPAIPU3::configure(const std::map &entityControls params_ = {}; - calculateBdsGrid(bdsOutputSize); + calculateBdsGrid(configInfo.bdsOutputSize); awbAlgo_ = std::make_unique(); - awbAlgo_->initialise(params_, bdsOutputSize, bdsGrid_); + awbAlgo_->initialise(params_, configInfo.bdsOutputSize, bdsGrid_); agcAlgo_ = std::make_unique(); agcAlgo_->initialise(bdsGrid_); diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 98c6160f..5b15ca90 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -633,9 +633,13 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) return ret; } - std::map entityControls; - entityControls.emplace(0, data->cio2_.sensor()->controls()); - data->ipa_->configure(entityControls, config->imguConfig().bds); + ipa::ipu3::IPAConfigInfo configInfo; + configInfo.entityControls.emplace(0, data->cio2_.sensor()->controls()); + configInfo.sensorInfo = sensorInfo; + configInfo.bdsOutputSize = config->imguConfig().bds; + configInfo.iif = config->imguConfig().iif; + + data->ipa_->configure(configInfo); return 0; } From patchwork Wed May 19 10:19:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 12326 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 619ECC31FB for ; Wed, 19 May 2021 10:20:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 20E2E68915; Wed, 19 May 2021 12:20:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="V4syvGlr"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C24F66891F for ; Wed, 19 May 2021 12:20:19 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.105]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9E95C45E; Wed, 19 May 2021 12:20:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1621419619; bh=seWOaBpLQL1i3WCH38j5JUe585SNLe6tHvMpUy7VZQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4syvGlrIHTeg0dKaeqpuR3WfxhIeIP2jhHxB3wVGz9Q8fAsv0EWJYfXai6hIebxF mp6C4aRaat9Y5MnAAnQgcbu2TJwr+iFKFzxOwMIklN/ajRX+DaVwmHoPoMSm9u6krO Rizl0mOnPORt3vb41Lqp30uF5DOUfOFjPcJvK/TI= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Wed, 19 May 2021 15:49:54 +0530 Message-Id: <20210519101954.77711-8-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210519101954.77711-1-umang.jain@ideasonboard.com> References: <20210519101954.77711-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 7/7] libcamera: pipeline: ipu3: Pass request metadata to IPA X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Kieran Bingham Pass the request metadata control list to the IPA when setting passing the statistics buffers, or after the raw buffer completion. This allows us to pass in the timestamp and other data from the request which will be used by the IPA. Signed-off-by: Kieran Bingham --- src/libcamera/pipeline/ipu3/ipu3.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 5b15ca90..38f66919 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1285,6 +1285,7 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer) ev.op = ipa::ipu3::EventFillParams; ev.frame = info->id; ev.bufferId = info->paramBuffer->cookie(); + ev.controls = request->metadata(); ipa_->processEvent(ev); } @@ -1314,6 +1315,8 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer) if (!info) return; + Request *request = info->request; + if (buffer->metadata().status == FrameMetadata::FrameCancelled) { info->metadataProcessed = true; @@ -1321,7 +1324,6 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer) * tryComplete() will delete info if it completes the IPU3Frame. * In that event, we must have obtained the Request before hand. */ - Request *request = info->request; if (frameInfos_.tryComplete(info)) pipe_->completeRequest(request); @@ -1333,6 +1335,7 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer) ev.op = ipa::ipu3::EventStatReady; ev.frame = info->id; ev.bufferId = info->statBuffer->cookie(); + ev.controls = request->metadata(); ipa_->processEvent(ev); }