From 4fd6bb33202a83017bc32625561273fd3a888d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Wed, 30 Sep 2020 16:10:07 +0200 Subject: libcamera: Add support for XRGB8888 and XBGR8888 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for XRGB8888 and XBGR8888 formats. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/formats.cpp | 20 ++++++++++++++++++++ src/libcamera/v4l2_pixelformat.cpp | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index ebaae9be..cc6e5790 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -175,6 +175,26 @@ const std::map pixelFormatInfo{ .pixelsPerGroup = 1, .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::XRGB8888, { + .name = "XRGB8888", + .format = formats::XRGB8888, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), + .bitsPerPixel = 32, + .colourEncoding = PixelFormatInfo::ColourEncodingRGB, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::XBGR8888, { + .name = "XBGR8888", + .format = formats::XBGR8888, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), + .bitsPerPixel = 32, + .colourEncoding = PixelFormatInfo::ColourEncodingRGB, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, { formats::ABGR8888, { .name = "ABGR8888", .format = formats::ABGR8888, diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 30c94bb9..6b05909f 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -48,6 +48,8 @@ const std::map vpf2pf{ { V4L2PixelFormat(V4L2_PIX_FMT_RGB565), formats::RGB565 }, { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 }, { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 }, -- cgit v1.2.1