From patchwork Fri Jul 24 08:55:49 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: 8956 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 F10A6BD878 for ; Fri, 24 Jul 2020 08:56:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 44F5F611B7; Fri, 24 Jul 2020 10:56:03 +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 3B3056118F for ; Fri, 24 Jul 2020 10:56:01 +0200 (CEST) X-Halon-ID: 55e04852-cd8b-11ea-86ee-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 55e04852-cd8b-11ea-86ee-0050569116f7; Fri, 24 Jul 2020 10:54:51 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Jul 2020 10:55:49 +0200 Message-Id: <20200724085550.496484-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200724085550.496484-1-niklas.soderlund@ragnatech.se> References: <20200724085550.496484-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] include: drm_fourcc: Add 16-bit Bayer FourCC 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" The patch trying to upstream Bayer formats to the DRM FourCC header file in Linux left out the 16-bit formats, add them. This addition will be included in the next version of the DRM Bayer patch sent out. Intention is to merge this in libcamera and update the header file once the upstream patch is picked up. Signed-off-by: Niklas Söderlund --- include/linux/drm_fourcc.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h index 69240dfe1df0df28..baa3faecdf1575c7 100644 --- a/include/linux/drm_fourcc.h +++ b/include/linux/drm_fourcc.h @@ -344,6 +344,12 @@ extern "C" { #define DRM_FORMAT_SGBRG14 fourcc_code('G', 'B', '1', '4') #define DRM_FORMAT_SBGGR14 fourcc_code('B', 'G', '1', '4') +/* 16-bit Bayer formats */ +#define DRM_FORMAT_SRGGB16 fourcc_code('R', 'G', '1', '6') +#define DRM_FORMAT_SGRBG16 fourcc_code('G', 'R', '1', '6') +#define DRM_FORMAT_SGBRG16 fourcc_code('G', 'B', '1', '6') +#define DRM_FORMAT_SBGGR16 fourcc_code('B', 'Y', 'R', '2') + /* * Format Modifiers: * From patchwork Fri Jul 24 08:55:50 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: 8957 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 A19EDBD878 for ; Fri, 24 Jul 2020 08:56:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 699D6611B2; Fri, 24 Jul 2020 10:56:04 +0200 (CEST) Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D8A6F6118A for ; Fri, 24 Jul 2020 10:56:01 +0200 (CEST) X-Halon-ID: 5625b4d8-cd8b-11ea-86ee-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 5625b4d8-cd8b-11ea-86ee-0050569116f7; Fri, 24 Jul 2020 10:54:51 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Jul 2020 10:55:50 +0200 Message-Id: <20200724085550.496484-3-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200724085550.496484-1-niklas.soderlund@ragnatech.se> References: <20200724085550.496484-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: Add support for 16-bit Bayer formats 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 16-bit Bayer formats. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/formats.cpp | 40 ++++++++++++++++++++++++++++++ src/libcamera/formats.yaml | 9 +++++++ src/libcamera/v4l2_pixelformat.cpp | 4 +++ 3 files changed, 53 insertions(+) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 60b42ce23c2145fd..b8bed685029f655e 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -563,6 +563,46 @@ const std::map pixelFormatInfo{ .pixelsPerGroup = 2, .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::SBGGR16, { + .name = "SBGGR16", + .format = formats::SBGGR16, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), + .bitsPerPixel = 16, + .colourEncoding = PixelFormatInfo::ColourEncodingRAW, + .packed = false, + .pixelsPerGroup = 2, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::SGBRG16, { + .name = "SGBRG16", + .format = formats::SGBRG16, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), + .bitsPerPixel = 16, + .colourEncoding = PixelFormatInfo::ColourEncodingRAW, + .packed = false, + .pixelsPerGroup = 2, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::SGRBG16, { + .name = "SGRBG16", + .format = formats::SGRBG16, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), + .bitsPerPixel = 16, + .colourEncoding = PixelFormatInfo::ColourEncodingRAW, + .packed = false, + .pixelsPerGroup = 2, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::SRGGB16, { + .name = "SRGGB16", + .format = formats::SRGGB16, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), + .bitsPerPixel = 16, + .colourEncoding = PixelFormatInfo::ColourEncodingRAW, + .packed = false, + .pixelsPerGroup = 2, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, { formats::SBGGR10_IPU3, { .name = "SBGGR10_IPU3", .format = formats::SBGGR10_IPU3, diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml index 3a69c05fcc04fb93..6a2fb721b7c649b6 100644 --- a/src/libcamera/formats.yaml +++ b/src/libcamera/formats.yaml @@ -93,6 +93,15 @@ formats: - SBGGR12: fourcc: DRM_FORMAT_SBGGR12 + - SRGGB16: + fourcc: DRM_FORMAT_SRGGB16 + - SGRBG16: + fourcc: DRM_FORMAT_SGRBG16 + - SGBRG16: + fourcc: DRM_FORMAT_SGBRG16 + - SBGGR16: + fourcc: DRM_FORMAT_SBGGR16 + - SRGGB10_CSI2P: fourcc: DRM_FORMAT_SRGGB10 mod: MIPI_FORMAT_MOD_CSI2_PACKED diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index c8f69ee9654223b3..8391ec48ac1009b6 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -92,6 +92,10 @@ const std::map vpf2pf{ { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), formats::SGBRG12_CSI2P }, { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), formats::SGRBG12_CSI2P }, { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), formats::SRGGB12_CSI2P }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), formats::SBGGR16 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), formats::SGBRG16 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), formats::SGRBG16 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), formats::SRGGB16 }, /* Compressed formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), formats::MJPEG },