[libcamera-devel] [PATCH 5/8] libcamera: pipeline: ipu3: frames: Add FrameInfo state tracing

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sun Mar 14 03:02:33 CET 2021


Hi Kieran,

Thank you for the patch.

On Fri, Mar 12, 2021 at 06:11:28AM +0000, Kieran Bingham wrote:
> Provide a toString() function on the IPU3Frames::Info structure so that
> it can be reported during debug logs.
> 
> Provide a public helper on the IPU3Frames class to report the state of
> all Info structures it holds.
> 
> This method can be used when debugging the contexts that are associated
> with requests.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>  src/libcamera/pipeline/ipu3/frames.cpp | 23 +++++++++++++++++++++++
>  src/libcamera/pipeline/ipu3/frames.h   |  4 ++++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp
> index 4198e2019f3f..b8b471c3c561 100644
> --- a/src/libcamera/pipeline/ipu3/frames.cpp
> +++ b/src/libcamera/pipeline/ipu3/frames.cpp
> @@ -131,4 +131,27 @@ IPU3Frames::Info *IPU3Frames::find(FrameBuffer *buffer)
>  	return nullptr;
>  }
>  
> +const std::string IPU3Frames::Info::toString() const
> +{
> +	std::stringstream ss;

Missing header (same in the Request patch that uses std::stringstream).

> +
> +	ss << request->toString()
> +	   << (metadataProcessed ? "" : "[!metadata]")
> +	   << (paramDequeued ? "" : "[!param]");
> +

Same comment as for Request::toString().

> +	return ss.str();
> +}
> +
> +void IPU3Frames::dump() const
> +{
> +	LOG(IPU3, Error) << "Frames:";

Debug ?

> +
> +	for (auto const &itInfo : frameInfo_) {

itInfo isn't an iterator, but a pair. You can name it elem, element,
entry, ... if you want a generic name.

> +		Info *info = itInfo.second.get();
> +
> +		LOG(IPU3, Error)

Debug ?

> +			<< " - " << info->toString();
> +	}
> +}
> +
>  } /* namespace libcamera */
> diff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h
> index 4acdf48eca9d..c769ae864d32 100644
> --- a/src/libcamera/pipeline/ipu3/frames.h
> +++ b/src/libcamera/pipeline/ipu3/frames.h
> @@ -34,6 +34,8 @@ public:
>  
>  		bool paramDequeued;
>  		bool metadataProcessed;
> +
> +		const std::string toString() const;

You can drop the first const, and you should include <string>.

>  	};
>  
>  	IPU3Frames();
> @@ -49,6 +51,8 @@ public:
>  	Info *find(unsigned int id);
>  	Info *find(FrameBuffer *buffer);
>  
> +	void dump() const;
> +
>  private:
>  	std::queue<FrameBuffer *> availableParamBuffers_;
>  	std::queue<FrameBuffer *> availableStatBuffers_;

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list