[v1,4/8] ipa: rkisp1: Add constructor to the ipa context
diff mbox series

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

Commit Message

Stefan Klug Oct. 2, 2024, 4:19 p.m. UTC
Initialization using the initializer list is cumbersome and requires
modifications to the list whenever the context is modified. Fix that by
adding a proper constructor to the context.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 src/ipa/rkisp1/ipa_context.h | 5 +++++
 src/ipa/rkisp1/rkisp1.cpp    | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Oct. 3, 2024, 4:37 p.m. UTC | #1
Hi Stefan,

Thank you for the patch.

On Wed, Oct 02, 2024 at 06:19:22PM +0200, Stefan Klug wrote:
> Initialization using the initializer list is cumbersome and requires
> modifications to the list whenever the context is modified. Fix that by
> adding a proper constructor to the context.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> ---
>  src/ipa/rkisp1/ipa_context.h | 5 +++++
>  src/ipa/rkisp1/rkisp1.cpp    | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
> index e274d9b01e1c..d52e73ad2503 100644
> --- a/src/ipa/rkisp1/ipa_context.h
> +++ b/src/ipa/rkisp1/ipa_context.h
> @@ -180,6 +180,11 @@ struct IPAFrameContext : public FrameContext {
>  };
>  
>  struct IPAContext {
> +	IPAContext(unsigned int frameContextSize)
> +		: hw(nullptr), frameContexts(frameContextSize)
> +	{
> +	}
> +
>  	const IPAHwSettings *hw;
>  	IPACameraSensorInfo sensorInfo;
>  	IPASessionConfiguration configuration;
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 9e161cabdea4..a579f21de56f 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -124,7 +124,7 @@ const ControlInfoMap::Map rkisp1Controls{
>  } /* namespace */
>  
>  IPARkISP1::IPARkISP1()
> -	: context_({ {}, {}, {}, {}, { kMaxFrameContexts }, {}, {} })
> +	: context_(kMaxFrameContexts)

This looks nicer indeed.

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

>  {
>  }
>
Kieran Bingham Oct. 3, 2024, 11:07 p.m. UTC | #2
Quoting Laurent Pinchart (2024-10-03 17:37:46)
> Hi Stefan,
> 
> Thank you for the patch.
> 
> On Wed, Oct 02, 2024 at 06:19:22PM +0200, Stefan Klug wrote:
> > Initialization using the initializer list is cumbersome and requires
> > modifications to the list whenever the context is modified. Fix that by
> > adding a proper constructor to the context.
> > 
> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> > ---
> >  src/ipa/rkisp1/ipa_context.h | 5 +++++
> >  src/ipa/rkisp1/rkisp1.cpp    | 2 +-
> >  2 files changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
> > index e274d9b01e1c..d52e73ad2503 100644
> > --- a/src/ipa/rkisp1/ipa_context.h
> > +++ b/src/ipa/rkisp1/ipa_context.h
> > @@ -180,6 +180,11 @@ struct IPAFrameContext : public FrameContext {
> >  };
> >  
> >  struct IPAContext {
> > +     IPAContext(unsigned int frameContextSize)
> > +             : hw(nullptr), frameContexts(frameContextSize)
> > +     {
> > +     }
> > +
> >       const IPAHwSettings *hw;
> >       IPACameraSensorInfo sensorInfo;
> >       IPASessionConfiguration configuration;
> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> > index 9e161cabdea4..a579f21de56f 100644
> > --- a/src/ipa/rkisp1/rkisp1.cpp
> > +++ b/src/ipa/rkisp1/rkisp1.cpp
> > @@ -124,7 +124,7 @@ const ControlInfoMap::Map rkisp1Controls{
> >  } /* namespace */
> >  
> >  IPARkISP1::IPARkISP1()
> > -     : context_({ {}, {}, {}, {}, { kMaxFrameContexts }, {}, {} })
> > +     : context_(kMaxFrameContexts)
> 
> This looks nicer indeed.

Very much indeed.

Would it be a lot to ask if we could get a drive by update to do the
same fix for the IPU3, and Simple pipeline handlers ?

It could always still be done separately though.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> >  {
> >  }
> >  
> 
> -- 
> Regards,
> 
> Laurent Pinchart

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
index e274d9b01e1c..d52e73ad2503 100644
--- a/src/ipa/rkisp1/ipa_context.h
+++ b/src/ipa/rkisp1/ipa_context.h
@@ -180,6 +180,11 @@  struct IPAFrameContext : public FrameContext {
 };
 
 struct IPAContext {
+	IPAContext(unsigned int frameContextSize)
+		: hw(nullptr), frameContexts(frameContextSize)
+	{
+	}
+
 	const IPAHwSettings *hw;
 	IPACameraSensorInfo sensorInfo;
 	IPASessionConfiguration configuration;
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 9e161cabdea4..a579f21de56f 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -124,7 +124,7 @@  const ControlInfoMap::Map rkisp1Controls{
 } /* namespace */
 
 IPARkISP1::IPARkISP1()
-	: context_({ {}, {}, {}, {}, { kMaxFrameContexts }, {}, {} })
+	: context_(kMaxFrameContexts)
 {
 }