[libcamera-devel] [PATCH v3 03/13] libcamera: camera: Log requested configuration in configureStreams()

Jacopo Mondi jacopo at jmondi.org
Fri Apr 19 12:03:03 CEST 2019


Hi Laurent,
   I've just noticed a small issue with this patch.

On Thu, Apr 18, 2019 at 05:14:27PM +0300, Laurent Pinchart wrote:
> The IPU3 pipeline handler logs the requested configuration in its
> configureStreams() handler. This is useful for other pipeline handlers
> as well, move it to the Camera class.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
>  src/libcamera/camera.cpp             | 14 ++++++++++++++
>  src/libcamera/pipeline/ipu3/ipu3.cpp |  6 ------
>  2 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
> index 75a21008070b..bd381fa1cb56 100644
> --- a/src/libcamera/camera.cpp
> +++ b/src/libcamera/camera.cpp
> @@ -5,6 +5,8 @@
>   * camera.cpp - Camera device
>   */
>
> +#include <iomanip>
> +
>  #include <libcamera/camera.h>
>  #include <libcamera/request.h>
>  #include <libcamera/stream.h>
> @@ -595,11 +597,23 @@ int Camera::configureStreams(const CameraConfiguration &config)
>  		return -EINVAL;
>  	}
>
> +	std::ostringstream msg("configuring streams:");
> +	unsigned int index = 0;
> +
>  	for (Stream *stream : config) {
>  		if (streams_.find(stream) == streams_.end())
>  			return -EINVAL;
> +
> +		const StreamConfiguration &cfg = config[stream];
> +		msg << " (" << index << ") " << cfg.width << "x"
> +		    << cfg.height << "-0x" << std::hex << std::setfill('0')
> +		    << std::setw(8) << cfg.pixelFormat;
> +
> +		index++;

When running with multiple streams I get:
INFO Camera camera.cpp:615  (0) 640x480-0x3231564e (1) 140xa0-0x3231564e

Stream (1) might seems like it is wrongly configured, but it is not,
it is just printed out as hex...

According to the std::hex function documentation, once it gets applied
to a stream, it sets its basefield to hexadecimal, and all numerical
values pushed to the stream will then be interepreted as hexadecimals.

A 'msg << std::dec;' before assembling the format description string,
fixes the issue for me.

Thanks
  j


>  	}
>
> +	LOG(Camera, Info) << msg.str();
> +
>  	ret = pipe_->configureStreams(this, config);
>  	if (ret)
>  		return ret;
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 924eb46c58d8..f2306efba3bf 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -244,12 +244,6 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,
>  	ImgUDevice *imgu = data->imgu_;
>  	int ret;
>
> -	LOG(IPU3, Info)
> -		<< "Requested image format " << cfg.width << "x"
> -		<< cfg.height << "-0x" << std::hex << std::setfill('0')
> -		<< std::setw(8) << cfg.pixelFormat << " on camera '"
> -		<< camera->name() << "'";
> -
>  	/*
>  	 * Verify that the requested size respects the IPU3 alignement
>  	 * requirements (the image width shall be a multiple of 8 pixels and
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20190419/2232e7e7/attachment.sig>


More information about the libcamera-devel mailing list