Patch Detail
Show a patch.
GET /api/patches/9569/?format=api
{ "id": 9569, "url": "https://patchwork.libcamera.org/api/patches/9569/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9569/", "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": "<20200911085514.30021-3-show.liu@linaro.org>", "date": "2020-09-11T08:55:12", "name": "[libcamera-devel,v6,2/4] qcam: new viewfinder hierarchy", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "82eb60a9d0aefd832ae3b2a3dc5028ed1c0f68bf", "submitter": { "id": 24, "url": "https://patchwork.libcamera.org/api/people/24/?format=api", "name": "Show Liu", "email": "show.liu@linaro.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9569/mbox/", "series": [ { "id": 1284, "url": "https://patchwork.libcamera.org/api/series/1284/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1284", "date": "2020-09-11T08:55:10", "name": "qcam: accelerate format conversion by OpenGL shader", "version": 6, "mbox": "https://patchwork.libcamera.org/series/1284/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9569/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9569/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9D5BABDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Sep 2020 08:55:45 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6803962D6E;\n\tFri, 11 Sep 2020 10:55:45 +0200 (CEST)", "from mail-pg1-x543.google.com (mail-pg1-x543.google.com\n\t[IPv6:2607:f8b0:4864:20::543])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4676B62D5B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Sep 2020 10:55:44 +0200 (CEST)", "by mail-pg1-x543.google.com with SMTP id g29so6194174pgl.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Sep 2020 01:55:44 -0700 (PDT)", "from localhost.localdomain (211-20-20-223.HINET-IP.hinet.net.\n\t[211.20.20.223]) by smtp.gmail.com with ESMTPSA id\n\tw192sm1616543pfd.156.2020.09.11.01.55.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 11 Sep 2020 01:55:42 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"H0lo110b\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=BWIcO9CF7ffOFNxyBar68aMjB+PR1UiV1lXSBRWX9k8=;\n\tb=H0lo110btfID3OM6i5dD9ZVNRwBf3Ysj1mC00CLeqzdrjEHygEB/oo0OTKBaRfZvlk\n\tBgs3UiA6y9pNI+Ld4QCk9J1W559mwlscKMXpA4L7f2FYuGuBj4HD6khdQP2hYy921sgY\n\tCayOxW/M7RAqjVdu96bUO+b3KV7jvuCTeUNDYKLdOE/kmbW9vFC8PyVF6JogNe1VXTTE\n\tIlvHer+P4bqhwP/fNwZh6mbjyap8GDTxd6GIu30+QrKNn2t+QKRvWwPMBGtfOpd7IVnM\n\tcWR4NK6h2n0mu/ZXAHc0t/DwBx/1XRlxh/d2QCjWe3ybcEvqniwy3C6fm5kO7zKlyIu5\n\txj0w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=BWIcO9CF7ffOFNxyBar68aMjB+PR1UiV1lXSBRWX9k8=;\n\tb=JctE9mZYS1D/irjLHgU5//DoyMlITJX+4XnLvC1VLe8QEj3C+o9COa/hQDP2ymYlD6\n\tcdEQ1DgF/BK3dg4viDF6BVHbLRYtvUQNb+Ik1huk21DtC7C1F7BqRGPXXCXsNFbwV+/L\n\tzH3nG5G4MAHhOLUm0rDPUvT6wy7L4yWagB++pqHpGwbCFth7deS2cK53Knzdw+UcVcKU\n\t+Ldl10Lmg7dKiSmgx+FzWfs2eHbF4by5hzsbat3cobRlWOy1PgwIfo2zMLg2f6IP1uk/\n\t/IpvPTWEDIzqEkYnC3KHDFpAvBfRVC2J15cyqABxLRruu0NAlug1LaVyd2CcGGdL/Tky\n\tTEzQ==", "X-Gm-Message-State": "AOAM532w2Idb7QjxosrRJNRg4oAGBE1/Eqms/g56/79/2xYQ53ACTpQv\n\tlb8VcAuhf5u57SYVolJhalK3jMFm2UUlog==", "X-Google-Smtp-Source": "ABdhPJyEglQOwehYA9/+pA55FnWp1CWeRwvlgCoFghh97tyctFDI5V7pJc9ou4KuEnJXpMxGUNVIKw==", "X-Received": "by 2002:a62:93:0:b029:13e:d13d:a085 with SMTP id\n\t141-20020a6200930000b029013ed13da085mr1260818pfa.28.1599814542653; \n\tFri, 11 Sep 2020 01:55:42 -0700 (PDT)", "From": "Show Liu <show.liu@linaro.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 11 Sep 2020 16:55:12 +0800", "Message-Id": "<20200911085514.30021-3-show.liu@linaro.org>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20200911085514.30021-1-show.liu@linaro.org>", "References": "<20200911085514.30021-1-show.liu@linaro.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v6 2/4] qcam: new viewfinder hierarchy", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Create viewfinder base class and rename the original viewfinder\nas QPainter-based ViewFinder\n\nSigned-off-by: Show Liu <show.liu@linaro.org>\n---\n src/qcam/meson.build | 4 +-\n src/qcam/viewfinder.h | 57 ++++-------------\n .../{viewfinder.cpp => viewfinder_qt.cpp} | 24 +++----\n src/qcam/viewfinder_qt.h | 64 +++++++++++++++++++\n 4 files changed, 89 insertions(+), 60 deletions(-)\n rename src/qcam/{viewfinder.cpp => viewfinder_qt.cpp} (86%)\n create mode 100644 src/qcam/viewfinder_qt.h", "diff": "diff --git a/src/qcam/meson.build b/src/qcam/meson.build\nindex e0c6f26..a4bad0a 100644\n--- a/src/qcam/meson.build\n+++ b/src/qcam/meson.build\n@@ -6,12 +6,12 @@ qcam_sources = files([\n 'format_converter.cpp',\n 'main.cpp',\n 'main_window.cpp',\n- 'viewfinder.cpp',\n+ 'viewfinder_qt.cpp',\n ])\n \n qcam_moc_headers = files([\n 'main_window.h',\n- 'viewfinder.h',\n+ 'viewfinder_qt.h',\n ])\n \n qcam_resources = files([\ndiff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h\nindex 26a1320..67da1df 100644\n--- a/src/qcam/viewfinder.h\n+++ b/src/qcam/viewfinder.h\n@@ -2,70 +2,35 @@\n /*\n * Copyright (C) 2019, Google Inc.\n *\n- * viewfinder.h - qcam - Viewfinder\n+ * viewfinder.h - qcam - Viewfinder base class\n */\n #ifndef __QCAM_VIEWFINDER_H__\n #define __QCAM_VIEWFINDER_H__\n \n-#include <stddef.h>\n-\n-#include <QIcon>\n-#include <QList>\n #include <QImage>\n-#include <QMutex>\n+#include <QList>\n #include <QSize>\n-#include <QWidget>\n \n #include <libcamera/buffer.h>\n-#include <libcamera/pixel_format.h>\n-\n-#include \"format_converter.h\"\n-\n-class QImage;\n+#include <libcamera/formats.h>\n \n struct MappedBuffer {\n \tvoid *memory;\n \tsize_t size;\n };\n \n-class ViewFinder : public QWidget\n+class ViewFinder\n {\n-\tQ_OBJECT\n-\n public:\n-\tViewFinder(QWidget *parent);\n-\t~ViewFinder();\n-\n-\tconst QList<libcamera::PixelFormat> &nativeFormats() const;\n-\n-\tint setFormat(const libcamera::PixelFormat &format, const QSize &size);\n-\tvoid render(libcamera::FrameBuffer *buffer, MappedBuffer *map);\n-\tvoid stop();\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-\n-private:\n-\tFormatConverter converter_;\n+\tvirtual ~ViewFinder() {}\n \n-\tlibcamera::PixelFormat format_;\n-\tQSize size_;\n+\tvirtual const QList<libcamera::PixelFormat> &nativeFormats() const = 0;\n \n-\t/* Camera stopped icon */\n-\tQSize vfSize_;\n-\tQIcon icon_;\n-\tQPixmap pixmap_;\n+\tvirtual int setFormat(const libcamera::PixelFormat &format, const QSize &size) = 0;\n+\tvirtual void render(libcamera::FrameBuffer *buffer, MappedBuffer *map) = 0;\n+\tvirtual void stop() = 0;\n \n-\t/* Buffer and render image */\n-\tlibcamera::FrameBuffer *buffer_;\n-\tQImage image_;\n-\tQMutex mutex_; /* Prevent concurrent access to image_ */\n+\tvirtual QImage getCurrentImage() = 0;\n };\n \n-#endif /* __QCAM_VIEWFINDER__ */\n+#endif /* __QCAM_VIEWFINDER_H__ */\ndiff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder_qt.cpp\nsimilarity index 86%\nrename from src/qcam/viewfinder.cpp\nrename to src/qcam/viewfinder_qt.cpp\nindex dcf8a15..e436714 100644\n--- a/src/qcam/viewfinder.cpp\n+++ b/src/qcam/viewfinder_qt.cpp\n@@ -2,10 +2,10 @@\n /*\n * Copyright (C) 2019, Google Inc.\n *\n- * viewfinder.cpp - qcam - Viewfinder\n+ * viewfinder_qt.cpp - qcam - QPainter-based ViewFinder\n */\n \n-#include \"viewfinder.h\"\n+#include \"viewfinder_qt.h\"\n \n #include <stdint.h>\n #include <utility>\n@@ -33,24 +33,24 @@ static const QMap<libcamera::PixelFormat, QImage::Format> nativeFormats\n \t{ libcamera::formats::BGR888, QImage::Format_RGB888 },\n };\n \n-ViewFinder::ViewFinder(QWidget *parent)\n+ViewFinderQt::ViewFinderQt(QWidget *parent)\n \t: QWidget(parent), buffer_(nullptr)\n {\n \ticon_ = QIcon(\":camera-off.svg\");\n }\n \n-ViewFinder::~ViewFinder()\n+ViewFinderQt::~ViewFinderQt()\n {\n }\n \n-const QList<libcamera::PixelFormat> &ViewFinder::nativeFormats() const\n+const QList<libcamera::PixelFormat> &ViewFinderQt::nativeFormats() const\n {\n \tstatic const QList<libcamera::PixelFormat> formats = ::nativeFormats.keys();\n \treturn formats;\n }\n \n-int ViewFinder::setFormat(const libcamera::PixelFormat &format,\n-\t\t\t const QSize &size)\n+int ViewFinderQt::setFormat(const libcamera::PixelFormat &format,\n+\t\t\t const QSize &size)\n {\n \timage_ = QImage();\n \n@@ -78,7 +78,7 @@ int ViewFinder::setFormat(const libcamera::PixelFormat &format,\n \treturn 0;\n }\n \n-void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n+void ViewFinderQt::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n {\n \tif (buffer->planes().size() != 1) {\n \t\tqWarning() << \"Multi-planar buffers are not supported\";\n@@ -121,7 +121,7 @@ void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n \t\trenderComplete(buffer);\n }\n \n-void ViewFinder::stop()\n+void ViewFinderQt::stop()\n {\n \timage_ = QImage();\n \n@@ -133,14 +133,14 @@ void ViewFinder::stop()\n \tupdate();\n }\n \n-QImage ViewFinder::getCurrentImage()\n+QImage ViewFinderQt::getCurrentImage()\n {\n \tQMutexLocker locker(&mutex_);\n \n \treturn image_.copy();\n }\n \n-void ViewFinder::paintEvent(QPaintEvent *)\n+void ViewFinderQt::paintEvent(QPaintEvent *)\n {\n \tQPainter painter(this);\n \n@@ -175,7 +175,7 @@ void ViewFinder::paintEvent(QPaintEvent *)\n \tpainter.drawPixmap(point, pixmap_);\n }\n \n-QSize ViewFinder::sizeHint() const\n+QSize ViewFinderQt::sizeHint() const\n {\n \treturn size_.isValid() ? size_ : QSize(640, 480);\n }\ndiff --git a/src/qcam/viewfinder_qt.h b/src/qcam/viewfinder_qt.h\nnew file mode 100644\nindex 0000000..d755428\n--- /dev/null\n+++ b/src/qcam/viewfinder_qt.h\n@@ -0,0 +1,64 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * viewfinder_qt.h - qcam - QPainter-based ViewFinder\n+ */\n+#ifndef __QCAM_VIEWFINDER_QT_H__\n+#define __QCAM_VIEWFINDER_QT_H__\n+\n+#include <QIcon>\n+#include <QImage>\n+#include <QList>\n+#include <QMutex>\n+#include <QSize>\n+#include <QWidget>\n+\n+#include <libcamera/buffer.h>\n+#include <libcamera/formats.h>\n+#include <libcamera/pixel_format.h>\n+\n+#include \"format_converter.h\"\n+#include \"viewfinder.h\"\n+\n+class ViewFinderQt : public QWidget, public ViewFinder\n+{\n+\tQ_OBJECT\n+\n+public:\n+\tViewFinderQt(QWidget *parent);\n+\t~ViewFinderQt();\n+\n+\tconst QList<libcamera::PixelFormat> &nativeFormats() const override;\n+\n+\tint setFormat(const libcamera::PixelFormat &format, const QSize &size) override;\n+\tvoid render(libcamera::FrameBuffer *buffer, MappedBuffer *map) override;\n+\tvoid stop() override;\n+\n+\tQImage getCurrentImage() override;\n+\n+Q_SIGNALS:\n+\tvoid renderComplete(libcamera::FrameBuffer *buffer);\n+\n+protected:\n+\tvoid paintEvent(QPaintEvent *) override;\n+\tQSize sizeHint() const override;\n+\n+private:\n+\tFormatConverter converter_;\n+\n+\tlibcamera::PixelFormat format_;\n+\tQSize size_;\n+\n+\t/* Camera stopped icon */\n+\tQSize vfSize_;\n+\tQIcon icon_;\n+\tQPixmap pixmap_;\n+\n+\t/* Buffer and render image */\n+\tlibcamera::FrameBuffer *buffer_;\n+\tQImage image_;\n+\tQMutex mutex_; /* Prevent concurrent access to image_ */\n+};\n+\n+#endif /* __QCAM_VIEWFINDER_QT_H__ */\n", "prefixes": [ "libcamera-devel", "v6", "2/4" ] }