From patchwork Mon Mar 13 09:19:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18383 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 A6800BE080 for ; Mon, 13 Mar 2023 09:20:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C39B262707; Mon, 13 Mar 2023 10:20:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1678699203; bh=tfHFfNcnbndsfD/VOjA30Ogl3nxiFW02857VdX0wUsY=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=zQyfoWLWfhOvYsdQoms3lYRQ9UEO6YvbtBlDn0QLjKn8gn9cP4wHx/hgWxRz2QRs/ a+92p2tKkTfg+00Lh6RjGPtquJ86pnLNLGq3MBTvnXtqOBTvENyDnFPvYtJMVKji3U 1fS+LhI6P1Mo70kKeCe5tfr1hJuBR7S4wT2PTQFfxQwlf1o8tSc+G/2OgHeMmzJDTs p7kWC5GtxG3xDR07h3Oejqku7gOP3EKM8tM/qmSIkF2FoNDFD5wX7WFrpFNPG8kEsU ssO4u02kk8QwicI9M+rpBNdtOBjjGYJeKNbJMnLIunQfFZskto+otpCSeQOSHZfsQ9 Avm5NWkqhBi2A== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 82F70626B2 for ; Mon, 13 Mar 2023 10:20:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="pByzB/Im"; dkim-atps=neutral Received: from uno.homenet.telecomitalia.it (host-79-33-55-183.retail.telecomitalia.it [79.33.55.183]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D337D563; Mon, 13 Mar 2023 10:20:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1678699201; bh=tfHFfNcnbndsfD/VOjA30Ogl3nxiFW02857VdX0wUsY=; h=From:To:Cc:Subject:Date:From; b=pByzB/Im7ARLefSU55+Xp1EOV/bqgea0wm039dvR6Cti53O85tN+GNJ8bMJjw1J4k pyb0+r+QHOEjhg7mKjRmIeMQjMUJgwkMFYZdVPNE1Qe6nTg+NpmqvDAlxGUIW4VvjD 8j10E2F4gLKcufAEmiI4wseBUcGyZin1IhwBs0C8= To: libcamera-devel@lists.libcamera.org Date: Mon, 13 Mar 2023 10:19:38 +0100 Message-Id: <20230313091944.9530-1-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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. 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 | 612 +++++++++++-------- 3 files changed, 381 insertions(+), 249 deletions(-) --- 2.39.0