[libcamera-devel,v2,07/10] ipa: rkisp1: Convert to use the FCQueue
diff mbox series

Message ID 20220805135312.47497-8-jacopo@jmondi.org
State Accepted
Headers show
Series
  • libcamera: Align IPU3 and RKISP1 interfaces
Related show

Commit Message

Jacopo Mondi Aug. 5, 2022, 1:53 p.m. UTC
From: Kieran Bingham via libcamera-devel <libcamera-devel@lists.libcamera.org>

Establish a queue of FrameContexts using the new FCQueue and use it to
supply the FrameContext to the algorithms.

The algorithms on the RKISP1 do not use this yet themselves, but are
able to do so after the introduction of this patch.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/ipa/rkisp1/ipa_context.h | 2 ++
 src/ipa/rkisp1/rkisp1.cpp    | 6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Umang Jain Aug. 11, 2022, 6:45 a.m. UTC | #1
Hi Jacopo,

Thank you for the patch

On 8/5/22 19:23, Jacopo Mondi via libcamera-devel wrote:
> From: Kieran Bingham via libcamera-devel <libcamera-devel@lists.libcamera.org>
>
> Establish a queue of FrameContexts using the new FCQueue and use it to
> supply the FrameContext to the algorithms.
>
> The algorithms on the RKISP1 do not use this yet themselves, but are
> able to do so after the introduction of this patch.
>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>


Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   src/ipa/rkisp1/ipa_context.h | 2 ++
>   src/ipa/rkisp1/rkisp1.cpp    | 6 +++---
>   2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
> index c42bcd73b314..dd756f4025d1 100644
> --- a/src/ipa/rkisp1/ipa_context.h
> +++ b/src/ipa/rkisp1/ipa_context.h
> @@ -86,6 +86,8 @@ struct RKISP1FrameContext : public IPAFrameContext {
>   struct IPAContext {
>   	IPASessionConfiguration configuration;
>   	IPAActiveState activeState;
> +
> +	FCQueue<RKISP1FrameContext> frameContexts;
>   };
>   
>   } /* namespace ipa::rkisp1 */
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index a2483f27cf52..2c7fdde55f49 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -192,6 +192,7 @@ int IPARkISP1::start()
>   void IPARkISP1::stop()
>   {
>   	/* Clean the IPA context at the end of the streaming session. */
> +	context_.frameContexts.clear();
>   	context_ = {};
>   }
>   
> @@ -318,6 +319,8 @@ void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
>   void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,
>   				   const ControlList &sensorControls)
>   {
> +	RKISP1FrameContext &frameContext = context_.frameContexts.get(frame);
> +
>   	const rkisp1_stat_buffer *stats =
>   		reinterpret_cast<rkisp1_stat_buffer *>(
>   			mappedBuffers_.at(bufferId).planes()[0].data());
> @@ -329,9 +332,6 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId
>   
>   	unsigned int aeState = 0;
>   
> -	/* \todo Obtain the frame context to pass to process from the FCQueue */
> -	RKISP1FrameContext frameContext;
> -
>   	for (auto const &algo : algorithms())
>   		algo->process(context_, frameContext, stats);
>

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
index c42bcd73b314..dd756f4025d1 100644
--- a/src/ipa/rkisp1/ipa_context.h
+++ b/src/ipa/rkisp1/ipa_context.h
@@ -86,6 +86,8 @@  struct RKISP1FrameContext : public IPAFrameContext {
 struct IPAContext {
 	IPASessionConfiguration configuration;
 	IPAActiveState activeState;
+
+	FCQueue<RKISP1FrameContext> frameContexts;
 };
 
 } /* namespace ipa::rkisp1 */
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index a2483f27cf52..2c7fdde55f49 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -192,6 +192,7 @@  int IPARkISP1::start()
 void IPARkISP1::stop()
 {
 	/* Clean the IPA context at the end of the streaming session. */
+	context_.frameContexts.clear();
 	context_ = {};
 }
 
@@ -318,6 +319,8 @@  void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
 void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,
 				   const ControlList &sensorControls)
 {
+	RKISP1FrameContext &frameContext = context_.frameContexts.get(frame);
+
 	const rkisp1_stat_buffer *stats =
 		reinterpret_cast<rkisp1_stat_buffer *>(
 			mappedBuffers_.at(bufferId).planes()[0].data());
@@ -329,9 +332,6 @@  void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId
 
 	unsigned int aeState = 0;
 
-	/* \todo Obtain the frame context to pass to process from the FCQueue */
-	RKISP1FrameContext frameContext;
-
 	for (auto const &algo : algorithms())
 		algo->process(context_, frameContext, stats);