[{"id":24156,"web_url":"https://patchwork.libcamera.org/comment/24156/","msgid":"<YuBXim2TlL9xpN3z@pendragon.ideasonboard.com>","date":"2022-07-26T21:07:22","subject":"Re: [libcamera-devel] [PATCH v5 1/3] qcam: Queue requests only\n\tthrough MainWindow::queueRequest()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Utkarsh,\n\nThank you for the patch.\n\nOn Wed, Jul 27, 2022 at 01:11:21AM +0530, 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 for requests.\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> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\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(-)\n> \n> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\n> index 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>  }\n> diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\n> index 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);","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 7F2A8BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jul 2022 21:07:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BDBA263312;\n\tTue, 26 Jul 2022 23:07:29 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B2A2460487\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jul 2022 23:07:28 +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 18398735;\n\tTue, 26 Jul 2022 23:07:28 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658869649;\n\tbh=GwDs4OfRMZTCk42dWuofu3AiM10dWt0/14eKrlgHJtk=;\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:Cc:\n\tFrom;\n\tb=Cn6jEeD0FNquv3sf3hulJfqYKTXgkJErTrkYLz3wZQOKK1SCIxQsAZ/VYaqYHyPj7\n\t0WaJXukaDxF+ZQjpuoa2AEvjpS2fnt9BmXIOMWSCMIzLwTXBMylHy8Tbru5RMKIp8n\n\teT2rlPptqATBYhJBAijt//UcJY1QO2DgcMy8DwTjvuS76NQETFn5CYzDx7Qkw7vXep\n\tbplfTo53RhFhVYvmY31NEspwmdGKnKK2I9svo7IMpfAz+DIofWVUaYk9yIUKoSBGod\n\tdG8RkrJ21fe1mfJjETnE2modTP+XYFY2Y2ywOMcDXEFEsIV3PI4vU+V1uS22AGlvCR\n\ti17gOV5oNTbIQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658869648;\n\tbh=GwDs4OfRMZTCk42dWuofu3AiM10dWt0/14eKrlgHJtk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=i9kEk9WKLLY6UMDoBKJ5NOwEHRs//dRjs9nIpaLsEI2s5zuFOR0HHR2Kyvu/eAiIw\n\tVnooP7QjaszPsUKj1b3n1w6GHnVOC3q2x0rn0rB1j11WRrx+TftngBf9PbwZMxnTrD\n\t6LPw5ST8zymj/Wz45V+IyKv6FICDsLdaMUcbXQ6Y="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"i9kEk9WK\"; dkim-atps=neutral","Date":"Wed, 27 Jul 2022 00:07:22 +0300","To":"Utkarsh Tiwari <utkarsh02t@gmail.com>","Message-ID":"<YuBXim2TlL9xpN3z@pendragon.ideasonboard.com>","References":"<20220726194123.170208-1-utkarsh02t@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220726194123.170208-1-utkarsh02t@gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v5 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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]