[{"id":17589,"web_url":"https://patchwork.libcamera.org/comment/17589/","msgid":"<20210617043057.GD1351869@pyrite.rasen.tech>","date":"2021-06-17T04:30:57","subject":"Re: [libcamera-devel] [PATCH v1] libcamera: Update v4l2 pixel\n\tformat to libcamera pixel format mapping","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Vedant,\n\nFor the subject, maybe \"libcamera: Fix V4L2 pixel format mapping for\nXRGB32\" ?\n\nOn Thu, Jun 17, 2021 at 02:18:44AM +0530, Vedant Paranjape wrote:\n> According to DRM FourCCs and linux kernel docs V4L2_PIX_FMT_XRGB32\n\nI find it odd that the DRM fourccs would document v4l2 pixel formats...\n\n> is BX24, but it was mapped to formats::XBGR8888, which is XB24.\n> \n> This patch fixes the mismatch of V4L2_PIX_FMT_XRGB32, i.e, matches it to\n> formats::BGRX8888. Furthermore, this patch adds V4L2_PIX_FMT_RBGX32 pixel\n\n\"Additionally, add a mapping from V4L2_PIX_FMT_RGBX32 to formats::XBGR8888\" ?\n\n\nPaul\n\n> format which is represented by XB24, and maps V4L2_PIX_FMT_RGBX32\n> to formats::XBGR8888\n> \n> Linux kernel pixel format docs: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-rgb.html#bits-per-component\n> DRM FourCC pixel format docs: https://elixir.bootlin.com/linux/latest/source/include/uapi/drm/drm_fourcc.h#L150\n> \n> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> ---\n>  src/libcamera/v4l2_pixelformat.cpp | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\n> index 166d93cf..e86788ed 100644\n> --- a/src/libcamera/v4l2_pixelformat.cpp\n> +++ b/src/libcamera/v4l2_pixelformat.cpp\n> @@ -51,7 +51,8 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{\n>  \t{ V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 },\n>  \t{ V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 },\n>  \t{ V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 },\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::BGRX8888 },\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> -- \n> 2.25.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6C7DBC3218\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Jun 2021 04:31:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C18C76893F;\n\tThu, 17 Jun 2021 06:31:07 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C9CA60296\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Jun 2021 06:31:06 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7FDDEE53;\n\tThu, 17 Jun 2021 06:31:04 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nQOHlroK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623904266;\n\tbh=Er0rM17aiPMJxufEAZVzJ8toCsylPUTOlRi+CxOe6ME=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=nQOHlroKaOVB7DpswSUwHW4pXOXJ2yuRrrJ4XGzJk4l+jA6Wd4T6jtx0r21Tsh3i2\n\t3Uw4YLqDa3yXuu0lH4kegUvTIqXPIKIrxXZUXSJUZJnpesXywofvxIePS95+ddpo/p\n\t1BF98zuQb3uv/JnyC65MvOnqFFyubLFODGmXZ66o=","Date":"Thu, 17 Jun 2021 13:30:57 +0900","From":"paul.elder@ideasonboard.com","To":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Message-ID":"<20210617043057.GD1351869@pyrite.rasen.tech>","References":"<20210616204844.429936-1-vedantparanjape160201@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20210616204844.429936-1-vedantparanjape160201@gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v1] libcamera: Update v4l2 pixel\n\tformat to libcamera pixel format mapping","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17590,"web_url":"https://patchwork.libcamera.org/comment/17590/","msgid":"<YMrVXgwcIHSYKuci@pendragon.ideasonboard.com>","date":"2021-06-17T04:53:50","subject":"Re: [libcamera-devel] [PATCH v1] libcamera: Update v4l2 pixel\n\tformat to libcamera pixel format mapping","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, Jun 17, 2021 at 01:30:57PM +0900, paul.elder@ideasonboard.com wrote:\n> Hi Vedant,\n> \n> For the subject, maybe \"libcamera: Fix V4L2 pixel format mapping for\n> XRGB32\" ?\n> \n> On Thu, Jun 17, 2021 at 02:18:44AM +0530, Vedant Paranjape wrote:\n> > According to DRM FourCCs and linux kernel docs V4L2_PIX_FMT_XRGB32\n> \n> I find it odd that the DRM fourccs would document v4l2 pixel formats...\n> \n> > is BX24, but it was mapped to formats::XBGR8888, which is XB24.\n\nThe patch is correct, but the explanation isn't. There are 4CC values\nthat refer to different formats in V4L2 and DRM. We can't rely on 'XR24'\nin DRM referring to the same format as 'XR24' in V4L2.\n\n> > This patch fixes the mismatch of V4L2_PIX_FMT_XRGB32, i.e, matches it to\n> > formats::BGRX8888. Furthermore, this patch adds V4L2_PIX_FMT_RBGX32 pixel\n> \n> \"Additionally, add a mapping from V4L2_PIX_FMT_RGBX32 to formats::XBGR8888\" ?\n> \n> Paul\n> \n> > format which is represented by XB24, and maps V4L2_PIX_FMT_RGBX32\n> > to formats::XBGR8888\n> > \n> > Linux kernel pixel format docs: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-rgb.html#bits-per-component\n> > DRM FourCC pixel format docs: https://elixir.bootlin.com/linux/latest/source/include/uapi/drm/drm_fourcc.h#L150\n> > \n> > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > ---\n> >  src/libcamera/v4l2_pixelformat.cpp | 3 ++-\n\nYou also need to update formats.cpp.\n\n> >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\n> > index 166d93cf..e86788ed 100644\n> > --- a/src/libcamera/v4l2_pixelformat.cpp\n> > +++ b/src/libcamera/v4l2_pixelformat.cpp\n> > @@ -51,7 +51,8 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{\n> >  \t{ V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 },\n> >  \t{ V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 },\n> >  \t{ V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 },\n> > -\t{ V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 },\n> > +\t{ V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },\n> > +\t{ V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::BGRX8888 },\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 },","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B3267C3218\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Jun 2021 04:54:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 17E6568941;\n\tThu, 17 Jun 2021 06:54:13 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AF92960296\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Jun 2021 06:54:11 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1D96CE53;\n\tThu, 17 Jun 2021 06:54:11 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"dW/LOxrm\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623905651;\n\tbh=0dP+NuEzd4VoL8yl31Cjv5376RKzCcdpvJ/fZOmfIKo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=dW/LOxrmxf6TFrg8kFbfY4yOIlLF8qfytp56PQAPVoiqK/GJwXJolVvm0C2brDIv/\n\tvQIcWnjMs002V5TkxlFmmCdehfhhdUN23RlJJRBfEd6ykGbKxHPvyM08XwZIQGpYC5\n\tKYWuteA0k32/cZO9PmihJjWKCOTXlaV9jNoekMoY=","Date":"Thu, 17 Jun 2021 07:53:50 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"paul.elder@ideasonboard.com","Message-ID":"<YMrVXgwcIHSYKuci@pendragon.ideasonboard.com>","References":"<20210616204844.429936-1-vedantparanjape160201@gmail.com>\n\t<20210617043057.GD1351869@pyrite.rasen.tech>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210617043057.GD1351869@pyrite.rasen.tech>","Subject":"Re: [libcamera-devel] [PATCH v1] libcamera: Update v4l2 pixel\n\tformat to libcamera pixel format mapping","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>","Cc":"libcamera-devel@lists.libcamera.org,\n\tVedant Paranjape <vedantparanjape160201@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17591,"web_url":"https://patchwork.libcamera.org/comment/17591/","msgid":"<CACGrz-Oj8634+Ghg5Rmqg6sjBmHgWsHGMwSO7dfoHVHw3oidMw@mail.gmail.com>","date":"2021-06-17T05:00:03","subject":"Re: [libcamera-devel] [PATCH v1] libcamera: Update v4l2 pixel\n\tformat to libcamera pixel format mapping","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/people/85/","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"content":"Hi Laurent,\n\nOn Thu, 17 Jun, 2021, 10:24 Laurent Pinchart, <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> On Thu, Jun 17, 2021 at 01:30:57PM +0900, paul.elder@ideasonboard.com\n> wrote:\n> > Hi Vedant,\n> >\n> > For the subject, maybe \"libcamera: Fix V4L2 pixel format mapping for\n> > XRGB32\" ?\n> >\n> > On Thu, Jun 17, 2021 at 02:18:44AM +0530, Vedant Paranjape wrote:\n> > > According to DRM FourCCs and linux kernel docs V4L2_PIX_FMT_XRGB32\n> >\n> > I find it odd that the DRM fourccs would document v4l2 pixel formats...\n> >\n> > > is BX24, but it was mapped to formats::XBGR8888, which is XB24.\n>\n> The patch is correct, but the explanation isn't. There are 4CC values\n> that refer to different formats in V4L2 and DRM. We can't rely on 'XR24'\n> in DRM referring to the same format as 'XR24' in V4L2.\n>\n\nThen what is the common denominator between DRM and V4L2 pix format we can\nuse to find a mapping between these ?\n\nAlso can you please help me with a right commit message. It seems tricky in\nthis case.\n\n> > This patch fixes the mismatch of V4L2_PIX_FMT_XRGB32, i.e, matches it to\n> > > formats::BGRX8888. Furthermore, this patch adds V4L2_PIX_FMT_RBGX32\n> pixel\n> >\n> > \"Additionally, add a mapping from V4L2_PIX_FMT_RGBX32 to\n> formats::XBGR8888\" ?\n> >\n> > Paul\n> >\n> > > format which is represented by XB24, and maps V4L2_PIX_FMT_RGBX32\n> > > to formats::XBGR8888\n> > >\n> > > Linux kernel pixel format docs:\n> https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-rgb.html#bits-per-component\n> > > DRM FourCC pixel format docs:\n> https://elixir.bootlin.com/linux/latest/source/include/uapi/drm/drm_fourcc.h#L150\n> > >\n> > > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > > ---\n> > >  src/libcamera/v4l2_pixelformat.cpp | 3 ++-\n>\n> You also need to update formats.cpp.\n>\n> > >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > >\n> > > diff --git a/src/libcamera/v4l2_pixelformat.cpp\n> b/src/libcamera/v4l2_pixelformat.cpp\n> > > index 166d93cf..e86788ed 100644\n> > > --- a/src/libcamera/v4l2_pixelformat.cpp\n> > > +++ b/src/libcamera/v4l2_pixelformat.cpp\n> > > @@ -51,7 +51,8 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{\n> > >     { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 },\n> > >     { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 },\n> > >     { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 },\n> > > -   { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 },\n> > > +   { V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },\n> > > +   { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::BGRX8888 },\n> > >     { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },\n> > >     { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 },\n> > >     { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 },\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3A0CEBD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Jun 2021 05:00:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A28B668941;\n\tThu, 17 Jun 2021 07:00:19 +0200 (CEST)","from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com\n\t[IPv6:2607:f8b0:4864:20::b2f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D7E2C60296\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Jun 2021 07:00:17 +0200 (CEST)","by mail-yb1-xb2f.google.com with SMTP id g142so6319825ybf.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Jun 2021 22:00:17 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"JqoJM60/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to;\n\tbh=mFZIYB7aEqkexqi8z0pPnbvQYu/uVQGHUVzQ7JM1w2A=;\n\tb=JqoJM60/iJf1SoyTm80D/vX8Y53vMSftoTw6n+P5Ki94m3RPlvkfCWnBpIrzRMYlkz\n\t35KL0MS6T8N52VXOvjVG6MorPwKLb2i59PBOC3gMMjGK2AwtpzZBq9Hpir+STn4i2T21\n\twbiWfJQgGH9IlYAABZ2PQbJ4xXDoRQhp0AJcTEkFbsKJpQmJvU403ae76MykmiOOnEJm\n\tq/wHfNziL/JDFFh8uRU6p51FKOPbC9yMMaqiwGzMe5iISvjEq00EttzDQ5ifx4A3LgtG\n\tmrkERFuLZbtgYp+H1yRti+Td/JYP31aXWBwmZnsQSeZjOHFms3PZ2AvtRXx7ooFEkE/T\n\tKbGA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to;\n\tbh=mFZIYB7aEqkexqi8z0pPnbvQYu/uVQGHUVzQ7JM1w2A=;\n\tb=NHnvjBFxvJPSy15vutTXj+vdEpr3sRI2RSjnAIOtuiGpqFnhezdY9W5vr2Ow2rgXqj\n\tUvQsdplbMYK8GeAKm9Aa1xw2EBz+TXM1rO1H1XOW1zsUI0qIKF/VSyp5dXjAflg67o9S\n\tQRjm+5olQEQJHB0PTYeYw+qKmls9a42tj0fqJW4LRyese41ugoVVDSWhmeyAfTdPTscU\n\tvO6c0Qj/kNtJi+USkFpswguINIDSTyTduL0++ED+97Ottei/LBacxc1X4klMZULjtner\n\ti+Lxc9AZ+BMjUpkpL5npGvC2jjEF29U5rlB2BTvm8Aq+fVjJVHCDoXy/XeX7iv9yw4KW\n\tjC0g==","X-Gm-Message-State":"AOAM533pL+1jtdRiE6zDB5bVhoK9t+Nt/LxH70H9WcUV043Npt9tSIdK\n\t01TMmchfGTn63HgrMoRuhndyOi1pJxp4sRbgtds=","X-Google-Smtp-Source":"ABdhPJzj6vnU20vO2pGCvMZbdH7WEOZ1Al01UK9TAAyRFc5QkiuDo651EgGorS/P9NHmpH7Gx4y5/hPLf1iii0LlHZk=","X-Received":"by 2002:a25:a0c2:: with SMTP id i2mr3751466ybm.248.1623906015084;\n\tWed, 16 Jun 2021 22:00:15 -0700 (PDT)","MIME-Version":"1.0","References":"<20210616204844.429936-1-vedantparanjape160201@gmail.com>\n\t<20210617043057.GD1351869@pyrite.rasen.tech>\n\t<YMrVXgwcIHSYKuci@pendragon.ideasonboard.com>","In-Reply-To":"<YMrVXgwcIHSYKuci@pendragon.ideasonboard.com>","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Date":"Thu, 17 Jun 2021 10:30:03 +0530","Message-ID":"<CACGrz-Oj8634+Ghg5Rmqg6sjBmHgWsHGMwSO7dfoHVHw3oidMw@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Content-Type":"multipart/alternative; boundary=\"0000000000002d846f05c4ef158e\"","Subject":"Re: [libcamera-devel] [PATCH v1] libcamera: Update v4l2 pixel\n\tformat to libcamera pixel format mapping","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17592,"web_url":"https://patchwork.libcamera.org/comment/17592/","msgid":"<YMrYlN2fenkdgLqQ@pendragon.ideasonboard.com>","date":"2021-06-17T05:07:32","subject":"Re: [libcamera-devel] [PATCH v1] libcamera: Update v4l2 pixel\n\tformat to libcamera pixel format mapping","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Vedant,\n\nOn Thu, Jun 17, 2021 at 10:30:03AM +0530, Vedant Paranjape wrote:\n> On Thu, 17 Jun, 2021, 10:24 Laurent Pinchart wrote:\n> > On Thu, Jun 17, 2021 at 01:30:57PM +0900, paul.elder@ideasonboard.com wrote:\n> > > Hi Vedant,\n> > >\n> > > For the subject, maybe \"libcamera: Fix V4L2 pixel format mapping for\n> > > XRGB32\" ?\n> > >\n> > > On Thu, Jun 17, 2021 at 02:18:44AM +0530, Vedant Paranjape wrote:\n> > > > According to DRM FourCCs and linux kernel docs V4L2_PIX_FMT_XRGB32\n> > >\n> > > I find it odd that the DRM fourccs would document v4l2 pixel formats...\n> > >\n> > > > is BX24, but it was mapped to formats::XBGR8888, which is XB24.\n> >\n> > The patch is correct, but the explanation isn't. There are 4CC values\n> > that refer to different formats in V4L2 and DRM. We can't rely on 'XR24'\n> > in DRM referring to the same format as 'XR24' in V4L2.\n> >\n> \n> Then what is the common denominator between DRM and V4L2 pix format we can\n> use to find a mapping between these ?\n\nOnly the documentation I'm afraid.\nDocumentation/userspace-api/media/v4l/pixfmt-rgb.rst for V4L2 (I highly\nencourage you to compile the kernel documentation and view the HTML\noutput), and include/uapi/drm/drm_fourcc.h for DRM. Note that the former\nshows how the bytes are layed out in memory, while the latter shows the\nformat of a work that is then stored in little endian, which results in\nbytes being swapped.\n\n> Also can you please help me with a right commit message. It seems tricky in\n> this case.\n\nI'll let Paul help :-) It would be useful if you split the patch in two,\nfirst a patch to fix the error, and then a patch to add the new format.\n\n> > > This patch fixes the mismatch of V4L2_PIX_FMT_XRGB32, i.e, matches it to\n> > > > formats::BGRX8888. Furthermore, this patch adds V4L2_PIX_FMT_RBGX32 pixel\n> > >\n> > > \"Additionally, add a mapping from V4L2_PIX_FMT_RGBX32 to formats::XBGR8888\" ?\n> > >\n> > > Paul\n> > >\n> > > > format which is represented by XB24, and maps V4L2_PIX_FMT_RGBX32\n> > > > to formats::XBGR8888\n> > > >\n> > > > Linux kernel pixel format docs:\n> > https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-rgb.html#bits-per-component\n> > > > DRM FourCC pixel format docs:\n> > https://elixir.bootlin.com/linux/latest/source/include/uapi/drm/drm_fourcc.h#L150\n> > > >\n> > > > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > > > ---\n> > > >  src/libcamera/v4l2_pixelformat.cpp | 3 ++-\n> >\n> > You also need to update formats.cpp.\n> >\n> > > >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > > >\n> > > > diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\n> > > > index 166d93cf..e86788ed 100644\n> > > > --- a/src/libcamera/v4l2_pixelformat.cpp\n> > > > +++ b/src/libcamera/v4l2_pixelformat.cpp\n> > > > @@ -51,7 +51,8 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{\n> > > >     { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 },\n> > > >     { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 },\n> > > >     { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 },\n> > > > -   { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 },\n> > > > +   { V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },\n> > > > +   { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::BGRX8888 },\n> > > >     { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 },\n> > > >     { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 },\n> > > >     { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 },","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 65E98C3218\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Jun 2021 05:07:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CC40C68941;\n\tThu, 17 Jun 2021 07:07:54 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A662E60296\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Jun 2021 07:07:53 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 20D73E53;\n\tThu, 17 Jun 2021 07:07:53 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"aTjn9ZGw\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623906473;\n\tbh=ZBaaL0b/qJfltm7GfnKZ+JnDr6IzYY80kzQzwTriLEI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=aTjn9ZGwXW7dkWCXdyNTlhBRLbOH3VuqEuE9ABB0b1CzBtJNsZFQWNwiiIQSF3nlW\n\tmg4HRpJ9N5J4P78OJ7L5ZqMqCRBdQPboZ62DHE5eVJBYgPTAGAKReS5diOUWCidABg\n\tFITLrAHdgpmUuTSw9o2oTF2xb8vcEKmPLdk3/a54=","Date":"Thu, 17 Jun 2021 08:07:32 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Message-ID":"<YMrYlN2fenkdgLqQ@pendragon.ideasonboard.com>","References":"<20210616204844.429936-1-vedantparanjape160201@gmail.com>\n\t<20210617043057.GD1351869@pyrite.rasen.tech>\n\t<YMrVXgwcIHSYKuci@pendragon.ideasonboard.com>\n\t<CACGrz-Oj8634+Ghg5Rmqg6sjBmHgWsHGMwSO7dfoHVHw3oidMw@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CACGrz-Oj8634+Ghg5Rmqg6sjBmHgWsHGMwSO7dfoHVHw3oidMw@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v1] libcamera: Update v4l2 pixel\n\tformat to libcamera pixel format mapping","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]