From patchwork Sun Aug 7 20:32:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17019 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 2E500BE173 for ; Sun, 7 Aug 2022 20:32:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DB0EF63329; Sun, 7 Aug 2022 22:32:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1659904343; bh=c4VuuPECAHqtJT0jZXC2FUT3ZP7jseExejACAso5SdI=; 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=2AjKtwU9a4+Qy+v0QDn+eL7HPXgbR4uza8xMIyjm6284Or4e6iZOjIs9Yo+7SiYhT 9hHtHsYGHnB1q8o/WBcQMgh+2+gSUl59aiaQYc8wRpV0Wf/tnJV6mXaaCWjfC3Rlvt 37PFwwYsY5IVsMrtNr6hkv40BDCRClb9ntpRL/tzN+X3vUAunzG1JscI8fEoX61hy/ I8FHfIiSJl7qYH2AijY+dBixtRlYOV2WsUybJtnX/C11TNx9SWM7ry1zImEm76VQDu Vl218CBBCF28PS3W3hH92fJcojsqcPTMKJOeO9Zfq/LWjL9cASx/Pe4I64BcZNVswl 1pphgihSZF+rQ== Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 97F4463327 for ; Sun, 7 Aug 2022 22:32:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="n2q9B0To"; dkim-atps=neutral Received: by mail-pf1-x430.google.com with SMTP id k14so4502609pfh.0 for ; Sun, 07 Aug 2022 13:32:22 -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=1BAur522nDly0wmsL7dBqSiwB12eYFtaaqg3Af9dIEk=; b=n2q9B0ToNkbzUsEf2cGg25IGvU0FT3BMOIy5dIgbrEWi1NLTRcHbT2Xgd1ZiLdJkCM w2uegcMa5Zr2bUzyhjIkJ7g1CSx8aReyh+T+eRzxCsyoMS/PneU5gbLN+OxZ7NC76q2f jjLeHt5ROh80+tDg3gQuRdkANPLeoEITg1p9yuCnhIIpwHl9Zv5IckC3I2YIwC3ulXg8 4HWDPu+CaX0HlA5mL3o+5s8hmwpPsSKpXm6PEeUe3I6AUJz8qPextkjxZ74YfHhOmUso PWcSVW5/XXvdLFH/2y6ydo5y6kfmfZMGHp4FWpU4GvSO2ywthaUUUijgF9vReK7zoYFz r8+g== 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=1BAur522nDly0wmsL7dBqSiwB12eYFtaaqg3Af9dIEk=; b=Fue6DYMr0wNC8GbT7Xzrsm9tJFalIaZlSnVUZhNVHCtdiLa3gBibG4EsJEqJO7yu7Q bTY81IczDk/OSsGYdUE67QOzqlK97UBLANBZCxH5Dhv1MtO+nrkR8SnbpSzFGBj7YB6C ry6J/h6FRwSv9LA+TnHWK/Dqsy/BgVjrQQhCYVdjG+C8qYPY021J1XxJkPK3NRGl5uIN Ul3JSkwN1WJ05RcwN8y4zMqeX/Jri+HR+0zwVmu8KUjL+HiqI3lbEC8S7qgX9WOacOAF 3lvvHwSvSp0MnN9vYenNkYFMt4Wnbg/YCt6iQIIZ0Xypt1Zl6IWJZCE5l5okhElSGY/P JfXg== X-Gm-Message-State: ACgBeo13ssapx+6Jk2usLH9w/JbFu3fs3v+MieRuNOaZtXAfyyd/yg0g RYLxvh/yz473k7vh6xIGUrDEkEQRoxw= X-Google-Smtp-Source: AA6agR5WFh/bDOLdxeZzjIfcFpHonFrF6sNDrSssfonQQtR7hnwjIxOozkJRQD3P5XKuVkS+JY2f1A== X-Received: by 2002:a63:f54:0:b0:41b:a215:cb4b with SMTP id 20-20020a630f54000000b0041ba215cb4bmr12849699pgp.529.1659904340754; Sun, 07 Aug 2022 13:32:20 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d2bc:8eec:115d:8ea8:b700]) by smtp.gmail.com with ESMTPSA id x29-20020aa7941d000000b0052d194a6602sm7006334pfo.102.2022.08.07.13.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Aug 2022 13:32:20 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Aug 2022 02:02:01 +0530 Message-Id: <20220807203204.152358-2-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220807203204.152358-1-utkarsh02t@gmail.com> References: <20220807203204.152358-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 1/4] 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 --- Difference from v1: No changes 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 98c22b71..549af024 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 @@ -515,7 +515,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; @@ -749,7 +749,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer) viewfinder_->render(buffer, mappedBuffers_[buffer].get()); } -void MainWindow::queueRequest(FrameBuffer *buffer) +void MainWindow::renderComplete(FrameBuffer *buffer) { Request *request; { @@ -778,6 +778,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 fe0f5938..7982939e 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);