[{"id":12519,"web_url":"https://patchwork.libcamera.org/comment/12519/","msgid":"<20200915025345.GA32152@pendragon.ideasonboard.com>","date":"2020-09-15T02:53:45","subject":"Re: [libcamera-devel] [PATCH v7 4/4] qcam: Add additional command\n\tline option to select the renderer type","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Sep 15, 2020 at 05:46:23AM +0300, Laurent Pinchart wrote:\n> From: Show Liu <show.liu@linaro.org>\n> \n> Add new option \"--renderer=qt|gles\" to select the renderer type,\n> \"--renderer=gles\" to accelerate format conversion and rendering\n> \"--renderer=qt\" is the original Qt rendering.\n> \n> Signed-off-by: Show Liu <show.liu@linaro.org>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/qcam/main.cpp        |  3 +++\n>  src/qcam/main_window.cpp | 32 +++++++++++++++++++++++++++-----\n>  src/qcam/main_window.h   |  1 +\n>  3 files changed, 31 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\n> index bae358df0877..f60d3cef0ecb 100644\n> --- a/src/qcam/main.cpp\n> +++ b/src/qcam/main.cpp\n> @@ -33,6 +33,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[])\n>  \t\t\t ArgumentRequired, \"camera\");\n>  \tparser.addOption(OptHelp, OptionNone, \"Display this help message\",\n>  \t\t\t \"help\");\n> +\tparser.addOption(OptRenderer, OptionString,\n> +\t\t\t \"Choose the renderer type {qt,gles} (default: qt)\",\n> +\t\t\t \"renderer\", ArgumentRequired, \"renderer\");\n>  \tparser.addOption(OptStream, &streamKeyValue,\n>  \t\t\t \"Set configuration of a camera stream\", \"stream\", true);\n>  \n> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n> index 7406f0bd4512..e5233f4fb706 100644\n> --- a/src/qcam/main_window.cpp\n> +++ b/src/qcam/main_window.cpp\n> @@ -28,6 +28,7 @@\n>  #include <libcamera/version.h>\n>  \n>  #include \"dng_writer.h\"\n> +#include \"viewfinder_gl.h\"\n>  #include \"viewfinder_qt.h\"\n\nThis is missing\n\ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex e5233f4fb706..985743f32334 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -28,7 +28,9 @@\n #include <libcamera/version.h>\n\n #include \"dng_writer.h\"\n+#ifndef QT_NO_OPENGL\n #include \"viewfinder_gl.h\"\n+#endif\n #include \"viewfinder_qt.h\"\n\n using namespace libcamera;\n\n>  using namespace libcamera;\n> @@ -106,11 +107,32 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n>  \tsetWindowTitle(title_);\n>  \tconnect(&titleTimer_, SIGNAL(timeout()), this, SLOT(updateTitle()));\n>  \n> -\tViewFinderQt *viewfinder = new ViewFinderQt(this);\n> -\tconnect(viewfinder, &ViewFinderQt::renderComplete,\n> -\t\tthis, &MainWindow::queueRequest);\n> -\tviewfinder_ = viewfinder;\n> -\tsetCentralWidget(viewfinder);\n> +\t/* Renderer type Qt or GLES, select Qt by default. */\n> +\tstd::string renderType = \"qt\";\n> +\tif (options_.isSet(OptRenderer))\n> +\t\trenderType = options_[OptRenderer].toString();\n> +\n> +\tif (renderType == \"qt\") {\n> +\t\tViewFinderQt *viewfinder = new ViewFinderQt(this);\n> +\t\tconnect(viewfinder, &ViewFinderQt::renderComplete,\n> +\t\t\tthis, &MainWindow::queueRequest);\n> +\t\tviewfinder_ = viewfinder;\n> +\t\tsetCentralWidget(viewfinder);\n> +#ifndef QT_NO_OPENGL\n> +\t} else if (renderType == \"gles\") {\n> +\t\tViewFinderGL *viewfinder = new ViewFinderGL(this);\n> +\t\tconnect(viewfinder, &ViewFinderGL::renderComplete,\n> +\t\t\tthis, &MainWindow::queueRequest);\n> +\t\tviewfinder_ = viewfinder;\n> +\t\tsetCentralWidget(viewfinder);\n> +#endif\n> +\t} else {\n> +\t\tqWarning() << \"Invalid render type\"\n> +\t\t\t   << QString::fromStdString(renderType);\n> +\t\tquit();\n> +\t\treturn;\n> +\t}\n> +\n>  \tadjustSize();\n>  \n>  \t/* Hotplug/unplug support */\n> diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\n> index 3d21779e3f4a..5c61a4dfce53 100644\n> --- a/src/qcam/main_window.h\n> +++ b/src/qcam/main_window.h\n> @@ -37,6 +37,7 @@ class HotplugEvent;\n>  enum {\n>  \tOptCamera = 'c',\n>  \tOptHelp = 'h',\n> +\tOptRenderer = 'r',\n>  \tOptStream = 's',\n>  };\n>","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 A53F2BF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 15 Sep 2020 02:54:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2A32462DAB;\n\tTue, 15 Sep 2020 04:54:16 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 559DD62901\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Sep 2020 04:54:14 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C2573275;\n\tTue, 15 Sep 2020 04:54:13 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"K9uDDO8i\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600138453;\n\tbh=aoMHu7sUX50/UP9WOzH4kqtDFbpFf7n9NuSB7AGRpak=;\n\th=Date:From:To:Subject:References:In-Reply-To:From;\n\tb=K9uDDO8iDuKf6Rgr46AvOVJFSp4sAhzyR6Pzd+DkECTD2a+OUihQsFoUucjsRzMGh\n\tO1bqPzJ8Zbc5ke10ciUl6QfxyfuitbkKaF4W8iOmRx/yscRfa3/i4u5hoEEpmd0B7h\n\tRRjLdMC2QZdTu9wN6Pb2oOquHSt6kH0CQFYyo2XE=","Date":"Tue, 15 Sep 2020 05:53:45 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org, Show Liu <show.liu@linaro.org>","Message-ID":"<20200915025345.GA32152@pendragon.ideasonboard.com>","References":"<20200915024623.30667-1-laurent.pinchart@ideasonboard.com>\n\t<20200915024623.30667-5-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200915024623.30667-5-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v7 4/4] qcam: Add additional command\n\tline option to select the renderer type","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>"}}]