diff options
author | Naushir Patuck <naush@raspberrypi.com> | 2021-03-13 10:27:41 +0000 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-03-13 22:21:01 +0200 |
commit | 4f4f8bb8bc994b209e86633764066ef8c665a437 (patch) | |
tree | a06c0692aba0469a7013b25485424e528156de09 | |
parent | cd3f70a14c69d2cc86dd483249d1943a80947be1 (diff) |
pipeline: raspberrypi: Use a default format for ISP::Output0
If the ISP::Output0 stream has not been configured, we must enable it
with a default format and resolution for internal use. This is to allow
the pipeline handler data flow to be consistent, and allow the IPA to
receive statistics for the frame.
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>
-rw-r--r-- | src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 9847e926..00fa62c9 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -625,7 +625,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) * StreamConfiguration appropriately. */ V4L2DeviceFormat format; - bool output1Set = false; + bool output0Set = false, output1Set = false; for (unsigned i = 0; i < config->size(); i++) { StreamConfiguration &cfg = config->at(i); @@ -662,6 +662,35 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) if (i != maxIndex) output1Set = true; + else + output0Set = true; + } + + /* + * If ISP::Output0 stream has not been configured by the application, + * we must allow the hardware to generate an output so that the data + * flow in the pipeline handler remains consistent, and we still generate + * statistics for the IPA to use. So enable the output at a very low + * resolution for internal use. + * + * \todo Allow the pipeline to work correctly without Output0 and only + * statistics coming from the hardware. + */ + if (!output0Set) { + maxSize = Size(320, 240); + format = {}; + format.size = maxSize; + format.fourcc = V4L2PixelFormat::fromPixelFormat(formats::YUV420, false); + ret = data->isp_[Isp::Output0].dev()->setFormat(&format); + if (ret) { + LOG(RPI, Error) + << "Failed to set default format on ISP Output0: " + << ret; + return -EINVAL; + } + + LOG(RPI, Debug) << "Defaulting ISP Output0 format to " + << format.toString(); } /* |