From patchwork Tue Jun 22 07:34:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 12677 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 823D1C321A for ; Tue, 22 Jun 2021 07:34:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EC46A68935; Tue, 22 Jun 2021 09:34:54 +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="J8c3FGJr"; dkim-atps=neutral Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9189668932 for ; Tue, 22 Jun 2021 09:34:53 +0200 (CEST) Received: by mail-pf1-x42a.google.com with SMTP id w71so5722477pfd.4 for ; Tue, 22 Jun 2021 00:34:53 -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=2QvVu71xC10oiSVPx53SIAHmdrdShITZzfkw0d9rN6I=; b=J8c3FGJrLXAXMIUo93Liab0t/D4OTkHOPm9YEFFilqqbK15F7CeKbqFm/SUVDbEYnQ f0wwQ3Ybf/KKK0btYt2/Tv+h9hlgfmLMcVMfPGHsA3WzDEoDDNu+Fc6NWVm/Oa+rQR9d g5HgCWN+qkTDpCRNqtxvdYYw8I+AJCM/tkUE/l3yUwil50bHjPYaj56FjWz5UsWp+Zly j3Iqsll3Xo4aV1dtEA2qiYXtqnuy2plH0c7KqKIk3cHrxb3JnoINB6rHgkM5zUSO/miU 90eJbtLAco9zZER8aWTnctMJZf5mqUPrtS7hXB9IdtKKB7uczxJsvqjjHHLcIDUQ8Ovb UlZA== 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=2QvVu71xC10oiSVPx53SIAHmdrdShITZzfkw0d9rN6I=; b=dmCR8zUeV2nTf+NPyMOL+XtKOj/OKDj/KW0+geYeUNmpkbKo9nVXaVi9tnKzefu2tn jNp1I19sIodUK62lX08HfPNh1S5h5fUgbdP8G0Uk1dWSr70h0uo0cIuk5R2qr/bACs3N l5L9qAIONXhDPPYPKMoOlz/LKLGgIba5wyxon29t6wPjlL5eD8rmrP2ZxI0JQpcQWg65 iXveQb1++UZAQBHqtnx34c93MFFaGG8NwpUQSiSpjbTfMEjQ2HwmSn9bQej0vs0VVESD DJwLYdAbInOqhbD+95cIVu0FQ27tBemwRtl4/OamMBZ8wn9Tn2OHrnfOh6+SLzdUHpQ2 29dQ== X-Gm-Message-State: AOAM530ARDV76iwqKY2u0dqoevM+LMZfN/qFrYowBnCupaKWpSFa/LtA tyvTpuqhxMT16eeNxtcrClO1m/91ZbaLu2A2TmI= X-Google-Smtp-Source: ABdhPJwn9WDusFVRQXm8rkzpIPYS2h66WGZm+ykgiHZ7r1WLNUMBW9+wNsqTuvhn635nlZWK80/U0A== X-Received: by 2002:a63:dd51:: with SMTP id g17mr2552004pgj.238.1624347291849; Tue, 22 Jun 2021 00:34:51 -0700 (PDT) Received: from localhost.localdomain ([2405:204:21a8:4877:7aca:bbac:9cc:99db]) by smtp.googlemail.com with ESMTPSA id o14sm1436554pjj.6.2021.06.22.00.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 00:34:51 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Jun 2021 13:04:33 +0530 Message-Id: <20210622073433.61678-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] 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 following warning, by updating the existing mapping of V4L2_PIX_FMT_XRGB32 to libcamera pixel format. Additionally, adds a new mapping of V4L2_PIX_FMT_RBGX32 to formats::XBGR8888 This patch does the following changes: - add the BGRX8888 format in libcamera - fix the mapping of XRGB32 to BGRX8888 - fix the mapping of RGBX32 to XBGR8888 Signed-off-by: Vedant Paranjape --- 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 },