Patch Detail
Show a patch.
GET /api/patches/3281/?format=api
{ "id": 3281, "url": "https://patchwork.libcamera.org/api/patches/3281/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3281/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20200323173559.21109-16-laurent.pinchart@ideasonboard.com>", "date": "2020-03-23T17:35:53", "name": "[libcamera-devel,v2,15/21] qcam: viewfinder: Make the viewfinder hold a reference to a buffer", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "a15fd48561cf82b1cccd9f53027c53813bc863a9", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3281/mbox/", "series": [ { "id": 762, "url": "https://patchwork.libcamera.org/api/series/762/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=762", "date": "2020-03-23T17:35:38", "name": "qcam: Bypass format conversion when not required", "version": 2, "mbox": "https://patchwork.libcamera.org/series/762/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3281/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3281/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B3FD62C88\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 18:36:21 +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 2150DA31\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2020 18:36:21 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1584984981;\n\tbh=CXKOfeBu+kJFTHGU7KKKu3mJrQaaF4nK76CNfVRNetY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=k/gcgtpKnLr2HeGGG6b1qyIpuIj4z4ErXwJRVhAp3CzNdXIMc0p75Dh3h1lFJKfC5\n\tXwexqbRrt5cGIjk4R6Hm7QNqrQSWlVQT72wHIs3QIWboWMGc4H8mQ+pO1bBzKZWUX9\n\twY996NOf9K9yKp2zYutb5FlILEWe93Zq6nSWomYo=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 23 Mar 2020 19:35:53 +0200", "Message-Id": "<20200323173559.21109-16-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200323173559.21109-1-laurent.pinchart@ideasonboard.com>", "References": "<20200323173559.21109-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 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 17:36:26 -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>\nReviewed-by: Kieran Bingham <kieran.bingham@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 3711a02c7fdc..e872bdd7ba86 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -63,6 +63,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@@ -518,15 +520,8 @@ void MainWindow::processCapture()\n \t\t<< \"timestamp:\" << metadata.timestamp\n \t\t<< \"fps:\" << 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 33522115b6be..5d6251c83070 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -55,6 +55,8 @@ private Q_SLOTS:\n \n \tvoid saveImageAs();\n \n+\tvoid queueRequest(FrameBuffer *buffer);\n+\n private:\n \tint createToolbars();\n \n@@ -66,8 +68,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", "v2", "15/21" ] }