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>
This commit is contained in:
Laurent Pinchart 2020-03-14 00:54:28 +02:00
parent aef75c32e0
commit bac0e7d675

View file

@ -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);