summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libcamera/include/pipeline_handler.h4
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp6
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp7
-rw-r--r--src/libcamera/pipeline/uvcvideo.cpp6
-rw-r--r--src/libcamera/pipeline/vimc.cpp6
-rw-r--r--src/libcamera/pipeline_handler.cpp35
6 files changed, 37 insertions, 27 deletions
diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h
index a02e6e77..f3622631 100644
--- a/src/libcamera/include/pipeline_handler.h
+++ b/src/libcamera/include/pipeline_handler.h
@@ -77,7 +77,7 @@ public:
virtual int start(Camera *camera) = 0;
virtual void stop(Camera *camera) = 0;
- virtual int queueRequest(Camera *camera, Request *request);
+ int queueRequest(Camera *camera, Request *request);
bool completeBuffer(Camera *camera, Request *request, Buffer *buffer);
void completeRequest(Camera *camera, Request *request);
@@ -89,6 +89,8 @@ protected:
std::unique_ptr<CameraData> data);
void hotplugMediaDevice(MediaDevice *media);
+ virtual int queueRequestDevice(Camera *camera, Request *request) = 0;
+
CameraData *cameraData(const Camera *camera);
CameraManager *manager_;
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 1c5fccf6..6d8c3fad 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -220,7 +220,7 @@ public:
int start(Camera *camera) override;
void stop(Camera *camera) override;
- int queueRequest(Camera *camera, Request *request) override;
+ int queueRequestDevice(Camera *camera, Request *request) override;
bool match(DeviceEnumerator *enumerator) override;
@@ -756,7 +756,7 @@ void PipelineHandlerIPU3::stop(Camera *camera)
data->rawBuffers_.clear();
}
-int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request)
+int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)
{
int error = 0;
@@ -769,8 +769,6 @@ int PipelineHandlerIPU3::queueRequest(Camera *camera, Request *request)
error = ret;
}
- PipelineHandler::queueRequest(camera, request);
-
return error;
}
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 4a583a7a..7e41222e 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -184,7 +184,7 @@ public:
int start(Camera *camera) override;
void stop(Camera *camera) override;
- int queueRequest(Camera *camera, Request *request) override;
+ int queueRequestDevice(Camera *camera, Request *request) override;
bool match(DeviceEnumerator *enumerator) override;
@@ -810,13 +810,12 @@ void PipelineHandlerRkISP1::stop(Camera *camera)
activeCamera_ = nullptr;
}
-int PipelineHandlerRkISP1::queueRequest(Camera *camera, Request *request)
+int PipelineHandlerRkISP1::queueRequestDevice(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)
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index 52222924..3043366b 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -72,7 +72,7 @@ public:
int start(Camera *camera) override;
void stop(Camera *camera) override;
- int queueRequest(Camera *camera, Request *request) override;
+ int queueRequestDevice(Camera *camera, Request *request) override;
bool match(DeviceEnumerator *enumerator) override;
@@ -262,7 +262,7 @@ int PipelineHandlerUVC::processControls(UVCCameraData *data, Request *request)
return ret;
}
-int PipelineHandlerUVC::queueRequest(Camera *camera, Request *request)
+int PipelineHandlerUVC::queueRequestDevice(Camera *camera, Request *request)
{
UVCCameraData *data = cameraData(camera);
Buffer *buffer = request->findBuffer(&data->stream_);
@@ -281,8 +281,6 @@ int PipelineHandlerUVC::queueRequest(Camera *camera, Request *request)
if (ret < 0)
return ret;
- PipelineHandler::queueRequest(camera, request);
-
return 0;
}
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index 06664fed..292900bc 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -90,7 +90,7 @@ public:
int start(Camera *camera) override;
void stop(Camera *camera) override;
- int queueRequest(Camera *camera, Request *request) override;
+ int queueRequestDevice(Camera *camera, Request *request) override;
bool match(DeviceEnumerator *enumerator) override;
@@ -323,7 +323,7 @@ int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)
return ret;
}
-int PipelineHandlerVimc::queueRequest(Camera *camera, Request *request)
+int PipelineHandlerVimc::queueRequestDevice(Camera *camera, Request *request)
{
VimcCameraData *data = cameraData(camera);
Buffer *buffer = request->findBuffer(&data->stream_);
@@ -342,8 +342,6 @@ int PipelineHandlerVimc::queueRequest(Camera *camera, Request *request)
if (ret < 0)
return ret;
- PipelineHandler::queueRequest(camera, request);
-
return 0;
}
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 4349ca89..5badf31c 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -345,16 +345,12 @@ const ControlInfoMap &PipelineHandler::controls(Camera *camera)
* \param[in] request The request to queue
*
* This method queues a capture request to the pipeline handler for processing.
- * The request contains a set of buffers associated with streams and a set of
- * parameters. The pipeline handler shall program the device to ensure that the
- * parameters will be applied to the frames captured in the buffers provided in
- * the request.
+ * The request is first added to the internal list of queued requests, and
+ * then passed to the pipeline handler with a call to queueRequestDevice().
*
- * Pipeline handlers shall override this method. The base implementation in the
- * PipelineHandler class keeps track of queued requests in order to ensure
- * completion of all requests when the pipeline handler is stopped with stop().
- * Requests completion shall be signalled by the pipeline handler using the
- * completeRequest() method.
+ * Keeping track of queued requests ensures automatic completion of all requests
+ * when the pipeline handler is stopped with stop(). Request completion shall be
+ * signalled by the pipeline handler using the completeRequest() method.
*
* \return 0 on success or a negative error code otherwise
*/
@@ -363,10 +359,29 @@ int PipelineHandler::queueRequest(Camera *camera, Request *request)
CameraData *data = cameraData(camera);
data->queuedRequests_.push_back(request);
- return 0;
+ int ret = queueRequestDevice(camera, request);
+ if (ret)
+ data->queuedRequests_.remove(request);
+
+ return ret;
}
/**
+ * \fn PipelineHandler::queueRequestDevice()
+ * \brief Queue a request to the device
+ * \param[in] camera The camera to queue the request to
+ * \param[in] request The request to queue
+ *
+ * This method queues a capture request to the device for processing. The
+ * request contains a set of buffers associated with streams and a set of
+ * parameters. The pipeline handler shall program the device to ensure that the
+ * parameters will be applied to the frames captured in the buffers provided in
+ * the request.
+ *
+ * \return 0 on success or a negative error code otherwise
+ */
+
+/**
* \brief Complete a buffer for a request
* \param[in] camera The camera the request belongs to
* \param[in] request The request the buffer belongs to