From patchwork Fri Jun 25 11:02:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 12706 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 32C1EC321A for ; Fri, 25 Jun 2021 11:02:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E6E3B684CE; Fri, 25 Jun 2021 13:02:35 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="slNY/DRS"; dkim-atps=neutral Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AB39E684C9 for ; Fri, 25 Jun 2021 13:02:34 +0200 (CEST) Received: by mail-pf1-x432.google.com with SMTP id k6so7717602pfk.12 for ; Fri, 25 Jun 2021 04:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fTPTdlZJr1bEK5wia416l6NxQWn0zJiGszx2MJmIXhY=; b=slNY/DRSHWAW5d0vu2oBaaOdzpYjflN/bmj0uluzI2yXluTl1y2l4E+6A4rsnyHzRj wBv/arI6/0oCwkbPKT9+FbgEtZEI1jNikEKPlvrmgA2FxtJZfEIOupvOVittGIdP7XWP Du9/7GjcajwW+6xJ1cy2fJjq7xxzyviMXCHm/KDDOnPjQKmTytslSx+xZyESzcLhWzhR dLrcld1pbMLmUG+2wm8tP/Lr+E+dt05Vyvymh4o1egG7/ejgeNWd4SvJvVUu+BwmBJCW au70HMqD8Fip6HcO/l7tYAsRfmjGbyGzeAh2wB+1bSU9zYWqbEeZu2kvsHPMCpQPeuvj 1qTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fTPTdlZJr1bEK5wia416l6NxQWn0zJiGszx2MJmIXhY=; b=FTtpITGhwlMe3nEDJcpFdZX9AjTgqwKwI6q3H4S/mECu8wiWn0lnFW08r7boPocwfd yDOERGiXQaE15iccOIsTmj54fT/DDYe4GkaDmJwBD9LiH9Fhf2t2+YojLBCiN44cuKJV BOZUTIhjHNag12jfuCsMI9M3+wZVRRB2Xxd0aKZw5j45v24qBPvtaj610t+oeAXBrzrT K4x3rm6v4Xqx8nxoGh+CJaNagnCr0oCygD2SJqls1FQSCJeWNUCHZ4ezPRs9PFcP0uLJ DL7EevYzigYTByXVBzLHAYeARpQvNfaykSnsqQWSaaPEMQ8Gven4TtifjCjRK5TO2DaC Z5Xw== X-Gm-Message-State: AOAM532hIaZmbYqyc57lLlFWOf3STPI9xuC3V4jSD3jC1YhIiAbi8BZl JgM/wRTh7unRpxUsDTCJypf1xkzhGfLzSD/J X-Google-Smtp-Source: ABdhPJyPFOz+KumF0UGM37p1phvBJGjr7I1bcbfV/Kqv0B6jBotXq3i0010edYDA8mH+g/+tIDSiOQ== X-Received: by 2002:a05:6a00:2395:b029:304:7a51:6f1d with SMTP id f21-20020a056a002395b02903047a516f1dmr10146164pfc.53.1624618952998; Fri, 25 Jun 2021 04:02:32 -0700 (PDT) Received: from localhost.localdomain ([1.186.165.32]) by smtp.googlemail.com with ESMTPSA id s42sm5564602pfw.184.2021.06.25.04.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 04:02:32 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Fri, 25 Jun 2021 16:32:24 +0530 Message-Id: <20210625110224.2001529-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4] libcamera: Fix V4L2 pixel format mapping for XRGB32 and RGBX32 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vedant Paranjape Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" On running libcamera gstreamer element on Raspberry Pi 4B+, there was a warning as follows: [3:23:59.717513107] [3577] WARN V4L2 v4l2_pixelformat.cpp:180 Unsupported V4L2 pixel format XB24 This patch fixes the warning, by adding BGRX8888 pixel format in libcamera, and updating the existing mapping of V4L2_PIX_FMT_XRGB32 to its corresponding libcamera pixel format, which is formats::BGRX8888. Additionally, add a new mapping of V4L2_PIX_FMT_RBGX32 to formats::XBGR8888. Signed-off-by: Vedant Paranjape Reviewed-by: Paul Elder --- src/libcamera/formats.cpp | 12 +++++++++++- src/libcamera/v4l2_pixelformat.cpp | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 55822f4c..e41bfc05 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -198,13 +198,23 @@ const std::map pixelFormatInfo{ { formats::XBGR8888, { .name = "XBGR8888", .format = formats::XBGR8888, - .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), .bitsPerPixel = 32, .colourEncoding = PixelFormatInfo::ColourEncodingRGB, .packed = false, .pixelsPerGroup = 1, .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::BGRX8888, { + .name = "BGRX8888", + .format = formats::BGRX8888, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), + .bitsPerPixel = 32, + .colourEncoding = PixelFormatInfo::ColourEncodingRGB, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, { formats::ABGR8888, { .name = "ABGR8888", .format = formats::ABGR8888, diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 166d93cf..78a08303 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -51,7 +51,8 @@ const std::map vpf2pf{ { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 }, { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 }, { V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), formats::XRGB8888 }, - { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::XBGR8888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::BGRX8888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGBX32), formats::XBGR8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 },