[libcamera-devel] [RFC PATCH] libcamera: pipeline: vimc: Skip unsupported formats

Kieran Bingham kieran.bingham at ideasonboard.com
Fri May 22 20:14:35 CEST 2020


Older kernels do not support all 'reported' formats. Skip them on those
kernels.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
Marking this as RFC, as I don't actually yet know what the correct
kernel version is to condition against.

Currently, the QCam application can not stream the VIMC Camera for users
of QT Version less that 5.14 as that is when the BGR888 format becomes a
'preferred' native format.

Users of QT < 5.14 will find that qcam will chose a 'preferred' format
which is reported as supported by the kernel, when in fact it isn't.

Ensure that those formats are not reported as supported by the vimc
pipeline handler on older kernels.



 src/libcamera/pipeline/vimc/vimc.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index 68d65bc785b0..78fb0ece21f8 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -171,6 +171,7 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera,
 	const StreamRoles &roles)
 {
 	CameraConfiguration *config = new VimcCameraConfiguration();
+	VimcCameraData *data = cameraData(camera);
 
 	if (roles.empty())
 		return config;
@@ -178,6 +179,19 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera,
 	std::map<PixelFormat, std::vector<SizeRange>> formats;
 
 	for (const auto &pixelformat : pixelformats) {
+		/*
+		 * \todo: Update this when the kernel correctly supports other
+		 * reported formats.
+		 */
+		if (data->media_->version() <= KERNEL_VERSION(5, 7, 0)) {
+			if (pixelformat.first != PixelFormat(DRM_FORMAT_BGR888)) {
+				LOG(VIMC, Info)
+					<< "Skipping unsupported pixel format"
+					<< pixelformat.first.toString();
+				continue;
+			}
+		}
+
 		/* The scaler hardcodes a x3 scale-up ratio. */
 		std::vector<SizeRange> sizes{
 			SizeRange{ { 48, 48 }, { 4096, 2160 } }
-- 
2.25.1



More information about the libcamera-devel mailing list