From patchwork Wed Jun 23 14:46:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 12696 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 035FFC321A for ; Wed, 23 Jun 2021 14:47:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 65A8468933; Wed, 23 Jun 2021 16:47:28 +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="G6nge9dF"; dkim-atps=neutral Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 232D068932 for ; Wed, 23 Jun 2021 16:47:27 +0200 (CEST) Received: by mail-pj1-x1029.google.com with SMTP id g4so1662385pjk.0 for ; Wed, 23 Jun 2021 07:47:27 -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=Mt2qaSCHeIpUiyWChJ2fW0D1yHHgg2vrLViAjVtoHcw=; b=G6nge9dFtVLAaEOYIjFnByZ05yE9CUJhDgn6r1E51un3y4FW6cVqH/MTspti4u9pdp Do2wkqZzG778ARf9lV8zDi9OIX05J2XXFMUQCqyMoPNO864YczDbfLvsC433RItBt2/T CjIbraufm9XR7mBXso+hhDhGk3+JCs17g/rHxq1vSZx1YPuHW0gX3PGtay8VYUGDJoWI mf7AUK43HkdzU1PzNjcVMmnB3AS4GdcDcRiTGkrHUGjK3syl3vsRr1o/JxVUcfcsqt2x RLN5OdUyX6jrqfuR7QE/Uu83WJ1NngKOHeuBDd6jhgf01uFzF2+2r78DW5iTMtqJQV1S EbdA== 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=Mt2qaSCHeIpUiyWChJ2fW0D1yHHgg2vrLViAjVtoHcw=; b=M96fzhE33VAJOr7HnCiMWAR7R3f1b5Tpuex2nUdVyHzmoapWm9FRCLTTxqeVQoFKVg Evj1AmJnzGnNuOHcbwNTP0QbmPxBmhV5cf4B7pAA2Ox33nF74EhV9VjrUNIqUcHrPuIa Gg648tisXuY/APO4GmsbslYvv9fcnNMsOGrJOkmPbILIaGm4ZHONTyfxhfIfl+D8xNR2 vCYWKlPOm/Vbsir/EyDTVPe8sECrXd205BOkryV1m5+R4zLo9w2WvFywr4ld3SiANZxE 9LzwLkv180jY01+RzuOqkam7Z3bn5wMa63c/HGZdzX4qH9xojmh08wQuejE3x42LXHKN +isQ== X-Gm-Message-State: AOAM530OFEm6wFlfKyNqXY7fUBkqvA428yOPPoAxbeagHDxHo9fad+DJ aciMBppKL/tBu3kAs7gIzn6FVuDLlphPz2cYVb4= X-Google-Smtp-Source: ABdhPJzniUWxAb4xc26f9iLqyjuUtaKNCsfEUKXsnwVqJ8lQeUGBPlPKEKeb26Zv0emEmDUn8zyd4g== X-Received: by 2002:a17:902:f212:b029:123:78c0:84a6 with SMTP id m18-20020a170902f212b029012378c084a6mr33571plc.31.1624459645183; Wed, 23 Jun 2021 07:47:25 -0700 (PDT) Received: from localhost.localdomain ([1.186.167.135]) by smtp.googlemail.com with ESMTPSA id r10sm166301pga.48.2021.06.23.07.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 07:47:24 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Jun 2021 20:16:56 +0530 Message-Id: <20210623144656.1206509-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3] 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 adding BGRX8888 pixel format in libcamera, and updating the existing mapping of V4L2_PIX_FMT_XRGB32 to it's corresponding libcamera pixel format. Additionally, adds 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 },