summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2021-03-13 10:27:40 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-13 22:20:56 +0200
commitcd3f70a14c69d2cc86dd483249d1943a80947be1 (patch)
tree07cfc1bc5025fa9ac6f2f55a10a81875e3ee3886 /src
parent1be68039247d986ea152cd3a171bc97e7e40866e (diff)
pipeline: raspberrypi: Avoid multiple opens of Unicam embedded data node
It is possible for the application to call pipeline_handler::configure() multiple times, which would attempt to open the Unicam embedded data node on every call. This would cause a warning message as the node would have already been opened. Avoid this by tracking if the node has previously been opened. Note that this is a temporary fix since the open call for the Unicam embedded data node will be moved from pipeline_handler::configure() to pipeline_handler::match(). Signed-off-by: Naushir Patuck <naush@raspberrypi.com> 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/pipeline/raspberrypi/raspberrypi.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 41f1cbff..9847e926 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -138,7 +138,7 @@ class RPiCameraData : public CameraData
{
public:
RPiCameraData(PipelineHandler *pipe)
- : CameraData(pipe), state_(State::Stopped),
+ : CameraData(pipe), embeddedNodeOpened_(false), state_(State::Stopped),
supportsFlips_(false), flipsAlterBayerOrder_(false),
updateScalerCrop_(true), dropFrameCount_(0), ispOutputCount_(0)
{
@@ -183,6 +183,7 @@ public:
std::unique_ptr<DelayedControls> delayedCtrls_;
bool sensorMetadata_;
+ bool embeddedNodeOpened_;
/*
* All the functions in this class are called from a single calling
@@ -726,8 +727,13 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
if (data->sensorMetadata_) {
format = {};
format.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA);
+
+ if (!data->embeddedNodeOpened_) {
+ data->unicam_[Unicam::Embedded].dev()->open();
+ data->embeddedNodeOpened_ = true;
+ }
+
LOG(RPI, Debug) << "Setting embedded data format.";
- data->unicam_[Unicam::Embedded].dev()->open();
ret = data->unicam_[Unicam::Embedded].dev()->setFormat(&format);
if (ret) {
LOG(RPI, Error) << "Failed to set format on Unicam embedded: "