{"id":9485,"url":"https://patchwork.libcamera.org/api/1.1/patches/9485/?format=json","web_url":"https://patchwork.libcamera.org/patch/9485/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20200904084316.7319-6-show.liu@linaro.org>","date":"2020-09-04T08:43:16","name":"[libcamera-devel,v5,4/4] qcam: add additional command line option to select the render type","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0c0c3ded9a337089eea3246632d27c2c39267d1f","submitter":{"id":24,"url":"https://patchwork.libcamera.org/api/1.1/people/24/?format=json","name":"Show Liu","email":"show.liu@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9485/mbox/","series":[{"id":1262,"url":"https://patchwork.libcamera.org/api/1.1/series/1262/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1262","date":"2020-09-04T08:43:11","name":"qcam: accelerate format conversion by OpenGL shader","version":5,"mbox":"https://patchwork.libcamera.org/series/1262/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9485/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9485/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 49588BE174\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  4 Sep 2020 08:43:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 12E9E62B5E;\n\tFri,  4 Sep 2020 10:43:52 +0200 (CEST)","from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com\n\t[IPv6:2607:f8b0:4864:20::52f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C5AA62B29\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  4 Sep 2020 10:43:50 +0200 (CEST)","by mail-pg1-x52f.google.com with SMTP id 67so3964126pgd.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 04 Sep 2020 01:43:50 -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\ta6sm5202148pgt.70.2020.09.04.01.43.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 04 Sep 2020 01:43:48 -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=\"JabvbRHE\"; 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=gn2JH7tF1O7M0KrQ6KFsWgs+zDBHROUzYsKfAYJPK6Y=;\n\tb=JabvbRHEOcBM2+jzz/4sbu6nPlczB1VWPQ3mJfoAyKdPcMWf7GNT2j5onThx1Ryd+M\n\tk+xE908vL5GS6BLyqFs04197oqBk4RlZc1U35Bxe7IZS4pSwwR7KPTb5bXqD7JId1TJ1\n\t8reYn+2ZVRzTsRmdQnZ/G3SOY7/oWdPhe0UpE10IITHxYZhKO2GBSTU2M98vBICQChey\n\tjOMCI5rvZ+btZIkj70ACiyaX7UFxoCn8wjuUh9AMnP45z0EscbUv/bRYGPz0NoUmD5f/\n\ttntp0lCsdGGZe4RasoZ6BnGqj2UT+m4s62JyLVe92UetxoFBJv7HJyd1bFgGDgqqwlNh\n\tpMKA==","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=gn2JH7tF1O7M0KrQ6KFsWgs+zDBHROUzYsKfAYJPK6Y=;\n\tb=OlEsYuUpJ0Q/AFoRUkeSVpZPEaI0hDeiPcFifidtwSwMNx+FrIPGAVKCAu9PBx4pie\n\tI4vSDXKX4PlPUnr9wZEu5UWwlQ6VqCa/oJNIWAIIZ8EoHKnGoQr3dXpFrxe5KZlB0mcy\n\tNBwCNABXbE+LyJuC0s2EU8hG/XM8drFCdRnNCbTbcqFZdAXOPHWFt5rl5f/l4sEnHiaU\n\tjMaNwWI55cTXYonDzSJ1+XElU8Efhlzk2TxHtSBhDwkXGNlTWDLzDmM8RhYXvrnHmBxC\n\tKTk5sFbjhvqLe8D/m8G1A4Dn6x30sGiALPB0t4NNGzML0/vf30H2tA7OE1+NJbyiw1Zk\n\tXtiA==","X-Gm-Message-State":"AOAM53166+w5El60hJQJxkrbvdr2oyWJ5D6XuDc4v0bCqqo41zM0wLxc\n\tW5BQ/tE9Jo1Gesq537s9q7feKfApqEnw/Q==","X-Google-Smtp-Source":"ABdhPJw/oXxecjyH1fXNVR9uOE7TaAPHBKzLqBSEretmTyQkGWJhXHJuI/c8c5znb1KgwqBKd/ysiQ==","X-Received":"by 2002:a63:26c6:: with SMTP id\n\tm189mr6393156pgm.68.1599209029032; \n\tFri, 04 Sep 2020 01:43:49 -0700 (PDT)","From":"Show Liu <show.liu@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  4 Sep 2020 16:43:16 +0800","Message-Id":"<20200904084316.7319-6-show.liu@linaro.org>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20200904084316.7319-1-show.liu@linaro.org>","References":"<20200904084316.7319-1-show.liu@linaro.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v5 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 | 29 ++++++++++++++++++++++++-----\n src/qcam/main_window.h   |  6 ++++++\n 3 files changed, 33 insertions(+), 5 deletions(-)","diff":"diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\nindex bae358d..19d0559 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 612d978..467cc74 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -91,7 +91,7 @@ private:\n \n MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \t: saveRaw_(nullptr), options_(options), cm_(cm), allocator_(nullptr),\n-\t  isCapturing_(false), captureRaw_(false)\n+\t  isCapturing_(false), captureRaw_(false), renderType_(\"qt\")\n {\n \tint ret;\n \n@@ -105,10 +105,29 @@ 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(OptRender))\n+\t\trenderType_ = options_[OptRender].toString().c_str();\n+\n+\tif (renderType_ == \"qt\") {\n+\t\tviewfinder_ = new ViewFinderQt(this);\n+\t\tViewFinderQt *vf = dynamic_cast<ViewFinderQt *>(viewfinder_);\n+\t\tconnect(vf, &ViewFinderQt::renderComplete,\n+\t\t\tthis, &MainWindow::queueRequest);\n+\t\tsetCentralWidget(vf);\n+\t} else if (renderType_ == \"gles\") {\n+\t\tviewfinder_ = new ViewFinderGL(this);\n+\t\tViewFinderGL *vf = dynamic_cast<ViewFinderGL *>(viewfinder_);\n+\t\tconnect(vf, &ViewFinderGL::renderComplete,\n+\t\t\tthis, &MainWindow::queueRequest);\n+\t\tsetCentralWidget(vf);\n+\t} else {\n+\t\tqWarning() << \"Render Type:\"\n+\t\t\t   << QString::fromStdString(renderType_)\n+\t\t\t   << \" is not support.\";\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..a69b399 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@@ -38,6 +40,7 @@ enum {\n \tOptCamera = 'c',\n \tOptHelp = 'h',\n \tOptStream = 's',\n+\tOptRender = 'r',\n };\n \n class CaptureRequest\n@@ -134,6 +137,9 @@ private:\n \tQElapsedTimer frameRateInterval_;\n \tuint32_t previousFrames_;\n \tuint32_t framesCaptured_;\n+\n+\t/* Render Type Qt or GLES */\n+\tstd::string renderType_;\n };\n \n #endif /* __QCAM_MAIN_WINDOW__ */\n","prefixes":["libcamera-devel","v5","4/4"]}