{"id":16318,"url":"https://patchwork.libcamera.org/api/1.1/patches/16318/?format=json","web_url":"https://patchwork.libcamera.org/patch/16318/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20220622131638.79122-2-utkarsh02t@gmail.com>","date":"2022-06-22T13:16:36","name":"[libcamera-devel,v2,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/1.1/people/114/?format=json","name":"Utkarsh Tiwari","email":"utkarsh02t@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16318/mbox/","series":[{"id":3204,"url":"https://patchwork.libcamera.org/api/1.1/series/3204/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3204","date":"2022-06-22T13:16:35","name":"Introduce capture scripts to qcam","version":2,"mbox":"https://patchwork.libcamera.org/series/3204/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16318/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16318/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 80369BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jun 2022 13:17:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2E4506563A;\n\tWed, 22 Jun 2022 15:17:27 +0200 (CEST)","from mail-pg1-x531.google.com (mail-pg1-x531.google.com\n\t[IPv6:2607:f8b0:4864:20::531])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 44BAE61FB2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jun 2022 15:17:26 +0200 (CEST)","by mail-pg1-x531.google.com with SMTP id 23so9912475pgc.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jun 2022 06:17:26 -0700 (PDT)","from localhost.localdomain\n\t([2406:3003:2005:1f6b:fd12:eca1:fe45:bbdb])\n\tby smtp.gmail.com with ESMTPSA id\n\tx82-20020a627c55000000b0052089e1b88esm7124540pfc.192.2022.06.22.06.17.23\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 22 Jun 2022 06:17:23 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655903847;\n\tbh=4Aq824HZHPf2PmvNblVn/eW6i8DB/sJg0DcK4tanfZg=;\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=DJ7RWXkBTzzdTBhiM0Cs2+F5XQYM+c7QfeWRWm3aJ1rhofMnfn4pboQ+wiywZ4TSB\n\tAxEFSe3drP9e1+SWBSyOGX5LUQQntOfowTbP1pc7nYoSY+pZBhznnLk5fQafGnAdDG\n\t2Hm4Azah2UietihCbboSUrh866vQqoFmx6NRZX6c0f9BeUzdPic3BfEMUuCsFZC/71\n\tSR5dIsgBduT/gkYQj1kedOtLP7TwDmC9xpz186g9LWWKlbbqlNHk74QjC4VybjYmYH\n\tfEBVkiFhlcIGN0P8I8G82qD+Z1kyEbS6GvRAVtwpgNYU4zKYgeKkp7e6q0wbgyVYfZ\n\ta3LjCrpt6m8gw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=FiD29FzPLJ25vLGERZCLerCSVMUJH90zaw1E+agM5O0=;\n\tb=ps0d5oe26rNZFXb0d+J0LdAjfF4PI1DmBb/Mp4up9QcN0kJGQt5dQCusEdKX/o5BNU\n\tghcR+OerDpXSl7pExx+giez0wzguKQ9uZ+gsqU9dMKg4pUWL1Rc5nPeuWtalHi64hRFY\n\tulgAjJfGXmQre3CdlQLKC+StJSOupp1qY3efBNvCzCdCzJors8xrZKi5O1dePSdenWks\n\te53h1ZitwJpO8XT5beNif2vlGcDuZ/+7gNDxqaBIHhRG5qZ4pZws1iGXpyztiK5zFp+P\n\tpcoNRoxF0tqVX2hCt5YL3w63bEpAJYyDSOQJ/xhWQp08ZpIIyVczbekmpUcV3UMTGrgj\n\tfiFg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ps0d5oe2\"; 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:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=FiD29FzPLJ25vLGERZCLerCSVMUJH90zaw1E+agM5O0=;\n\tb=ib8IUlrJJ31+mJN9FyZbMNxsuO6duJ7L+bBYjzRwk2zkqwKr8wBIWx+z72M4dV1Rzj\n\trZezMKmiqI4byG0N1atL7NAWtK/kW8gyLssGJPquXG23Xg3AyoA5fM6EYjEvRYGKo4nH\n\tKBiQLTkSXeGpEJJbVTDKnapg9pnQ3q44WtUMeECxl0Zf4gyWnzzoRkZaOJAJ1VAghvGj\n\to8aJwXyxGfCIl2/12w8xbOFPJX80XMXrkjf8ianXHqzx/+QgNEotDdDdzxL1bFroIqQ1\n\tIDFT4KARAamXSIgknkuuDo29ux/AX9uDFnZmEustV+8QOFgVxPmko9tKO2EoUycG0EWJ\n\ttcyA==","X-Gm-Message-State":"AJIora+nYW56+SuJvb2c3/NVQXRt16cwOmcaOxj0cZ2ZRJdoD3nU4b9s\n\tnZL9L8Z/49mDedLx1wzd9rwIS4Jzc0E=","X-Google-Smtp-Source":"AGRyM1u0N8h03VohKHxkGbU3dHurk20+9VnnBIP3Cy5Z48U0C51bVl4uOBK6aTO7vdiLDb7mx9ueLg==","X-Received":"by 2002:a65:6a4f:0:b0:3fe:9ef:1c49 with SMTP id\n\to15-20020a656a4f000000b003fe09ef1c49mr2904086pgu.229.1655903844732; \n\tWed, 22 Jun 2022 06:17:24 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 22 Jun 2022 21:16:36 +0800","Message-Id":"<20220622131638.79122-2-utkarsh02t@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220622131638.79122-1-utkarsh02t@gmail.com>","References":"<20220622131638.79122-1-utkarsh02t@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 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 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>\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 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 }\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 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);\n","prefixes":["libcamera-devel","v2","1/3"]}