summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-14 00:54:28 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-04-15 01:07:38 +0300
commitbac0e7d6759c1fc74ab5fb0dc0cb2b561cf0f63a (patch)
treedd0442c8e8bec62ff08de2321cd7b76a2e912688
parentaef75c32e0e9c0cdef88d40ed68f578449f76c21 (diff)
libcamera: v4l2_videodevice: Map V4L2_PIX_FMT_GREY to DRM FourCC
DRM has a format for 8-bit greyscale data, DRM_FORMAT_R8. Despite the 'R' name, which comes from GL/Vulkan to mean single-channel data, the format maps to greyscale for display. We can thus map it to V4L2_PIX_FMT_GREY. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
-rw-r--r--src/libcamera/v4l2_videodevice.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 83a16922..439a9c90 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -1689,12 +1689,15 @@ PixelFormat V4L2VideoDevice::toPixelFormat(V4L2PixelFormat v4l2Fourcc)
case V4L2_PIX_FMT_NV21M:
return PixelFormat(DRM_FORMAT_NV21);
+ /* Greyscale formats. */
+ case V4L2_PIX_FMT_GREY:
+ return PixelFormat(DRM_FORMAT_R8);
+
/* Compressed formats. */
case V4L2_PIX_FMT_MJPEG:
return PixelFormat(DRM_FORMAT_MJPEG);
/* V4L2 formats not yet supported by DRM. */
- case V4L2_PIX_FMT_GREY:
default:
/*
* \todo We can't use LOG() in a static method of a Loggable
@@ -1780,6 +1783,10 @@ V4L2PixelFormat V4L2VideoDevice::toV4L2PixelFormat(const PixelFormat &pixelForma
case DRM_FORMAT_NV21:
return V4L2PixelFormat(V4L2_PIX_FMT_NV21);
+ /* Greyscale formats. */
+ case DRM_FORMAT_R8:
+ return V4L2PixelFormat(V4L2_PIX_FMT_GREY);
+
/* Compressed formats. */
case DRM_FORMAT_MJPEG:
return V4L2PixelFormat(V4L2_PIX_FMT_MJPEG);