{"id":16372,"url":"https://patchwork.libcamera.org/api/patches/16372/?format=json","web_url":"https://patchwork.libcamera.org/patch/16372/","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":"<20220627030159.30730-2-utkarsh02t@gmail.com>","date":"2022-06-27T03:01:57","name":"[libcamera-devel,v3,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/people/114/?format=json","name":"Utkarsh Tiwari","email":"utkarsh02t@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16372/mbox/","series":[{"id":3220,"url":"https://patchwork.libcamera.org/api/series/3220/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3220","date":"2022-06-27T03:01:56","name":"Introduce capture scripts to qcam","version":3,"mbox":"https://patchwork.libcamera.org/series/3220/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16372/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16372/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 530E5BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jun 2022 03:02:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1B1FB65638;\n\tMon, 27 Jun 2022 05:02:13 +0200 (CEST)","from mail-pl1-x631.google.com (mail-pl1-x631.google.com\n\t[IPv6:2607:f8b0:4864:20::631])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C10A465633\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jun 2022 05:02:11 +0200 (CEST)","by mail-pl1-x631.google.com with SMTP id jh14so6982773plb.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 26 Jun 2022 20:02:11 -0700 (PDT)","from localhost.localdomain\n\t([2406:3003:2005:1c27:cf57:31af:7925:f9e6])\n\tby smtp.gmail.com with ESMTPSA id\n\ts7-20020aa78d47000000b0051bba89c2bcsm5899378pfe.58.2022.06.26.20.02.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 26 Jun 2022 20:02:09 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656298933;\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=zCNdGnobwUOGAduBknwh46SpsWO6JmAsPEvDLi1ADwXltgSobeddIkiZd5yrHnKmC\n\tFFim6yZZpGqfYgB7u55XGincF1xleJPs+uUywxmflLPZIZrRbbMg9J5TPpDGudRxD3\n\tWVQCX9eNVrcw2TbwnswM0Odf9pfv6x098E8Ok1NQdI8qBQKO5JqxIjyPNIrBLndiTl\n\tXjoN3P0PcFOPSbapBA5IHDqQYLn2kYc1ajvKjonGVcQCmD9UYfzSEshgQDnYZvqEFF\n\tK05BMsQeVq2pLyvjQ4SJfFceXiep4lMgJE7ULF3vHO3BbW0gFmHS50vLhv18zkZ4FM\n\t2VDK7fXYPvymQ==","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=SCEAtlGfwk49UxN7mPHexmMdodfka2PxBvF89qwfJe5VvBVNa0H0seolnDvQ5vAC2u\n\tYW62qTkzeOkWsr0EW2v4iBysXEPTiLynjj7UviH6lCUOSA4RGSlLNoozWHcgm4EfVtgG\n\tD1u7JzCIq17IiqmAel6QK4t2HFqUoSd78rl3SgMICpPXEt9fSAsnb9U/2Oatxg8DeGyp\n\t9EoQy4QQrnATVHiNUocJq1BGBLiqMWBzEBwxzG8afwaj0xxTUALT5rlOtbegA6H2PRfT\n\tq59/hWO93bD3mEGAo282CzeXbqIGgQ5UhV57ao/PZu7n/CwV25wa/4dqWDU7LqN5bR0V\n\t+UJg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"SCEAtlGf\"; 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=1kLFZ26/t278t5yuHUBpQJlcjtyVlt/AskPuN+Ar8z+bsXH4JYlFMqCgh6cUbIBO6g\n\tSHBMkmjQjegXXv7Wrlk/YvpljZWMzgQH6Oe7Iv9qx3mkSsK6kLDXr/MB1FPiWsyzWH7M\n\tmYYCi8qhwvkiSP8E17IeMW1w3hUuclEvvHyBB3B+E/AsS8V5nWr4Ws8Z1DAa4MtonJep\n\tMy2P2GQ0a8tlwGE3NnFdUdr+4UZ5cu4h87KXxh9JSsJZTbnSUYojYwWJwihPAY7bjXYs\n\tLtUVpFtrCWY/Nt1ILIelZ3lIDnTU/g8+MQvbqz3O0BvyCz/IG/Wm9oMzDLZh9tvuPzYJ\n\tdHvg==","X-Gm-Message-State":"AJIora/qHSvxObpidI989R+roKx+5esg7KDu/PJW5tv4nDif0rxcM51o\n\th/fMSAej2uak1uW7ZmOB7XtrTFu5fS/Fmg==","X-Google-Smtp-Source":"AGRyM1sUKfy7wj7H2EvAP545c3aqw+6wmob9Zpp0Z+O1eBLRYlS9l5V0thyrT99V1Gq3/vsCFlnEeg==","X-Received":"by 2002:a17:902:ce85:b0:16a:3db5:5966 with SMTP id\n\tf5-20020a170902ce8500b0016a3db55966mr12687542plg.79.1656298930059; \n\tSun, 26 Jun 2022 20:02:10 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 27 Jun 2022 11:01:57 +0800","Message-Id":"<20220627030159.30730-2-utkarsh02t@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220627030159.30730-1-utkarsh02t@gmail.com>","References":"<20220627030159.30730-1-utkarsh02t@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 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","v3","1/3"]}