@@ -15,6 +15,7 @@
#include "libcamera/internal/device_enumerator.h"
#include "libcamera/internal/dma_buf_allocator.h"
+#include "libcamera/internal/v4l2_pixelformat.h"
#include "libcamera/internal/v4l2_subdevice.h"
#include "../common/pipeline_base.h"
@@ -622,6 +623,14 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi
V4L2VideoDevice *unicam = unicam_[Unicam::Image].dev();
V4L2DeviceFormat unicamFormat;
+ /*
+ * The sensor bayer order is the order of the data arriving at the
+ * Unicam image input, as affected by any transform applied to the
+ * sensor.
+ */
+ ColorFilterArray sensorBayerOrder =
+ sensor_->bayerOrder(rpiConfig->combinedTransform_);
+
/*
* See which streams are requested, and route the user
* StreamConfiguration appropriately.
@@ -641,9 +650,13 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi
if (ret)
return ret;
+ V4L2DeviceFormat ispFormat = unicamFormat;
+ ispFormat.fourcc.toNonGeneric(sensorBayerOrder);
+
LOG(RPI, Info) << "Sensor: " << sensor_->id()
<< " - Selected sensor format: " << rpiConfig->sensorFormat_
- << " - Selected unicam format: " << unicamFormat;
+ << " - Selected unicam format: " << unicamFormat
+ << " - Selected ISP input format: " << ispFormat;
/*
* Configure the Unicam embedded data output format only if the sensor
@@ -684,7 +697,7 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi
* 3. Configure the ISP.
*/
- ret = isp_[Isp::Input].dev()->setFormat(&unicamFormat);
+ ret = isp_[Isp::Input].dev()->setFormat(&ispFormat);
if (ret)
return ret;
Unicam supports both the new media bus codes and fourcc values. VC4 ISP unfortunately uses fourcc values to talk to the firmware, so we instead convert the new generic fourcc to the legacy (bayer-order specific) values before configuring it. Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> --- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)