[libcamera-devel] ipa: ipu3: Move the IPA to the ipa::ipu3 namespace
diff mbox series

Message ID 20210416160411.68226-1-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel] ipa: ipu3: Move the IPA to the ipa::ipu3 namespace
Related show

Commit Message

Kieran Bingham April 16, 2021, 4:04 p.m. UTC
Simplify name-spacing of the IPU3 components by placing it in the
ipa::ipu3 namespace directly.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/ipa/ipu3/ipu3.cpp | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)

Comments

Jean-Michel Hautbois April 16, 2021, 7:40 p.m. UTC | #1
Hi Kieran,

Thanks for the patch !

On 16/04/2021 18:04, Kieran Bingham wrote:
> Simplify name-spacing of the IPU3 components by placing it in the
> ipa::ipu3 namespace directly.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>

> ---
>  src/ipa/ipu3/ipu3.cpp | 34 +++++++++++++++++++++-------------
>  1 file changed, 21 insertions(+), 13 deletions(-)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index 34a907f23ef5..edd325555b51 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -25,7 +25,11 @@ namespace libcamera {
>  
>  LOG_DEFINE_CATEGORY(IPAIPU3)
>  
> -class IPAIPU3 : public ipa::ipu3::IPAIPU3Interface
> +namespace ipa {
> +
> +namespace ipu3 {
> +
> +class IPAIPU3 : public IPAIPU3Interface
>  {
>  public:
>  	int init([[maybe_unused]] const IPASettings &settings) override
> @@ -40,7 +44,7 @@ public:
>  
>  	void mapBuffers(const std::vector<IPABuffer> &buffers) override;
>  	void unmapBuffers(const std::vector<unsigned int> &ids) override;
> -	void processEvent(const ipa::ipu3::IPU3Event &event) override;
> +	void processEvent(const IPU3Event &event) override;
>  
>  private:
>  	void processControls(unsigned int frame, const ControlList &controls);
> @@ -119,14 +123,14 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)
>  	}
>  }
>  
> -void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
> +void IPAIPU3::processEvent(const IPU3Event &event)
>  {
>  	switch (event.op) {
> -	case ipa::ipu3::EventProcessControls: {
> +	case EventProcessControls: {
>  		processControls(event.frame, event.controls);
>  		break;
>  	}
> -	case ipa::ipu3::EventStatReady: {
> +	case EventStatReady: {
>  		auto it = buffers_.find(event.bufferId);
>  		if (it == buffers_.end()) {
>  			LOG(IPAIPU3, Error) << "Could not find stats buffer!";
> @@ -140,7 +144,7 @@ void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
>  		parseStatistics(event.frame, stats);
>  		break;
>  	}
> -	case ipa::ipu3::EventFillParams: {
> +	case EventFillParams: {
>  		auto it = buffers_.find(event.bufferId);
>  		if (it == buffers_.end()) {
>  			LOG(IPAIPU3, Error) << "Could not find param buffer!";
> @@ -173,8 +177,8 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)
>  
>  	/* \todo Fill in parameters buffer. */
>  
> -	ipa::ipu3::IPU3Action op;
> -	op.op = ipa::ipu3::ActionParamFilled;
> +	IPU3Action op;
> +	op.op = ActionParamFilled;
>  
>  	queueFrameAction.emit(frame, op);
>  }
> @@ -187,8 +191,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>  	/* \todo React to statistics and update internal state machine. */
>  	/* \todo Add meta-data information to ctrls. */
>  
> -	ipa::ipu3::IPU3Action op;
> -	op.op = ipa::ipu3::ActionMetadataReady;
> +	IPU3Action op;
> +	op.op = ActionMetadataReady;
>  	op.controls = ctrls;
>  
>  	queueFrameAction.emit(frame, op);
> @@ -196,8 +200,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>  
>  void IPAIPU3::setControls(unsigned int frame)
>  {
> -	ipa::ipu3::IPU3Action op;
> -	op.op = ipa::ipu3::ActionSetSensorControls;
> +	IPU3Action op;
> +	op.op = ActionSetSensorControls;
>  
>  	ControlList ctrls(ctrls_);
>  	ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
> @@ -207,6 +211,10 @@ void IPAIPU3::setControls(unsigned int frame)
>  	queueFrameAction.emit(frame, op);
>  }
>  
> +} /* namespace ipu3 */
> +
> +} /* namespace ipa */
> +
>  /*
>   * External IPA module interface
>   */
> @@ -221,7 +229,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
>  
>  IPAInterface *ipaCreate()
>  {
> -	return new IPAIPU3();
> +	return new ipa::ipu3::IPAIPU3();
>  }
>  }
>  
>
Jean-Michel Hautbois April 16, 2021, 7:43 p.m. UTC | #2
JM, I think you missed a line ?

On 16/04/2021 21:40, Jean-Michel Hautbois wrote:
> Hi Kieran,
> 
> Thanks for the patch !
> 
> On 16/04/2021 18:04, Kieran Bingham wrote:
>> Simplify name-spacing of the IPU3 components by placing it in the
>> ipa::ipu3 namespace directly.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
>> ---
>>  src/ipa/ipu3/ipu3.cpp | 34 +++++++++++++++++++++-------------
>>  1 file changed, 21 insertions(+), 13 deletions(-)
>>
>> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
>> index 34a907f23ef5..edd325555b51 100644
>> --- a/src/ipa/ipu3/ipu3.cpp
>> +++ b/src/ipa/ipu3/ipu3.cpp
>> @@ -25,7 +25,11 @@ namespace libcamera {
>>  
>>  LOG_DEFINE_CATEGORY(IPAIPU3)
>>  
>> -class IPAIPU3 : public ipa::ipu3::IPAIPU3Interface
>> +namespace ipa {
>> +
>> +namespace ipu3 {
>> +
>> +class IPAIPU3 : public IPAIPU3Interface
>>  {
>>  public:
>>  	int init([[maybe_unused]] const IPASettings &settings) override
>> @@ -40,7 +44,7 @@ public:
>>  
>>  	void mapBuffers(const std::vector<IPABuffer> &buffers) override;
>>  	void unmapBuffers(const std::vector<unsigned int> &ids) override;
>> -	void processEvent(const ipa::ipu3::IPU3Event &event) override;
>> +	void processEvent(const IPU3Event &event) override;
>>  
>>  private:
>>  	void processControls(unsigned int frame, const ControlList &controls);
>> @@ -119,14 +123,14 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)
>>  	}
>>  }
>>  
>> -void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
>> +void IPAIPU3::processEvent(const IPU3Event &event)
>>  {
>>  	switch (event.op) {
>> -	case ipa::ipu3::EventProcessControls: {
>> +	case EventProcessControls: {
>>  		processControls(event.frame, event.controls);
>>  		break;
>>  	}
>> -	case ipa::ipu3::EventStatReady: {
>> +	case EventStatReady: {
>>  		auto it = buffers_.find(event.bufferId);
>>  		if (it == buffers_.end()) {
>>  			LOG(IPAIPU3, Error) << "Could not find stats buffer!";
>> @@ -140,7 +144,7 @@ void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
>>  		parseStatistics(event.frame, stats);
>>  		break;
>>  	}
>> -	case ipa::ipu3::EventFillParams: {
>> +	case EventFillParams: {
>>  		auto it = buffers_.find(event.bufferId);
>>  		if (it == buffers_.end()) {
>>  			LOG(IPAIPU3, Error) << "Could not find param buffer!";
>> @@ -173,8 +177,8 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)
>>  
>>  	/* \todo Fill in parameters buffer. */
>>  
>> -	ipa::ipu3::IPU3Action op;
>> -	op.op = ipa::ipu3::ActionParamFilled;
>> +	IPU3Action op;
>> +	op.op = ActionParamFilled;
>>  
>>  	queueFrameAction.emit(frame, op);
>>  }
>> @@ -187,8 +191,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>>  	/* \todo React to statistics and update internal state machine. */
>>  	/* \todo Add meta-data information to ctrls. */
>>  
>> -	ipa::ipu3::IPU3Action op;
>> -	op.op = ipa::ipu3::ActionMetadataReady;
>> +	IPU3Action op;
>> +	op.op = ActionMetadataReady;
>>  	op.controls = ctrls;
>>  
>>  	queueFrameAction.emit(frame, op);
>> @@ -196,8 +200,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>>  
>>  void IPAIPU3::setControls(unsigned int frame)
>>  {
>> -	ipa::ipu3::IPU3Action op;
>> -	op.op = ipa::ipu3::ActionSetSensorControls;
>> +	IPU3Action op;
>> +	op.op = ActionSetSensorControls;
>>  
>>  	ControlList ctrls(ctrls_);
>>  	ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
>> @@ -207,6 +211,10 @@ void IPAIPU3::setControls(unsigned int frame)
>>  	queueFrameAction.emit(frame, op);
>>  }
>>  
>> +} /* namespace ipu3 */
>> +
>> +} /* namespace ipa */
>> +
>>  /*
>>   * External IPA module interface
>>   */
>> @@ -221,7 +229,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
>>  
>>  IPAInterface *ipaCreate()
>>  {
>> -	return new IPAIPU3();
>> +	return new ipa::ipu3::IPAIPU3();
>>  }
>>  }
>>  
>>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>
Laurent Pinchart April 16, 2021, 10:14 p.m. UTC | #3
Hi Kieran,

Thank you for the patch.

On Fri, Apr 16, 2021 at 05:04:11PM +0100, Kieran Bingham wrote:
> Simplify name-spacing of the IPU3 components by placing it in the
> ipa::ipu3 namespace directly.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  src/ipa/ipu3/ipu3.cpp | 34 +++++++++++++++++++++-------------
>  1 file changed, 21 insertions(+), 13 deletions(-)
> 
> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
> index 34a907f23ef5..edd325555b51 100644
> --- a/src/ipa/ipu3/ipu3.cpp
> +++ b/src/ipa/ipu3/ipu3.cpp
> @@ -25,7 +25,11 @@ namespace libcamera {
>  
>  LOG_DEFINE_CATEGORY(IPAIPU3)
>  
> -class IPAIPU3 : public ipa::ipu3::IPAIPU3Interface
> +namespace ipa {
> +
> +namespace ipu3 {

I think you can write this

namespace ipa::ipu3 {

in C++17.

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

> +
> +class IPAIPU3 : public IPAIPU3Interface
>  {
>  public:
>  	int init([[maybe_unused]] const IPASettings &settings) override
> @@ -40,7 +44,7 @@ public:
>  
>  	void mapBuffers(const std::vector<IPABuffer> &buffers) override;
>  	void unmapBuffers(const std::vector<unsigned int> &ids) override;
> -	void processEvent(const ipa::ipu3::IPU3Event &event) override;
> +	void processEvent(const IPU3Event &event) override;
>  
>  private:
>  	void processControls(unsigned int frame, const ControlList &controls);
> @@ -119,14 +123,14 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)
>  	}
>  }
>  
> -void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
> +void IPAIPU3::processEvent(const IPU3Event &event)
>  {
>  	switch (event.op) {
> -	case ipa::ipu3::EventProcessControls: {
> +	case EventProcessControls: {
>  		processControls(event.frame, event.controls);
>  		break;
>  	}
> -	case ipa::ipu3::EventStatReady: {
> +	case EventStatReady: {
>  		auto it = buffers_.find(event.bufferId);
>  		if (it == buffers_.end()) {
>  			LOG(IPAIPU3, Error) << "Could not find stats buffer!";
> @@ -140,7 +144,7 @@ void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
>  		parseStatistics(event.frame, stats);
>  		break;
>  	}
> -	case ipa::ipu3::EventFillParams: {
> +	case EventFillParams: {
>  		auto it = buffers_.find(event.bufferId);
>  		if (it == buffers_.end()) {
>  			LOG(IPAIPU3, Error) << "Could not find param buffer!";
> @@ -173,8 +177,8 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)
>  
>  	/* \todo Fill in parameters buffer. */
>  
> -	ipa::ipu3::IPU3Action op;
> -	op.op = ipa::ipu3::ActionParamFilled;
> +	IPU3Action op;
> +	op.op = ActionParamFilled;
>  
>  	queueFrameAction.emit(frame, op);
>  }
> @@ -187,8 +191,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>  	/* \todo React to statistics and update internal state machine. */
>  	/* \todo Add meta-data information to ctrls. */
>  
> -	ipa::ipu3::IPU3Action op;
> -	op.op = ipa::ipu3::ActionMetadataReady;
> +	IPU3Action op;
> +	op.op = ActionMetadataReady;
>  	op.controls = ctrls;
>  
>  	queueFrameAction.emit(frame, op);
> @@ -196,8 +200,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>  
>  void IPAIPU3::setControls(unsigned int frame)
>  {
> -	ipa::ipu3::IPU3Action op;
> -	op.op = ipa::ipu3::ActionSetSensorControls;
> +	IPU3Action op;
> +	op.op = ActionSetSensorControls;
>  
>  	ControlList ctrls(ctrls_);
>  	ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
> @@ -207,6 +211,10 @@ void IPAIPU3::setControls(unsigned int frame)
>  	queueFrameAction.emit(frame, op);
>  }
>  
> +} /* namespace ipu3 */
> +
> +} /* namespace ipa */
> +
>  /*
>   * External IPA module interface
>   */
> @@ -221,7 +229,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
>  
>  IPAInterface *ipaCreate()
>  {
> -	return new IPAIPU3();
> +	return new ipa::ipu3::IPAIPU3();
>  }
>  }
>
Kieran Bingham April 16, 2021, 10:25 p.m. UTC | #4
Hi Laurent,

On 16/04/2021 23:14, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Fri, Apr 16, 2021 at 05:04:11PM +0100, Kieran Bingham wrote:
>> Simplify name-spacing of the IPU3 components by placing it in the
>> ipa::ipu3 namespace directly.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>> ---
>>  src/ipa/ipu3/ipu3.cpp | 34 +++++++++++++++++++++-------------
>>  1 file changed, 21 insertions(+), 13 deletions(-)
>>
>> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
>> index 34a907f23ef5..edd325555b51 100644
>> --- a/src/ipa/ipu3/ipu3.cpp
>> +++ b/src/ipa/ipu3/ipu3.cpp
>> @@ -25,7 +25,11 @@ namespace libcamera {
>>  
>>  LOG_DEFINE_CATEGORY(IPAIPU3)
>>  
>> -class IPAIPU3 : public ipa::ipu3::IPAIPU3Interface
>> +namespace ipa {
>> +
>> +namespace ipu3 {
> 
> I think you can write this
> 
> namespace ipa::ipu3 {
> 

Ah yes, and I've tried to move towards that in other (internal) places
too, so I've missed this one.

I think it's better, so I'll update it.
--
Kieran


> in C++17.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> +
>> +class IPAIPU3 : public IPAIPU3Interface
>>  {
>>  public:
>>  	int init([[maybe_unused]] const IPASettings &settings) override
>> @@ -40,7 +44,7 @@ public:
>>  
>>  	void mapBuffers(const std::vector<IPABuffer> &buffers) override;
>>  	void unmapBuffers(const std::vector<unsigned int> &ids) override;
>> -	void processEvent(const ipa::ipu3::IPU3Event &event) override;
>> +	void processEvent(const IPU3Event &event) override;
>>  
>>  private:
>>  	void processControls(unsigned int frame, const ControlList &controls);
>> @@ -119,14 +123,14 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)
>>  	}
>>  }
>>  
>> -void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
>> +void IPAIPU3::processEvent(const IPU3Event &event)
>>  {
>>  	switch (event.op) {
>> -	case ipa::ipu3::EventProcessControls: {
>> +	case EventProcessControls: {
>>  		processControls(event.frame, event.controls);
>>  		break;
>>  	}
>> -	case ipa::ipu3::EventStatReady: {
>> +	case EventStatReady: {
>>  		auto it = buffers_.find(event.bufferId);
>>  		if (it == buffers_.end()) {
>>  			LOG(IPAIPU3, Error) << "Could not find stats buffer!";
>> @@ -140,7 +144,7 @@ void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
>>  		parseStatistics(event.frame, stats);
>>  		break;
>>  	}
>> -	case ipa::ipu3::EventFillParams: {
>> +	case EventFillParams: {
>>  		auto it = buffers_.find(event.bufferId);
>>  		if (it == buffers_.end()) {
>>  			LOG(IPAIPU3, Error) << "Could not find param buffer!";
>> @@ -173,8 +177,8 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)
>>  
>>  	/* \todo Fill in parameters buffer. */
>>  
>> -	ipa::ipu3::IPU3Action op;
>> -	op.op = ipa::ipu3::ActionParamFilled;
>> +	IPU3Action op;
>> +	op.op = ActionParamFilled;
>>  
>>  	queueFrameAction.emit(frame, op);
>>  }
>> @@ -187,8 +191,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>>  	/* \todo React to statistics and update internal state machine. */
>>  	/* \todo Add meta-data information to ctrls. */
>>  
>> -	ipa::ipu3::IPU3Action op;
>> -	op.op = ipa::ipu3::ActionMetadataReady;
>> +	IPU3Action op;
>> +	op.op = ActionMetadataReady;
>>  	op.controls = ctrls;
>>  
>>  	queueFrameAction.emit(frame, op);
>> @@ -196,8 +200,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>>  
>>  void IPAIPU3::setControls(unsigned int frame)
>>  {
>> -	ipa::ipu3::IPU3Action op;
>> -	op.op = ipa::ipu3::ActionSetSensorControls;
>> +	IPU3Action op;
>> +	op.op = ActionSetSensorControls;
>>  
>>  	ControlList ctrls(ctrls_);
>>  	ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
>> @@ -207,6 +211,10 @@ void IPAIPU3::setControls(unsigned int frame)
>>  	queueFrameAction.emit(frame, op);
>>  }
>>  
>> +} /* namespace ipu3 */
>> +
>> +} /* namespace ipa */
>> +
>>  /*
>>   * External IPA module interface
>>   */
>> @@ -221,7 +229,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
>>  
>>  IPAInterface *ipaCreate()
>>  {
>> -	return new IPAIPU3();
>> +	return new ipa::ipu3::IPAIPU3();
>>  }
>>  }
>>  
>
Umang Jain April 19, 2021, 8:01 a.m. UTC | #5
On 4/17/21 3:55 AM, Kieran Bingham wrote:
> Hi Laurent,
>
> On 16/04/2021 23:14, Laurent Pinchart wrote:
>> Hi Kieran,
>>
>> Thank you for the patch.
>>
>> On Fri, Apr 16, 2021 at 05:04:11PM +0100, Kieran Bingham wrote:
>>> Simplify name-spacing of the IPU3 components by placing it in the
>>> ipa::ipu3 namespace directly.
>>>
>>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>>> ---
>>>   src/ipa/ipu3/ipu3.cpp | 34 +++++++++++++++++++++-------------
>>>   1 file changed, 21 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
>>> index 34a907f23ef5..edd325555b51 100644
>>> --- a/src/ipa/ipu3/ipu3.cpp
>>> +++ b/src/ipa/ipu3/ipu3.cpp
>>> @@ -25,7 +25,11 @@ namespace libcamera {
>>>   
>>>   LOG_DEFINE_CATEGORY(IPAIPU3)
>>>   
>>> -class IPAIPU3 : public ipa::ipu3::IPAIPU3Interface
>>> +namespace ipa {
>>> +
>>> +namespace ipu3 {
>> I think you can write this
>>
>> namespace ipa::ipu3 {
>>
> Ah yes, and I've tried to move towards that in other (internal) places
> too, so I've missed this one.
>
> I think it's better, so I'll update it.
yes, I was about to ask you the namespacing style is going a bit 
different for our different components. But it's already noticed, cool

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> --
> Kieran
>
>
>> in C++17.
>>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>
>>> +
>>> +class IPAIPU3 : public IPAIPU3Interface
>>>   {
>>>   public:
>>>   	int init([[maybe_unused]] const IPASettings &settings) override
>>> @@ -40,7 +44,7 @@ public:
>>>   
>>>   	void mapBuffers(const std::vector<IPABuffer> &buffers) override;
>>>   	void unmapBuffers(const std::vector<unsigned int> &ids) override;
>>> -	void processEvent(const ipa::ipu3::IPU3Event &event) override;
>>> +	void processEvent(const IPU3Event &event) override;
>>>   
>>>   private:
>>>   	void processControls(unsigned int frame, const ControlList &controls);
>>> @@ -119,14 +123,14 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)
>>>   	}
>>>   }
>>>   
>>> -void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
>>> +void IPAIPU3::processEvent(const IPU3Event &event)
>>>   {
>>>   	switch (event.op) {
>>> -	case ipa::ipu3::EventProcessControls: {
>>> +	case EventProcessControls: {
>>>   		processControls(event.frame, event.controls);
>>>   		break;
>>>   	}
>>> -	case ipa::ipu3::EventStatReady: {
>>> +	case EventStatReady: {
>>>   		auto it = buffers_.find(event.bufferId);
>>>   		if (it == buffers_.end()) {
>>>   			LOG(IPAIPU3, Error) << "Could not find stats buffer!";
>>> @@ -140,7 +144,7 @@ void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
>>>   		parseStatistics(event.frame, stats);
>>>   		break;
>>>   	}
>>> -	case ipa::ipu3::EventFillParams: {
>>> +	case EventFillParams: {
>>>   		auto it = buffers_.find(event.bufferId);
>>>   		if (it == buffers_.end()) {
>>>   			LOG(IPAIPU3, Error) << "Could not find param buffer!";
>>> @@ -173,8 +177,8 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)
>>>   
>>>   	/* \todo Fill in parameters buffer. */
>>>   
>>> -	ipa::ipu3::IPU3Action op;
>>> -	op.op = ipa::ipu3::ActionParamFilled;
>>> +	IPU3Action op;
>>> +	op.op = ActionParamFilled;
>>>   
>>>   	queueFrameAction.emit(frame, op);
>>>   }
>>> @@ -187,8 +191,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>>>   	/* \todo React to statistics and update internal state machine. */
>>>   	/* \todo Add meta-data information to ctrls. */
>>>   
>>> -	ipa::ipu3::IPU3Action op;
>>> -	op.op = ipa::ipu3::ActionMetadataReady;
>>> +	IPU3Action op;
>>> +	op.op = ActionMetadataReady;
>>>   	op.controls = ctrls;
>>>   
>>>   	queueFrameAction.emit(frame, op);
>>> @@ -196,8 +200,8 @@ void IPAIPU3::parseStatistics(unsigned int frame,
>>>   
>>>   void IPAIPU3::setControls(unsigned int frame)
>>>   {
>>> -	ipa::ipu3::IPU3Action op;
>>> -	op.op = ipa::ipu3::ActionSetSensorControls;
>>> +	IPU3Action op;
>>> +	op.op = ActionSetSensorControls;
>>>   
>>>   	ControlList ctrls(ctrls_);
>>>   	ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
>>> @@ -207,6 +211,10 @@ void IPAIPU3::setControls(unsigned int frame)
>>>   	queueFrameAction.emit(frame, op);
>>>   }
>>>   
>>> +} /* namespace ipu3 */
>>> +
>>> +} /* namespace ipa */
>>> +
>>>   /*
>>>    * External IPA module interface
>>>    */
>>> @@ -221,7 +229,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
>>>   
>>>   IPAInterface *ipaCreate()
>>>   {
>>> -	return new IPAIPU3();
>>> +	return new ipa::ipu3::IPAIPU3();
>>>   }
>>>   }
>>>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 34a907f23ef5..edd325555b51 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -25,7 +25,11 @@  namespace libcamera {
 
 LOG_DEFINE_CATEGORY(IPAIPU3)
 
-class IPAIPU3 : public ipa::ipu3::IPAIPU3Interface
+namespace ipa {
+
+namespace ipu3 {
+
+class IPAIPU3 : public IPAIPU3Interface
 {
 public:
 	int init([[maybe_unused]] const IPASettings &settings) override
@@ -40,7 +44,7 @@  public:
 
 	void mapBuffers(const std::vector<IPABuffer> &buffers) override;
 	void unmapBuffers(const std::vector<unsigned int> &ids) override;
-	void processEvent(const ipa::ipu3::IPU3Event &event) override;
+	void processEvent(const IPU3Event &event) override;
 
 private:
 	void processControls(unsigned int frame, const ControlList &controls);
@@ -119,14 +123,14 @@  void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)
 	}
 }
 
-void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
+void IPAIPU3::processEvent(const IPU3Event &event)
 {
 	switch (event.op) {
-	case ipa::ipu3::EventProcessControls: {
+	case EventProcessControls: {
 		processControls(event.frame, event.controls);
 		break;
 	}
-	case ipa::ipu3::EventStatReady: {
+	case EventStatReady: {
 		auto it = buffers_.find(event.bufferId);
 		if (it == buffers_.end()) {
 			LOG(IPAIPU3, Error) << "Could not find stats buffer!";
@@ -140,7 +144,7 @@  void IPAIPU3::processEvent(const ipa::ipu3::IPU3Event &event)
 		parseStatistics(event.frame, stats);
 		break;
 	}
-	case ipa::ipu3::EventFillParams: {
+	case EventFillParams: {
 		auto it = buffers_.find(event.bufferId);
 		if (it == buffers_.end()) {
 			LOG(IPAIPU3, Error) << "Could not find param buffer!";
@@ -173,8 +177,8 @@  void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)
 
 	/* \todo Fill in parameters buffer. */
 
-	ipa::ipu3::IPU3Action op;
-	op.op = ipa::ipu3::ActionParamFilled;
+	IPU3Action op;
+	op.op = ActionParamFilled;
 
 	queueFrameAction.emit(frame, op);
 }
@@ -187,8 +191,8 @@  void IPAIPU3::parseStatistics(unsigned int frame,
 	/* \todo React to statistics and update internal state machine. */
 	/* \todo Add meta-data information to ctrls. */
 
-	ipa::ipu3::IPU3Action op;
-	op.op = ipa::ipu3::ActionMetadataReady;
+	IPU3Action op;
+	op.op = ActionMetadataReady;
 	op.controls = ctrls;
 
 	queueFrameAction.emit(frame, op);
@@ -196,8 +200,8 @@  void IPAIPU3::parseStatistics(unsigned int frame,
 
 void IPAIPU3::setControls(unsigned int frame)
 {
-	ipa::ipu3::IPU3Action op;
-	op.op = ipa::ipu3::ActionSetSensorControls;
+	IPU3Action op;
+	op.op = ActionSetSensorControls;
 
 	ControlList ctrls(ctrls_);
 	ctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));
@@ -207,6 +211,10 @@  void IPAIPU3::setControls(unsigned int frame)
 	queueFrameAction.emit(frame, op);
 }
 
+} /* namespace ipu3 */
+
+} /* namespace ipa */
+
 /*
  * External IPA module interface
  */
@@ -221,7 +229,7 @@  const struct IPAModuleInfo ipaModuleInfo = {
 
 IPAInterface *ipaCreate()
 {
-	return new IPAIPU3();
+	return new ipa::ipu3::IPAIPU3();
 }
 }