From patchwork Wed Jun 16 20:48:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vedant Paranjape X-Patchwork-Id: 12623 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 813E0BD78E for ; Wed, 16 Jun 2021 20:49:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AC9136892F; Wed, 16 Jun 2021 22:49:06 +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="d5QPulLF"; dkim-atps=neutral Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 443046029A for ; Wed, 16 Jun 2021 22:49:06 +0200 (CEST) Received: by mail-pj1-x102c.google.com with SMTP id x21-20020a17090aa395b029016e25313bfcso2521347pjp.2 for ; Wed, 16 Jun 2021 13:49:06 -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=o64f1eWWPk868TPqM+iZw1V9RuKLSP0N6osBNUWshYs=; b=d5QPulLFILlQTC/DRySGqInZkbQ0SoT2XgoGinQQL2mXxNNx2WU6ncVcCdonOOn9Yf VE9pLMeckzAOeFdwbH4t3lLo4deDz+myUNOR7BOq4HITiTwawA3JFlwZYVwpwFZl85je m6U93VCN2Hz6CnuoPff/Tn+0z4QSrcLrI5rNIf6BQ1vTdcbuxJLA2UCz/VHra9AUnKvz eQWIWx4v0vdxacdlgD00s00chuURe+GWDrHv0KQxj1y9UMUaq0bhJCgUjKhhDVLcvXHw 29mw+PmSUxHiQ1mhUeNnliPaAwg5eaIIJ47e04ThulmLTbZfSWFvjfivWCNKpgDfH5E8 GThQ== 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=o64f1eWWPk868TPqM+iZw1V9RuKLSP0N6osBNUWshYs=; b=XSwAhF3DfL/Z+igKSjEMWfeUfI6a6tkxZF0howSUOFDtXeFLLBrEU0ChWS0xA3ebqt mUCVW4FIY/Nwh7Pw7IM7lP9e/XI0n3pFVwCRh40mVuPkaY6ANVbEywl9ZjckEeQUt4Ac HYvIAwVOAYz1rqpAASrD+ByzIEAGzFi3pM6zleSfOeB6lPCPbnlDFU9Ef3EhcAgHCYEp 1OAM9efgjIi3AVavx4+DyJm1bOicS7XBZAmVLQyi0obp7ibFQyYChz/Fihj0VasykX2r gY9X9lwqRyeXR7ja7T5lCSBjW5YKKtUeFU5FQE/KlqaWWWixkyV8Qb/8kYiegpOZxwJy CUVw== X-Gm-Message-State: AOAM533TYyYB5us4UuClNHjDcJzbH8hJjcb2C7l+QWSvtQtuT0N5uAM7 QSHfF6xWwssjXZqYJ1/qSm4NX8oFwFo4zsK5 X-Google-Smtp-Source: ABdhPJxO8l4oY5Q+kBHJnz8WuGYDVUcqCEvrM5TlK/PxkiB5s3tojhC2JRpoO8LebXiLzXDALmfvgA== X-Received: by 2002:a17:903:22c9:b029:11f:4529:70ac with SMTP id y9-20020a17090322c9b029011f452970acmr1318418plg.54.1623876543981; Wed, 16 Jun 2021 13:49:03 -0700 (PDT) Received: from localhost.localdomain ([1.186.76.76]) by smtp.googlemail.com with ESMTPSA id z14sm3014926pfn.11.2021.06.16.13.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 13:49:03 -0700 (PDT) From: Vedant Paranjape To: libcamera-devel@lists.libcamera.org Date: Thu, 17 Jun 2021 02:18:44 +0530 Message-Id: <20210616204844.429936-1-vedantparanjape160201@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1] libcamera: Update v4l2 pixel format to libcamera pixel format mapping 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" According to DRM FourCCs and linux kernel docs V4L2_PIX_FMT_XRGB32 is BX24, but it was mapped to formats::XBGR8888, which is XB24. This patch fixes the mismatch of V4L2_PIX_FMT_XRGB32, i.e, matches it to formats::BGRX8888. Furthermore, this patch adds V4L2_PIX_FMT_RBGX32 pixel format which is represented by XB24, and maps V4L2_PIX_FMT_RGBX32 to formats::XBGR8888 Linux kernel pixel format docs: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-rgb.html#bits-per-component DRM FourCC pixel format docs: https://elixir.bootlin.com/linux/latest/source/include/uapi/drm/drm_fourcc.h#L150 Signed-off-by: Vedant Paranjape --- src/libcamera/v4l2_pixelformat.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 166d93cf..e86788ed 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_RGBX32), formats::XBGR8888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_XRGB32), formats::BGRX8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 },