From patchwork Tue Jul 26 19:41:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 16809 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 A3000C3275 for ; Tue, 26 Jul 2022 19:41:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7B74D63312; Tue, 26 Jul 2022 21:41:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658864504; bh=3Z0HBm5+psRkG8twCvvKP2WPwiLjQU/h7vfRLmk55Dc=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=lZmzRyV7idjx8VglloiuG6fkHB6HXETIdGi0sUIdDLoGkvfmlp6YHKF1+Vb/R1ScP QzaJlHtdIkaOgIcMlmwqIaU/y9u6uV5jbVSnuenqDMOotpMaLrEbrNdL36C9c7FNDc tnYi9wxt1DqF0WdXAUg8Q++0PZg2i9FO/p2aG/wLXYzKUfU66rC/UZNPvTJ2MAWSAd 3go7yh7ekIcBc4K9khmefRv4UpBf8fspnA94pSO3tB6xBlOcNGrcOWmZZfxTxrVcp6 uzaCt8RILdRx1bJW6E3aFwqCeeHyNq+WyNFKyH1RE+hnFvSVCNpJGxwmglbETqVtGN +mOUNDCuRV9Vw== Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A85B60487 for ; Tue, 26 Jul 2022 21:41:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bvI4PscM"; dkim-atps=neutral Received: by mail-pf1-x431.google.com with SMTP id w205so10790382pfc.8 for ; Tue, 26 Jul 2022 12:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jHwjnUKeUvBi6o6pk+wq5ks5LIpCU8fe7V02l2HJH9U=; b=bvI4PscMhgP0mENGrWEYufs5dQbVbG1H70bafeaqCmBxeej4Mw4pMWpFmjou6gij19 v5Pr62EdCRLoQdg9GoA22yYW04sM4cPEhbSRCTtwn4iltrhzATTfg7GXRzvz9Yl4gTPR pnnRL7+omjbiADQkDQtI6A4gg32d+GWApGG8HBhcOVUn4RG6ikEiCfoB8G7z5aIZsu65 nwxx8X619lPbwfPuodQtvQA2yU2aBIe5dOgGSov+Br/OM6qZQUdJTG1QOI8r7OSjsP0Q CtsEDQsxmy9YDHCRMO9IIFomDe0KqvVOqm9DsIsV03pt/o0WQpAWCRZUc0XSp/JN14im XbnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jHwjnUKeUvBi6o6pk+wq5ks5LIpCU8fe7V02l2HJH9U=; b=TtVXEVBD6En1AI8+OzxO5b0xfYvzVm5Xmt2oE5oULT0x/Ao+wPkS7oCfWEcLXi/vmC LSseF5pxI37cypBpSKUjrQcqGnNlJfFr/XqYrY314QlMUWm2HyIz1W6uKTJmFcFrC3ar Kvj4PbVj7pW8e8g9Xs54l8DJnMyFP3ybGyE8oYKmQsO6F+Aus0mBg4ALEOdi19YKHaTb XIaYuT/kwPFpeL3EZiSgwmmEzzlzxpyfwxo9TjOJu4pKeCQueDGAHYsV2LwZgdft1vaV 1moTlZEPv+g6XcB+n5+6cNWFUaettHS5yVof3k9YdlXq6zkY/DUmqdPSn2249BwTAuJe oZyQ== X-Gm-Message-State: AJIora8hpnPHv7tneBVIEAR9DbZq/tgHnu66lcSUzHx57wvAF5e4rjtA JffGyGDBJ+waih1qBvoeDUtYY62MvsI= X-Google-Smtp-Source: AGRyM1vBl5wOGb/u08a2ObvnJbXE95vEnIHYx4T1sXjCWMLegriF/s78livev+ZOsTKP1Xdpva/Yog== X-Received: by 2002:a63:2bcc:0:b0:40c:95b5:46a4 with SMTP id r195-20020a632bcc000000b0040c95b546a4mr16018155pgr.535.1658864501566; Tue, 26 Jul 2022 12:41:41 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d6bf:24ea:3f52:4c78:7bd8]) by smtp.gmail.com with ESMTPSA id a5-20020aa794a5000000b0052ac1af926fsm12017782pfl.20.2022.07.26.12.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 12:41:41 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 27 Jul 2022 01:11:21 +0530 Message-Id: <20220726194123.170208-1-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 1/3] 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 --- Changes from v4 - Grammer fixes in the commit message 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 7433d647..4e773c31 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 @@ -522,7 +522,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; @@ -756,7 +756,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer) viewfinder_->render(buffer, mappedBuffers_[buffer].get()); } -void MainWindow::queueRequest(FrameBuffer *buffer) +void MainWindow::renderComplete(FrameBuffer *buffer) { Request *request; { @@ -785,6 +785,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 fc70920f..bc844711 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -67,7 +67,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(); @@ -81,6 +81,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);