From patchwork Sat Jul 13 17:23:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1690 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4757660C23 for ; Sat, 13 Jul 2019 19:24:40 +0200 (CEST) Received: from pendragon.ideasonboard.com (softbank126209254147.bbtec.net [126.209.254.147]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ED33E2B2 for ; Sat, 13 Jul 2019 19:24:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1563038680; bh=AQnkuXuCVS9ffEDIOY8qsL428MAKHXoik31YeXIxO6Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TM58QijIc5HsOH222DxNQX73ZcWeAf/kas5OJXDaxhRpsIA93TbNtZUtjFTmjokLD AeEm3lTFbnN6hPKdUhJtobaP6CU8+O9ZAbUHEGTRfhpak/C3Wrv5v++qecTrlnwpUa p/GuovPWeMgokAiIkzjMuB7fOY31BCIfwsr2rVu0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 13 Jul 2019 20:23:44 +0300 Message-Id: <20190713172351.25452-10-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190713172351.25452-1-laurent.pinchart@ideasonboard.com> References: <20190713172351.25452-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 09/16] libcamera: Stop using Stream::bufferPool to get the number of buffers X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 17:24:40 -0000 The cam and qcam applications, as well as the camera capture test case, access the Stream::bufferPool in order to know how many requests to initially queue. As part of an effort to remove access to the buffer pool from applications, use the buffer count from the stream configuration instead. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/cam/capture.cpp | 6 ++---- src/qcam/main_window.cpp | 3 +-- test/camera/capture.cpp | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp index 1cf59063c93b..66ec1abaa5ac 100644 --- a/src/cam/capture.cpp +++ b/src/cam/capture.cpp @@ -74,10 +74,8 @@ int Capture::capture(EventLoop *loop) /* Identify the stream with the least number of buffers. */ unsigned int nbuffers = UINT_MAX; - for (StreamConfiguration &cfg : *config_) { - Stream *stream = cfg.stream(); - nbuffers = std::min(nbuffers, stream->bufferPool().count()); - } + for (StreamConfiguration &cfg : *config_) + nbuffers = std::min(nbuffers, cfg.bufferCount); /* * TODO: make cam tool smarter to support still capture by for diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 6ecf30e33bcf..7023e1158fb6 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -140,9 +140,8 @@ int MainWindow::startCapture() return ret; } - BufferPool &pool = stream->bufferPool(); std::vector requests; - for (unsigned int i = 0; i < pool.count(); ++i) { + for (unsigned int i = 0; i < cfg.bufferCount; ++i) { Request *request = camera_->createRequest(); if (!request) { std::cerr << "Can't create request" << std::endl; diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp index ff1cbd6cbac0..e6bf7a8d9ebb 100644 --- a/test/camera/capture.cpp +++ b/test/camera/capture.cpp @@ -80,9 +80,8 @@ protected: } Stream *stream = cfg.stream(); - BufferPool &pool = stream->bufferPool(); std::vector requests; - for (unsigned int i = 0; i < pool.count(); ++i) { + for (unsigned int i = 0; i < cfg.bufferCount; ++i) { Request *request = camera_->createRequest(); if (!request) { cout << "Failed to create request" << endl;