Patch Detail
Show a patch.
GET /api/1.1/patches/3257/?format=api
{ "id": 3257, "url": "https://patchwork.libcamera.org/api/1.1/patches/3257/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3257/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200323142205.28342-16-laurent.pinchart@ideasonboard.com>", "date": "2020-03-23T14:21:59", "name": "[libcamera-devel,15/21] qcam: viewfinder: Make the viewfinder hold a reference to a buffer", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "9ef687a2a13e45a9dbad0266e0966497ed7b6323", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3257/mbox/", "series": [ { "id": 760, "url": "https://patchwork.libcamera.org/api/1.1/series/760/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=760", "date": "2020-03-23T14:21:44", "name": "qcam: Bypass format conversion when not required", "version": 1, "mbox": "https://patchwork.libcamera.org/series/760/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3257/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3257/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FD5362C3B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 15:22:23 +0100 (CET)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 26DFCA31\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 15:22:23 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584973343;\n\tbh=H2RV0aIkeUXrQs9hzTcXOfgSZh5VT92rFw1DjR7uQ4g=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=QIBT6Uqq31XvnLaIOc7l4BW6HeALuyGUCbi//Id2YQWMLQQRP34MpqnE6/1eZ74Ig\n\tPIZ5zcE4JFioyImfC716QhnY2PGlw0H4EqMwhzaDvideVHcMPHHEIKSnSM4bmgfUYo\n\tOJpVlAwwAe1Uk8J0DgnFkqN5EA4vf1LecXMWOR2s=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 23 Mar 2020 16:21:59 +0200", "Message-Id": "<20200323142205.28342-16-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>", "References": "<20200323142205.28342-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 15/21] qcam: viewfinder: Make the\n\tviewfinder hold a reference to a buffer", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "X-List-Received-Date": "Mon, 23 Mar 2020 14:22:28 -0000" }, "content": "The viewfinder is currently expected to render frames to the screen\nsynchronously in the display() function, or at least to copy data so\nthat the buffer can be queued in a new request when the function\nreturns. This prevents optimisations when the capture format is\nidentical to the display format.\n\nMake the viewfinder take ownership of the buffer, and notify of its\nrelease through a signal. The release is currently still synchronous,\nthis will be addressed in a subsequent patch.\n\nRename the ViewFinder::display() function to render() to better describe\nits purpose, as it's meant to start the rendering and not display the\nframe synchronously.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/main_window.cpp | 13 ++++---------\n src/qcam/main_window.h | 4 ++--\n src/qcam/meson.build | 1 +\n src/qcam/viewfinder.cpp | 5 +++--\n src/qcam/viewfinder.h | 7 ++++++-\n 5 files changed, 16 insertions(+), 14 deletions(-)", "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex ad0d6bf4f3e5..b68e171c5e01 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -64,6 +64,8 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \tconnect(&titleTimer_, SIGNAL(timeout()), this, SLOT(updateTitle()));\n \n \tviewfinder_ = new ViewFinder(this);\n+\tconnect(viewfinder_, &ViewFinder::renderComplete,\n+\t\tthis, &MainWindow::queueRequest);\n \tsetCentralWidget(viewfinder_);\n \tadjustSize();\n \n@@ -513,15 +515,8 @@ void MainWindow::processCapture()\n \t\t<< \"timestamp:\" << metadata.timestamp\n \t\t<< \"fps:\" << Qt::fixed << qSetRealNumberPrecision(2) << fps;\n \n-\t/* Display the buffer and requeue it to the camera. */\n-\tdisplay(buffer);\n-\n-\tqueueRequest(buffer);\n-}\n-\n-void MainWindow::display(FrameBuffer *buffer)\n-{\n-\tviewfinder_->display(buffer, &mappedBuffers_[buffer]);\n+\t/* Render the frame on the viewfinder. */\n+\tviewfinder_->render(buffer, &mappedBuffers_[buffer]);\n }\n \n void MainWindow::queueRequest(FrameBuffer *buffer)\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 03db761b58e4..1a2ccbd632b0 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -54,6 +54,8 @@ private Q_SLOTS:\n \n \tvoid saveImageAs();\n \n+\tvoid queueRequest(FrameBuffer *buffer);\n+\n private:\n \tint createToolbars();\n \n@@ -65,8 +67,6 @@ private:\n \n \tvoid requestComplete(Request *request);\n \tvoid processCapture();\n-\tvoid display(FrameBuffer *buffer);\n-\tvoid queueRequest(FrameBuffer *buffer);\n \n \t/* UI elements */\n \tQToolBar *toolbar_;\ndiff --git a/src/qcam/meson.build b/src/qcam/meson.build\nindex 214bfb12aabb..c256d06f8ccf 100644\n--- a/src/qcam/meson.build\n+++ b/src/qcam/meson.build\n@@ -8,6 +8,7 @@ qcam_sources = files([\n \n qcam_moc_headers = files([\n 'main_window.h',\n+ 'viewfinder.h',\n ])\n \n qcam_resources = files([\ndiff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp\nindex b8feabd5d189..2a35932e0b79 100644\n--- a/src/qcam/viewfinder.cpp\n+++ b/src/qcam/viewfinder.cpp\n@@ -25,8 +25,7 @@ ViewFinder::~ViewFinder()\n \tdelete image_;\n }\n \n-void ViewFinder::display(const libcamera::FrameBuffer *buffer,\n-\t\t\t MappedBuffer *map)\n+void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n {\n \tif (buffer->planes().size() != 1) {\n \t\tqWarning() << \"Multi-planar buffers are not supported\";\n@@ -44,6 +43,8 @@ void ViewFinder::display(const libcamera::FrameBuffer *buffer,\n \tconverter_.convert(static_cast<unsigned char *>(map->memory),\n \t\t\t buffer->metadata().planes[0].bytesused, image_);\n \tupdate();\n+\n+\trenderComplete(buffer);\n }\n \n QImage ViewFinder::getCurrentImage()\ndiff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h\nindex 735a6b67e91d..784fcceda5bd 100644\n--- a/src/qcam/viewfinder.h\n+++ b/src/qcam/viewfinder.h\n@@ -27,15 +27,20 @@ struct MappedBuffer {\n \n class ViewFinder : public QWidget\n {\n+\tQ_OBJECT\n+\n public:\n \tViewFinder(QWidget *parent);\n \t~ViewFinder();\n \n \tint setFormat(const libcamera::PixelFormat &format, const QSize &size);\n-\tvoid display(const libcamera::FrameBuffer *buffer, MappedBuffer *map);\n+\tvoid render(libcamera::FrameBuffer *buffer, MappedBuffer *map);\n \n \tQImage getCurrentImage();\n \n+Q_SIGNALS:\n+\tvoid renderComplete(libcamera::FrameBuffer *buffer);\n+\n protected:\n \tvoid paintEvent(QPaintEvent *) override;\n \tQSize sizeHint() const override;\n", "prefixes": [ "libcamera-devel", "15/21" ] }