[{"id":24115,"web_url":"https://patchwork.libcamera.org/comment/24115/","msgid":"<e0bc8ab0-354d-f58b-cca8-ec2caecac121@ideasonboard.com>","date":"2022-07-25T18:32:15","subject":"Re: [libcamera-devel] [PATCH v4 1/3] qcam: Queue requests only\n\tthrough MainWindow::queueRequest()","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Utkarsh,\n\nThank you for the patch.\n\nOn 7/3/22 10:07, Utkarsh Tiwari via libcamera-devel wrote:\n> Currently to request a frame, we operate the camera directly.\n> This approach is also scattered in two places,\n> MainWindow::startCapture() and MainWindow::queueRequest().\n> This makes it difficult to account requests.\n\n\ns/account/account for/ maybe?\n\n>\n> Centralize all the queuing to a single function queueRequest()\n>\n> Rename the current queueRequest() to renderComplete(),\n> This makes more sense as this slot is triggered when\n> the render is complete and we want to queue another\n> request.\n>\n> Signed-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   src/qcam/main_window.cpp | 14 +++++++++-----\n>   src/qcam/main_window.h   |  3 ++-\n>   2 files changed, 11 insertions(+), 6 deletions(-)\n>\n> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n> index dd0e51f5..adeb3181 100644\n> --- a/src/qcam/main_window.cpp\n> +++ b/src/qcam/main_window.cpp\n> @@ -119,14 +119,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> @@ -521,7 +521,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> @@ -755,7 +755,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> @@ -784,6 +784,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>   }\n> diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\n> index 3fbe872c..c3e4b665 100644\n> --- a/src/qcam/main_window.h\n> +++ b/src/qcam/main_window.h\n> @@ -66,7 +66,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> @@ -80,6 +80,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);","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 463FDBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 25 Jul 2022 18:32:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A44D863312;\n\tMon, 25 Jul 2022 20:32:24 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2A7206330A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Jul 2022 20:32:23 +0200 (CEST)","from [IPV6:2401:4900:1f3e:f7a:bc8f:12ed:b45f:c35d] (unknown\n\t[IPv6:2401:4900:1f3e:f7a:bc8f:12ed:b45f:c35d])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 361176D1;\n\tMon, 25 Jul 2022 20:32:22 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658773944;\n\tbh=/7jZ/hZeMdj66MPulohmYyadww9FaC2K0n9iudxHU/Y=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=qceBRgPK2huLCnS2e3cfnzWLhOjFJ+82WMB3/2boHupyQdcIXxYcX0EWzhJBuTMRG\n\tS+hIOfFf5T3ZWJLLEt9AFSoSzkM4exypzQPIeR4da6QvLk9eakLdoXQiBIeHCAcXaU\n\t/BJhaBjNFPAXp6wtfF2IePZ62GAecsh9SZ507kbo2yb1bBlsLhwho4QnLOFKm8S98v\n\t4qGWBzLeb9GmbQMBVrj7jG9Q/9QvxFw7ezNAWj64D7cQXgWBXd85+3E6PtvOZ6vUEq\n\t1diJvKCEzu6mkPVo4fouuGRcHiFdiQ+w1nETkjJNP23QhDoU+nPcbHl1WAQ2dnq3Py\n\tKk0o3GrV43YTg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658773942;\n\tbh=/7jZ/hZeMdj66MPulohmYyadww9FaC2K0n9iudxHU/Y=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=gHAozcD9UkLHFRG4uCRaMzgr0Ot2HfVBkpDP/AJ5lP5P0yIRCp8h1j1liTi9Oe+q2\n\tfEa9J3/+tfdxA66Ze1TbZhBtggAjwWWx5cc6PyfIKfDp1mNnQ3sLSErwyEXylHoDJ5\n\tZghJsHm2TrCQ9kvt5UlnhKPTqgSw3pZkNbOMyCU8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"gHAozcD9\"; dkim-atps=neutral","Message-ID":"<e0bc8ab0-354d-f58b-cca8-ec2caecac121@ideasonboard.com>","Date":"Tue, 26 Jul 2022 00:02:15 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.4.1","Content-Language":"en-US","To":"Utkarsh Tiwari <utkarsh02t@gmail.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220703043704.296872-1-utkarsh02t@gmail.com>\n\t<20220703043704.296872-2-utkarsh02t@gmail.com>","In-Reply-To":"<20220703043704.296872-2-utkarsh02t@gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v4 1/3] qcam: Queue requests only\n\tthrough MainWindow::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":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]