From patchwork Thu Aug 8 07:14:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 20829 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 363E7BE173 for ; Thu, 8 Aug 2024 07:14:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D005F6338D; Thu, 8 Aug 2024 09:14:30 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="GopI11xU"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 53E556337F for ; Thu, 8 Aug 2024 09:14:28 +0200 (CEST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4281ca54fd3so4546035e9.2 for ; Thu, 08 Aug 2024 00:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1723101267; x=1723706067; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wrCYY9Ks7e6nUe3FTRF2ERCt3Gd9uXxWpFoenV0ryHg=; b=GopI11xU1IKpgBIzSPsen/Hatdohqft37K9JfWzTVASOKNJx9QhUSEJ9EWJMcN5DSx goWzRXvwMA3BpZqXK4lEgZth77YV7Jh2V7Ij0OgoGx6EKUKGQS1X/x3D80FdtE9/WNVn yOXQzC6/Nv8TWxL1aoTiRPigSINON5Wj+SgT4qS9cED9tvfEKqfgrKdDw9D774RC3npY 94BrG6Smo7q4/HkOZ/hAtTfSBDEZA/KxfaVa6R1rEeMccC/9zrDOBEFu8yZd6Bk1LwDe L/WmvXNvtxHaNymB4UMHyWajwvMcF64IqpLwUMPBJ2c08tKDnFNyrQmV//D2CkKfTp2R mrDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723101267; x=1723706067; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wrCYY9Ks7e6nUe3FTRF2ERCt3Gd9uXxWpFoenV0ryHg=; b=lDJZOuKH/0pO8dny0Dj4XtWTLdBBy+8UpWsLaJPtV2bga8ivzcWFkG8zloVcJOE2EO RQ8dos1j7sDnepdtgmk/cQcm9rx3DajhRkQ51qSgugk8snVOs7Mo0IzP0uVc5/DP6yRs t86f+ESOpIOdNk0H3CPsole7BLIkHU+kqKiauZtmvFNMutdOEE2gmdhjWHIkw7ykjocz ZrEaPlT8AloFY1/t4FLqsObA1CxLJPAGjmJpxwKkUBhhN7o7tH4pWxbUk5wu3B1tr4nS nsSEPGWwAq/wPrx7fz6BLXHN4HjX3ncCHVQ9BJiKF7aQICVXND43TNtSUMMuSHc7HLXH mIoQ== X-Gm-Message-State: AOJu0YzVmvvLQc/m6QBqyGMZgXpnF95iAbDcj9w5acwfikpxVhRl3hcV H8IUGw4UXB6s0xlqbh8mzmjhipzMCnsOcLETBqkjfPrBmyPQX9EvTa1GD0J1E2FaXVF0laCC5bH B X-Google-Smtp-Source: AGHT+IGcPtpo8eCPPEXGSCRlC8Nr29qWBUrouCNuwMA1uwsPh6vmiO4lp5RduNzj+RkO0Wig1lkGog== X-Received: by 2002:a05:600c:6c8e:b0:428:1e8c:ff75 with SMTP id 5b1f17b1804b1-4290af48098mr8111355e9.35.1723101266905; Thu, 08 Aug 2024 00:14:26 -0700 (PDT) Received: from naush-laptop.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4290c74a9d2sm7506775e9.27.2024.08.08.00.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 00:14:26 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: will whang , Naushir Patuck Subject: [PATCH] libcamera: formats: Adding Support for Y12P Date: Thu, 8 Aug 2024 08:14:33 +0100 Message-Id: <20240808071433.10724-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240807080344.12780-2-naush@raspberrypi.com> References: <20240807080344.12780-2-naush@raspberrypi.com> MIME-Version: 1.0 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" From: will whang Add support for a 12-bit Mono format named formats::R12_CSI2P. This format is added to support the IMX585 mono sensor, which uses the MEDIA_BUS_FMT_Y12_1X12 media bus format. Signed-off-by: will whang Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Reviewed-by: Daniel Scally --- src/libcamera/bayer_format.cpp | 2 ++ src/libcamera/formats.cpp | 10 ++++++++++ src/libcamera/formats.yaml | 3 +++ src/libcamera/v4l2_pixelformat.cpp | 2 ++ 4 files changed, 17 insertions(+) diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp index 014f716d28f7..c2120d1c16d7 100644 --- a/src/libcamera/bayer_format.cpp +++ b/src/libcamera/bayer_format.cpp @@ -184,6 +184,8 @@ const std::map bayerToFormat{ { formats::R10_CSI2P, V4L2PixelFormat(V4L2_PIX_FMT_Y10P) } }, { { BayerFormat::MONO, 12, BayerFormat::Packing::None }, { formats::R12, V4L2PixelFormat(V4L2_PIX_FMT_Y12) } }, + { { BayerFormat::MONO, 12, BayerFormat::Packing::CSI2 }, + { formats::R12_CSI2P, V4L2PixelFormat(V4L2_PIX_FMT_Y12P) } }, { { BayerFormat::MONO, 16, BayerFormat::Packing::None }, { formats::R16, V4L2PixelFormat(V4L2_PIX_FMT_Y16) } }, { { BayerFormat::MONO, 16, BayerFormat::Packing::PISP1 }, diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index cf41f2c261ed..f338fc373f33 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -527,6 +527,16 @@ const std::map pixelFormatInfo{ .pixelsPerGroup = 4, .planes = {{ { 5, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::R12_CSI2P, { + .name = "R12_CSI2P", + .format = formats::R12_CSI2P, + .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_Y12P), }, + .bitsPerPixel = 12, + .colourEncoding = PixelFormatInfo::ColourEncodingYUV, + .packed = true, + .pixelsPerGroup = 2, + .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, { formats::R12, { .name = "R12", .format = formats::R12, diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml index fe027a7cce70..2d54d391ca01 100644 --- a/src/libcamera/formats.yaml +++ b/src/libcamera/formats.yaml @@ -138,6 +138,9 @@ formats: - R10_CSI2P: fourcc: DRM_FORMAT_R10 mod: MIPI_FORMAT_MOD_CSI2_PACKED + - R12_CSI2P: + fourcc: DRM_FORMAT_R12 + mod: MIPI_FORMAT_MOD_CSI2_PACKED - SRGGB10_CSI2P: fourcc: DRM_FORMAT_SRGGB10 diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 70568335b266..eb9ac2224fd1 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -139,6 +139,8 @@ const std::map vpf2pf{ { formats::R10_CSI2P, "10-bit Greyscale Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_Y12), { formats::R12, "12-bit Greyscale" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_Y12P), + { formats::R12_CSI2P, "12-bit Greyscale Packed" } }, { V4L2PixelFormat(V4L2_PIX_FMT_Y16), { formats::R16, "16-bit Greyscale" } },