[libcamera-devel] qcam: viewfinder: Print message to report format converter usage

Message ID 20200324094112.704-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 798b7ac9692746ea9df15923f3b00b622c7f2ed4
Headers show
Series
  • [libcamera-devel] qcam: viewfinder: Print message to report format converter usage
Related show

Commit Message

Laurent Pinchart March 24, 2020, 9:41 a.m. UTC
Print an info message when initializing the viewfinder to report if the
format converter is used or if zero-copy is enabled. This is useful to
notify of a possible impact on performances.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/qcam/viewfinder.cpp | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Kieran Bingham March 24, 2020, 11:57 a.m. UTC | #1
Hi Laurent,

On 24/03/2020 09:41, Laurent Pinchart wrote:
> Print an info message when initializing the viewfinder to report if the
> format converter is used or if zero-copy is enabled. This is useful to
> notify of a possible impact on performances.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/qcam/viewfinder.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp
> index c7c6d099dfba..df5ee5ee7b83 100644
> --- a/src/qcam/viewfinder.cpp
> +++ b/src/qcam/viewfinder.cpp
> @@ -56,6 +56,11 @@ int ViewFinder::setFormat(const libcamera::PixelFormat &format,
>  			return ret;
>  
>  		image_ = QImage(size, QImage::Format_RGB32);
> +
> +		qInfo() << "Using software format conversion from"
> +			<< format.toString().c_str();


Should this message state the conversion from and to?

Perhaps it doesn't matter too much at the moment as we always convert to
the same destination format - but perhaps that might differ if we have
multiple compatible 'native' formats?

> +	} else {
> +		qInfo() << "Zero-copy enabled";

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

>  	}
>  
>  	format_ = format;
>
Laurent Pinchart March 24, 2020, 12:49 p.m. UTC | #2
On Tue, Mar 24, 2020 at 11:57:52AM +0000, Kieran Bingham wrote:
> Hi Laurent,
> 
> On 24/03/2020 09:41, Laurent Pinchart wrote:
> > Print an info message when initializing the viewfinder to report if the
> > format converter is used or if zero-copy is enabled. This is useful to
> > notify of a possible impact on performances.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  src/qcam/viewfinder.cpp | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp
> > index c7c6d099dfba..df5ee5ee7b83 100644
> > --- a/src/qcam/viewfinder.cpp
> > +++ b/src/qcam/viewfinder.cpp
> > @@ -56,6 +56,11 @@ int ViewFinder::setFormat(const libcamera::PixelFormat &format,
> >  			return ret;
> >  
> >  		image_ = QImage(size, QImage::Format_RGB32);
> > +
> > +		qInfo() << "Using software format conversion from"
> > +			<< format.toString().c_str();
> 
> Should this message state the conversion from and to?
> 
> Perhaps it doesn't matter too much at the moment as we always convert to
> the same destination format - but perhaps that might differ if we have
> multiple compatible 'native' formats?

I initially had a message that stated "... to QImage::Format_RGB32", but
thought it was overkill as that's fixed. If we end up picking the
destination format dynamically, we can update the message then.

> 
> > +	} else {
> > +		qInfo() << "Zero-copy enabled";
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> >  	}
> >  
> >  	format_ = format;

Patch

diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp
index c7c6d099dfba..df5ee5ee7b83 100644
--- a/src/qcam/viewfinder.cpp
+++ b/src/qcam/viewfinder.cpp
@@ -56,6 +56,11 @@  int ViewFinder::setFormat(const libcamera::PixelFormat &format,
 			return ret;
 
 		image_ = QImage(size, QImage::Format_RGB32);
+
+		qInfo() << "Using software format conversion from"
+			<< format.toString().c_str();
+	} else {
+		qInfo() << "Zero-copy enabled";
 	}
 
 	format_ = format;