From patchwork Wed Aug 31 05:49:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17269 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 79098C3272 for ; Wed, 31 Aug 2022 05:50:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 21BB161FC7; Wed, 31 Aug 2022 07:50:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1661925008; bh=fXoMlk6sgHoLEmRpFy57e1Hx90cBeYwS6e11OGTXJAQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=GI3LsYOZ2WVFTuekhD+1vRyb8O8tir/UHn6jDYU1Fi7tyIxZJJWnrkqKaV6SRKCRh x51dxV4cXDgLicbRjF64hcLD63F6hZGFNReQ3qHDQXqWoFsB4Us5m6m7R944LlNq6s t547dJwx7dka1w5p71P3mXrZcVuTIHd/vOKHJdn10OPzp5/ZdoblZYCyK4DyoGxemX 6Wo2xNHKDmEvctzw9ePJ7OJ7BT1IijMW/YCFB42M7Z95116v+/8J0Fvdq0bfm/vmkI Hd7uYg6+bl1iphI1M1pY7HwGN7TWrLq23oIkNj1a7A5WtIBHW3BFIXswPwnWVNXPr/ WuIpKF2ZIwaow== Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A20F661F9B for ; Wed, 31 Aug 2022 07:50:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HJDo1rkE"; dkim-atps=neutral Received: by mail-pg1-x536.google.com with SMTP id f4so12610075pgc.12 for ; Tue, 30 Aug 2022 22:50:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=K8djUDQAO1qcatMQ0yfPTxbPOky+Dev0DXfz/BLLymk=; b=HJDo1rkE4k4FhO9gs5wM7H23G8ABRYh1Tt5TnVSVVSSHsnamv/CqIVJ7MrlibRkxM8 frB3kl6uPR2VXs0ubZ6PAT1Sdn8rdUjR9V68hcWk8Gy3+/3djs3KS84YwClrcoha1QQs oFnaVSsIA05iIRZYsNPk6CPM/mYv/MDopvwoBxDOhlDYsyqDSqIdj4scCA52Npgn7ZMI pOQz75JX5WMykHfdd99ViXztIn0yvsWIt/h5xRRANN+jVFB5/U5Wg/8oV+qc/kwBqKma KXdm9crMwiV3Jb75Q36hjv1uAK0n98cl3vizuJOMY7RIE2mamdPUPa2bc8OXhcc7+jXH pxtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=K8djUDQAO1qcatMQ0yfPTxbPOky+Dev0DXfz/BLLymk=; b=do+KW0b6DAW+Z7CBaifY0N9O8z1W+jW6pLiHkTCwES+zPaFuyNpjCGVmi/KQnb2eOM mz90TD/k/8w6LESvMp54uoTuO8iRHpdW01fsOvHSD6Z3mBs+FCbwuyb79Af8fwJeAkq6 GdIHm4B33pe6hA8AAct2y1IRcdjgQRE9JkYhMvo+1SD2oS+hXsYyT9JrEq72SFKIXYq5 1dgyPYJgRYdv9do7mueHSPqwmCNPT4baEKYyX0PRBHS13zr/Z2QAwEaVfI4I+E9jx9R1 eXOJ9zckrzaWZqu9C6JLFK2R0CIgEiC/Caa0EX7LhIrdbcBgf8hsbyr3r4AZKfFzPsFE uP4A== X-Gm-Message-State: ACgBeo01TtQFiA82ciiDQm5twBBAiaBhvAcZJKZ/QkJ/zxTREIm1QwGo W6BLjNHBmUhSUNlz4eUMbkrbJcFGgIY= X-Google-Smtp-Source: AA6agR4fuwry5k7sidZOfIHHqM9wUJ/ai6Z3pjpJeNwd7i3K9oAFSY2Pjht56YDRJfhvv21xvmM++Q== X-Received: by 2002:a63:91c1:0:b0:42b:50f8:774c with SMTP id l184-20020a6391c1000000b0042b50f8774cmr20821571pge.496.1661925005109; Tue, 30 Aug 2022 22:50:05 -0700 (PDT) Received: from devut-HP-Laptop-14q-cs0xxx.. ([103.36.82.122]) by smtp.gmail.com with ESMTPSA id q19-20020aa79833000000b00537eacc8fa6sm8307333pfl.40.2022.08.30.22.50.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 22:50:04 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 31 Aug 2022 11:19:36 +0530 Message-Id: <20220831054938.21617-6-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220831054938.21617-1-utkarsh02t@gmail.com> References: <20220831054938.21617-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v9 5/7] qcam: Queue requests only through MainWindow::queueRequest() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Utkarsh Tiwari via libcamera-devel From: Utkarsh Tiwari Reply-To: Utkarsh Tiwari Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Currently to request a frame, we operate the camera directly. This approach is also scattered in two places, MainWindow::startCapture() and MainWindow::queueRequest(). This makes it difficult to account for requests. Centralize all the queuing to a single function queueRequest() Rename the current queueRequest() to renderComplete(). This makes more sense as this slot is triggered when the render is complete and we want to queue another request. Signed-off-by: Utkarsh Tiwari Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- Difference from v8: 1. None :D src/qcam/main_window.cpp | 14 +++++++++----- src/qcam/main_window.h | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 505bdc56..2a9ca830 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -119,14 +119,14 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options) if (renderType == "qt") { ViewFinderQt *viewfinder = new ViewFinderQt(this); connect(viewfinder, &ViewFinderQt::renderComplete, - this, &MainWindow::queueRequest); + this, &MainWindow::renderComplete); viewfinder_ = viewfinder; setCentralWidget(viewfinder); #ifndef QT_NO_OPENGL } else if (renderType == "gles") { ViewFinderGL *viewfinder = new ViewFinderGL(this); connect(viewfinder, &ViewFinderGL::renderComplete, - this, &MainWindow::queueRequest); + this, &MainWindow::renderComplete); viewfinder_ = viewfinder; setCentralWidget(viewfinder); #endif @@ -510,7 +510,7 @@ int MainWindow::startCapture() /* Queue all requests. */ for (std::unique_ptr &request : requests_) { - ret = camera_->queueRequest(request.get()); + ret = queueRequest(request.get()); if (ret < 0) { qWarning() << "Can't queue request"; goto error_disconnect; @@ -743,7 +743,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer) viewfinder_->render(buffer, mappedBuffers_[buffer].get()); } -void MainWindow::queueRequest(FrameBuffer *buffer) +void MainWindow::renderComplete(FrameBuffer *buffer) { Request *request; { @@ -772,6 +772,10 @@ void MainWindow::queueRequest(FrameBuffer *buffer) qWarning() << "No free buffer available for RAW capture"; } } + queueRequest(request); +} - camera_->queueRequest(request); +int MainWindow::queueRequest(Request *request) +{ + return camera_->queueRequest(request); } diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 79723256..22c85247 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -69,7 +69,7 @@ private Q_SLOTS: void processRaw(libcamera::FrameBuffer *buffer, const libcamera::ControlList &metadata); - void queueRequest(libcamera::FrameBuffer *buffer); + void renderComplete(libcamera::FrameBuffer *buffer); private: int createToolbars(); @@ -83,6 +83,7 @@ private: void addCamera(std::shared_ptr camera); void removeCamera(std::shared_ptr camera); + int queueRequest(libcamera::Request *request); void requestComplete(libcamera::Request *request); void processCapture(); void processHotplug(HotplugEvent *e);