From patchwork Mon Mar 23 14:21:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3247 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AF04562BFC for ; Mon, 23 Mar 2020 15:22:19 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 57B72308 for ; Mon, 23 Mar 2020 15:22:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1584973339; bh=MqK7QUbiwoSiHIC626STnQgrKoRO1R9/LuHmJEjqzCw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Mkh9097dYn6fir5OUgoHxERp90pQBRb3DzIqLjZfbj1pePtF92Di1NMt4KyD49tNf WH4sOO3G8gtecSpwmvPYdyym0FpYWHwaq558kJrvHqh9F2CkYpvntqOV/yQQtD99Ry xieQabvpRzc/kpCJ8FJQMA9t2Q/H2qJoxdqn+gTQ= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 23 Mar 2020 16:21:48 +0200 Message-Id: <20200323142205.28342-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200323142205.28342-1-laurent.pinchart@ideasonboard.com> References: <20200323142205.28342-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/21] qcam: main_window: Move request queuing to a separate function 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-List-Received-Date: Mon, 23 Mar 2020 14:22:20 -0000 Requests are requeued synchronously from the completion handler. To prepare for delayed requeuing, move the queuing to a separate function. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/qcam/main_window.cpp | 29 +++++++++++++++-------------- src/qcam/main_window.h | 1 + 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index e0668176e427..354a53367d0f 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -389,20 +389,7 @@ void MainWindow::requestComplete(Request *request) display(buffer); - request = camera_->createRequest(); - if (!request) { - std::cerr << "Can't create request" << std::endl; - return; - } - - for (auto it = buffers.begin(); it != buffers.end(); ++it) { - Stream *stream = it->first; - FrameBuffer *buffer = it->second; - - request->addBuffer(stream, buffer); - } - - camera_->queueRequest(request); + queueRequest(buffer); } int MainWindow::display(FrameBuffer *buffer) @@ -417,3 +404,17 @@ int MainWindow::display(FrameBuffer *buffer) return 0; } + +void MainWindow::queueRequest(FrameBuffer *buffer) +{ + Request *request = camera_->createRequest(); + if (!request) { + std::cerr << "Can't create request" << std::endl; + return; + } + + Stream *stream = config_->at(0).stream(); + request->addBuffer(stream, buffer); + + camera_->queueRequest(request); +} diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 40aa10aaea8e..720a3393e3dc 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -58,6 +58,7 @@ private: void requestComplete(Request *request); int display(FrameBuffer *buffer); + void queueRequest(FrameBuffer *buffer); QString title_; QTimer titleTimer_;