libcamera: rkisp1: Fix enumeration of RAW formats

The current implementation enumerates a single RAW format (the sensor's
resolution) and does that regardless of what role the
CameraConfiguration has been generated for.

Fix this by:
- Enumerate RAW StreamFormats only when the requested role is
  StreamRole::Raw
- Add all the sensor's provided resolutions that fit the video device
  output maximum size

Before this patch, a single RAW size was enumerated in stream formats

 * Pixelformat: SRGGB10 (4208x3120)-(4208x3120)/(+1,+1)
  - 4208x3120

With this patch applied all sensor's supported resolutions are
enumerated but only when the stream role RAW is explicitly requested

 * Pixelformat: SRGGB10 (1048x780)-(4208x3120)/(+0,+0)
  - 1048x780
  - 2104x1560
  - 4032x3024
  - 4208x3120

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
Jacopo Mondi
2023-06-06 18:59:26 +02:00
parent d45da036a4
commit e58121cfc1
+18 -2
View File
@@ -149,18 +149,34 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,
for (const auto &format : streamFormats_) {
const PixelFormatInfo &info = PixelFormatInfo::info(format);
/* Populate stream formats for non-RAW configurations. */
if (info.colourEncoding != PixelFormatInfo::ColourEncodingRAW) {
if (role == StreamRole::Raw)
continue;
streamFormats[format] = { { minResolution, maxResolution } };
continue;
}
/* Skip raw formats not supported by the sensor. */
/* Skip RAW formats for non-raw roles. */
if (role != StreamRole::Raw)
continue;
/* Populate stream formats for RAW configurations. */
uint32_t mbusCode = formatToMediaBus.at(format);
if (std::find(mbusCodes.begin(), mbusCodes.end(), mbusCode) ==
mbusCodes.end())
/* Skip formats not supported by sensor. */
continue;
streamFormats[format] = { { resolution, resolution } };
/* Add all the RAW sizes the sensor can produce for this code. */
for (const auto &rawSize : sensor->sizes(mbusCode)) {
if (rawSize.width > maxResolution_.width ||
rawSize.height > maxResolution_.height)
continue;
streamFormats[format].push_back({ rawSize, rawSize });
}
/*
* Store the raw format with the highest bits per pixel for