From patchwork Wed Jun 22 13:16: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: 16318 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 80369BD808 for ; Wed, 22 Jun 2022 13:17:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2E4506563A; Wed, 22 Jun 2022 15:17:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655903847; bh=4Aq824HZHPf2PmvNblVn/eW6i8DB/sJg0DcK4tanfZg=; 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=DJ7RWXkBTzzdTBhiM0Cs2+F5XQYM+c7QfeWRWm3aJ1rhofMnfn4pboQ+wiywZ4TSB AxEFSe3drP9e1+SWBSyOGX5LUQQntOfowTbP1pc7nYoSY+pZBhznnLk5fQafGnAdDG 2Hm4Azah2UietihCbboSUrh866vQqoFmx6NRZX6c0f9BeUzdPic3BfEMUuCsFZC/71 SR5dIsgBduT/gkYQj1kedOtLP7TwDmC9xpz186g9LWWKlbbqlNHk74QjC4VybjYmYH fEBVkiFhlcIGN0P8I8G82qD+Z1kyEbS6GvRAVtwpgNYU4zKYgeKkp7e6q0wbgyVYfZ a3LjCrpt6m8gw== Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 44BAE61FB2 for ; Wed, 22 Jun 2022 15:17:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ps0d5oe2"; dkim-atps=neutral Received: by mail-pg1-x531.google.com with SMTP id 23so9912475pgc.8 for ; Wed, 22 Jun 2022 06:17:26 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=FiD29FzPLJ25vLGERZCLerCSVMUJH90zaw1E+agM5O0=; b=ps0d5oe26rNZFXb0d+J0LdAjfF4PI1DmBb/Mp4up9QcN0kJGQt5dQCusEdKX/o5BNU ghcR+OerDpXSl7pExx+giez0wzguKQ9uZ+gsqU9dMKg4pUWL1Rc5nPeuWtalHi64hRFY ulgAjJfGXmQre3CdlQLKC+StJSOupp1qY3efBNvCzCdCzJors8xrZKi5O1dePSdenWks e53h1ZitwJpO8XT5beNif2vlGcDuZ/+7gNDxqaBIHhRG5qZ4pZws1iGXpyztiK5zFp+P pcoNRoxF0tqVX2hCt5YL3w63bEpAJYyDSOQJ/xhWQp08ZpIIyVczbekmpUcV3UMTGrgj fiFg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=FiD29FzPLJ25vLGERZCLerCSVMUJH90zaw1E+agM5O0=; b=ib8IUlrJJ31+mJN9FyZbMNxsuO6duJ7L+bBYjzRwk2zkqwKr8wBIWx+z72M4dV1Rzj rZezMKmiqI4byG0N1atL7NAWtK/kW8gyLssGJPquXG23Xg3AyoA5fM6EYjEvRYGKo4nH KBiQLTkSXeGpEJJbVTDKnapg9pnQ3q44WtUMeECxl0Zf4gyWnzzoRkZaOJAJ1VAghvGj o8aJwXyxGfCIl2/12w8xbOFPJX80XMXrkjf8ianXHqzx/+QgNEotDdDdzxL1bFroIqQ1 IDFT4KARAamXSIgknkuuDo29ux/AX9uDFnZmEustV+8QOFgVxPmko9tKO2EoUycG0EWJ tcyA== X-Gm-Message-State: AJIora+nYW56+SuJvb2c3/NVQXRt16cwOmcaOxj0cZ2ZRJdoD3nU4b9s nZL9L8Z/49mDedLx1wzd9rwIS4Jzc0E= X-Google-Smtp-Source: AGRyM1u0N8h03VohKHxkGbU3dHurk20+9VnnBIP3Cy5Z48U0C51bVl4uOBK6aTO7vdiLDb7mx9ueLg== X-Received: by 2002:a65:6a4f:0:b0:3fe:9ef:1c49 with SMTP id o15-20020a656a4f000000b003fe09ef1c49mr2904086pgu.229.1655903844732; Wed, 22 Jun 2022 06:17:24 -0700 (PDT) Received: from localhost.localdomain ([2406:3003:2005:1f6b:fd12:eca1:fe45:bbdb]) by smtp.gmail.com with ESMTPSA id x82-20020a627c55000000b0052089e1b88esm7124540pfc.192.2022.06.22.06.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 06:17:23 -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 Subject: [libcamera-devel] [PATCH v2 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 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 --- 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 dd0e51f5..adeb3181 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 @@ -521,7 +521,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; @@ -755,7 +755,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer) viewfinder_->render(buffer, mappedBuffers_[buffer].get()); } -void MainWindow::queueRequest(FrameBuffer *buffer) +void MainWindow::renderComplete(FrameBuffer *buffer) { Request *request; { @@ -784,6 +784,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 3fbe872c..c3e4b665 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -66,7 +66,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(); @@ -80,6 +80,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);