From 60deeb25558a794e6e664bb832318b87958c18ea Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Sun, 5 May 2024 10:35:57 +0200 Subject: [PATCH] spa: libcamera: fix RGB mappings Libcamera formats are generally little-endian, matching DMA DRM fourccs, while PW ones are big-endian. Thus we have to invert the order. Only RGB and BGR where tested, as these are the formats currently supported by the software ISP. This fixes inverted red and blue in Snapshot on the Librem5 and Pinephone (OG). See also gstlibcamera-utils.cpp in libcamera. --- spa/plugins/libcamera/libcamera-utils.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/spa/plugins/libcamera/libcamera-utils.cpp b/spa/plugins/libcamera/libcamera-utils.cpp index 4604f0000..970bbd4f9 100644 --- a/spa/plugins/libcamera/libcamera-utils.cpp +++ b/spa/plugins/libcamera/libcamera-utils.cpp @@ -165,16 +165,16 @@ static const struct format_info format_info[] = { /* RGB formats */ MAKE_FMT(formats::RGB565, RGB16, video, raw), MAKE_FMT(formats::RGB565_BE, RGB16, video, raw), - MAKE_FMT(formats::RGB888, RGB, video, raw), - MAKE_FMT(formats::BGR888, BGR, video, raw), - MAKE_FMT(formats::XRGB8888, xRGB, video, raw), - MAKE_FMT(formats::XBGR8888, xBGR, video, raw), - MAKE_FMT(formats::RGBX8888, RGBx, video, raw), - MAKE_FMT(formats::BGRX8888, BGRx, video, raw), - MAKE_FMT(formats::ARGB8888, ARGB, video, raw), - MAKE_FMT(formats::ABGR8888, ABGR, video, raw), - MAKE_FMT(formats::RGBA8888, RGBA, video, raw), - MAKE_FMT(formats::BGRA8888, BGRA, video, raw), + MAKE_FMT(formats::RGB888, BGR, video, raw), + MAKE_FMT(formats::BGR888, RGB, video, raw), + MAKE_FMT(formats::XRGB8888, BGRx, video, raw), + MAKE_FMT(formats::XBGR8888, RGBx, video, raw), + MAKE_FMT(formats::RGBX8888, xBGR, video, raw), + MAKE_FMT(formats::BGRX8888, xRGB, video, raw), + MAKE_FMT(formats::ARGB8888, BGRA, video, raw), + MAKE_FMT(formats::ABGR8888, RGBA, video, raw), + MAKE_FMT(formats::RGBA8888, ABGR, video, raw), + MAKE_FMT(formats::BGRA8888, ARGB, video, raw), MAKE_FMT(formats::YUYV, YUY2, video, raw), MAKE_FMT(formats::YVYU, YVYU, video, raw),