From 615f7438ad6bf49bd213e7ae4f9f3fe334edeb67 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 23 Mar 2020 02:34:36 +0200 Subject: qcam: viewfinder: Make the viewfinder hold a reference to a buffer The viewfinder is currently expected to render frames to the screen synchronously in the display() function, or at least to copy data so that the buffer can be queued in a new request when the function returns. This prevents optimisations when the capture format is identical to the display format. Make the viewfinder take ownership of the buffer, and notify of its release through a signal. The release is currently still synchronous, this will be addressed in a subsequent patch. Rename the ViewFinder::display() function to render() to better describe its purpose, as it's meant to start the rendering and not display the frame synchronously. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/qcam/viewfinder.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/qcam/viewfinder.h') diff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h index 735a6b67..784fcced 100644 --- a/src/qcam/viewfinder.h +++ b/src/qcam/viewfinder.h @@ -27,15 +27,20 @@ struct MappedBuffer { class ViewFinder : public QWidget { + Q_OBJECT + public: ViewFinder(QWidget *parent); ~ViewFinder(); int setFormat(const libcamera::PixelFormat &format, const QSize &size); - void display(const libcamera::FrameBuffer *buffer, MappedBuffer *map); + void render(libcamera::FrameBuffer *buffer, MappedBuffer *map); QImage getCurrentImage(); +Q_SIGNALS: + void renderComplete(libcamera::FrameBuffer *buffer); + protected: void paintEvent(QPaintEvent *) override; QSize sizeHint() const override; -- cgit v1.2.1