From patchwork Mon Apr 15 23:18:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 999 Return-Path: Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EF6FB60DC1 for ; Tue, 16 Apr 2019 01:18:22 +0200 (CEST) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 2A7941BF203; Mon, 15 Apr 2019 23:18:21 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Apr 2019 01:18:58 +0200 Message-Id: <20190415231859.9747-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415231859.9747-1-jacopo@jmondi.org> References: <20190415231859.9747-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 6/7] libcamera: request: Expose the Stream to Buffers map 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: Mon, 15 Apr 2019 23:18:23 -0000 Add to the Request class a method to access the map to Stream to Buffer. Prepare the IPU3 pipeline handler to support multiple streams by retrieving the buffers to queue from the map exposed by this change, to better show the purpose of the patch. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- include/libcamera/request.h | 1 + src/libcamera/pipeline/ipu3/ipu3.cpp | 19 ++++++++----------- src/libcamera/request.cpp | 10 ++++++++++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/include/libcamera/request.h b/include/libcamera/request.h index 6f97aa177ae0..e9687f7e14d3 100644 --- a/include/libcamera/request.h +++ b/include/libcamera/request.h @@ -32,6 +32,7 @@ public: Request(const Request &) = delete; Request &operator=(const Request &) = delete; + const std::map &buffers() const { return bufferMap_; } int setBuffers(const std::map &streamMap); Buffer *findBuffer(Stream *stream) const; diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index f96e8763bce9..7d865fa329ea 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -409,19 +409,16 @@ int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request) { IPU3CameraData *data = cameraData(camera); V4L2Device *output = data->imgu_->output_.dev; - Stream *stream = &data->stream_; - /* Queue a buffer to the ImgU output for capture. */ - Buffer *buffer = request->findBuffer(stream); - if (!buffer) { - LOG(IPU3, Error) - << "Attempt to queue request with invalid stream"; - return -ENOENT; - } + /* Queue buffers to the ImgU output for capture. */ + for (auto &it : request->buffers()) { + Buffer *buffer = it.second; - int ret = output->queueBuffer(buffer); - if (ret < 0) - return ret; + int ret = output->queueBuffer(buffer); + if (ret < 0) + return ret; + + } PipelineHandler::queueRequest(camera, request); diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index 33055c5ac533..7fa034e6c747 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -51,6 +51,16 @@ Request::Request(Camera *camera) { } +/** + * \fn Request::buffers() + * \brief Retrieve the request's streams to buffer map + * + * Return a reference to the map that associates each Stream part of the + * request to the Buffer the Stream output should be directed to. + * + * \return The map of Stream to Buffer + */ + /** * \brief Set the streams to capture with associated buffers * \param[in] streamMap The map of streams to buffers