[v2,5/7] ipa: rkisp1: Add debug metadata support to the rkisp1
diff mbox series

Message ID 20241007095425.211158-6-stefan.klug@ideasonboard.com
State Superseded
Headers show
Series
  • Add support for IPA debugging metadata
Related show

Commit Message

Stefan Klug Oct. 7, 2024, 9:54 a.m. UTC
Add a DebugMetadata helper to the context and add the corresponding
plumbing.  This is all that is needed to support debug metadata in an
IPA.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

---
Changes in v2:
- Replace DebugMetadata::assignList by DebugMetadata::moveEntries
---
 src/ipa/rkisp1/ipa_context.h | 5 +++++
 src/ipa/rkisp1/rkisp1.cpp    | 3 +++
 2 files changed, 8 insertions(+)

Comments

Laurent Pinchart Oct. 7, 2024, 10:15 p.m. UTC | #1
On Mon, Oct 07, 2024 at 11:54:09AM +0200, Stefan Klug wrote:
> Add a DebugMetadata helper to the context and add the corresponding
> plumbing.  This is all that is needed to support debug metadata in an
> IPA.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> 
> ---
> Changes in v2:
> - Replace DebugMetadata::assignList by DebugMetadata::moveEntries
> ---
>  src/ipa/rkisp1/ipa_context.h | 5 +++++
>  src/ipa/rkisp1/rkisp1.cpp    | 3 +++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
> index d52e73ad2503..7b93a9e9461d 100644
> --- a/src/ipa/rkisp1/ipa_context.h
> +++ b/src/ipa/rkisp1/ipa_context.h
> @@ -17,8 +17,11 @@
>  #include <libcamera/control_ids.h>
>  #include <libcamera/controls.h>
>  #include <libcamera/geometry.h>
> +
>  #include <libcamera/ipa/core_ipa_interface.h>
>  
> +#include "libcamera/internal/debug_controls.h"
> +
>  #include <libipa/camera_sensor_helper.h>
>  #include <libipa/fc_queue.h>
>  #include <libipa/matrix.h>
> @@ -194,6 +197,8 @@ struct IPAContext {
>  
>  	ControlInfoMap::Map ctrlMap;
>  
> +	DebugMetadata debugMetadata;
> +
>  	/* Interface to the Camera Helper */
>  	std::unique_ptr<CameraSensorHelper> camHelper;
>  };
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index a579f21de56f..b96141aabf0f 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -117,6 +117,7 @@ const IPAHwSettings ipaHwSettingsV12{
>  const ControlInfoMap::Map rkisp1Controls{
>  	{ &controls::AwbEnable, ControlInfo(false, true) },
>  	{ &controls::ColourGains, ControlInfo(0.0f, 3.996f, 1.0f) },
> +	{ &controls::DebugMetadataEnable, ControlInfo(false, true, false) },
>  	{ &controls::Sharpness, ControlInfo(0.0f, 10.0f, 1.0f) },
>  	{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },
>  };
> @@ -326,6 +327,7 @@ void IPARkISP1::unmapBuffers(const std::vector<unsigned int> &ids)
>  void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls)
>  {
>  	IPAFrameContext &frameContext = context_.frameContexts.alloc(frame);
> +	context_.debugMetadata.checkForEnable(controls);
>  
>  	for (auto const &a : algorithms()) {
>  		Algorithm *algo = static_cast<Algorithm *>(a.get());
> @@ -377,6 +379,7 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId
>  	}
>  
>  	setControls(frame);
> +	context_.debugMetadata.moveEntries(metadata);
>  
>  	metadataReady.emit(frame, metadata);

Nitpicking, I'd write

	setControls(frame);

	context_.debugMetadata.moveEntries(metadata);
	metadataReady.emit(frame, metadata);

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  }

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
index d52e73ad2503..7b93a9e9461d 100644
--- a/src/ipa/rkisp1/ipa_context.h
+++ b/src/ipa/rkisp1/ipa_context.h
@@ -17,8 +17,11 @@ 
 #include <libcamera/control_ids.h>
 #include <libcamera/controls.h>
 #include <libcamera/geometry.h>
+
 #include <libcamera/ipa/core_ipa_interface.h>
 
+#include "libcamera/internal/debug_controls.h"
+
 #include <libipa/camera_sensor_helper.h>
 #include <libipa/fc_queue.h>
 #include <libipa/matrix.h>
@@ -194,6 +197,8 @@  struct IPAContext {
 
 	ControlInfoMap::Map ctrlMap;
 
+	DebugMetadata debugMetadata;
+
 	/* Interface to the Camera Helper */
 	std::unique_ptr<CameraSensorHelper> camHelper;
 };
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index a579f21de56f..b96141aabf0f 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -117,6 +117,7 @@  const IPAHwSettings ipaHwSettingsV12{
 const ControlInfoMap::Map rkisp1Controls{
 	{ &controls::AwbEnable, ControlInfo(false, true) },
 	{ &controls::ColourGains, ControlInfo(0.0f, 3.996f, 1.0f) },
+	{ &controls::DebugMetadataEnable, ControlInfo(false, true, false) },
 	{ &controls::Sharpness, ControlInfo(0.0f, 10.0f, 1.0f) },
 	{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },
 };
@@ -326,6 +327,7 @@  void IPARkISP1::unmapBuffers(const std::vector<unsigned int> &ids)
 void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls)
 {
 	IPAFrameContext &frameContext = context_.frameContexts.alloc(frame);
+	context_.debugMetadata.checkForEnable(controls);
 
 	for (auto const &a : algorithms()) {
 		Algorithm *algo = static_cast<Algorithm *>(a.get());
@@ -377,6 +379,7 @@  void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId
 	}
 
 	setControls(frame);
+	context_.debugMetadata.moveEntries(metadata);
 
 	metadataReady.emit(frame, metadata);
 }