summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2022-11-18 17:32:05 +0100
committerJacopo Mondi <jacopo@jmondi.org>2022-11-21 14:54:33 +0100
commitf8e998a4c19e66b6a9ba5dc864ac6f6556c87937 (patch)
tree2fce768318ebc7122ed29e99bf0ce749fd964552
parente228a5b7f4090a8e0598e9bcff006aaa0f5c0786 (diff)
libcamera: imx8-isi: Enumerate supported stream formats
Add to the formats map all the supported ISI video capture stream formats. This allows to populate the list of stream formats for all the non-RAW use cases, as the ISI can perform colorspace conversion between YUV and RGB. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/imx8-isi/imx8-isi.cpp62
1 files changed, 59 insertions, 3 deletions
diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
index 14d699b7..a3dfd3fc 100644
--- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
+++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
@@ -189,11 +189,51 @@ const ISICameraConfiguration::FormatMap ISICameraConfiguration::formatsMap_ = {
MEDIA_BUS_FMT_UYVY8_1X16 },
},
{
+ formats::AVUY8888,
+ { MEDIA_BUS_FMT_YUV8_1X24,
+ MEDIA_BUS_FMT_UYVY8_1X16 },
+ },
+ {
+ formats::NV12,
+ { MEDIA_BUS_FMT_YUV8_1X24,
+ MEDIA_BUS_FMT_UYVY8_1X16 },
+ },
+ {
+ formats::NV16,
+ { MEDIA_BUS_FMT_YUV8_1X24,
+ MEDIA_BUS_FMT_UYVY8_1X16 },
+ },
+ {
+ formats::YUV444,
+ { MEDIA_BUS_FMT_YUV8_1X24,
+ MEDIA_BUS_FMT_UYVY8_1X16 },
+ },
+ {
formats::RGB565,
{ MEDIA_BUS_FMT_RGB888_1X24,
MEDIA_BUS_FMT_RGB565_1X16 },
},
{
+ formats::BGR888,
+ { MEDIA_BUS_FMT_RGB888_1X24,
+ MEDIA_BUS_FMT_RGB565_1X16 },
+ },
+ {
+ formats::RGB888,
+ { MEDIA_BUS_FMT_RGB888_1X24,
+ MEDIA_BUS_FMT_RGB565_1X16 },
+ },
+ {
+ formats::XRGB8888,
+ { MEDIA_BUS_FMT_RGB888_1X24,
+ MEDIA_BUS_FMT_RGB565_1X16 },
+ },
+ {
+ formats::ABGR8888,
+ { MEDIA_BUS_FMT_RGB888_1X24,
+ MEDIA_BUS_FMT_RGB565_1X16 },
+ },
+ {
formats::SBGGR8,
{ MEDIA_BUS_FMT_SBGGR8_1X8,
MEDIA_BUS_FMT_SBGGR8_1X8 },
@@ -546,6 +586,7 @@ PipelineHandlerISI::generateConfiguration(Camera *camera,
return nullptr;
}
+ bool isRaw = false;
for (const auto &role : roles) {
/*
* Prefer the following formats
@@ -553,6 +594,7 @@ PipelineHandlerISI::generateConfiguration(Camera *camera,
* - ViewFinder/VideoRecording: 1080p YUYV
* - RAW: sensor's native format and resolution
*/
+ std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
PixelFormat pixelFormat;
Size size;
@@ -614,6 +656,9 @@ PipelineHandlerISI::generateConfiguration(Camera *camera,
size = data->sensor_->resolution();
pixelFormat = rawPipeFormat->first;
+ streamFormats[pixelFormat] = { { kMinISISize, size } };
+ isRaw = true;
+
break;
}
@@ -622,9 +667,20 @@ PipelineHandlerISI::generateConfiguration(Camera *camera,
return nullptr;
}
- /* \todo Add all supported formats. */
- std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
- streamFormats[pixelFormat] = { { kMinISISize, size } };
+ /*
+ * For non-RAW configurations the ISI can perform colorspace
+ * conversion. List all the supported output formats here.
+ */
+ if (!isRaw) {
+ for (const auto &[pixFmt, pipeFmt] : ISICameraConfiguration::formatsMap_) {
+ const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt);
+ if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW)
+ continue;
+
+ streamFormats[pixFmt] = { { kMinISISize, size } };
+ }
+ }
+
StreamFormats formats(streamFormats);
StreamConfiguration cfg(formats);