.../userspace-api/media/v4l/subdev-formats.rst | 51 +++++++++++++++++++--- drivers/media/i2c/gc2145.c | 4 +- drivers/media/i2c/tc358743.c | 10 ++--- include/uapi/linux/media-bus-format.h | 3 +- 4 files changed, 54 insertions(+), 14 deletions(-)
Hi, Here's an(other [1]) attempt at fixing the current mess due to the opposite meaning of what v4l2 and the MIPI-CSI2 spec call "RGB". By v4l2 nomenclature, the format CSI calls RGB is actually BGR. Unfortunately, a handful of CSI transceivers report through RGB media bus pixel code, which is then understood as V4L2_PIX_FMT_RGB24 by CSI receivers. This is made somewhat worse the fact that media bus codes have been made mostly with parallel busses in mind, and thus the order of pixels wasn't clearly defined anywhere. So the v4l2 vs CSI mismatch was confusing (but there's nothing we can do about it), but the doc didn't really make an attempt at clearing it up either. We did have a convention so far though, that about half the affected drivers were following. This series improves the doc, adds the missing media bus codes, and converts the transceiver drivers to the rightful media bus format. We'll also need that series [2] from Laurent to fix all the affected transceivers. Let me know what you think, Maxime 1: https://lore.kernel.org/r/20250606-rpi-unicam-rgb-bgr-fix-v1-1-9930b963f3eb@kernel.org 2: https://lore.kernel.org/r/20250611181528.19542-1-laurent.pinchart@ideasonboard.com --- Maxime Ripard (4): media: uapi: Clarify MBUS color component order for serial buses media: uapi: Introduce MEDIA_BUS_FMT_BGR565_1X16 media: tc358743: Fix the RGB MBUS format media: gc2145: Fix the RGB MBUS format .../userspace-api/media/v4l/subdev-formats.rst | 51 +++++++++++++++++++--- drivers/media/i2c/gc2145.c | 4 +- drivers/media/i2c/tc358743.c | 10 ++--- include/uapi/linux/media-bus-format.h | 3 +- 4 files changed, 54 insertions(+), 14 deletions(-) --- base-commit: 6e417fb287553495e43135125d099daf80b63fe1 change-id: 20250612-csi-bgr-rgb-b837980c00b3 Best regards, -- Maxime Ripard <mripard@kernel.org>
On 12/06/2025 14:53, Maxime Ripard wrote: > Hi, > > Here's an(other [1]) attempt at fixing the current mess due to the > opposite meaning of what v4l2 and the MIPI-CSI2 spec call "RGB". By v4l2 > nomenclature, the format CSI calls RGB is actually BGR. > > Unfortunately, a handful of CSI transceivers report through RGB media > bus pixel code, which is then understood as V4L2_PIX_FMT_RGB24 by CSI > receivers. > > This is made somewhat worse the fact that media bus codes have been made > mostly with parallel busses in mind, and thus the order of pixels wasn't > clearly defined anywhere. > > So the v4l2 vs CSI mismatch was confusing (but there's nothing we can do > about it), but the doc didn't really make an attempt at clearing it up > either. > > We did have a convention so far though, that about half the affected > drivers were following. > > This series improves the doc, adds the missing media bus codes, and > converts the transceiver drivers to the rightful media bus format. > > We'll also need that series [2] from Laurent to fix all the affected > transceivers. > > Let me know what you think, > Maxime > > 1: https://lore.kernel.org/r/20250606-rpi-unicam-rgb-bgr-fix-v1-1-9930b963f3eb@kernel.org > 2: https://lore.kernel.org/r/20250611181528.19542-1-laurent.pinchart@ideasonboard.com This link seems to be wrong. Can you give the correct URL? Regards, Hans > > --- > Maxime Ripard (4): > media: uapi: Clarify MBUS color component order for serial buses > media: uapi: Introduce MEDIA_BUS_FMT_BGR565_1X16 > media: tc358743: Fix the RGB MBUS format > media: gc2145: Fix the RGB MBUS format > > .../userspace-api/media/v4l/subdev-formats.rst | 51 +++++++++++++++++++--- > drivers/media/i2c/gc2145.c | 4 +- > drivers/media/i2c/tc358743.c | 10 ++--- > include/uapi/linux/media-bus-format.h | 3 +- > 4 files changed, 54 insertions(+), 14 deletions(-) > --- > base-commit: 6e417fb287553495e43135125d099daf80b63fe1 > change-id: 20250612-csi-bgr-rgb-b837980c00b3 > > Best regards,
Hi Hans, On Mon, Jun 16, 2025 at 10:02:57AM +0200, Hans Verkuil wrote: > On 12/06/2025 14:53, Maxime Ripard wrote: > > Here's an(other [1]) attempt at fixing the current mess due to the > > opposite meaning of what v4l2 and the MIPI-CSI2 spec call "RGB". By v4l2 > > nomenclature, the format CSI calls RGB is actually BGR. > > > > Unfortunately, a handful of CSI transceivers report through RGB media > > bus pixel code, which is then understood as V4L2_PIX_FMT_RGB24 by CSI > > receivers. > > > > This is made somewhat worse the fact that media bus codes have been made > > mostly with parallel busses in mind, and thus the order of pixels wasn't > > clearly defined anywhere. > > > > So the v4l2 vs CSI mismatch was confusing (but there's nothing we can do > > about it), but the doc didn't really make an attempt at clearing it up > > either. > > > > We did have a convention so far though, that about half the affected > > drivers were following. > > > > This series improves the doc, adds the missing media bus codes, and > > converts the transceiver drivers to the rightful media bus format. > > > > We'll also need that series [2] from Laurent to fix all the affected > > transceivers. > > > > Let me know what you think, > > Maxime > > > > 1: https://lore.kernel.org/r/20250606-rpi-unicam-rgb-bgr-fix-v1-1-9930b963f3eb@kernel.org > > 2: https://lore.kernel.org/r/20250611181528.19542-1-laurent.pinchart@ideasonboard.com > > This link seems to be wrong. Can you give the correct URL? Yeah, sorry about that. Laurent sent a series to a bunch of us after discussing it in private, but I assumed it was public. Hopefully he'll post it soon :) Maxime
© 2016 - 2025 Red Hat, Inc.