<div dir="auto"><div>Hi Laurent,<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 17 Jun, 2021, 10:24 Laurent Pinchart, <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Jun 17, 2021 at 01:30:57PM +0900, <a href="mailto:paul.elder@ideasonboard.com" target="_blank" rel="noreferrer">paul.elder@ideasonboard.com</a> wrote:<br>
> Hi Vedant,<br>
> <br>
> For the subject, maybe "libcamera: Fix V4L2 pixel format mapping for<br>
> XRGB32" ?<br>
> <br>
> On Thu, Jun 17, 2021 at 02:18:44AM +0530, Vedant Paranjape wrote:<br>
> > According to DRM FourCCs and linux kernel docs V4L2_PIX_FMT_XRGB32<br>
> <br>
> I find it odd that the DRM fourccs would document v4l2 pixel formats...<br>
> <br>
> > is BX24, but it was mapped to formats::XBGR8888, which is XB24.<br>
<br>
The patch is correct, but the explanation isn't. There are 4CC values<br>
that refer to different formats in V4L2 and DRM. We can't rely on 'XR24'<br>
in DRM referring to the same format as 'XR24' in V4L2.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Then what is the common denominator between DRM and V4L2 pix format we can use to find a mapping between these ?</div><div dir="auto"><br></div><div dir="auto">Also can you please help me with a right commit message. It seems tricky in this case.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> > This patch fixes the mismatch of V4L2_PIX_FMT_XRGB32, i.e, matches it to<br>
> > formats::BGRX8888. Furthermore, this patch adds V4L2_PIX_FMT_RBGX32 pixel<br>
> <br>
> "Additionally, add a mapping from V4L2_PIX_FMT_RGBX32 to formats::XBGR8888" ?<br>
> <br>
> Paul<br>
> <br>
> > format which is represented by XB24, and maps V4L2_PIX_FMT_RGBX32<br>
> > to formats::XBGR8888<br>
> > <br>
> > Linux kernel pixel format docs: <a href="https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-rgb.html#bits-per-component" rel="noreferrer noreferrer" target="_blank">https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-rgb.html#bits-per-component</a><br>
> > DRM FourCC pixel format docs: <a href="https://elixir.bootlin.com/linux/latest/source/include/uapi/drm/drm_fourcc.h#L150" rel="noreferrer noreferrer" target="_blank">https://elixir.bootlin.com/linux/latest/source/include/uapi/drm/drm_fourcc.h#L150</a><br>
> > <br>
> > Signed-off-by: Vedant Paranjape <<a href="mailto:vedantparanjape160201@gmail.com" target="_blank" rel="noreferrer">vedantparanjape160201@gmail.com</a>><br>
> > ---<br>
> >  src/libcamera/v4l2_pixelformat.cpp | 3 ++-<br>
<br>
You also need to update formats.cpp.<br>
<br>
> >  1 file changed, 2 insertions(+), 1 deletion(-)<br>
> > <br>
> > diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp<br>
> > index 166d93cf..e86788ed 100644<br>
> > --- a/src/libcamera/v4l2_pixelformat.cpp<br>
> > +++ b/src/libcamera/v4l2_pixelformat.cpp<br>
> > @@ -51,7 +51,8 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{<br>
> >     { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 },<br>
> >     { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 },<br>
> >     { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 },<br>
> > -   { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 },<br>
> > +   { V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },<br>
> > +   { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::BGRX8888 },<br>
> >     { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },<br>
> >     { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 },<br>
> >     { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 },<br>
<br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
</blockquote></div></div></div>