{"id":17057,"url":"https://patchwork.libcamera.org/api/patches/17057/?format=json","web_url":"https://patchwork.libcamera.org/patch/17057/","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":"<20220809205042.344923-6-utkarsh02t@gmail.com>","date":"2022-08-09T20:50:39","name":"[libcamera-devel,v7,5/8] 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/17057/mbox/","series":[{"id":3400,"url":"https://patchwork.libcamera.org/api/series/3400/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3400","date":"2022-08-09T20:50:34","name":"Introduce capture scripts to qcam","version":7,"mbox":"https://patchwork.libcamera.org/series/3400/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17057/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17057/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 25AE1BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Aug 2022 20:53:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B7116332B;\n\tTue,  9 Aug 2022 22:53:18 +0200 (CEST)","from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com\n\t[IPv6:2607:f8b0:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 95F0D61FAA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Aug 2022 22:53:16 +0200 (CEST)","by mail-pf1-x42d.google.com with SMTP id f28so11875444pfk.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 09 Aug 2022 13:53:16 -0700 (PDT)","from localhost.localdomain ([2404:bd00:3:d2bc:2358:3bcd:fb4f:cbb7])\n\tby smtp.gmail.com with ESMTPSA id\n\td3-20020a623603000000b0052d981e7842sm301936pfa.208.2022.08.09.13.53.12\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 09 Aug 2022 13:53:14 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660078398;\n\tbh=W3QoFPcQqQKVRH5GnhX5zifdpYLJkUVHcrTW7dGcBEk=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=TJSwRHwHdkpHzTjWTF3v3mco5Qzsq06kqr7UYsOwZXrfBbaQRXvIe6bfdYQWiX8b2\n\tC8WeUl+EZO/UaxLwuWht/VBr8J1QzP/HIWI93Deilrl/nFmSLxZFbUR8eDjU7OACyl\n\tDg1w90azhKBQgadQiR2+/wGvPEo3LKUtSD6Y630ef7LCsDqwuye13+2fj2Na93oHMW\n\taYStA/+iLlYe8fsWvlv91ZaZ7e/5wCwlMRfd843SK+df3O7xVIne4OBME1lwA9+/88\n\tS9AB9R3cssg9OAKukvIlQkHfZkQkuzmutNtDipqQJ8cWQly5wnciVXHe7cnAsr5cw9\n\tDb/qP1V5cchng==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc;\n\tbh=yt6mCUrFgve5P3MjYWCshMuvkLX5Znj/8iQ14Dej+Rw=;\n\tb=a6JTGAaG352LuGbn+YwGH7sCPWtjMuCYCDfqnTJ4ir7q+ewd0k+Av4htEoS/B37Mu/\n\taZwrkZSZH8D5lDekMet9Ug4HZzxYBtYy8EpRWB+SAcIg79FzkKRoj2sGpZOZYZ8rFC1k\n\tY+m+tRSsknLs1lWzOVnlK5ex3Z1QnkleWI8GHxbDOtnIq7FJz9GetKEAQafh4L7R35/O\n\tcGBDV2CCMYBNi6fLDGwkJz6KEAMekWP/JoJkmKcW6LsyJJjaR9H+CIx6mQgmNcRfXtg6\n\trWiAaOXWNt+ASKRghh/scco9YF88qEd0VRfP2BzyMoFX04nBlCN+olwh6ekwO5ZdfuJ2\n\tY60g=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"a6JTGAaG\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc;\n\tbh=yt6mCUrFgve5P3MjYWCshMuvkLX5Znj/8iQ14Dej+Rw=;\n\tb=eIqKCp4Nch44WsUDeljXHN84QvKzZekRGTMa1wXewfkes/JubGNS4A6fs5VmCNMrB4\n\tV/JWmwVXSAHdWpdxuEEcLSsSBoRkiJa2rf1oPg+UDsBBduTT42wt2637LkmThQ9geImj\n\tUhqQXpYWoeUKZMxBqoqFpXc42djiI8/5UucVsSSZuZGeMzbUT/Z4MaVVzCc+qvJgjPlT\n\tvtcWjLoSAYMJXpefNRwDTvjER+SFm42hVLx5INqR3Do4X0ChAsT6yNHoqLMW6hMFtXVt\n\tNWnaLskd3wcqYoG1SsrO0FiqocHI+stUXAzUXwxXpeke95OwOackh8rDwQ96wCwjxKDc\n\tbs+g==","X-Gm-Message-State":"ACgBeo2tZeuc3b5pKWtf9FuIPBkeqrKH9vusc7UJau76vA0ROZpTnZ1L\n\tlei1V0cRC9z/oolCO/TW6JYiM+DPMpI=","X-Google-Smtp-Source":"AA6agR6JR3GL/BdC28AFsWmFPvUUZG+y4o0epkIKlN5e8kbJO98xbN59ige4cjQx53o3/zWwepEe2A==","X-Received":"by 2002:a65:6556:0:b0:41c:9c36:98fa with SMTP id\n\ta22-20020a656556000000b0041c9c3698famr20978778pgw.491.1660078394957; \n\tTue, 09 Aug 2022 13:53:14 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 10 Aug 2022 02:20:39 +0530","Message-Id":"<20220809205042.344923-6-utkarsh02t@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220809205042.344923-1-utkarsh02t@gmail.com>","References":"<20220809205042.344923-1-utkarsh02t@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v7 5/8] 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 at gmail.com>\nReviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain at ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\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 15b150ec..3feabcff 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@@ -513,7 +513,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@@ -745,7 +745,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@@ -774,6 +774,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 bbdbb21c..bd6f0172 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -70,7 +70,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@@ -84,6 +84,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","v7","5/8"]}