[{"id":17676,"web_url":"https://patchwork.libcamera.org/comment/17676/","msgid":"<20210622042632.GE1899306@pyrite.rasen.tech>","date":"2021-06-22T04:26:32","subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: Fix V4L2 pixel format\n\tmapping for XRGB32","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Vedant,\n\nOn Sat, Jun 19, 2021 at 01:32:46AM +0530, Vedant Paranjape wrote:\n> Fixed the mismatch of V4L2 and Libcamera pixelformats.\n> \n> Matched V4L2_PIX_FMT_XRGB32 with formats::BGRX8888. Additionally, fixes\n> mapping of V4L2_PIX_FMT_RGBX32 to formats::XBGR8888 in formats.cpp\n\nThe points that you did in this series are:\n- add the BGRX8888 format\n- fix the mapping of XRGB32 to BGRX8888\n- fix the mapping of RGBX32 to XBGR8888\n\nThe last two you mention, but I think you should mention the first as\nwell.\n\n> \n> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> ---\n>  src/libcamera/formats.cpp          | 12 +++++++++++-\n>  src/libcamera/v4l2_pixelformat.cpp |  2 +-\n>  2 files changed, 12 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> index 55822f4c..e41bfc05 100644\n> --- a/src/libcamera/formats.cpp\n> +++ b/src/libcamera/formats.cpp\n> @@ -198,13 +198,23 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t{ formats::XBGR8888, {\n>  \t\t.name = \"XBGR8888\",\n>  \t\t.format = formats::XBGR8888,\n> -\t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),\n> +\t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGBX32),\n>  \t\t.bitsPerPixel = 32,\n>  \t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n>  \t\t.packed = false,\n>  \t\t.pixelsPerGroup = 1,\n>  \t\t.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},\n>  \t} },\n> +\t{ formats::BGRX8888, {\n> +\t\t.name = \"BGRX8888\",\n> +\t\t.format = formats::BGRX8888,\n> +\t\t.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),\n\nHm, maybe this is too intertwined. Here you add BGRX8888 = XRGB32, which\nmeans that you have to fix the mapping above to RGBX32, but the\ncorresponding mapping in the v4l2 pixel format map is only added later\nin 2/2.\n\nI think it's okay to squash 2/2 into this.\n\n\nPaul\n\n> +\t\t.bitsPerPixel = 32,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\t\n>  \t{ formats::ABGR8888, {\n>  \t\t.name = \"ABGR8888\",\n>  \t\t.format = formats::ABGR8888,\n> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\n> index 166d93cf..950cbda4 100644\n> --- a/src/libcamera/v4l2_pixelformat.cpp\n> +++ b/src/libcamera/v4l2_pixelformat.cpp\n> @@ -51,7 +51,7 @@ 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_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 11086C321A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Jun 2021 04:26:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7464868931;\n\tTue, 22 Jun 2021 06:26:41 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DA61E68931\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jun 2021 06:26:39 +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 5BA02A15;\n\tTue, 22 Jun 2021 06:26:38 +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=\"sW0dfvt+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624335999;\n\tbh=ysTG7/Va2GJcg43GaR5bPlie1eBk0Ws0dDbQX0HpzMQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=sW0dfvt+TFL4bwd7a9PY66ol0jJEua76Dn/KcaieTaT3KBnyjAp8xw8fVij5Mot8d\n\tBAmnrxedkeDx/9gPNBhikaAXouWY23FAGw6QWNlDqpMTVYLiv11zFMEBcPuIDX0Z07\n\t2mdaVNx/UkzytW6EWUxzfUZTPyBNUWhz57rgn9Dw=","Date":"Tue, 22 Jun 2021 13:26:32 +0900","From":"paul.elder@ideasonboard.com","To":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Message-ID":"<20210622042632.GE1899306@pyrite.rasen.tech>","References":"<20210618200247.624987-1-vedantparanjape160201@gmail.com>\n\t<20210618200247.624987-2-vedantparanjape160201@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20210618200247.624987-2-vedantparanjape160201@gmail.com>","Subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: Fix V4L2 pixel format\n\tmapping for XRGB32","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":17677,"web_url":"https://patchwork.libcamera.org/comment/17677/","msgid":"<CACGrz-OJr00ajwQy0ekZ_TA-XnF-odZSA-+UGY3uRyocJkYX7g@mail.gmail.com>","date":"2021-06-22T07:07:54","subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: Fix V4L2 pixel format\n\tmapping for XRGB32","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/people/85/","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"content":"Hi Paul,\n\nOk, will do that.\n\nRegards,\nVedant Paranjape\n\nOn Tue, Jun 22, 2021 at 9:56 AM <paul.elder@ideasonboard.com> wrote:\n\n> Hi Vedant,\n>\n> On Sat, Jun 19, 2021 at 01:32:46AM +0530, Vedant Paranjape wrote:\n> > Fixed the mismatch of V4L2 and Libcamera pixelformats.\n> >\n> > Matched V4L2_PIX_FMT_XRGB32 with formats::BGRX8888. Additionally, fixes\n> > mapping of V4L2_PIX_FMT_RGBX32 to formats::XBGR8888 in formats.cpp\n>\n> The points that you did in this series are:\n> - add the BGRX8888 format\n> - fix the mapping of XRGB32 to BGRX8888\n> - fix the mapping of RGBX32 to XBGR8888\n>\n> The last two you mention, but I think you should mention the first as\n> well.\n>\n> >\n> > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > ---\n> >  src/libcamera/formats.cpp          | 12 +++++++++++-\n> >  src/libcamera/v4l2_pixelformat.cpp |  2 +-\n> >  2 files changed, 12 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> > index 55822f4c..e41bfc05 100644\n> > --- a/src/libcamera/formats.cpp\n> > +++ b/src/libcamera/formats.cpp\n> > @@ -198,13 +198,23 @@ const std::map<PixelFormat, PixelFormatInfo>\n> pixelFormatInfo{\n> >       { formats::XBGR8888, {\n> >               .name = \"XBGR8888\",\n> >               .format = formats::XBGR8888,\n> > -             .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),\n> > +             .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGBX32),\n> >               .bitsPerPixel = 32,\n> >               .colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n> >               .packed = false,\n> >               .pixelsPerGroup = 1,\n> >               .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},\n> >       } },\n> > +     { formats::BGRX8888, {\n> > +             .name = \"BGRX8888\",\n> > +             .format = formats::BGRX8888,\n> > +             .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32),\n>\n> Hm, maybe this is too intertwined. Here you add BGRX8888 = XRGB32, which\n> means that you have to fix the mapping above to RGBX32, but the\n> corresponding mapping in the v4l2 pixel format map is only added later\n> in 2/2.\n>\n> I think it's okay to squash 2/2 into this.\n>\n>\n> Paul\n>\n> > +             .bitsPerPixel = 32,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingRGB,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> >       { formats::ABGR8888, {\n> >               .name = \"ABGR8888\",\n> >               .format = formats::ABGR8888,\n> > diff --git a/src/libcamera/v4l2_pixelformat.cpp\n> b/src/libcamera/v4l2_pixelformat.cpp\n> > index 166d93cf..950cbda4 100644\n> > --- a/src/libcamera/v4l2_pixelformat.cpp\n> > +++ b/src/libcamera/v4l2_pixelformat.cpp\n> > @@ -51,7 +51,7 @@ 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_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> > 2.25.1\n> >\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 5041AC321B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Jun 2021 07:08:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4B9D268939;\n\tTue, 22 Jun 2021 09:08:11 +0200 (CEST)","from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com\n\t[IPv6:2607:f8b0:4864:20::72b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ECCC668932\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jun 2021 09:08:08 +0200 (CEST)","by mail-qk1-x72b.google.com with SMTP id q64so30608085qke.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Jun 2021 00:08:08 -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=\"mzFNn7Ru\"; 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\t:cc; bh=UIBZ5W8r2EmEzh36ontM0cAyrt/G0KxJD7HclclnW5U=;\n\tb=mzFNn7Ru950fGx1yNYXzvOH9JbL92ZTlLPzr0PTwIHkVrJm0NeBvkWqbm1nBZ45Qlf\n\tJJV7szNnFyGrG0QC4qcFBLRJqwsT7Xx8T+rNyGeHfyIiJy2j2XFvKdoh1P2QsIRqvdNy\n\t6L3DFXybYRceCZ3Qy+tpGUig0ue/3/OQDYaZjhxSCKhXub/vMmP3dGuOK+cfxH6FLu6T\n\tFVz+rwwLKQfFpqML3jwUTum7et6bppFNMOfPU23hz9kJmCP8ffUQ//KA+D2xum/cuWAH\n\tYXurefknl9XnAAQa369Ton93s+Pa2dnngVvRJZpeO+ITqlzI8JsYtOBSHjdkRCTYVSxR\n\tjseg==","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:cc;\n\tbh=UIBZ5W8r2EmEzh36ontM0cAyrt/G0KxJD7HclclnW5U=;\n\tb=oYLebwvUvXBU23oG8fRGT7bxhjxLrnCFTJJbmQdxdR7JmswObGnLJMeH5+faDZimkb\n\t8vZlj7cmnpMdpaqZsVES6jDTC91OagkpiMgwza8FgxJhJfkfYAk+y7ctBRCMcixVKAYd\n\tTwA1k9AYFG9mKVHq/6Hb5SNfhxurZ1x52WCapVam5bA0BEnMBD5pPNAk93H3j6miWU5v\n\tnjFm1pGkeAYf8w/pAnhbDb3MFTkbvUudNVvTsZxyXK+GXIutDSynKIoD8oSv4NuBr8s9\n\tKNH3ZdMKQek1O1gxxLZvq44lhmDpFc9B960bvf5zufL1O4VVQmhxMYjrue54vQ/ytAMo\n\tYw4w==","X-Gm-Message-State":"AOAM531jYlsMxCaByYyIykK5X/XNGt248gdt9sVCvs675G74zwxp7oPE\n\tx3Dy8uS+04GwlMYatA0BtUxn1x9Do0dV45K1oqGTkt2UIvs8ToBb","X-Google-Smtp-Source":"ABdhPJzwfG75YHXtgg9CMow/0JAJzyaTlBzXIjXoLtC8u1ll2SZosqzejj5v9sPVArQn4oVmhILN8InrYO7SG0KXbTc=","X-Received":"by 2002:a25:d290:: with SMTP id\n\tj138mr2856103ybg.468.1624345686073; \n\tTue, 22 Jun 2021 00:08:06 -0700 (PDT)","MIME-Version":"1.0","References":"<20210618200247.624987-1-vedantparanjape160201@gmail.com>\n\t<20210618200247.624987-2-vedantparanjape160201@gmail.com>\n\t<20210622042632.GE1899306@pyrite.rasen.tech>","In-Reply-To":"<20210622042632.GE1899306@pyrite.rasen.tech>","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Date":"Tue, 22 Jun 2021 12:37:54 +0530","Message-ID":"<CACGrz-OJr00ajwQy0ekZ_TA-XnF-odZSA-+UGY3uRyocJkYX7g@mail.gmail.com>","To":"paul.elder@ideasonboard.com","Content-Type":"multipart/alternative; boundary=\"0000000000009c64cf05c5557377\"","Subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: Fix V4L2 pixel format\n\tmapping for XRGB32","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>"}}]