@@ -1353,8 +1353,20 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
if (ret < 0)
return ret;
- /* Configure the video node. */
- V4L2PixelFormat videoFormat = video->toV4L2PixelFormat(pipeConfig->captureFormat);
+ /* Configure the video node, taking into account any Bayer pattern change. */
+ V4L2PixelFormat videoFormat;
+ if (format.code == pipeConfig->code) {
+ videoFormat = video->toV4L2PixelFormat(pipeConfig->captureFormat);
+ } else {
+ /*
+ * Bayer pattern has changed because of the transform that was applied on
+ * the sensor. Get the V4L2PixelFormat corresponding to the configured Bayer
+ * pattern.
+ */
+ BayerFormat cfgBayer = BayerFormat::fromPixelFormat(pipeConfig->captureFormat);
+ cfgBayer.order = data->sensor_->bayerOrder(config->combinedTransform());
+ videoFormat = cfgBayer.toV4L2PixelFormat();
+ }
V4L2DeviceFormat captureFormat;
captureFormat.fourcc = videoFormat;
@@ -1396,7 +1408,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
return 0;
StreamConfiguration inputCfg;
- inputCfg.pixelFormat = pipeConfig->captureFormat;
+ inputCfg.pixelFormat = videoFormat.toPixelFormat();
inputCfg.size = pipeConfig->captureSize;
inputCfg.stride = captureFormat.planes[0].bpl;
inputCfg.bufferCount = kNumInternalBuffers;
Bayer pattern on the sensor can change while configuring it with the intended capture format. This is due to the transform being applied on the sensor which supports [v/h]flips. During configure(), the simple pipeline handler does not detect any bayer pattern changes that can arise due to the transformations being applied via SimpleCameraData:setupFormats(). In such cases, the video node will be configured in-correctly, without realising the bayer pattern has changed on the sensor, for the given capture format. This patch detects the bayer pattern change after the sensor has been configured and retrieves the corresponding V4L2 pixel format to correctly configure the video node and the input to converter or Soft-ISP. Signed-off-by: Umang Jain <uajain@igalia.com> --- Changes in v3: - Drop addition of 'unicam' in supportedDevices[]. This could be enabled through a global configuration file. Changes in v2: - Pass the updated format(Bayer applied with transforms) to the converter/SoftISP input configuration as well to configure them correctly. --- src/libcamera/pipeline/simple/simple.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)