summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2020-12-04 15:31:19 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-08 14:28:51 +0200
commita62b35b8c07ee83c4f0e9ee741f3226d47fe3f87 (patch)
tree1b41de47e8ea2842f4259952adfc48b9da633059 /src
parentee477efde8e49e26cc02437fd50a45cd439ee65e (diff)
libcamera: pipeline: Pass libcamera controls into pipeline_handler::start()
Applications now have the ability to pass in controls that need to be applied on startup, rather than doing it through Request where there might be some frames of delay in getting the controls applied. This commit adds the ability to pass in a set of libcamera controls into the pipeline handlers through the pipeline_handler::start() method. These controls are provided by the application through the camera::start() public API. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera.cpp12
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp4
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp4
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp4
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp4
-rw-r--r--src/libcamera/pipeline/uvcvideo/uvcvideo.cpp4
-rw-r--r--src/libcamera/pipeline/vimc/vimc.cpp4
-rw-r--r--src/libcamera/pipeline_handler.cpp1
8 files changed, 20 insertions, 17 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index bcb7b046..3579ba96 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -1002,10 +1002,12 @@ int Camera::queueRequest(Request *request)
/**
* \brief Start capture from camera
+ * \param[in] controls Controls to be applied before starting the Camera
*
- * Start the camera capture session. Once the camera is started the application
- * can queue requests to the camera to process and return to the application
- * until the capture session is terminated with \a stop().
+ * Start the camera capture session, optionally providing a list of controls to
+ * apply before starting. Once the camera is started the application can queue
+ * requests to the camera to process and return to the application until the
+ * capture session is terminated with \a stop().
*
* \context This function may only be called when the camera is in the
* Configured state as defined in \ref camera_operation, and shall be
@@ -1016,7 +1018,7 @@ int Camera::queueRequest(Request *request)
* \retval -ENODEV The camera has been disconnected from the system
* \retval -EACCES The camera is not in a state where it can be started
*/
-int Camera::start()
+int Camera::start(ControlList *controls)
{
Private *const d = LIBCAMERA_D_PTR();
@@ -1027,7 +1029,7 @@ int Camera::start()
LOG(Camera, Debug) << "Starting capture";
ret = d->pipe_->invokeMethod(&PipelineHandler::start,
- ConnectionTypeBlocking, this);
+ ConnectionTypeBlocking, this, controls);
if (ret)
return ret;
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 4cedb32b..8a1918d5 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -105,7 +105,7 @@ public:
int exportFrameBuffers(Camera *camera, Stream *stream,
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
- int start(Camera *camera) override;
+ int start(Camera *camera, ControlList *controls) override;
void stop(Camera *camera) override;
int queueRequestDevice(Camera *camera, Request *request) override;
@@ -596,7 +596,7 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera)
return 0;
}
-int PipelineHandlerIPU3::start(Camera *camera)
+int PipelineHandlerIPU3::start(Camera *camera, [[maybe_unused]] ControlList *controls)
{
IPU3CameraData *data = cameraData(camera);
CIO2Device *cio2 = &data->cio2_;
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 76252806..8f67873a 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -242,7 +242,7 @@ public:
int exportFrameBuffers(Camera *camera, Stream *stream,
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
- int start(Camera *camera) override;
+ int start(Camera *camera, ControlList *controls) override;
void stop(Camera *camera) override;
int queueRequestDevice(Camera *camera, Request *request) override;
@@ -731,7 +731,7 @@ int PipelineHandlerRPi::exportFrameBuffers([[maybe_unused]] Camera *camera, Stre
return ret;
}
-int PipelineHandlerRPi::start(Camera *camera)
+int PipelineHandlerRPi::start(Camera *camera, [[maybe_unused]] ControlList *controls)
{
RPiCameraData *data = cameraData(camera);
int ret;
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 6e74a49a..4e959fde 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -187,7 +187,7 @@ public:
int exportFrameBuffers(Camera *camera, Stream *stream,
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
- int start(Camera *camera) override;
+ int start(Camera *camera, ControlList *controls) override;
void stop(Camera *camera) override;
int queueRequestDevice(Camera *camera, Request *request) override;
@@ -832,7 +832,7 @@ int PipelineHandlerRkISP1::freeBuffers(Camera *camera)
return 0;
}
-int PipelineHandlerRkISP1::start(Camera *camera)
+int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *controls)
{
RkISP1CameraData *data = cameraData(camera);
int ret;
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 0d3078f7..b047aeb9 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -126,7 +126,7 @@ public:
int exportFrameBuffers(Camera *camera, Stream *stream,
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
- int start(Camera *camera) override;
+ int start(Camera *camera, ControlList *controls) override;
void stop(Camera *camera) override;
bool match(DeviceEnumerator *enumerator) override;
@@ -646,7 +646,7 @@ int SimplePipelineHandler::exportFrameBuffers(Camera *camera, Stream *stream,
return data->video_->exportBuffers(count, buffers);
}
-int SimplePipelineHandler::start(Camera *camera)
+int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] ControlList *controls)
{
SimpleCameraData *data = cameraData(camera);
V4L2VideoDevice *video = data->video_;
diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index 0f3241cc..87b0f03d 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -76,7 +76,7 @@ public:
int exportFrameBuffers(Camera *camera, Stream *stream,
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
- int start(Camera *camera) override;
+ int start(Camera *camera, ControlList *controls) override;
void stop(Camera *camera) override;
int queueRequestDevice(Camera *camera, Request *request) override;
@@ -236,7 +236,7 @@ int PipelineHandlerUVC::exportFrameBuffers(Camera *camera, Stream *stream,
return data->video_->exportBuffers(count, buffers);
}
-int PipelineHandlerUVC::start(Camera *camera)
+int PipelineHandlerUVC::start(Camera *camera, [[maybe_unused]] ControlList *controls)
{
UVCCameraData *data = cameraData(camera);
unsigned int count = data->stream_.configuration().bufferCount;
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index 914b6b54..d81b8598 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -92,7 +92,7 @@ public:
int exportFrameBuffers(Camera *camera, Stream *stream,
std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;
- int start(Camera *camera) override;
+ int start(Camera *camera, ControlList *controls) override;
void stop(Camera *camera) override;
int queueRequestDevice(Camera *camera, Request *request) override;
@@ -313,7 +313,7 @@ int PipelineHandlerVimc::exportFrameBuffers(Camera *camera, Stream *stream,
return data->video_->exportBuffers(count, buffers);
}
-int PipelineHandlerVimc::start(Camera *camera)
+int PipelineHandlerVimc::start(Camera *camera, [[maybe_unused]] ControlList *controls)
{
VimcCameraData *data = cameraData(camera);
unsigned int count = data->stream_.configuration().bufferCount;
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 894200ee..c75ebbd5 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -351,6 +351,7 @@ const ControlList &PipelineHandler::properties(const Camera *camera) const
* \fn PipelineHandler::start()
* \brief Start capturing from a group of streams
* \param[in] camera The camera to start
+ * \param[in] controls Controls to be applied before starting the Camera
*
* Start the group of streams that have been configured for capture by
* \a configure(). The intended caller of this method is the Camera class which