From patchwork Wed Aug 10 15:03:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Utkarsh Tiwari X-Patchwork-Id: 17071 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 20681C3272 for ; Wed, 10 Aug 2022 15:04:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B66796333B; Wed, 10 Aug 2022 17:04:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660143850; bh=eMQ9fTcDsbdhogqD9GzzYdsP7fFmYYdw8BiNGR78NOQ=; 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=z91wrlZrFyKzjGrmEWiC0MreoolpuLDLcKdcCW6eAKpIs1kSGBOdXnqspxgLMMsr8 FFOalW28ZLFC4BG5QohI5+L3R48YhEedgpXtavRTbbqIcmDXcCMiDbZlQSq5kh7Kr1 lvMDrcCD2nqF6HSeR+C87Sql9rLM9NcLLvC+6FPw6bI4YaUayWquCgvi660xtocHa9 /Uyzclj29iCb4Y9HcLjHEvMgAtW+qiPCXc4xQ0tCfcZNGhWVXHzJADuSOgBuKm7Y5V UIjmyC2aLyjdVSu7G35HvfIwHXcSaQOI4UhvYXRKgUJQQIBIfSX5Ydzkt6L5N++LA3 V1EhozPegZNXg== Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 82C686332F for ; Wed, 10 Aug 2022 17:04:08 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UWElb8oX"; dkim-atps=neutral Received: by mail-pj1-x102c.google.com with SMTP id t2-20020a17090a4e4200b001f21572f3a4so2417614pjl.0 for ; Wed, 10 Aug 2022 08:04:08 -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=nah3tKvUMmyz1awvcvaknd4JXs71eyge+DgPppV+IVA=; b=UWElb8oXNcTh/kt8skmCKYAnMPCNyNAhRYynNzJstps3OkjONlI2nKK7UvyaaMi1cq o1tckfPNTGKuuD4UgFLTwdAAuq34Vt3oz1yA97ZeaDcm7hac9gcRZCGNLADhPxtT64pz TxDBX6esrfFyApeyhBsuv34dv6sjFqRy1qFFj5XuXZPnI88DE/S93FahwbJlR2UoxOj8 LIz38yed4yK8Zum9P6NB1iyz8e/vKhCj3RSu53o5678UkFFAE4jbCGYOhpGBAuSY49JB z7prbLGo8eN7qUzuS8Ba+SiwMLe7aFQhcEAG7G6gWKnscLso9BZb2PK08SiV525af6im 8ouA== 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=nah3tKvUMmyz1awvcvaknd4JXs71eyge+DgPppV+IVA=; b=iBJ54U94gViO4ILnAtDSymC2GaAEiSENiuF3H2sPGDfzTnW5lujb8kmIHuipfn1vvJ n5Vx5TlBJCI4cK0OjZkXV5DnArnDaY5BeXvebop52IRCIjgD6Fn/+sxNuJzYdfoTxvNC EgYzXisKh20X25gFjMqdu/vU0a2CusiTYntt1+3uCocYXtDrHME/nb8wP9C4NLrP+nD2 1Sxoxws+S9yWB98/nzsZNwGakU9G7lOLu4u+Gys08BA8RG7WkAZSRCEMNEBdtQY2RrSw GkIQQlx/1QJB2tZ/w9SZAaBWgsczPAmobEZRjDpEkWTZFXvNRKcIzGiD7eFybJYkgWLM bqrw== X-Gm-Message-State: ACgBeo1D2DmDwDKoCU98fi9rMlp19W+KyYj3pxxkgkr4U3DU9jUH8fR3 89uB7PaxzNt9t8FM2AaeiY8Ofns5ZGU= X-Google-Smtp-Source: AA6agR6lrHDQyN5Pow4I0NESyCE6bDfs3qGCQMQKobdWLnhvkwcfPYFQQgXqM64DKZlLpepFcKSFrg== X-Received: by 2002:a17:90b:4b46:b0:1f7:2430:2286 with SMTP id mi6-20020a17090b4b4600b001f724302286mr4091340pjb.138.1660143846788; Wed, 10 Aug 2022 08:04:06 -0700 (PDT) Received: from localhost.localdomain ([2404:bd00:3:d2bc:2a55:4cae:bf8f:f4ed]) by smtp.gmail.com with ESMTPSA id b3-20020a1709027e0300b0016f1319d2a7sm12882624plm.297.2022.08.10.08.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:04:05 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 10 Aug 2022 20:33:46 +0530 Message-Id: <20220810150349.414043-6-utkarsh02t@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220810150349.414043-1-utkarsh02t@gmail.com> References: <20220810150349.414043-1-utkarsh02t@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v8 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 --- Difference from v7: 1. Nothing (the only perfect patch) 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 d1b8d2dd..bf40572a 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -121,14 +121,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 @@ -517,7 +517,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 f9ea8bd3..d161365a 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);