[libcamera-devel] libcamera: pipeline: vimc: Fail without an IPA
diff mbox series

Message ID 20210616095610.3593281-1-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel] libcamera: pipeline: vimc: Fail without an IPA
Related show

Commit Message

Kieran Bingham June 16, 2021, 9:56 a.m. UTC
Registering a camera for VIMC without an IPA will fail later when
attempting to configure.

The IPA is required for VIMC so fail early if it can't be loaded.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/pipeline/vimc/vimc.cpp | 1 +
 1 file changed, 1 insertion(+)

Comments

Umang Jain June 16, 2021, 11:29 a.m. UTC | #1
Hi Kieran,

On 6/16/21 3:26 PM, Kieran Bingham wrote:
> Registering a camera for VIMC without an IPA will fail later when
> attempting to configure.
>
> The IPA is required for VIMC so fail early if it can't be loaded.
>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>   src/libcamera/pipeline/vimc/vimc.cpp | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
> index 9ebd723be171..8af0e92012e6 100644
> --- a/src/libcamera/pipeline/vimc/vimc.cpp
> +++ b/src/libcamera/pipeline/vimc/vimc.cpp
> @@ -431,6 +431,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
>   		data->ipa_->init(IPASettings{ conf, data->sensor_->model() });
>   	} else {
>   		LOG(VIMC, Warning) << "no matching IPA found";
> +		return false;
     Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

>   	}
>   
>   	/* Create and register the camera. */
Laurent Pinchart June 16, 2021, 12:33 p.m. UTC | #2
Hi Kieran,

Thank you for the patch.

On Wed, Jun 16, 2021 at 10:56:10AM +0100, Kieran Bingham wrote:
> Registering a camera for VIMC without an IPA will fail later when
> attempting to configure.
> 
> The IPA is required for VIMC so fail early if it can't be loaded.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Assuming this doesn't break any unit test, the change looks good.

> ---
>  src/libcamera/pipeline/vimc/vimc.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
> index 9ebd723be171..8af0e92012e6 100644
> --- a/src/libcamera/pipeline/vimc/vimc.cpp
> +++ b/src/libcamera/pipeline/vimc/vimc.cpp
> @@ -431,6 +431,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
>  		data->ipa_->init(IPASettings{ conf, data->sensor_->model() });
>  	} else {
>  		LOG(VIMC, Warning) << "no matching IPA found";
> +		return false;
>  	}

I would have rewritten the code as

	if (!data->ipa_) {
		LOG(VIMC, Warning) << "no matching IPA found";
		return false;
	}

	std::string conf = data->ipa_->configurationFile("vimc.conf");
	data->ipa_->init(IPASettings{ conf, data->sensor_->model() });

and while at it, turned the message to an Error.

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

>  
>  	/* Create and register the camera. */
Kieran Bingham June 16, 2021, 2:33 p.m. UTC | #3
Hi Laurent,

On 16/06/2021 13:33, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Wed, Jun 16, 2021 at 10:56:10AM +0100, Kieran Bingham wrote:
>> Registering a camera for VIMC without an IPA will fail later when
>> attempting to configure.
>>
>> The IPA is required for VIMC so fail early if it can't be loaded.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> Assuming this doesn't break any unit test, the change looks good.
> 
>> ---
>>  src/libcamera/pipeline/vimc/vimc.cpp | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
>> index 9ebd723be171..8af0e92012e6 100644
>> --- a/src/libcamera/pipeline/vimc/vimc.cpp
>> +++ b/src/libcamera/pipeline/vimc/vimc.cpp
>> @@ -431,6 +431,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
>>  		data->ipa_->init(IPASettings{ conf, data->sensor_->model() });
>>  	} else {
>>  		LOG(VIMC, Warning) << "no matching IPA found";
>> +		return false;
>>  	}
> 
> I would have rewritten the code as
> 
> 	if (!data->ipa_) {
> 		LOG(VIMC, Warning) << "no matching IPA found";
> 		return false;
> 	}
> 
> 	std::string conf = data->ipa_->configurationFile("vimc.conf");
> 	data->ipa_->init(IPASettings{ conf, data->sensor_->model() });
> 
> and while at it, turned the message to an Error.


That's worth the update indeed.


> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>>  
>>  	/* Create and register the camera. */
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index 9ebd723be171..8af0e92012e6 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -431,6 +431,7 @@  bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
 		data->ipa_->init(IPASettings{ conf, data->sensor_->model() });
 	} else {
 		LOG(VIMC, Warning) << "no matching IPA found";
+		return false;
 	}
 
 	/* Create and register the camera. */