[{"id":17869,"web_url":"https://patchwork.libcamera.org/comment/17869/","msgid":"<YNlvDTfbgKOwuFiO@pendragon.ideasonboard.com>","date":"2021-06-28T06:41:17","subject":"Re: [libcamera-devel] [PATCH v4] libcamera: Fix V4L2 pixel format\n\tmapping for XRGB32 and RGBX32","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Vedant,\n\nThank you for the patch.\n\nOn Fri, Jun 25, 2021 at 04:32:24PM +0530, Vedant Paranjape wrote:\n> On running libcamera gstreamer element on Raspberry Pi 4B+, there was a\n> warning as follows:\n> \n> [3:23:59.717513107] [3577] WARN V4L2 v4l2_pixelformat.cpp:180 Unsupported V4L2 pixel format XB24\n> \n> This patch fixes the warning, by adding BGRX8888 pixel format\n> in libcamera, and updating the existing mapping of V4L2_PIX_FMT_XRGB32\n> to its corresponding libcamera pixel format, which is formats::BGRX8888.\n> Additionally, add a new mapping of V4L2_PIX_FMT_RBGX32 to formats::XBGR8888.\n\nI'd still like to split the fix (which should have a Fixes: tag) and the\naddition of the new format.\n\n> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  src/libcamera/formats.cpp          | 12 +++++++++++-\n>  src/libcamera/v4l2_pixelformat.cpp |  3 ++-\n>  2 files changed, 13 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\nThis goes in the fix.\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} },\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> +\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\nAnd this doesn't (and there are extra white spaces at the end of the\nline, 'git show' should have shown you).\n\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..78a08303 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_XRGB32), formats::BGRX8888 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },\n\nHere, the fix would be\n\n> -\t{ V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 },\n\nThe commit message should be updated accordingly, by explaining that the\ncommit fixes the V4L2 format for formats::XBGR8888.\n\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 4F8EFC321E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Jun 2021 06:41:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B0F5C684D5;\n\tMon, 28 Jun 2021 08:41:20 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DBA726028C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Jun 2021 08:41:18 +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 52AC2B8A;\n\tMon, 28 Jun 2021 08:41:18 +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=\"PDBcQUhL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624862478;\n\tbh=0dUFXNnZKmq3HSjn+jqWpYocpYTfz3jufSEg9w8RMew=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=PDBcQUhLfz2jCNdw48hoMc8FhfzaADXf1sWJTRqeS3phl/28ZnO9XXZW3TGLsfADq\n\to7QmQgjWZvmDK8gohBwkR87nkYa3E+ERhBk85WJ83VEK6zY1b5GGYSPzWhFX4AQ5re\n\tjw3bkm33Yk5CWVH7jXUzl0Z43CDc8Se0fGN3KFuE=","Date":"Mon, 28 Jun 2021 09:41:17 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Message-ID":"<YNlvDTfbgKOwuFiO@pendragon.ideasonboard.com>","References":"<20210625110224.2001529-1-vedantparanjape160201@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210625110224.2001529-1-vedantparanjape160201@gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v4] libcamera: Fix V4L2 pixel format\n\tmapping for XRGB32 and RGBX32","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>"}}]