{"id":9571,"url":"https://patchwork.libcamera.org/api/patches/9571/?format=json","web_url":"https://patchwork.libcamera.org/patch/9571/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","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-5-show.liu@linaro.org>","date":"2020-09-11T08:55:14","name":"[libcamera-devel,v6,4/4] qcam: add additional command line option to select the render type","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"352acb728391c11fed764ffe4186b1edf8ecc02c","submitter":{"id":24,"url":"https://patchwork.libcamera.org/api/people/24/?format=json","name":"Show Liu","email":"show.liu@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9571/mbox/","series":[{"id":1284,"url":"https://patchwork.libcamera.org/api/series/1284/?format=json","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/9571/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9571/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 6B9B8BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Sep 2020 08:55:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 387DC62D81;\n\tFri, 11 Sep 2020 10:55:50 +0200 (CEST)","from mail-pg1-x535.google.com (mail-pg1-x535.google.com\n\t[IPv6:2607:f8b0:4864:20::535])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E2FF662D38\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Sep 2020 10:55:48 +0200 (CEST)","by mail-pg1-x535.google.com with SMTP id f2so4149463pgd.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Sep 2020 01:55:48 -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.46\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 11 Sep 2020 01:55:47 -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=\"OPKwd4VK\"; 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=pplAyIWzx/jJzkQ8ErheBqp/JOxZ8UPVrHihID0UcyI=;\n\tb=OPKwd4VKgIIIKRsjxFjXBz/Cx8xMaKCS7IMlPL6NmoZ+bvnl8Vt4g4oUxoPSwWP70k\n\tr3Bs9uNGFPxvwHwPxBLpd+BipXuQvOpq4/ydzLBNNDYoxrP7oVxNS1oyc/GMtpkgME6u\n\tjch0RJZ3VxGFVqcVvIZfciVmgqETiHv8AofTfxPrqU+WjJ2vRDtn99SpIwgo9kNKIIcC\n\tF11GjezY/rLuUmm+AoZgUKzhrUBa+DVL1WVQY1YmPngkXaBp+0tX3e0YueP9X+z08m3L\n\tzYgX5BI4uiXrwUNWhnhqmwCq09Dc7Xlv9r6j8xWTWipXH66nTp3k3f2divjoxW8cXREf\n\tOo2Q==","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=pplAyIWzx/jJzkQ8ErheBqp/JOxZ8UPVrHihID0UcyI=;\n\tb=d9ZVe/i7SUagwabulx8HjXj049yVPHDyfC/2PgrRWDVcxqb4VWrU/1AC7WFZ07+1+Y\n\thcAmaCglDzG7vdjd/0QXWO3x2hI66vashIl4hI6qcFwuLMNT7+2JsaqbfP/MNwTv9wjW\n\tRApgh7DF3sEI2ZgK3KkoLYvfdw8PA+R58kK6ItMvSVDMIKx7Yy99PhRwaSYeTW36FaNY\n\ts7LxiKkUN2ey0lt8QB6cSlu5+uGMjuKqKVAdlTztru6xny9dxnzPugeplzNENg4xAnaj\n\tVHD5isQL8EqCddWCuIL2xKRQ3py5Hs/XtfwBX+7iZHzddpPTKsb2ly98EfAG56FU3m9k\n\t+6fA==","X-Gm-Message-State":"AOAM5303BNrBxZuCGMLjbE0h9NnjPkNbMW780s1Y+rUE8yThFpMl4O3x\n\tYdHBpKQSR+O6ztRW6C9St7VY45XBSETsrg==","X-Google-Smtp-Source":"ABdhPJxNpzy/hFw2SihqXYSN4Jiv3Fnl7fcsHMR1c4DvczcKMArA0UbcyT5HIDoKw9tA8ytJEJgxtA==","X-Received":"by 2002:a63:1356:: with SMTP id 22mr964104pgt.108.1599814547320; \n\tFri, 11 Sep 2020 01:55:47 -0700 (PDT)","From":"Show Liu <show.liu@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 11 Sep 2020 16:55:14 +0800","Message-Id":"<20200911085514.30021-5-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 4/4] qcam: add additional command line\n\toption to select the render 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>"},"content":"Add new option \"--render=qt|gles\" to select the render type,\n\"--render=gles\" to accelerate format conversion and rendering\n\"--render=qt\" is the original Qt rendering\n\nSigned-off-by: Show Liu <show.liu@linaro.org>\n---\n src/qcam/main.cpp        |  3 +++\n src/qcam/main_window.cpp | 31 +++++++++++++++++++++++++++----\n src/qcam/main_window.h   |  3 +++\n 3 files changed, 33 insertions(+), 4 deletions(-)","diff":"diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\nindex bae358d..4b7d041 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(OptRendered, OptionString,\n+\t\t\t \"Choose the renderer type {qt,gles} (default: qt)\", \"renderer\",\n+\t\t\t ArgumentRequired, \"render\");\n \tparser.addOption(OptStream, &streamKeyValue,\n \t\t\t \"Set configuration of a camera stream\", \"stream\", true);\n \ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 612d978..315102c 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -95,6 +95,9 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n {\n \tint ret;\n \n+\t/* Render Type Qt or GLES, and set Qt by default */\n+\tstd::string renderType_ = \"qt\";\n+\n \t/*\n \t * Initialize the UI: Create the toolbar, set the window title and\n \t * create the viewfinder widget.\n@@ -105,10 +108,30 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \tsetWindowTitle(title_);\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+\tif (options_.isSet(OptRendered))\n+\t\trenderType_ = options_[OptRendered].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 */\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 3d21779..251f78b 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -26,6 +26,8 @@\n \n #include \"../cam/stream_options.h\"\n #include \"viewfinder.h\"\n+#include \"viewfinder_gl.h\"\n+#include \"viewfinder_qt.h\"\n \n using namespace libcamera;\n \n@@ -37,6 +39,7 @@ class HotplugEvent;\n enum {\n \tOptCamera = 'c',\n \tOptHelp = 'h',\n+\tOptRendered = 'r',\n \tOptStream = 's',\n };\n \n","prefixes":["libcamera-devel","v6","4/4"]}