[libcamera-devel,14/21] qcam: viewfinder: Move multi-planar check into viewfinder

Message ID 20200323142205.28342-15-laurent.pinchart@ideasonboard.com
State Superseded
Headers show
Series
  • qcam: Bypass format conversion when not required
Related show

Commit Message

Laurent Pinchart March 23, 2020, 2:21 p.m. UTC
The lack of support for multiplanar buffers comes from the viewfinder.
Move the corresponding check from MainWindow.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/qcam/main_window.cpp | 7 +------
 src/qcam/main_window.h   | 2 +-
 src/qcam/viewfinder.cpp  | 6 ++++++
 3 files changed, 8 insertions(+), 7 deletions(-)

Comments

Kieran Bingham March 23, 2020, 5:06 p.m. UTC | #1
Hi Laurent,

On 23/03/2020 14:21, Laurent Pinchart wrote:
> The lack of support for multiplanar buffers comes from the viewfinder.
> Move the corresponding check from MainWindow.

Presumably this limitation can be removed with the FormatConvertor too?
(Particularly when we get a hardware accelerated format convertor...)

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

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/qcam/main_window.cpp | 7 +------
>  src/qcam/main_window.h   | 2 +-
>  src/qcam/viewfinder.cpp  | 6 ++++++
>  3 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> index c0feb91a6fb1..ad0d6bf4f3e5 100644
> --- a/src/qcam/main_window.cpp
> +++ b/src/qcam/main_window.cpp
> @@ -519,14 +519,9 @@ void MainWindow::processCapture()
>  	queueRequest(buffer);
>  }
>  
> -int MainWindow::display(FrameBuffer *buffer)
> +void MainWindow::display(FrameBuffer *buffer)
>  {
> -	if (buffer->planes().size() != 1)
> -		return -EINVAL;
> -
>  	viewfinder_->display(buffer, &mappedBuffers_[buffer]);
> -
> -	return 0;
>  }
>  
>  void MainWindow::queueRequest(FrameBuffer *buffer)
> diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
> index 0918ae5307d8..03db761b58e4 100644
> --- a/src/qcam/main_window.h
> +++ b/src/qcam/main_window.h
> @@ -65,7 +65,7 @@ private:
>  
>  	void requestComplete(Request *request);
>  	void processCapture();
> -	int display(FrameBuffer *buffer);
> +	void display(FrameBuffer *buffer);
>  	void queueRequest(FrameBuffer *buffer);
>  
>  	/* UI elements */
> diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp
> index d00edc33dfb7..b8feabd5d189 100644
> --- a/src/qcam/viewfinder.cpp
> +++ b/src/qcam/viewfinder.cpp
> @@ -11,6 +11,7 @@
>  #include <QImageWriter>
>  #include <QMutexLocker>
>  #include <QPainter>
> +#include <QtDebug>
>  
>  #include "format_converter.h"
>  
> @@ -27,6 +28,11 @@ ViewFinder::~ViewFinder()
>  void ViewFinder::display(const libcamera::FrameBuffer *buffer,
>  			 MappedBuffer *map)
>  {
> +	if (buffer->planes().size() != 1) {
> +		qWarning() << "Multi-planar buffers are not supported";
> +		return;
> +	}
> +
>  	QMutexLocker locker(&mutex_);
>  
>  	/*
>
Laurent Pinchart March 23, 2020, 5:09 p.m. UTC | #2
Hi Kieran,

On Mon, Mar 23, 2020 at 05:06:24PM +0000, Kieran Bingham wrote:
> On 23/03/2020 14:21, Laurent Pinchart wrote:
> > The lack of support for multiplanar buffers comes from the viewfinder.
> > Move the corresponding check from MainWindow.
> 
> Presumably this limitation can be removed with the FormatConvertor too?
> (Particularly when we get a hardware accelerated format convertor...)

Exactly. When we'll have multiple viewfinder implementations it will be
up to them to report what they support. We'll need an API for that, but
one thing at a time :-)

> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  src/qcam/main_window.cpp | 7 +------
> >  src/qcam/main_window.h   | 2 +-
> >  src/qcam/viewfinder.cpp  | 6 ++++++
> >  3 files changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> > index c0feb91a6fb1..ad0d6bf4f3e5 100644
> > --- a/src/qcam/main_window.cpp
> > +++ b/src/qcam/main_window.cpp
> > @@ -519,14 +519,9 @@ void MainWindow::processCapture()
> >  	queueRequest(buffer);
> >  }
> >  
> > -int MainWindow::display(FrameBuffer *buffer)
> > +void MainWindow::display(FrameBuffer *buffer)
> >  {
> > -	if (buffer->planes().size() != 1)
> > -		return -EINVAL;
> > -
> >  	viewfinder_->display(buffer, &mappedBuffers_[buffer]);
> > -
> > -	return 0;
> >  }
> >  
> >  void MainWindow::queueRequest(FrameBuffer *buffer)
> > diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
> > index 0918ae5307d8..03db761b58e4 100644
> > --- a/src/qcam/main_window.h
> > +++ b/src/qcam/main_window.h
> > @@ -65,7 +65,7 @@ private:
> >  
> >  	void requestComplete(Request *request);
> >  	void processCapture();
> > -	int display(FrameBuffer *buffer);
> > +	void display(FrameBuffer *buffer);
> >  	void queueRequest(FrameBuffer *buffer);
> >  
> >  	/* UI elements */
> > diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp
> > index d00edc33dfb7..b8feabd5d189 100644
> > --- a/src/qcam/viewfinder.cpp
> > +++ b/src/qcam/viewfinder.cpp
> > @@ -11,6 +11,7 @@
> >  #include <QImageWriter>
> >  #include <QMutexLocker>
> >  #include <QPainter>
> > +#include <QtDebug>
> >  
> >  #include "format_converter.h"
> >  
> > @@ -27,6 +28,11 @@ ViewFinder::~ViewFinder()
> >  void ViewFinder::display(const libcamera::FrameBuffer *buffer,
> >  			 MappedBuffer *map)
> >  {
> > +	if (buffer->planes().size() != 1) {
> > +		qWarning() << "Multi-planar buffers are not supported";
> > +		return;
> > +	}
> > +
> >  	QMutexLocker locker(&mutex_);
> >  
> >  	/*
> >

Patch

diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index c0feb91a6fb1..ad0d6bf4f3e5 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -519,14 +519,9 @@  void MainWindow::processCapture()
 	queueRequest(buffer);
 }
 
-int MainWindow::display(FrameBuffer *buffer)
+void MainWindow::display(FrameBuffer *buffer)
 {
-	if (buffer->planes().size() != 1)
-		return -EINVAL;
-
 	viewfinder_->display(buffer, &mappedBuffers_[buffer]);
-
-	return 0;
 }
 
 void MainWindow::queueRequest(FrameBuffer *buffer)
diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h
index 0918ae5307d8..03db761b58e4 100644
--- a/src/qcam/main_window.h
+++ b/src/qcam/main_window.h
@@ -65,7 +65,7 @@  private:
 
 	void requestComplete(Request *request);
 	void processCapture();
-	int display(FrameBuffer *buffer);
+	void display(FrameBuffer *buffer);
 	void queueRequest(FrameBuffer *buffer);
 
 	/* UI elements */
diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp
index d00edc33dfb7..b8feabd5d189 100644
--- a/src/qcam/viewfinder.cpp
+++ b/src/qcam/viewfinder.cpp
@@ -11,6 +11,7 @@ 
 #include <QImageWriter>
 #include <QMutexLocker>
 #include <QPainter>
+#include <QtDebug>
 
 #include "format_converter.h"
 
@@ -27,6 +28,11 @@  ViewFinder::~ViewFinder()
 void ViewFinder::display(const libcamera::FrameBuffer *buffer,
 			 MappedBuffer *map)
 {
+	if (buffer->planes().size() != 1) {
+		qWarning() << "Multi-planar buffers are not supported";
+		return;
+	}
+
 	QMutexLocker locker(&mutex_);
 
 	/*