From patchwork Tue Aug 9 20:50:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17057 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 25AE1BE173 for ; Tue, 9 Aug 2022 20:53:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9B7116332B; Tue, 9 Aug 2022 22:53:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660078398; bh=W3QoFPcQqQKVRH5GnhX5zifdpYLJkUVHcrTW7dGcBEk=; 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=TJSwRHwHdkpHzTjWTF3v3mco5Qzsq06kqr7UYsOwZXrfBbaQRXvIe6bfdYQWiX8b2 C8WeUl+EZO/UaxLwuWht/VBr8J1QzP/HIWI93Deilrl/nFmSLxZFbUR8eDjU7OACyl Dg1w90azhKBQgadQiR2+/wGvPEo3LKUtSD6Y630ef7LCsDqwuye13+2fj2Na93oHMW aYStA/+iLlYe8fsWvlv91ZaZ7e/5wCwlMRfd843SK+df3O7xVIne4OBME1lwA9+/88 S9AB9R3cssg9OAKukvIlQkHfZkQkuzmutNtDipqQJ8cWQly5wnciVXHe7cnAsr5cw9 Db/qP1V5cchng== Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 95F0D61FAA for ; Tue, 9 Aug 2022 22:53:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="a6JTGAaG"; dkim-atps=neutral Received: by mail-pf1-x42d.google.com with SMTP id f28so11875444pfk.1 for ; Tue, 09 Aug 2022 13:53:16 -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=yt6mCUrFgve5P3MjYWCshMuvkLX5Znj/8iQ14Dej+Rw=; b=a6JTGAaG352LuGbn+YwGH7sCPWtjMuCYCDfqnTJ4ir7q+ewd0k+Av4htEoS/B37Mu/ aZwrkZSZH8D5lDekMet9Ug4HZzxYBtYy8EpRWB+SAcIg79FzkKRoj2sGpZOZYZ8rFC1k Y+m+tRSsknLs1lWzOVnlK5ex3Z1QnkleWI8GHxbDOtnIq7FJz9GetKEAQafh4L7R35/O cGBDV2CCMYBNi6fLDGwkJz6KEAMekWP/JoJkmKcW6LsyJJjaR9H+CIx6mQgmNcRfXtg6 rWiAaOXWNt+ASKRghh/scco9YF88qEd0VRfP2BzyMoFX04nBlCN+olwh6ekwO5ZdfuJ2 Y60g== 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=yt6mCUrFgve5P3MjYWCshMuvkLX5Znj/8iQ14Dej+Rw=; b=eIqKCp4Nch44WsUDeljXHN84QvKzZekRGTMa1wXewfkes/JubGNS4A6fs5VmCNMrB4 V/JWmwVXSAHdWpdxuEEcLSsSBoRkiJa2rf1oPg+UDsBBduTT42wt2637LkmThQ9geImj UhqQXpYWoeUKZMxBqoqFpXc42djiI8/5UucVsSSZuZGeMzbUT/Z4MaVVzCc+qvJgjPlT vtcWjLoSAYMJXpefNRwDTvjER+SFm42hVLx5INqR3Do4X0ChAsT6yNHoqLMW6hMFtXVt NWnaLskd3wcqYoG1SsrO0FiqocHI+stUXAzUXwxXpeke95OwOackh8rDwQ96wCwjxKDc bs+g== X-Gm-Message-State: ACgBeo2tZeuc3b5pKWtf9FuIPBkeqrKH9vusc7UJau76vA0ROZpTnZ1L lei1V0cRC9z/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 a22-20020a656556000000b0041c9c3698famr20978778pgw.491.1660078394957; Tue, 09 Aug 2022 13:53:14 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d2bc:2358:3bcd:fb4f:cbb7]) by smtp.gmail.com with ESMTPSA id d3-20020a623603000000b0052d981e7842sm301936pfa.208.2022.08.09.13.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 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 Subject: [libcamera-devel] [PATCH v7 5/8] 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 Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain --- 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 15b150ec..3feabcff 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -120,14 +120,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 @@ -513,7 +513,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; @@ -745,7 +745,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer) viewfinder_->render(buffer, mappedBuffers_[buffer].get()); } -void MainWindow::queueRequest(FrameBuffer *buffer) +void MainWindow::renderComplete(FrameBuffer *buffer) { Request *request; { @@ -774,6 +774,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 bbdbb21c..bd6f0172 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -70,7 +70,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(); @@ -84,6 +84,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);