From patchwork Thu Oct 1 15:45:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 9894 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 95A6BC3B5B for ; Thu, 1 Oct 2020 15:46:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 71125622F2; Thu, 1 Oct 2020 17:46:19 +0200 (CEST) Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B101E622EE for ; Thu, 1 Oct 2020 17:46:16 +0200 (CEST) X-Halon-ID: 3cba82f6-03fd-11eb-9823-005056917f90 Authorized-sender: niklas.soderlund@fsdn.se Received: from bismarck.berto.se (p54ac52a8.dip0.t-ipconnect.de [84.172.82.168]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 3cba82f6-03fd-11eb-9823-005056917f90; Thu, 01 Oct 2020 17:46:14 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Oct 2020 17:45:59 +0200 Message-Id: <20201001154600.2722718-6-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201001154600.2722718-1-niklas.soderlund@ragnatech.se> References: <20201001154600.2722718-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 5/6] libcamera: Add support for XRGB8888 and XBGR8888 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add support for XRGB8888 and XBGR8888 formats. Signed-off-by: Niklas Söderlund --- * Changes since v1 - Fix type in v4l2_pixelformat.cpp where V4L2_PIX_FMT_XBGR32 was added twice instead of adding V4L2_PIX_FMT_XBGR32 and V4L2_PIX_FMT_XRGB32. --- src/libcamera/formats.cpp | 20 ++++++++++++++++++++ src/libcamera/v4l2_pixelformat.cpp | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index ebaae9be3d75fe58..cc6e579005b2d4b6 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -175,6 +175,26 @@ const std::map pixelFormatInfo{ .pixelsPerGroup = 1, .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::XRGB8888, { + .name = "XRGB8888", + .format = formats::XRGB8888, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_XBGR32), + .bitsPerPixel = 32, + .colourEncoding = PixelFormatInfo::ColourEncodingRGB, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::XBGR8888, { + .name = "XBGR8888", + .format = formats::XBGR8888, + .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 30c94bb98f442b08..6b05909f56ae975b 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -48,6 +48,8 @@ const std::map vpf2pf{ { V4L2PixelFormat(V4L2_PIX_FMT_RGB565), formats::RGB565 }, { 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_RGBA32), formats::ABGR8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 }, { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 },