@@ -37,6 +37,8 @@ struct BufferIds {
struct ConfigParams {
uint32 transform;
+ uint32 rawFormat; /* raw buffer PixelFormat fourcc, or zero if unknown */
+ uint64 rawFormatModifier; /* raw buffer PixelFormat modifier */
libcamera.ControlInfoMap sensorControls;
libcamera.ControlInfoMap ispControls;
libcamera.ControlInfoMap lensControls;
@@ -215,6 +215,7 @@ int32_t IpaBase::configure(const IPACameraSensorInfo &sensorInfo, const ConfigPa
setMode(sensorInfo);
mode_.transform = static_cast<libcamera::Transform>(params.transform);
+ mode_.rawFormat = PixelFormat(params.rawFormat, params.rawFormatModifier);
/* Pass the camera mode to the CamHelper to setup algorithms. */
helper_->setCameraMode(mode_);
@@ -6,6 +6,7 @@
*/
#pragma once
+#include <libcamera/pixel_format.h>
#include <libcamera/transform.h>
#include <libcamera/base/utils.h>
@@ -43,6 +44,8 @@ struct CameraMode {
libcamera::utils::Duration maxFrameDuration;
/* any camera transform *not* reflected already in the camera tuning */
libcamera::Transform transform;
+ /* PixelFormat of the raw buffers */
+ libcamera::PixelFormat rawFormat;
/* minimum and maximum frame lengths in units of lines */
uint32_t minFrameLength;
uint32_t maxFrameLength;
@@ -1236,6 +1236,20 @@ int CameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::Config
Transform transform = config->orientation / Orientation::Rotate0;
params.transform = static_cast<unsigned int>(transform);
+ /*
+ * Send the format of the raw Bayer buffers, which should match what's
+ * set on the frontend device, whether buffers are internal or not.
+ */
+ V4L2DeviceFormat frontendFormat;
+ ret = frontendDevice()->getFormat(&frontendFormat);
+ if (ret) {
+ LOG(RPI, Error) << "Failed to get the frontend format";
+ return ret;
+ }
+ const PixelFormat rawFormat = frontendFormat.fourcc.toPixelFormat();
+ params.rawFormat = rawFormat.fourcc();
+ params.rawFormatModifier = rawFormat.modifier();
+
/* Ready the IPA - it must know about the sensor resolution. */
ret = ipa_->configure(sensorInfo_, params, result);
if (ret < 0) {
We have to pass both the fourcc and the modifier so that the IPA can reconstruct the PixelFormat faithfully, and we do so whether the raw buffers are internal or external. This is for the benefit of future IPAs that may want to peak at pixel values. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> --- include/libcamera/ipa/raspberrypi.mojom | 2 ++ src/ipa/rpi/common/ipa_base.cpp | 1 + src/ipa/rpi/controller/camera_mode.h | 3 +++ .../pipeline/rpi/common/pipeline_base.cpp | 14 ++++++++++++++ 4 files changed, 20 insertions(+)