[libcamera-devel,2/2] libcamera: pipeline: simple: try next mbus code if setupFormats() fails

Message ID 20200421203954.15585-3-andrey.konovalov@linaro.org
State Accepted
Headers show
Series
  • Simple pipeline: skip broken pipeline configurations
Related show

Commit Message

Andrey Konovalov April 21, 2020, 8:39 p.m. UTC
Now SimpleCameraData::setupFormats() can fail if the camera sensor
supports media bus code which some entities down the pipeline don't.

When this happens continue with the next media bus code instead of aborting
the enumeration of the possible pipeline configurations.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
---
 src/libcamera/pipeline/simple/simple.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart June 28, 2020, 9:55 a.m. UTC | #1
Hi Andrey,

Thank you for the patch.

On Tue, Apr 21, 2020 at 11:39:54PM +0300, Andrey Konovalov wrote:
> Now SimpleCameraData::setupFormats() can fail if the camera sensor
> supports media bus code which some entities down the pipeline don't.
> 
> When this happens continue with the next media bus code instead of aborting
> the enumeration of the possible pipeline configurations.
> 
> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
> ---
>  src/libcamera/pipeline/simple/simple.cpp | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
> index 8212bd9..1a31e18 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -265,10 +265,11 @@ int SimpleCameraData::init()
>  
>  		ret = setupFormats(&format, V4L2Subdevice::TryFormat);
>  		if (ret < 0) {
> -			LOG(SimplePipeline, Error)
> +			LOG(SimplePipeline, Warning)
>  				<< "Failed to setup pipeline for media bus code "
>  				<< utils::hex(code, 4);

Should we downgrade this to a debug message to avoid worrying the user
when all goes well ? Or maybe an info message to still give a hint that
something may be wrong ? And how about also making the message less
scary ?

				<< "Media bus code " << utils::hex(code, 4)
				<< " not supported for this pipeline";

If you're fine with these changes I can fix when applying.

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

> -			return ret;
> +			/* Try next mbus_code supported by the sensor */
> +			continue;
>  		}
>  
>  		std::map<V4L2PixelFormat, std::vector<SizeRange>> videoFormats =

Patch

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 8212bd9..1a31e18 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -265,10 +265,11 @@  int SimpleCameraData::init()
 
 		ret = setupFormats(&format, V4L2Subdevice::TryFormat);
 		if (ret < 0) {
-			LOG(SimplePipeline, Error)
+			LOG(SimplePipeline, Warning)
 				<< "Failed to setup pipeline for media bus code "
 				<< utils::hex(code, 4);
-			return ret;
+			/* Try next mbus_code supported by the sensor */
+			continue;
 		}
 
 		std::map<V4L2PixelFormat, std::vector<SizeRange>> videoFormats =