Patch Detail
Show a patch.
GET /api/1.1/patches/9357/?format=api
{ "id": 9357, "url": "https://patchwork.libcamera.org/api/1.1/patches/9357/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9357/", "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": "<20200821161602.5093-4-show.liu@linaro.org>", "date": "2020-08-21T16:16:02", "name": "[libcamera-devel,v4,3/3] qcam: use the OpenGL renderer as NV family YUV format converter", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "7c2754f2bf2a90b64ec512b572b0b16f1cde40d9", "submitter": { "id": 24, "url": "https://patchwork.libcamera.org/api/1.1/people/24/?format=api", "name": "Show Liu", "email": "show.liu@linaro.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9357/mbox/", "series": [ { "id": 1229, "url": "https://patchwork.libcamera.org/api/1.1/series/1229/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1229", "date": "2020-08-21T16:15:59", "name": "qcam: NV family YUV format conversion by using OpenGL shader", "version": 4, "mbox": "https://patchwork.libcamera.org/series/1229/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9357/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9357/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 2B4C5BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Aug 2020 16:16:37 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EAC1261FE7;\n\tFri, 21 Aug 2020 18:16:36 +0200 (CEST)", "from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com\n\t[IPv6:2607:f8b0:4864:20::1042])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 12E9F60383\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Aug 2020 18:16:35 +0200 (CEST)", "by mail-pj1-x1042.google.com with SMTP id t6so1028315pjr.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Aug 2020 09:16:35 -0700 (PDT)", "from localhost.localdomain\n\t(2001-b011-200c-3405-5522-d8a8-1333-f09d.dynamic-ip6.hinet.net.\n\t[2001:b011:200c:3405:5522:d8a8:1333:f09d])\n\tby smtp.gmail.com with ESMTPSA id\n\th15sm2524184pjf.54.2020.08.21.09.16.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 21 Aug 2020 09:16:33 -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=\"KSrFtMls\"; 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=AABaVwCLWJKMc3x6nrrpXEKPsBtmSlwX7fcsA/Kyxpg=;\n\tb=KSrFtMlsKdInzHkSnuHHxn0VbrRL6d6UFxUdHo9C1cZ/7j/vczunbIJEAxfKYr+aLr\n\tOuFxQoWUxKnpgzbReSWXxESzjUygVrA2tjAPne30Z++oBZWdCE/PM6joFDoyUZqrLK+g\n\ted1yIRIa+EV1eN2M/i4bzeUfLmdRmRgQLSlC4LSCdvmf41hCASUzI4A1wnsp6VPQxLcS\n\t7SOi2iZjWBCz95rQ++mMdgLkQoweykVrsvB1pE0yp0+hsP7PymJnIxlDPrknA50ZW6c2\n\t8+IdjnmwgZ8/Y9EMKuwKvx0HPSeSq7K7a8Ll61kXUYeeDqOeNIbYgm0icWFlEqCdKYqX\n\tDOGw==", "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=AABaVwCLWJKMc3x6nrrpXEKPsBtmSlwX7fcsA/Kyxpg=;\n\tb=YxTJ2M+bFAFsDBFkHjJXiP199urZ9HvbcFkO+RXbNQH8g3w59JzoHZKLnIMSphRB1k\n\ttRVz+rg6MkSOnyDOWGnO2Lh5iFvvNinMAAlZB71CURnuONPmmhfcB55nP7eQYaY0wsAn\n\tX0dK60vVYr1zTm61ILy5jsoSL8daYUEaEBcNjLLx7uTRgyb4WT5vP/oMto8+76UKHW83\n\tUPw+CuSFDJAI0ZVoiWX2hXOEGOZQg1YvxlhtSiKVEI79WKT/YExYhCq11jF5f7FviZbj\n\tM2n/p7912F5WKzc3nBM72/Qum6LVR3IEDPtvHw1TUPzjgaEDyJxJlPFyC6HI69+2SS8G\n\tkp2A==", "X-Gm-Message-State": "AOAM533V4HZg1Ki96KfEtvELHCYZQxND1RQtXj5TXnm6fMAOTEokg9/i\n\t9iCxLShIYFrLiHG2Xt50nrdTbzHR2OPaOA==", "X-Google-Smtp-Source": "ABdhPJw/0ms84Nj8v3JhE3XSPQP8sAsRpMREyjWEjDQFAY5sSl0S8DiAsRZvHjyJQyANxzvWVbi8fA==", "X-Received": "by 2002:a17:90a:db96:: with SMTP id\n\th22mr3089527pjv.28.1598026593458; \n\tFri, 21 Aug 2020 09:16:33 -0700 (PDT)", "From": "Show Liu <show.liu@linaro.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 22 Aug 2020 00:16:02 +0800", "Message-Id": "<20200821161602.5093-4-show.liu@linaro.org>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20200821161602.5093-1-show.liu@linaro.org>", "References": "<20200821161602.5093-1-show.liu@linaro.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v4 3/3] qcam: use the OpenGL renderer as\n\tNV family YUV format converter", "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": "qcam: use the OpenGL renderer as NV family YUV format converter\n\nSigned-off-by: Show Liu <show.liu@linaro.org>\n---\n src/qcam/main.cpp | 3 +++\n src/qcam/main_window.cpp | 2 ++\n src/qcam/main_window.h | 1 +\n src/qcam/viewfinder.cpp | 46 +++++++++++++++++++++++++++++++++-------\n src/qcam/viewfinder.h | 10 +++++++++\n 5 files changed, 54 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\nindex b3468cb..a336486 100644\n--- a/src/qcam/main.cpp\n+++ b/src/qcam/main.cpp\n@@ -35,6 +35,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[])\n \t\t\t \"help\");\n \tparser.addOption(OptStream, &streamKeyValue,\n \t\t\t \"Set configuration of a camera stream\", \"stream\", true);\n+\tparser.addOption(OptRender, OptionString,\n+\t\t\t \"Choose the render type use qt|gles\", \"render\",\n+\t\t\t ArgumentRequired, \"render\");\n \n \tOptionsParser::Options options = parser.parse(argc, argv);\n \tif (options.isSet(OptHelp))\ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 7503537..26e8a69 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -106,6 +106,8 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \tconnect(&titleTimer_, SIGNAL(timeout()), this, SLOT(updateTitle()));\n \n \tviewfinder_ = new ViewFinder(this);\n+\tif (options_.isSet(OptRender))\n+\t\tviewfinder_->setRender(options_[OptRender].toString().c_str());\n \tconnect(viewfinder_, &ViewFinder::renderComplete,\n \t\tthis, &MainWindow::queueRequest);\n \tsetCentralWidget(viewfinder_);\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 3d21779..ecc9938 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -38,6 +38,7 @@ enum {\n \tOptCamera = 'c',\n \tOptHelp = 'h',\n \tOptStream = 's',\n+\tOptRender = 'r',\n };\n \n class CaptureRequest\ndiff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp\nindex dcf8a15..7e2b7a7 100644\n--- a/src/qcam/viewfinder.cpp\n+++ b/src/qcam/viewfinder.cpp\n@@ -20,6 +20,7 @@\n #include <libcamera/formats.h>\n \n #include \"format_converter.h\"\n+#include \"renderer.h\"\n \n static const QMap<libcamera::PixelFormat, QImage::Format> nativeFormats\n {\n@@ -34,13 +35,15 @@ static const QMap<libcamera::PixelFormat, QImage::Format> nativeFormats\n };\n \n ViewFinder::ViewFinder(QWidget *parent)\n-\t: QWidget(parent), buffer_(nullptr)\n+\t: QWidget(parent), buffer_(nullptr), renderer_(nullptr)\n {\n \ticon_ = QIcon(\":camera-off.svg\");\n }\n \n ViewFinder::~ViewFinder()\n {\n+\tif (renderer_)\n+\t\tdelete renderer_;\n }\n \n const QList<libcamera::PixelFormat> &ViewFinder::nativeFormats() const\n@@ -59,14 +62,26 @@ int ViewFinder::setFormat(const libcamera::PixelFormat &format,\n \t * the destination image.\n \t */\n \tif (!::nativeFormats.contains(format)) {\n-\t\tint ret = converter_.configure(format, size);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n+\t\tif ((renderType_ == RenderGLES) &&\n+\t\t renderer_->configure(format, size)) {\n+\t\t\tqInfo() << \"Using OpenGL shader format conversion from \"\n+\t\t\t\t<< format.toString().c_str();\n+\t\t} else {\n+\t\t\tint ret = converter_.configure(format, size);\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn ret;\n+\n+\t\t\timage_ = QImage(size, QImage::Format_RGB32);\n \n-\t\timage_ = QImage(size, QImage::Format_RGB32);\n+\t\t\tqInfo() << \"Using software format conversion from\"\n+\t\t\t\t<< format.toString().c_str();\n \n-\t\tqInfo() << \"Using software format conversion from\"\n-\t\t\t<< format.toString().c_str();\n+\t\t\tif (renderType_ == RenderGLES) {\n+\t\t\t\trenderType_ = RenderQT;\n+\t\t\t\tqInfo() << \"Using QT rendering due to \"\n+\t\t\t\t\t<< \"OpenGL shader configure failed.\";\n+\t\t\t}\n+\t\t}\n \t} else {\n \t\tqInfo() << \"Zero-copy enabled\";\n \t}\n@@ -111,7 +126,11 @@ void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n \t\t\t * Otherwise, convert the format and release the frame\n \t\t\t * buffer immediately.\n \t\t\t */\n-\t\t\tconverter_.convert(memory, size, &image_);\n+\t\t\tif (renderType_ == RenderGLES) {\n+\t\t\t\trenderer_->render(memory);\n+\t\t\t\timage_ = QImage(renderer_->toImage());\n+\t\t\t} else\n+\t\t\t\tconverter_.convert(memory, size, &image_);\n \t\t}\n \t}\n \n@@ -179,3 +198,14 @@ QSize ViewFinder::sizeHint() const\n {\n \treturn size_.isValid() ? size_ : QSize(640, 480);\n }\n+\n+void ViewFinder::setRender(std::string render_type)\n+{\n+\tif (render_type == \"gles\") {\n+\t\trenderer_ = new Renderer();\n+\t\trenderer_->initializeGL();\n+\t\trenderType_ = RenderGLES;\n+\t} else {\n+\t\trenderType_ = RenderQT;\n+\t}\n+}\ndiff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h\nindex 26a1320..ed09c1e 100644\n--- a/src/qcam/viewfinder.h\n+++ b/src/qcam/viewfinder.h\n@@ -20,6 +20,7 @@\n #include <libcamera/pixel_format.h>\n \n #include \"format_converter.h\"\n+#include \"renderer.h\"\n \n class QImage;\n \n@@ -28,6 +29,11 @@ struct MappedBuffer {\n \tsize_t size;\n };\n \n+enum RenderType {\n+\tRenderGLES,\n+\tRenderQT,\n+};\n+\n class ViewFinder : public QWidget\n {\n \tQ_OBJECT\n@@ -43,6 +49,7 @@ public:\n \tvoid stop();\n \n \tQImage getCurrentImage();\n+\tvoid setRender(std::string render_type);\n \n Q_SIGNALS:\n \tvoid renderComplete(libcamera::FrameBuffer *buffer);\n@@ -66,6 +73,9 @@ private:\n \tlibcamera::FrameBuffer *buffer_;\n \tQImage image_;\n \tQMutex mutex_; /* Prevent concurrent access to image_ */\n+\n+\tRenderer *renderer_; /* OpenGL renderer */\n+\tRenderType renderType_;\n };\n \n #endif /* __QCAM_VIEWFINDER__ */\n", "prefixes": [ "libcamera-devel", "v4", "3/3" ] }