[libcamera-devel,2/2] libcamera: pipeline: vivid: Print diagnostic on configuration failure
diff mbox series

Message ID 20201103133042.30341-2-laurent.pinchart@ideasonboard.com
State Accepted
Delegated to: Laurent Pinchart
Headers show
Series
  • [libcamera-devel,1/2] libcamera: pipeline: vivid: Set camera properties
Related show

Commit Message

Laurent Pinchart Nov. 3, 2020, 1:30 p.m. UTC
In case the setFormat() call on the video device fails to match the
configuration, print both the requested and actual configurations to
ease debugging.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/vivid/vivid.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Kieran Bingham Nov. 3, 2020, 3:32 p.m. UTC | #1
Hi Laurent,

On 03/11/2020 13:30, Laurent Pinchart wrote:
> In case the setFormat() call on the video device fails to match the
> configuration, print both the requested and actual configurations to
> ease debugging.

Sounds like it would be helpful. Again I'll add this to the vivid branch.

Sometime we should move that branch onto a repository at libcamera.org
rather than my personal external repository - but we can deal with that
later.

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

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/libcamera/pipeline/vivid/vivid.cpp | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/pipeline/vivid/vivid.cpp b/src/libcamera/pipeline/vivid/vivid.cpp
> index bf8f82af981f..a0ccbd1e711e 100644
> --- a/src/libcamera/pipeline/vivid/vivid.cpp
> +++ b/src/libcamera/pipeline/vivid/vivid.cpp
> @@ -181,8 +181,13 @@ int PipelineHandlerVivid::configure(Camera *camera, CameraConfiguration *config)
>  		return ret;
>  
>  	if (format.size != cfg.size ||
> -	    format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat))
> +	    format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat)) {
> +		LOG(VIVID, Error)
> +			<< "Requested " << cfg.toString() << ", got "
> +			<< format.size.toString() << "-"
> +			<< format.fourcc.toString();
>  		return -EINVAL;
> +	}
>  
>  	/* Set initial controls specific to VIVID */
>  	ControlList controls(data->video_->controls());
>
Laurent Pinchart Nov. 3, 2020, 3:37 p.m. UTC | #2
Hi Kieran,

On Tue, Nov 03, 2020 at 03:32:47PM +0000, Kieran Bingham wrote:
> On 03/11/2020 13:30, Laurent Pinchart wrote:
> > In case the setFormat() call on the video device fails to match the
> > configuration, print both the requested and actual configurations to
> > ease debugging.
> 
> Sounds like it would be helpful. Again I'll add this to the vivid branch.
> 
> Sometime we should move that branch onto a repository at libcamera.org
> rather than my personal external repository - but we can deal with that
> later.

We have a public tree there, so it's whenever you're ready :-) We can
also create a specific tree for this purpose if you think that's best.

> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  src/libcamera/pipeline/vivid/vivid.cpp | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/libcamera/pipeline/vivid/vivid.cpp b/src/libcamera/pipeline/vivid/vivid.cpp
> > index bf8f82af981f..a0ccbd1e711e 100644
> > --- a/src/libcamera/pipeline/vivid/vivid.cpp
> > +++ b/src/libcamera/pipeline/vivid/vivid.cpp
> > @@ -181,8 +181,13 @@ int PipelineHandlerVivid::configure(Camera *camera, CameraConfiguration *config)
> >  		return ret;
> >  
> >  	if (format.size != cfg.size ||
> > -	    format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat))
> > +	    format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat)) {
> > +		LOG(VIVID, Error)
> > +			<< "Requested " << cfg.toString() << ", got "
> > +			<< format.size.toString() << "-"
> > +			<< format.fourcc.toString();
> >  		return -EINVAL;
> > +	}
> >  
> >  	/* Set initial controls specific to VIVID */
> >  	ControlList controls(data->video_->controls());
Kieran Bingham Nov. 3, 2020, 3:52 p.m. UTC | #3
Hi Laurent,

On 03/11/2020 15:37, Laurent Pinchart wrote:
> Hi Kieran,
> 
> On Tue, Nov 03, 2020 at 03:32:47PM +0000, Kieran Bingham wrote:
>> On 03/11/2020 13:30, Laurent Pinchart wrote:
>>> In case the setFormat() call on the video device fails to match the
>>> configuration, print both the requested and actual configurations to
>>> ease debugging.
>>
>> Sounds like it would be helpful. Again I'll add this to the vivid branch.
>>
>> Sometime we should move that branch onto a repository at libcamera.org
>> rather than my personal external repository - but we can deal with that
>> later.
> 
> We have a public tree there, so it's whenever you're ready :-) We can
> also create a specific tree for this purpose if you think that's best.

Aha - good point, I had in my head considered that tree was just for the
main branch - but of course vivid could live in there too if it's going
to live somewhere.

I'll mull it over :-)

--
Kieran


> 
>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>>
>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>> ---
>>>  src/libcamera/pipeline/vivid/vivid.cpp | 7 ++++++-
>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/libcamera/pipeline/vivid/vivid.cpp b/src/libcamera/pipeline/vivid/vivid.cpp
>>> index bf8f82af981f..a0ccbd1e711e 100644
>>> --- a/src/libcamera/pipeline/vivid/vivid.cpp
>>> +++ b/src/libcamera/pipeline/vivid/vivid.cpp
>>> @@ -181,8 +181,13 @@ int PipelineHandlerVivid::configure(Camera *camera, CameraConfiguration *config)
>>>  		return ret;
>>>  
>>>  	if (format.size != cfg.size ||
>>> -	    format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat))
>>> +	    format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat)) {
>>> +		LOG(VIVID, Error)
>>> +			<< "Requested " << cfg.toString() << ", got "
>>> +			<< format.size.toString() << "-"
>>> +			<< format.fourcc.toString();
>>>  		return -EINVAL;
>>> +	}
>>>  
>>>  	/* Set initial controls specific to VIVID */
>>>  	ControlList controls(data->video_->controls());
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/vivid/vivid.cpp b/src/libcamera/pipeline/vivid/vivid.cpp
index bf8f82af981f..a0ccbd1e711e 100644
--- a/src/libcamera/pipeline/vivid/vivid.cpp
+++ b/src/libcamera/pipeline/vivid/vivid.cpp
@@ -181,8 +181,13 @@  int PipelineHandlerVivid::configure(Camera *camera, CameraConfiguration *config)
 		return ret;
 
 	if (format.size != cfg.size ||
-	    format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat))
+	    format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat)) {
+		LOG(VIVID, Error)
+			<< "Requested " << cfg.toString() << ", got "
+			<< format.size.toString() << "-"
+			<< format.fourcc.toString();
 		return -EINVAL;
+	}
 
 	/* Set initial controls specific to VIVID */
 	ControlList controls(data->video_->controls());