[{"id":5169,"web_url":"https://patchwork.libcamera.org/comment/5169/","msgid":"<20200610144520.GI192296@oden.dyn.berto.se>","date":"2020-06-10T14:45:20","subject":"Re: [libcamera-devel] [PATCH v2 7/7] libcamera: Replace explicit\n\tDRM FourCCs with libcamera formats","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your patch.\n\nOn 2020-06-10 02:23:23 +0300, Laurent Pinchart wrote:\n> Use the new pixel format constants to replace usage of macros from\n> drm_fourcc.h.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/pixel_format.h   |   2 -\n>  src/android/camera_device.cpp      |   9 +-\n>  src/libcamera/formats.cpp          | 146 +++++++++++++++--------------\n>  src/libcamera/v4l2_pixelformat.cpp |  83 ++++++++--------\n>  4 files changed, 116 insertions(+), 124 deletions(-)\n> \n> diff --git a/include/libcamera/pixel_format.h b/include/libcamera/pixel_format.h\n> index 8dfeb8922418..6727315a11b1 100644\n> --- a/include/libcamera/pixel_format.h\n> +++ b/include/libcamera/pixel_format.h\n> @@ -11,8 +11,6 @@\n>  #include <stdint.h>\n>  #include <string>\n>  \n> -#include <linux/drm_fourcc.h>\n> -\n>  namespace libcamera {\n>  \n>  class PixelFormat\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 7a0dc530e35b..0fc2fa37c3b8 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -12,6 +12,7 @@\n>  #include <vector>\n>  \n>  #include <libcamera/controls.h>\n> +#include <libcamera/formats.h>\n>  #include <libcamera/property_ids.h>\n>  \n>  #include \"libcamera/internal/log.h\"\n> @@ -58,13 +59,13 @@ struct Camera3Format {\n>  const std::map<int, const Camera3Format> camera3FormatsMap = {\n>  \t{\n>  \t\tHAL_PIXEL_FORMAT_BLOB, {\n> -\t\t\t{ PixelFormat(DRM_FORMAT_MJPEG) },\n> +\t\t\t{ formats::MJPEG },\n>  \t\t\tANDROID_SCALER_AVAILABLE_FORMATS_BLOB,\n>  \t\t\t\"BLOB\"\n>  \t\t}\n>  \t}, {\n>  \t\tHAL_PIXEL_FORMAT_YCbCr_420_888, {\n> -\t\t\t{ PixelFormat(DRM_FORMAT_NV12), PixelFormat(DRM_FORMAT_NV21) },\n> +\t\t\t{ formats::NV12, formats::NV21 },\n>  \t\t\tANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888,\n>  \t\t\t\"YCbCr_420_888\"\n>  \t\t}\n> @@ -74,7 +75,7 @@ const std::map<int, const Camera3Format> camera3FormatsMap = {\n>  \t\t * usage flag. For now, copy the YCbCr_420 configuration.\n>  \t\t */\n>  \t\tHAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, {\n> -\t\t\t{ PixelFormat(DRM_FORMAT_NV12), PixelFormat(DRM_FORMAT_NV21) },\n> +\t\t\t{ formats::NV12, formats::NV21 },\n>  \t\t\tANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED,\n>  \t\t\t\"IMPLEMENTATION_DEFINED\"\n>  \t\t}\n> @@ -264,7 +265,7 @@ int CameraDevice::initializeStreamConfigurations()\n>  \t\tfor (const PixelFormat &pixelFormat : libcameraFormats) {\n>  \t\t\t/* \\todo Fixed mapping for JPEG. */\n>  \t\t\tif (androidFormat == HAL_PIXEL_FORMAT_BLOB) {\n> -\t\t\t\tmappedFormat = PixelFormat(DRM_FORMAT_MJPEG);\n> +\t\t\t\tmappedFormat = formats::MJPEG;\n>  \t\t\t\tbreak;\n>  \t\t\t}\n>  \n> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> index 74c239a5e710..97e986786cc8 100644\n> --- a/src/libcamera/formats.cpp\n> +++ b/src/libcamera/formats.cpp\n> @@ -9,6 +9,8 @@\n>  \n>  #include <errno.h>\n>  \n> +#include <libcamera/formats.h>\n> +\n>  #include \"libcamera/internal/log.h\"\n>  \n>  /**\n> @@ -166,43 +168,43 @@ namespace {\n>  \n>  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t/* RGB formats. */\n> -\t{ PixelFormat(DRM_FORMAT_BGR888), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_BGR888),\n> +\t{ formats::BGR888, {\n> +\t\t.format = formats::BGR888,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGB24),\n>  \t\t.bitsPerPixel = 24,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_RGB888), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_RGB888),\n> +\t{ formats::RGB888, {\n> +\t\t.format = formats::RGB888,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_BGR24),\n>  \t\t.bitsPerPixel = 24,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_ABGR8888), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_ABGR8888),\n> +\t{ formats::ABGR8888, {\n> +\t\t.format = formats::ABGR8888,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGBA32),\n>  \t\t.bitsPerPixel = 32,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_ARGB8888), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_ARGB8888),\n> +\t{ formats::ARGB8888, {\n> +\t\t.format = formats::ARGB8888,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_ABGR32),\n>  \t\t.bitsPerPixel = 32,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_BGRA8888), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_BGRA8888),\n> +\t{ formats::BGRA8888, {\n> +\t\t.format = formats::BGRA8888,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_ARGB32),\n>  \t\t.bitsPerPixel = 32,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_RGBA8888), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_RGBA8888),\n> +\t{ formats::RGBA8888, {\n> +\t\t.format = formats::RGBA8888,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_BGRA32),\n>  \t\t.bitsPerPixel = 32,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n> @@ -210,29 +212,29 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t} },\n>  \n>  \t/* YUV packed formats. */\n> -\t{ PixelFormat(DRM_FORMAT_YUYV), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_YUYV),\n> +\t{ formats::YUYV, {\n> +\t\t.format = formats::YUYV,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUYV),\n>  \t\t.bitsPerPixel = 16,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_YVYU), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_YVYU),\n> +\t{ formats::YVYU, {\n> +\t\t.format = formats::YVYU,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YVYU),\n>  \t\t.bitsPerPixel = 16,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_UYVY), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_UYVY),\n> +\t{ formats::UYVY, {\n> +\t\t.format = formats::UYVY,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_UYVY),\n>  \t\t.bitsPerPixel = 16,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_VYUY), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_VYUY),\n> +\t{ formats::VYUY, {\n> +\t\t.format = formats::VYUY,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_VYUY),\n>  \t\t.bitsPerPixel = 16,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> @@ -240,29 +242,29 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t} },\n>  \n>  \t/* YUV planar formats. */\n> -\t{ PixelFormat(DRM_FORMAT_NV16), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_NV16),\n> +\t{ formats::NV16, {\n> +\t\t.format = formats::NV16,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV16),\n>  \t\t.bitsPerPixel = 16,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_NV61), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_NV61),\n> +\t{ formats::NV61, {\n> +\t\t.format = formats::NV61,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV61),\n>  \t\t.bitsPerPixel = 16,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_NV12), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_NV12),\n> +\t{ formats::NV12, {\n> +\t\t.format = formats::NV12,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV12),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_NV21), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_NV21),\n> +\t{ formats::NV21, {\n> +\t\t.format = formats::NV21,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV21),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> @@ -270,8 +272,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t} },\n>  \n>  \t/* Greyscale formats. */\n> -\t{ PixelFormat(DRM_FORMAT_R8), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_R8),\n> +\t{ formats::R8, {\n> +\t\t.format = formats::R8,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_GREY),\n>  \t\t.bitsPerPixel = 8,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> @@ -279,141 +281,141 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t} },\n>  \n>  \t/* Bayer formats. */\n> -\t{ PixelFormat(DRM_FORMAT_SBGGR8), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SBGGR8),\n> +\t{ formats::SBGGR8, {\n> +\t\t.format = formats::SBGGR8,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8),\n>  \t\t.bitsPerPixel = 8,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGBRG8), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGBRG8),\n> +\t{ formats::SGBRG8, {\n> +\t\t.format = formats::SGBRG8,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8),\n>  \t\t.bitsPerPixel = 8,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGRBG8), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGRBG8),\n> +\t{ formats::SGRBG8, {\n> +\t\t.format = formats::SGRBG8,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8),\n>  \t\t.bitsPerPixel = 8,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SRGGB8), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SRGGB8),\n> +\t{ formats::SRGGB8, {\n> +\t\t.format = formats::SRGGB8,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8),\n>  \t\t.bitsPerPixel = 8,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SBGGR10), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SBGGR10),\n> +\t{ formats::SBGGR10, {\n> +\t\t.format = formats::SBGGR10,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10),\n>  \t\t.bitsPerPixel = 10,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGBRG10), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGBRG10),\n> +\t{ formats::SGBRG10, {\n> +\t\t.format = formats::SGBRG10,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10),\n>  \t\t.bitsPerPixel = 10,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGRBG10), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGRBG10),\n> +\t{ formats::SGRBG10, {\n> +\t\t.format = formats::SGRBG10,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10),\n>  \t\t.bitsPerPixel = 10,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SRGGB10), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SRGGB10),\n> +\t{ formats::SRGGB10, {\n> +\t\t.format = formats::SRGGB10,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10),\n>  \t\t.bitsPerPixel = 10,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED),\n> +\t{ formats::SBGGR10_CSI2P, {\n> +\t\t.format = formats::SBGGR10_CSI2P,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P),\n>  \t\t.bitsPerPixel = 10,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = true,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED),\n> +\t{ formats::SGBRG10_CSI2P, {\n> +\t\t.format = formats::SGBRG10_CSI2P,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P),\n>  \t\t.bitsPerPixel = 10,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = true,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED),\n> +\t{ formats::SGRBG10_CSI2P, {\n> +\t\t.format = formats::SGRBG10_CSI2P,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P),\n>  \t\t.bitsPerPixel = 10,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = true,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED),\n> +\t{ formats::SRGGB10_CSI2P, {\n> +\t\t.format = formats::SRGGB10_CSI2P,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P),\n>  \t\t.bitsPerPixel = 10,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = true,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SBGGR12), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SBGGR12),\n> +\t{ formats::SBGGR12, {\n> +\t\t.format = formats::SBGGR12,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGBRG12), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGBRG12),\n> +\t{ formats::SGBRG12, {\n> +\t\t.format = formats::SGBRG12,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGRBG12), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGRBG12),\n> +\t{ formats::SGRBG12, {\n> +\t\t.format = formats::SGRBG12,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SRGGB12), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SRGGB12),\n> +\t{ formats::SRGGB12, {\n> +\t\t.format = formats::SRGGB12,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = false,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED),\n> +\t{ formats::SBGGR12_CSI2P, {\n> +\t\t.format = formats::SBGGR12_CSI2P,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = true,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED),\n> +\t{ formats::SGBRG12_CSI2P, {\n> +\t\t.format = formats::SGBRG12_CSI2P,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = true,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED),\n> +\t{ formats::SGRBG12_CSI2P, {\n> +\t\t.format = formats::SGRBG12_CSI2P,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n>  \t\t.packed = true,\n>  \t} },\n> -\t{ PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED),\n> +\t{ formats::SRGGB12_CSI2P, {\n> +\t\t.format = formats::SRGGB12_CSI2P,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P),\n>  \t\t.bitsPerPixel = 12,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> @@ -421,8 +423,8 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t} },\n>  \n>  \t/* Compressed formats. */\n> -\t{ PixelFormat(DRM_FORMAT_MJPEG), {\n> -\t\t.format = PixelFormat(DRM_FORMAT_MJPEG),\n> +\t{ formats::MJPEG, {\n> +\t\t.format = formats::MJPEG,\n>  \t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_MJPEG),\n>  \t\t.bitsPerPixel = 0,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\n> index 94fae470f926..741f6c2646bc 100644\n> --- a/src/libcamera/v4l2_pixelformat.cpp\n> +++ b/src/libcamera/v4l2_pixelformat.cpp\n> @@ -12,8 +12,7 @@\n>  #include <map>\n>  #include <string.h>\n>  \n> -#include <linux/drm_fourcc.h>\n> -\n> +#include <libcamera/formats.h>\n>  #include <libcamera/pixel_format.h>\n>  \n>  #include \"libcamera/internal/formats.h\"\n> @@ -46,60 +45,52 @@ namespace {\n>  \n>  const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{\n>  \t/* RGB formats. */\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_RGB24), PixelFormat(DRM_FORMAT_BGR888) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_BGR24), PixelFormat(DRM_FORMAT_RGB888) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), PixelFormat(DRM_FORMAT_ABGR8888) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), PixelFormat(DRM_FORMAT_ARGB8888) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), PixelFormat(DRM_FORMAT_BGRA8888) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_BGRA32), PixelFormat(DRM_FORMAT_RGBA8888) },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_BGRA32), formats::RGBA8888 },\n>  \n>  \t/* YUV packed formats. */\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_YUYV), PixelFormat(DRM_FORMAT_YUYV) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_YVYU), PixelFormat(DRM_FORMAT_YVYU) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_UYVY), PixelFormat(DRM_FORMAT_UYVY) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_VYUY), PixelFormat(DRM_FORMAT_VYUY) },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_YUYV), formats::YUYV },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_YVYU), formats::YVYU },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_UYVY), formats::UYVY },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_VYUY), formats::VYUY },\n>  \n>  \t/* YUV planar formats. */\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_NV16), PixelFormat(DRM_FORMAT_NV16) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_NV61), PixelFormat(DRM_FORMAT_NV61) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_NV12), PixelFormat(DRM_FORMAT_NV12) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_NV21), PixelFormat(DRM_FORMAT_NV21) },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_NV16), formats::NV16 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_NV61), formats::NV61 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_NV12), formats::NV12 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_NV21), formats::NV21 },\n>  \n>  \t/* Greyscale formats. */\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_GREY), PixelFormat(DRM_FORMAT_R8) },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_GREY), formats::R8 },\n>  \n>  \t/* Bayer formats. */\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), PixelFormat(DRM_FORMAT_SBGGR8) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), PixelFormat(DRM_FORMAT_SGBRG8) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), PixelFormat(DRM_FORMAT_SGRBG8) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), PixelFormat(DRM_FORMAT_SRGGB8) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), PixelFormat(DRM_FORMAT_SBGGR10) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), PixelFormat(DRM_FORMAT_SGBRG10) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), PixelFormat(DRM_FORMAT_SGRBG10) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), PixelFormat(DRM_FORMAT_SRGGB10) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P),\n> -\t  PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P),\n> -\t  PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P),\n> -\t  PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P),\n> -\t  PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), PixelFormat(DRM_FORMAT_SBGGR12) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), PixelFormat(DRM_FORMAT_SGBRG12) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), PixelFormat(DRM_FORMAT_SGRBG12) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), PixelFormat(DRM_FORMAT_SRGGB12) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P),\n> -\t  PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P),\n> -\t  PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P),\n> -\t  PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED) },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P),\n> -\t  PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED) },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), formats::SBGGR8 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), formats::SGBRG8 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), formats::SGRBG8 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), formats::SRGGB8 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), formats::SBGGR10 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), formats::SGBRG10 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), formats::SGRBG10 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), formats::SRGGB10 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), formats::SBGGR10_CSI2P },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), formats::SGBRG10_CSI2P },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), formats::SGRBG10_CSI2P },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), formats::SRGGB10_CSI2P },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), formats::SBGGR12 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), formats::SGBRG12 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), formats::SGRBG12 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), formats::SRGGB12 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), formats::SBGGR12_CSI2P },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), formats::SGBRG12_CSI2P },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), formats::SGRBG12_CSI2P },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), formats::SRGGB12_CSI2P },\n>  \n>  \t/* Compressed formats. */\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), PixelFormat(DRM_FORMAT_MJPEG) },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), formats::MJPEG },\n>  };\n>  \n>  } /* namespace */\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F2112600F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jun 2020 16:45:21 +0200 (CEST)","by mail-lj1-x244.google.com with SMTP id z9so2784383ljh.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jun 2020 07:45:21 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tk27sm5864011lfe.88.2020.06.10.07.45.20\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 10 Jun 2020 07:45:20 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com header.b=\"xV/TYngo\"; \n\tdkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=8BFx+rOrjzverQ6Kl9tEOUi8M+pLVhskeuZ8KZnTh+E=;\n\tb=xV/TYngo8RNsQHU9ynP06fLYIvGJ1hreZDtnpJuJfEynSd/jOTtxopLCklnhnTXnlN\n\tJ5XotsOenTMyfqn+QVZ75xZNM5Q+Q/k/lU7i9VIfS64bsLD/lJZPlSrLXYGKtejLT2RQ\n\tV60QSFu95aA+YQNgcggxUsfQefLikkxXNQQJEwkYdP15I2WtanCtW1OAhh0fGvYAkFZm\n\t2jt12c0S6KMciQRk/tIJwj1BpoLnmFPLUdQY/xGQj2i+YXhTGw30EpZIcUOskc1uNffe\n\tEKTyPz7XZTuST6VYBQE9F+DSz4sYxo3qsUFonhK8SS7Gp6jgm2o9gjxGLZE77K79nOYT\n\tJdrQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=8BFx+rOrjzverQ6Kl9tEOUi8M+pLVhskeuZ8KZnTh+E=;\n\tb=LnE5IJRDbTFSYKAu3jLrtnRiRj12GCpZh71EXA8dfba0AUujS9gqqWKiZvnul6Vn9x\n\txFBXEJxa6i0XPVV92RX+VMM+0iJi4Xvz2lUa6HBUmcZMa2Lu1qEHcWv/LDfQVSrc1onV\n\tt29Gwx6hYXeViOZLxi+xFIjj33pn84NsVMfQW9c40mpBetO8CLQgHsR8iwcxKIas5l/K\n\toTPIiCLVSAqd/hDtdWvYUuqh24Q3rRqUvVga38mCIrrwQrdxPBLmwsIIRqu4tGt0/8Bs\n\tOA8+e7EzjpW20Q+pxdEH232AHDkRVRwxfgxHeCstJ2EWrzx3IiBdkrVbPUXFJjMy2BH+\n\tbtIw==","X-Gm-Message-State":"AOAM530HWkCKhl5U+gOJ6Pxnn3cTp1fG4JOi7rJcOdg2fwK6bjJwnjG9\n\tHZEtaSG51lW7inMqtbqSCCOqkCmXEdI=","X-Google-Smtp-Source":"ABdhPJwJtCXEXhS3STH7yzNcACH/+yRgb0aH5JOx/dL0ET0nM6Jg9h6Vd0GZRCqmetPil0qqoi1lTQ==","X-Received":"by 2002:a05:651c:93:: with SMTP id\n\t19mr2063798ljq.245.1591800321049; \n\tWed, 10 Jun 2020 07:45:21 -0700 (PDT)","Date":"Wed, 10 Jun 2020 16:45:20 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200610144520.GI192296@oden.dyn.berto.se>","References":"<20200609232323.29628-1-laurent.pinchart@ideasonboard.com>\n\t<20200609232323.29628-8-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200609232323.29628-8-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 7/7] libcamera: Replace explicit\n\tDRM FourCCs with libcamera formats","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 10 Jun 2020 14:45:22 -0000"}}]