[{"id":23712,"web_url":"https://patchwork.libcamera.org/comment/23712/","msgid":"<165668926479.1516045.7614590790779896921@Monstersaurus>","date":"2022-07-01T15:27:44","subject":"Re: [libcamera-devel] [PATCH v3 1/3] qcam: Queue requests only\n\tthrough MainWindow::queueRequest()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Utkarsh Tiwari via libcamera-devel (2022-06-27 04:01:57)\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> 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\nI gave this on both v1 and v2 so I think you can copy it directly into\nthe commit for any later versions (if required).\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n\n> \n> Signed-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\n> ---\n\nAfter these three dashes is a good place to put extra comments like a\nchangelog to say what has (or has not) changed between versions.\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>         if (renderType == \"qt\") {\n>                 ViewFinderQt *viewfinder = new ViewFinderQt(this);\n>                 connect(viewfinder, &ViewFinderQt::renderComplete,\n> -                       this, &MainWindow::queueRequest);\n> +                       this, &MainWindow::renderComplete);\n>                 viewfinder_ = viewfinder;\n>                 setCentralWidget(viewfinder);\n>  #ifndef QT_NO_OPENGL\n>         } else if (renderType == \"gles\") {\n>                 ViewFinderGL *viewfinder = new ViewFinderGL(this);\n>                 connect(viewfinder, &ViewFinderGL::renderComplete,\n> -                       this, &MainWindow::queueRequest);\n> +                       this, &MainWindow::renderComplete);\n>                 viewfinder_ = viewfinder;\n>                 setCentralWidget(viewfinder);\n>  #endif\n> @@ -521,7 +521,7 @@ int MainWindow::startCapture()\n>  \n>         /* Queue all requests. */\n>         for (std::unique_ptr<Request> &request : requests_) {\n> -               ret = camera_->queueRequest(request.get());\n> +               ret = queueRequest(request.get());\n>                 if (ret < 0) {\n>                         qWarning() << \"Can't queue request\";\n>                         goto error_disconnect;\n> @@ -755,7 +755,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer)\n>         viewfinder_->render(buffer, mappedBuffers_[buffer].get());\n>  }\n>  \n> -void MainWindow::queueRequest(FrameBuffer *buffer)\n> +void MainWindow::renderComplete(FrameBuffer *buffer)\n>  {\n>         Request *request;\n>         {\n> @@ -784,6 +784,10 @@ void MainWindow::queueRequest(FrameBuffer *buffer)\n>                         qWarning() << \"No free buffer available for RAW capture\";\n>                 }\n>         }\n> +       queueRequest(request);\n> +}\n>  \n> -       camera_->queueRequest(request);\n> +int MainWindow::queueRequest(Request *request)\n> +{\n> +       return 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>         void processRaw(libcamera::FrameBuffer *buffer,\n>                         const libcamera::ControlList &metadata);\n>  \n> -       void queueRequest(libcamera::FrameBuffer *buffer);\n> +       void renderComplete(libcamera::FrameBuffer *buffer);\n>  \n>  private:\n>         int createToolbars();\n> @@ -80,6 +80,7 @@ private:\n>         void addCamera(std::shared_ptr<libcamera::Camera> camera);\n>         void removeCamera(std::shared_ptr<libcamera::Camera> camera);\n>  \n> +       int queueRequest(libcamera::Request *request);\n>         void requestComplete(libcamera::Request *request);\n>         void processCapture();\n>         void processHotplug(HotplugEvent *e);\n> -- \n> 2.25.1\n>","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 DF6BDBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  1 Jul 2022 15:27:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 27DA36564E;\n\tFri,  1 Jul 2022 17:27:48 +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 13D0060552\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Jul 2022 17:27:47 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A22FE25C;\n\tFri,  1 Jul 2022 17:27:46 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656689268;\n\tbh=ZZgc+cbdqkLjHAgSf/EqY0ySWUFtPinYo6GBbdPwNRg=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=LmjRX0KUbqp3dzYkCWjsqOHvGjwAwAolxxGLqW967DMCRjFZ3zM2RjLysl/hkjPUu\n\tB7bpr0mJJcr0R/qRiWxlp7J6+eeRc14Q8eVlfzMlt3PWTV0tgpBCYRQ6GjXTV/u8FW\n\trpiqAnCGGXbP3bJlQQ1D8I95M6lW31Xe/a/snv4ON5YeLayHvkOqlnY6qYYtXtyp1W\n\tVL5BecnJgtOa+Usu96zCz5A+Liu+UvzvaUrbSCeHM/78o4P4iTWemdbtZhwPLuSt2x\n\tjebBoqjIVyV5Ht3HWvCtSgmN9Bcmz965KLmkbYmf7tiCEt1jqg/+XJYq8sjq5m3mr9\n\t/rrdQybRx+Yxg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1656689266;\n\tbh=ZZgc+cbdqkLjHAgSf/EqY0ySWUFtPinYo6GBbdPwNRg=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=V13HrtgdkCEqcfB/jxPScXSYQm7LfNG0IBn5lwrGckWW8C5/oegxVN8SM8CGth5Vx\n\tOtzs7ZGbrS+FCOFbRP0srYlsnsvbWjPSZ3t7LpddBJ+4LR7uRhL1ezhR4Zk/l3sC7G\n\tZI5V1x3PGrvcBW7vRwp/7YxkxwKT764d4bZoweoo="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"V13Hrtgd\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220627030159.30730-2-utkarsh02t@gmail.com>","References":"<20220627030159.30730-1-utkarsh02t@gmail.com>\n\t<20220627030159.30730-2-utkarsh02t@gmail.com>","To":"Utkarsh Tiwari <utkarsh02t@gmail.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 01 Jul 2022 16:27:44 +0100","Message-ID":"<165668926479.1516045.7614590790779896921@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v3 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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]