From patchwork Thu Apr 27 14:47:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18566 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 0D6B6C0DA4 for ; Thu, 27 Apr 2023 14:48:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7A7F7627B7; Thu, 27 Apr 2023 16:47:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1682606879; bh=pofF/u9OtkdCGx/FHnlBNd3RsXhIvam7pIEcVN64tRs=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=M29PYbC6879iPL2yOzNgD4XQ3SfqOEj5ZORtxtL3SSGhIQrD5TnK6sYdwelFAeN9C v/F87/T6z0nRx7NWQyzBJE9LFPWs1N3JK1EJFEj1yeaag1ZZXhWdR7TafHiEnw0qPx Jho9mj37CrSgEOzOvUgwjcC1tuQRpYwQbYK0WBLIfpI19LMyDR3muQRYL3p4QO8i44 Tv0g07IwDELSK7CVXNIBchs9v84tnrEFQg0llOqKnMMtbhckSBA/H3nTB6618SydzA GRf2GbR69C7oI7NeYaUeQZzL1APD/+cpvg3LhGXVVNc+f/EiwHClLigbpOmWaFgEZ6 axdPOQzTwgpJg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C53CB627B7 for ; Thu, 27 Apr 2023 16:47:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="haT8Rgpz"; dkim-atps=neutral Received: from uno.lan (unknown [IPv6:2001:b07:5d2e:52c9:1cf0:b3bc:c785:4625]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7D90E802; Thu, 27 Apr 2023 16:47:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1682606866; bh=pofF/u9OtkdCGx/FHnlBNd3RsXhIvam7pIEcVN64tRs=; h=From:To:Cc:Subject:Date:From; b=haT8Rgpz9iRiDpDh11q41SKophqAqdjYGYdiMKMr1bR844fF8dW61Zf5WtzLIAm3k DtQH7rY67e2kw/c9bHemWAORNWzADHVRpomLNHfuHudC4Q9IvPqhFpRUClbD/1Oc/b m3Lli88M0cbIe/l4jqq2QBxvfoteo0qHYro6JNOw= To: libcamera-devel@lists.libcamera.org Date: Thu, 27 Apr 2023 16:47:34 +0200 Message-Id: <20230427144740.64075-1-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/6] libcamera: imx8-isi: Remove pixelformat-2-media-bus map 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The ISI pipeline handler currently associates the output PixelFormat with the media bus code that can produce it. This mapping is however limiting as the ISI can produce any YUV/RGB format from any non-RAW media bus format. Rework the format selection procedures in order to remove the association between pixel formats and mbus codes by introducing 4 new functions. This fixes the problem originally pointed out by Laurent that when used with RAW sensors, the generated CameraConfiguration does not work as it assumes a YUV media bus code is available. Tested with ov5640 which can produce UYVY8, RGB565 and SBGGR8. $ cam -c1 Selected sensor format: 1920x1080-UYVY8_1X16 $ cam -c1 --stream role=raw Selected sensor format: 2592x1944-SBGGR8_1X8 $ cam -c1 --stream pixelformat=RGB565 Selected sensor format: 1920x1080-RGB565_ Tested with imx219 which can only produce SRGGB10 $ cam -c1 Selected sensor format: 3280x2464-SRGGB10_1X10 $ cam -c1 --stream pixelformat=YUV WARN ISI imx8-isi.cpp:278 Cannot find a supported YUV/RGB format $ cam -c1 --stream role=viewfinder Selected sensor format: 3280x2464-SRGGB10_1X10 Also fix the available stream formats list for both YUV and RAW use cases. v2->v3: - Fix (for real) the formatsMap_ to contain the ISI format and not the sensor format - Add RAW14 formats - Minor style fixes as suggested by Laurent v1->v2: - Split out "libcamera: camera_sensor: Add tryFormat()" - Fix resolution the generated format map for RAW configuration as we can't downscale - Minor fixes Jacopo Mondi (6): libcamera: imx8-isi: Break out RAW format selection libcamera: imx8-isi: Break out YUV format selection libcamera: imx8-isi: Automatically select media bus code libcamera: camera_sensor: Add tryFormat() libcamera: imx8-isi: Split Bayer/YUV config generation libcamera: imx8-isi: Remove mbusCode from formatsMap_ include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 17 + src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 627 +++++++++++-------- 3 files changed, 387 insertions(+), 258 deletions(-) --- 2.40.0