{"id":16809,"url":"https://patchwork.libcamera.org/api/patches/16809/?format=json","web_url":"https://patchwork.libcamera.org/patch/16809/","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":"<20220726194123.170208-1-utkarsh02t@gmail.com>","date":"2022-07-26T19:41:21","name":"[libcamera-devel,v5,1/3] qcam: Queue requests only through MainWindow::queueRequest()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"bbc350001fa86beee4bea0c7bf20251307f63765","submitter":{"id":114,"url":"https://patchwork.libcamera.org/api/people/114/?format=json","name":"Utkarsh Tiwari","email":"utkarsh02t@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16809/mbox/","series":[{"id":3330,"url":"https://patchwork.libcamera.org/api/series/3330/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3330","date":"2022-07-26T19:38:56","name":"Introduce capture scripts to qcam","version":5,"mbox":"https://patchwork.libcamera.org/series/3330/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16809/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16809/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 A3000C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jul 2022 19:41:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7B74D63312;\n\tTue, 26 Jul 2022 21:41:44 +0200 (CEST)","from mail-pf1-x431.google.com (mail-pf1-x431.google.com\n\t[IPv6:2607:f8b0:4864:20::431])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A85B60487\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 21:41:43 +0200 (CEST)","by mail-pf1-x431.google.com with SMTP id w205so10790382pfc.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 12:41:43 -0700 (PDT)","from localhost.localdomain ([2404:bd00:3:d6bf:24ea:3f52:4c78:7bd8])\n\tby smtp.gmail.com with ESMTPSA id\n\ta5-20020aa794a5000000b0052ac1af926fsm12017782pfl.20.2022.07.26.12.41.39\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 26 Jul 2022 12:41:41 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658864504;\n\tbh=3Z0HBm5+psRkG8twCvvKP2WPwiLjQU/h7vfRLmk55Dc=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=lZmzRyV7idjx8VglloiuG6fkHB6HXETIdGi0sUIdDLoGkvfmlp6YHKF1+Vb/R1ScP\n\tQzaJlHtdIkaOgIcMlmwqIaU/y9u6uV5jbVSnuenqDMOotpMaLrEbrNdL36C9c7FNDc\n\ttnYi9wxt1DqF0WdXAUg8Q++0PZg2i9FO/p2aG/wLXYzKUfU66rC/UZNPvTJ2MAWSAd\n\t3go7yh7ekIcBc4K9khmefRv4UpBf8fspnA94pSO3tB6xBlOcNGrcOWmZZfxTxrVcp6\n\tuzaCt8RILdRx1bJW6E3aFwqCeeHyNq+WyNFKyH1RE+hnFvSVCNpJGxwmglbETqVtGN\n\t+mOUNDCuRV9Vw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=jHwjnUKeUvBi6o6pk+wq5ks5LIpCU8fe7V02l2HJH9U=;\n\tb=bvI4PscMhgP0mENGrWEYufs5dQbVbG1H70bafeaqCmBxeej4Mw4pMWpFmjou6gij19\n\tv5Pr62EdCRLoQdg9GoA22yYW04sM4cPEhbSRCTtwn4iltrhzATTfg7GXRzvz9Yl4gTPR\n\tpnnRL7+omjbiADQkDQtI6A4gg32d+GWApGG8HBhcOVUn4RG6ikEiCfoB8G7z5aIZsu65\n\tnwxx8X619lPbwfPuodQtvQA2yU2aBIe5dOgGSov+Br/OM6qZQUdJTG1QOI8r7OSjsP0Q\n\tCtsEDQsxmy9YDHCRMO9IIFomDe0KqvVOqm9DsIsV03pt/o0WQpAWCRZUc0XSp/JN14im\n\tXbnQ=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"bvI4PscM\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=jHwjnUKeUvBi6o6pk+wq5ks5LIpCU8fe7V02l2HJH9U=;\n\tb=TtVXEVBD6En1AI8+OzxO5b0xfYvzVm5Xmt2oE5oULT0x/Ao+wPkS7oCfWEcLXi/vmC\n\tLSseF5pxI37cypBpSKUjrQcqGnNlJfFr/XqYrY314QlMUWm2HyIz1W6uKTJmFcFrC3ar\n\tKvj4PbVj7pW8e8g9Xs54l8DJnMyFP3ybGyE8oYKmQsO6F+Aus0mBg4ALEOdi19YKHaTb\n\tXIaYuT/kwPFpeL3EZiSgwmmEzzlzxpyfwxo9TjOJu4pKeCQueDGAHYsV2LwZgdft1vaV\n\t1moTlZEPv+g6XcB+n5+6cNWFUaettHS5yVof3k9YdlXq6zkY/DUmqdPSn2249BwTAuJe\n\toZyQ==","X-Gm-Message-State":"AJIora8hpnPHv7tneBVIEAR9DbZq/tgHnu66lcSUzHx57wvAF5e4rjtA\n\tJffGyGDBJ+waih1qBvoeDUtYY62MvsI=","X-Google-Smtp-Source":"AGRyM1vBl5wOGb/u08a2ObvnJbXE95vEnIHYx4T1sXjCWMLegriF/s78livev+ZOsTKP1Xdpva/Yog==","X-Received":"by 2002:a63:2bcc:0:b0:40c:95b5:46a4 with SMTP id\n\tr195-20020a632bcc000000b0040c95b546a4mr16018155pgr.535.1658864501566; \n\tTue, 26 Jul 2022 12:41:41 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 27 Jul 2022 01:11:21 +0530","Message-Id":"<20220726194123.170208-1-utkarsh02t@gmail.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 1/3] qcam: Queue requests only through\n\tMainWindow::queueRequest()","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>","From":"Utkarsh Tiwari via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Utkarsh Tiwari <utkarsh02t@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Currently to request a frame, we operate the camera directly.\nThis approach is also scattered in two places,\nMainWindow::startCapture() and MainWindow::queueRequest().\nThis makes it difficult to account for requests.\n\nCentralize all the queuing to a single function queueRequest()\n\nRename the current queueRequest() to renderComplete().\nThis makes more sense as this slot is triggered when\nthe render is complete and we want to queue another\nrequest.\n\nSigned-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n Changes from v4\n\t- Grammer fixes in the commit message\n src/qcam/main_window.cpp | 14 +++++++++-----\n src/qcam/main_window.h   |  3 ++-\n 2 files changed, 11 insertions(+), 6 deletions(-)","diff":"diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 7433d647..4e773c31 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -120,14 +120,14 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\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\t\tthis, &MainWindow::renderComplete);\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\t\tthis, &MainWindow::renderComplete);\n \t\tviewfinder_ = viewfinder;\n \t\tsetCentralWidget(viewfinder);\n #endif\n@@ -522,7 +522,7 @@ int MainWindow::startCapture()\n \n \t/* Queue all requests. */\n \tfor (std::unique_ptr<Request> &request : requests_) {\n-\t\tret = camera_->queueRequest(request.get());\n+\t\tret = queueRequest(request.get());\n \t\tif (ret < 0) {\n \t\t\tqWarning() << \"Can't queue request\";\n \t\t\tgoto error_disconnect;\n@@ -756,7 +756,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer)\n \tviewfinder_->render(buffer, mappedBuffers_[buffer].get());\n }\n \n-void MainWindow::queueRequest(FrameBuffer *buffer)\n+void MainWindow::renderComplete(FrameBuffer *buffer)\n {\n \tRequest *request;\n \t{\n@@ -785,6 +785,10 @@ void MainWindow::queueRequest(FrameBuffer *buffer)\n \t\t\tqWarning() << \"No free buffer available for RAW capture\";\n \t\t}\n \t}\n+\tqueueRequest(request);\n+}\n \n-\tcamera_->queueRequest(request);\n+int MainWindow::queueRequest(Request *request)\n+{\n+\treturn camera_->queueRequest(request);\n }\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex fc70920f..bc844711 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -67,7 +67,7 @@ private Q_SLOTS:\n \tvoid processRaw(libcamera::FrameBuffer *buffer,\n \t\t\tconst libcamera::ControlList &metadata);\n \n-\tvoid queueRequest(libcamera::FrameBuffer *buffer);\n+\tvoid renderComplete(libcamera::FrameBuffer *buffer);\n \n private:\n \tint createToolbars();\n@@ -81,6 +81,7 @@ private:\n \tvoid addCamera(std::shared_ptr<libcamera::Camera> camera);\n \tvoid removeCamera(std::shared_ptr<libcamera::Camera> camera);\n \n+\tint queueRequest(libcamera::Request *request);\n \tvoid requestComplete(libcamera::Request *request);\n \tvoid processCapture();\n \tvoid processHotplug(HotplugEvent *e);\n","prefixes":["libcamera-devel","v5","1/3"]}