summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/raspberrypi
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-04 01:13:58 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-07 19:17:46 +0300
commit395d43d6d75b3a7dc8545cc4d89616a09948ee4c (patch)
treee5757ec1d8d9954325e91d1cfd9a54b3c254415e /src/libcamera/pipeline/raspberrypi
parent8e18f8d45fb61977926a3395b1963028bab258f9 (diff)
libcamera: v4l2_videodevice: Drop toV4L2PixelFormat()
The V4L2VideoDevice::toV4L2PixelFormat() function is incorrectly implemented, as it will pick a multi-planar format if the device supports the multi-planar API, even if only single-planar formats are supported. This currently works because the implementation calls V4L2PixelFormat::fromPixelFormat(), which ignores the multiplanar argument and always returns a single-planar format. Fixing this isn't trivial. As we don't need to support multi-planar V4L2 formats at this point, drop the function instead of pretending everything is fine, and call V4L2PixelFormat::fromPixelFormat() directly from pipeline handlers. As the single-planar case is the most common, set the multiplanar argument to false by default to avoid long lines. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Diffstat (limited to 'src/libcamera/pipeline/raspberrypi')
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index b2674ac0..0bdfa727 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -440,14 +440,14 @@ CameraConfiguration::Status RPiCameraConfiguration::validate()
V4L2VideoDevice::Formats fmts = dev->formats();
- if (fmts.find(V4L2PixelFormat::fromPixelFormat(cfgPixFmt, false)) == fmts.end()) {
+ if (fmts.find(V4L2PixelFormat::fromPixelFormat(cfgPixFmt)) == fmts.end()) {
/* If we cannot find a native format, use a default one. */
cfgPixFmt = formats::NV12;
status = Adjusted;
}
V4L2DeviceFormat format;
- format.fourcc = dev->toV4L2PixelFormat(cfg.pixelFormat);
+ format.fourcc = V4L2PixelFormat::fromPixelFormat(cfg.pixelFormat);
format.size = cfg.size;
int ret = dev->tryFormat(&format);
@@ -647,7 +647,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
RPi::Stream *stream = i == maxIndex ? &data->isp_[Isp::Output0]
: &data->isp_[Isp::Output1];
- V4L2PixelFormat fourcc = stream->dev()->toV4L2PixelFormat(cfg.pixelFormat);
+ V4L2PixelFormat fourcc = V4L2PixelFormat::fromPixelFormat(cfg.pixelFormat);
format.size = cfg.size;
format.fourcc = fourcc;
@@ -688,7 +688,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
maxSize = Size(320, 240);
format = {};
format.size = maxSize;
- format.fourcc = V4L2PixelFormat::fromPixelFormat(formats::YUV420, false);
+ format.fourcc = V4L2PixelFormat::fromPixelFormat(formats::YUV420);
ret = data->isp_[Isp::Output0].dev()->setFormat(&format);
if (ret) {
LOG(RPI, Error)