From patchwork Mon Oct 28 02:22:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2250 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1FD6A6017C for ; Mon, 28 Oct 2019 03:22:44 +0100 (CET) X-Halon-ID: d01dcbd8-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d01dcbd8-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:40 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:15 +0100 Message-Id: <20191028022224.795355-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 01/10] libcamera: buffer: Drop forward declaration of BufferPool 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, 28 Oct 2019 02:22:44 -0000 There is no need to forward declare BufferPool, drop it. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/buffer.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 7b657509ab5f5d41..e14c9bd390a13bfc 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -13,7 +13,6 @@ namespace libcamera { -class BufferPool; class Request; class Stream; From patchwork Mon Oct 28 02:22:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2251 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 82DB16017C for ; Mon, 28 Oct 2019 03:22:44 +0100 (CET) X-Halon-ID: d146c184-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d146c184-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:41 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:16 +0100 Message-Id: <20191028022224.795355-3-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 02/10] libcamera: buffer: Plane: Drop friend statement 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, 28 Oct 2019 02:22:45 -0000 The Plane class do not need to friend Stream, drop it. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/buffer.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index e14c9bd390a13bfc..d7784d9d24ab3f41 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -29,8 +29,6 @@ public: unsigned int length() const { return length_; } private: - friend class Stream; - int mmap(); int munmap(); From patchwork Mon Oct 28 02:22:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2252 X-Patchwork-Delegate: niklas.soderlund@ragnatech.se Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D0F06017E for ; Mon, 28 Oct 2019 03:22:46 +0100 (CET) X-Halon-ID: d1c4772a-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d1c4772a-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:42 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:17 +0100 Message-Id: <20191028022224.795355-4-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 03/10] libcamera: buffer: Drop friend statment 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, 28 Oct 2019 02:22:47 -0000 The Buffer class do not need to friend PipelineHandler, drop it. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/buffer.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index d7784d9d24ab3f41..c349b995e1eb35ee 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -88,7 +88,6 @@ public: private: friend class Camera; - friend class PipelineHandler; friend class Request; friend class Stream; friend class V4L2VideoDevice; From patchwork Mon Oct 28 02:22:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2253 Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 862FE61506 for ; Mon, 28 Oct 2019 03:22:46 +0100 (CET) X-Halon-ID: d241955c-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d241955c-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:43 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:18 +0100 Message-Id: <20191028022224.795355-5-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/10] libcamera: camera: Remove explicit stream to buffer map in requestCompleted signal 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, 28 Oct 2019 02:22:47 -0000 The stream to buffer map in the requestCompleted signal is taken directly from the request which is part of the same signal. Remove the map as it can be fetched directly from the request. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/camera.h | 2 +- src/cam/capture.cpp | 4 +++- src/cam/capture.h | 3 +-- src/libcamera/camera.cpp | 2 +- src/qcam/main_window.cpp | 5 +++-- src/qcam/main_window.h | 3 +-- test/camera/capture.cpp | 4 +++- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index 21fac550f4121fdc..268d2d37ccac8b71 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -79,7 +79,7 @@ public: const std::string &name() const; Signal bufferCompleted; - Signal &> requestCompleted; + Signal requestCompleted; Signal disconnected; int acquire(); diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp index 0d7854d674e0a78d..27332df1d55a5c2d 100644 --- a/src/cam/capture.cpp +++ b/src/cam/capture.cpp @@ -133,11 +133,13 @@ int Capture::capture(EventLoop *loop) return ret; } -void Capture::requestComplete(Request *request, const std::map &buffers) +void Capture::requestComplete(Request *request) { if (request->status() == Request::RequestCancelled) return; + const std::map &buffers = request->buffers(); + std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); double fps = std::chrono::duration_cast(now - last_).count(); fps = last_ != std::chrono::steady_clock::time_point() && fps diff --git a/src/cam/capture.h b/src/cam/capture.h index ee0dc421111197c1..4d396afb8c771a74 100644 --- a/src/cam/capture.h +++ b/src/cam/capture.h @@ -28,8 +28,7 @@ public: private: int capture(EventLoop *loop); - void requestComplete(libcamera::Request *request, - const std::map &buffers); + void requestComplete(libcamera::Request *request); libcamera::Camera *camera_; libcamera::CameraConfiguration *config_; diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 76c737cb93813115..e810fb725d81350d 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -919,7 +919,7 @@ void Camera::requestComplete(Request *request) stream->unmapBuffer(buffer); } - requestCompleted.emit(request, request->buffers()); + requestCompleted.emit(request); delete request; } diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 3d56309227235fec..cca7365ae75687f9 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -248,12 +248,13 @@ void MainWindow::stopCapture() setWindowTitle(title_); } -void MainWindow::requestComplete(Request *request, - const std::map &buffers) +void MainWindow::requestComplete(Request *request) { if (request->status() == Request::RequestCancelled) return; + const std::map &buffers = request->buffers(); + framesCaptured_++; Buffer *buffer = buffers.begin()->second; diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 30dd8743104d75e0..78511581a8d5c025 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -49,8 +49,7 @@ private: int startCapture(); void stopCapture(); - void requestComplete(Request *request, - const std::map &buffers); + void requestComplete(Request *request); int display(Buffer *buffer); QString title_; diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp index 791ccad15f7042f9..83f974749affd3cd 100644 --- a/test/camera/capture.cpp +++ b/test/camera/capture.cpp @@ -27,11 +27,13 @@ protected: completeBuffersCount_++; } - void requestComplete(Request *request, const std::map &buffers) + void requestComplete(Request *request) { if (request->status() != Request::RequestComplete) return; + const std::map &buffers = request->buffers(); + completeRequestsCount_++; /* Create a new request. */ From patchwork Mon Oct 28 02:22:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2254 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 183886017E for ; Mon, 28 Oct 2019 03:22:47 +0100 (CET) X-Halon-ID: d2dcfa6a-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d2dcfa6a-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:44 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:19 +0100 Message-Id: <20191028022224.795355-6-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/10] cam: BufferWriter: Use the libcamera namespace 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, 28 Oct 2019 02:22:47 -0000 Other parts of the cam utility uses the libcamera namespace, do the same in the buffer writer. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/cam/buffer_writer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cam/buffer_writer.cpp b/src/cam/buffer_writer.cpp index 1c044b0634672d87..c33e99c5f8173db8 100644 --- a/src/cam/buffer_writer.cpp +++ b/src/cam/buffer_writer.cpp @@ -14,12 +14,14 @@ #include "buffer_writer.h" +using namespace libcamera; + BufferWriter::BufferWriter(const std::string &pattern) : pattern_(pattern) { } -int BufferWriter::write(libcamera::Buffer *buffer, const std::string &streamName) +int BufferWriter::write(Buffer *buffer, const std::string &streamName) { std::string filename; size_t pos; @@ -40,8 +42,8 @@ int BufferWriter::write(libcamera::Buffer *buffer, const std::string &streamName if (fd == -1) return -errno; - libcamera::BufferMemory *mem = buffer->mem(); - for (libcamera::Plane &plane : mem->planes()) { + BufferMemory *mem = buffer->mem(); + for (Plane &plane : mem->planes()) { void *data = plane.mem(); unsigned int length = plane.length(); From patchwork Mon Oct 28 02:22:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2256 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AA6256139C for ; Mon, 28 Oct 2019 03:22:48 +0100 (CET) X-Halon-ID: d34a2ef7-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d34a2ef7-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:44 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:20 +0100 Message-Id: <20191028022224.795355-7-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/10] libcamera: v4l2_videodevice: Simplify error checking for requestBuffers() 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, 28 Oct 2019 02:22:49 -0000 There is no point in explicitly checking the same error in the only call sites for the internal function, centralize the check and simplify the code. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/v4l2_videodevice.cpp | 31 ++++++++++-------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 208ab54199b141c3..a2a9eab2bcc0d7e8 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -819,9 +819,16 @@ int V4L2VideoDevice::requestBuffers(unsigned int count) return ret; } + if (rb.count < count) { + LOG(V4L2, Error) + << "Not enough buffers provided by V4L2VideoDevice"; + requestBuffers(0); + return -ENOMEM; + } + LOG(V4L2, Debug) << rb.count << " buffers requested."; - return rb.count; + return 0; } /** @@ -832,24 +839,15 @@ int V4L2VideoDevice::requestBuffers(unsigned int count) */ int V4L2VideoDevice::exportBuffers(BufferPool *pool) { - unsigned int allocatedBuffers; unsigned int i; int ret; memoryType_ = V4L2_MEMORY_MMAP; ret = requestBuffers(pool->count()); - if (ret < 0) + if (ret) return ret; - allocatedBuffers = ret; - if (allocatedBuffers < pool->count()) { - LOG(V4L2, Error) - << "Not enough buffers provided by V4L2VideoDevice"; - requestBuffers(0); - return -ENOMEM; - } - /* Map the buffers. */ for (i = 0; i < pool->count(); ++i) { struct v4l2_plane planes[VIDEO_MAX_PLANES] = {}; @@ -936,23 +934,14 @@ int V4L2VideoDevice::createPlane(BufferMemory *buffer, unsigned int index, */ int V4L2VideoDevice::importBuffers(BufferPool *pool) { - unsigned int allocatedBuffers; int ret; memoryType_ = V4L2_MEMORY_DMABUF; ret = requestBuffers(pool->count()); - if (ret < 0) + if (ret) return ret; - allocatedBuffers = ret; - if (allocatedBuffers < pool->count()) { - LOG(V4L2, Error) - << "Not enough buffers provided by V4L2VideoDevice"; - requestBuffers(0); - return -ENOMEM; - } - LOG(V4L2, Debug) << "provided pool of " << pool->count() << " buffers"; bufferPool_ = pool; From patchwork Mon Oct 28 02:22:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2255 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A18BC6017D for ; Mon, 28 Oct 2019 03:22:48 +0100 (CET) X-Halon-ID: d3e66e4d-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d3e66e4d-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:45 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:21 +0100 Message-Id: <20191028022224.795355-8-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 07/10] libcamera: pipeline_handler: Do not use argument as local variable 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, 28 Oct 2019 02:22:49 -0000 In completeRequest() the request argument is used as a local variable, this is confusing. Add a separate local variable instead of reusing the argument. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline_handler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index bf8c86d35c4fb6f4..f9ae767d529d44d9 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -409,13 +409,13 @@ void PipelineHandler::completeRequest(Camera *camera, Request *request) CameraData *data = cameraData(camera); while (!data->queuedRequests_.empty()) { - request = data->queuedRequests_.front(); - if (request->status() == Request::RequestPending) + Request *req = data->queuedRequests_.front(); + if (req->status() == Request::RequestPending) break; - ASSERT(!request->hasPendingBuffers()); + ASSERT(!req->hasPendingBuffers()); data->queuedRequests_.pop_front(); - camera->requestComplete(request); + camera->requestComplete(req); } } From patchwork Mon Oct 28 02:22:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2257 X-Patchwork-Delegate: niklas.soderlund@ragnatech.se Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4217B6017E for ; Mon, 28 Oct 2019 03:22:50 +0100 (CET) X-Halon-ID: d453aada-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d453aada-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:46 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:22 +0100 Message-Id: <20191028022224.795355-9-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 08/10] libcamera: pipelines: Align where to call base class 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-List-Received-Date: Mon, 28 Oct 2019 02:22:50 -0000 The PipelineHandler base class queueRequest() where called at different points in different pipeline handlers. Align where they are called to make it easier to read different pipeline implementations. Signed-off-by: Niklas Söderlund --- src/libcamera/pipeline/ipu3/ipu3.cpp | 5 +++-- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 4 +--- src/libcamera/pipeline/uvcvideo.cpp | 4 +--- src/libcamera/pipeline/vimc.cpp | 4 +--- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 8d3ad568d16e9f8f..06ee6ccac641eb41 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -768,9 +768,10 @@ int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request) error = ret; } - PipelineHandler::queueRequest(camera, request); + if (error) + return error; - return error; + return PipelineHandler::queueRequest(camera, request); } bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 7a28b03b8d38c8b9..a99df4f8b846d8b7 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -814,8 +814,6 @@ int PipelineHandlerRkISP1::queueRequest(Camera *camera, Request *request) RkISP1CameraData *data = cameraData(camera); Stream *stream = &data->stream_; - PipelineHandler::queueRequest(camera, request); - RkISP1FrameInfo *info = data->frameInfo_.create(data->frame_, request, stream); if (!info) @@ -833,7 +831,7 @@ int PipelineHandlerRkISP1::queueRequest(Camera *camera, Request *request) data->frame_++; - return 0; + return PipelineHandler::queueRequest(camera, request); } /* ----------------------------------------------------------------------------- diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index fae0ffc4de30e1b7..dc17b456af6987e6 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -281,9 +281,7 @@ int PipelineHandlerUVC::queueRequest(Camera *camera, Request *request) if (ret < 0) return ret; - PipelineHandler::queueRequest(camera, request); - - return 0; + return PipelineHandler::queueRequest(camera, request); } bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index c16ae4cb76b57e1c..5f83ae2b85997828 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -341,9 +341,7 @@ int PipelineHandlerVimc::queueRequest(Camera *camera, Request *request) if (ret < 0) return ret; - PipelineHandler::queueRequest(camera, request); - - return 0; + return PipelineHandler::queueRequest(camera, request); } bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) From patchwork Mon Oct 28 02:22:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2258 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A7A1E6151C for ; Mon, 28 Oct 2019 03:22:50 +0100 (CET) X-Halon-ID: d4f17c33-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d4f17c33-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:47 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:23 +0100 Message-Id: <20191028022224.795355-10-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 09/10] cam: Store camera as shared pointer everywhere 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, 28 Oct 2019 02:22:51 -0000 Do not store the camera raw pointer in the capture class, this will prevent forwarding the shared pointer in the future. Signed-off-by: Niklas Söderlund --- src/cam/capture.cpp | 2 +- src/cam/capture.h | 4 ++-- src/cam/main.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp index 27332df1d55a5c2d..e665d819fb777a90 100644 --- a/src/cam/capture.cpp +++ b/src/cam/capture.cpp @@ -16,7 +16,7 @@ using namespace libcamera; -Capture::Capture(Camera *camera, CameraConfiguration *config) +Capture::Capture(std::shared_ptr camera, CameraConfiguration *config) : camera_(camera), config_(config), writer_(nullptr) { } diff --git a/src/cam/capture.h b/src/cam/capture.h index 4d396afb8c771a74..c692d48918f2de1d 100644 --- a/src/cam/capture.h +++ b/src/cam/capture.h @@ -21,7 +21,7 @@ class Capture { public: - Capture(libcamera::Camera *camera, + Capture(std::shared_ptr camera, libcamera::CameraConfiguration *config); int run(EventLoop *loop, const OptionsParser::Options &options); @@ -30,7 +30,7 @@ private: void requestComplete(libcamera::Request *request); - libcamera::Camera *camera_; + std::shared_ptr camera_; libcamera::CameraConfiguration *config_; std::map streamName_; diff --git a/src/cam/main.cpp b/src/cam/main.cpp index 9d99f5587cbb77d0..a38cca959aca05ff 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -319,7 +319,7 @@ int CamApp::run() } if (options_.isSet(OptCapture)) { - Capture capture(camera_.get(), config_.get()); + Capture capture(camera_, config_.get()); return capture.run(loop_, options_); } From patchwork Mon Oct 28 02:22:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2259 Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4CFFB61507 for ; Mon, 28 Oct 2019 03:22:53 +0100 (CET) X-Halon-ID: d56d1532-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d56d1532-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:48 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:24 +0100 Message-Id: <20191028022224.795355-11-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 10/10] libcamera: pipeline: Drop forward declaration of BufferPool 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, 28 Oct 2019 02:22:53 -0000 There is no need to forward declare BufferPool, drop it. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/include/pipeline_handler.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h index 42b90a4bf1a6e414..320740746bc6e998 100644 --- a/src/libcamera/include/pipeline_handler.h +++ b/src/libcamera/include/pipeline_handler.h @@ -21,7 +21,6 @@ namespace libcamera { class Buffer; -class BufferPool; class Camera; class CameraConfiguration; class CameraManager;