From patchwork Sun Jan 29 13:58:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18222 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 35CBEC3242 for ; Sun, 29 Jan 2023 13:58:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6D6D0625E8; Sun, 29 Jan 2023 14:58:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1675000733; bh=Ofx7L4xjftg48uUvNiLDmYde6zcfpbM7wMHYVeRs3uQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=RSwVkSgcje7F6xWqAx+NGEcezR5H8+7Khoym6u7r/wcSVFeLxjNOFYUWrbM4TCR+f /+brawXW8SK5RfKckloonAuwU5mZz0c2OVxcNR5Xkz2oAd82q8Yj14OUymnFrdf+tq 5pmXITQqL00AsPHZIhKkIOnXj0u3wlyNUSo4/Qyr83/T1Ql4wY+idE4bbj0ZFQLxBC FpiqhGI4gX84HSfmHFz7nXC8yXNPafyWocFZ4HpeeNQHBS9grOtzcFqR6ncGICeJxH fNtLGpf0/IwlnO/6Qm6pMix8hACEw0EfSxDYL5f0RH3eZ6+wCt44SzX8FJzKeTUmrF JvD7rjDH3bPgQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC4E9625E4 for ; Sun, 29 Jan 2023 14:58:49 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Ixg/bHU7"; dkim-atps=neutral Received: from uno.localdomain (mob-5-90-54-203.net.vodafone.it [5.90.54.203]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 49FC9449; Sun, 29 Jan 2023 14:58:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1675000729; bh=Ofx7L4xjftg48uUvNiLDmYde6zcfpbM7wMHYVeRs3uQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ixg/bHU7E0HemQNguBt8omrDsG+A+lgCI9Yq/tRKxFYbYU2oFHlwX6Dvcf1MrFe/+ hzDx5g5r0iS93AM2hYWwBc2c0Dg6qcz0nd8iXVZO5+nNijrekkDjg+keFCD/4/qnvV nSViNeyUV1FwX3MVXsWTvGShfxYKh3ubpA1Hpt6Q= To: libcamera-devel@lists.libcamera.org Date: Sun, 29 Jan 2023 14:58:30 +0100 Message-Id: <20230129135830.27490-6-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230129135830.27490-1-jacopo.mondi@ideasonboard.com> References: <20230129135830.27490-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/5] libcamera: imx8-isi: Remove mbusCode from formatsMap_ 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" Now that the media bus code selection procedure does not depend on the ISICameraConfiguration::formatsMap_ remove the association between PixelFormat supported by the ISI and the media bus code produced by the sensor. Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder --- src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 159 ++++--------------- 1 file changed, 29 insertions(+), 130 deletions(-) diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp index 0e1e87c7a2aa..f754f5d77f90 100644 --- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp +++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp @@ -76,18 +76,6 @@ public: class ISICameraConfiguration : public CameraConfiguration { public: - /* - * formatsMap_ records the association between an output pixel format - * and the combination of V4L2 pixel format and media bus codes that have - * to be applied to the pipeline. - */ - struct PipeFormat { - unsigned int isiCode; - unsigned int sensorCode; - }; - - using FormatMap = std::map; - ISICameraConfiguration(ISICameraData *data) : data_(data) { @@ -95,7 +83,7 @@ public: Status validate() override; - static const FormatMap formatsMap_; + static const std::map formatsMap_; V4L2SubdeviceFormat sensorFormat_; @@ -333,121 +321,33 @@ unsigned int ISICameraData::getMediaBusFormat(PixelFormat *pixelFormat) const * Camera Configuration */ -/** - * \todo Do not associate the sensor format to non-RAW pixelformats, as - * the ISI can do colorspace conversion. +/* + * ISICameraConfiguration::formatsMap_ records the association between an output + * pixel format and the ISI source pixel format to be applied to the pipeline. */ -const ISICameraConfiguration::FormatMap ISICameraConfiguration::formatsMap_ = { - { - formats::YUYV, - { MEDIA_BUS_FMT_YUV8_1X24, - MEDIA_BUS_FMT_UYVY8_1X16 }, - }, - { - formats::AVUY8888, - { MEDIA_BUS_FMT_YUV8_1X24, - MEDIA_BUS_FMT_UYVY8_1X16 }, - }, - { - formats::NV12, - { MEDIA_BUS_FMT_YUV8_1X24, - MEDIA_BUS_FMT_UYVY8_1X16 }, - }, - { - formats::NV16, - { MEDIA_BUS_FMT_YUV8_1X24, - MEDIA_BUS_FMT_UYVY8_1X16 }, - }, - { - formats::YUV444, - { MEDIA_BUS_FMT_YUV8_1X24, - MEDIA_BUS_FMT_UYVY8_1X16 }, - }, - { - formats::RGB565, - { MEDIA_BUS_FMT_RGB888_1X24, - MEDIA_BUS_FMT_RGB565_1X16 }, - }, - { - formats::BGR888, - { MEDIA_BUS_FMT_RGB888_1X24, - MEDIA_BUS_FMT_RGB565_1X16 }, - }, - { - formats::RGB888, - { MEDIA_BUS_FMT_RGB888_1X24, - MEDIA_BUS_FMT_RGB565_1X16 }, - }, - { - formats::XRGB8888, - { MEDIA_BUS_FMT_RGB888_1X24, - MEDIA_BUS_FMT_RGB565_1X16 }, - }, - { - formats::ABGR8888, - { MEDIA_BUS_FMT_RGB888_1X24, - MEDIA_BUS_FMT_RGB565_1X16 }, - }, - { - formats::SBGGR8, - { MEDIA_BUS_FMT_SBGGR8_1X8, - MEDIA_BUS_FMT_SBGGR8_1X8 }, - }, - { - formats::SGBRG8, - { MEDIA_BUS_FMT_SGBRG8_1X8, - MEDIA_BUS_FMT_SGBRG8_1X8 }, - }, - { - formats::SGRBG8, - { MEDIA_BUS_FMT_SGRBG8_1X8, - MEDIA_BUS_FMT_SGRBG8_1X8 }, - }, - { - formats::SRGGB8, - { MEDIA_BUS_FMT_SRGGB8_1X8, - MEDIA_BUS_FMT_SRGGB8_1X8 }, - }, - { - formats::SBGGR10, - { MEDIA_BUS_FMT_SBGGR10_1X10, - MEDIA_BUS_FMT_SBGGR10_1X10 }, - }, - { - formats::SGBRG10, - { MEDIA_BUS_FMT_SGBRG10_1X10, - MEDIA_BUS_FMT_SGBRG10_1X10 }, - }, - { - formats::SGRBG10, - { MEDIA_BUS_FMT_SGRBG10_1X10, - MEDIA_BUS_FMT_SGRBG10_1X10 }, - }, - { - formats::SRGGB10, - { MEDIA_BUS_FMT_SRGGB10_1X10, - MEDIA_BUS_FMT_SRGGB10_1X10 }, - }, - { - formats::SBGGR12, - { MEDIA_BUS_FMT_SBGGR12_1X12, - MEDIA_BUS_FMT_SBGGR12_1X12 }, - }, - { - formats::SGBRG12, - { MEDIA_BUS_FMT_SGBRG12_1X12, - MEDIA_BUS_FMT_SGBRG12_1X12 }, - }, - { - formats::SGRBG12, - { MEDIA_BUS_FMT_SGRBG12_1X12, - MEDIA_BUS_FMT_SGRBG12_1X12 }, - }, - { - formats::SRGGB12, - { MEDIA_BUS_FMT_SRGGB12_1X12, - MEDIA_BUS_FMT_SRGGB12_1X12 }, - }, +const std::map ISICameraConfiguration::formatsMap_ = { + { formats::YUYV, MEDIA_BUS_FMT_UYVY8_1X16 }, + { formats::AVUY8888, MEDIA_BUS_FMT_UYVY8_1X16 }, + { formats::NV12, MEDIA_BUS_FMT_UYVY8_1X16 }, + { formats::NV16, MEDIA_BUS_FMT_UYVY8_1X16 }, + { formats::YUV444, MEDIA_BUS_FMT_UYVY8_1X16 }, + { formats::RGB565, MEDIA_BUS_FMT_RGB565_1X16 }, + { formats::BGR888, MEDIA_BUS_FMT_RGB565_1X16 }, + { formats::RGB888, MEDIA_BUS_FMT_RGB565_1X16 }, + { formats::XRGB8888, MEDIA_BUS_FMT_RGB565_1X16 }, + { formats::ABGR8888, MEDIA_BUS_FMT_RGB565_1X16 }, + { formats::SBGGR8, MEDIA_BUS_FMT_SBGGR8_1X8 }, + { formats::SGBRG8, MEDIA_BUS_FMT_SGBRG8_1X8 }, + { formats::SGRBG8, MEDIA_BUS_FMT_SGRBG8_1X8 }, + { formats::SRGGB8, MEDIA_BUS_FMT_SRGGB8_1X8 }, + { formats::SBGGR10, MEDIA_BUS_FMT_SBGGR10_1X10 }, + { formats::SGBRG10, MEDIA_BUS_FMT_SGBRG10_1X10 }, + { formats::SGRBG10, MEDIA_BUS_FMT_SGRBG10_1X10 }, + { formats::SRGGB10, MEDIA_BUS_FMT_SRGGB10_1X10 }, + { formats::SBGGR12, MEDIA_BUS_FMT_SBGGR12_1X12 }, + { formats::SGBRG12, MEDIA_BUS_FMT_SGBRG12_1X12 }, + { formats::SGRBG12, MEDIA_BUS_FMT_SGRBG12_1X12 }, + { formats::SRGGB12, MEDIA_BUS_FMT_SRGGB12_1X12 }, }; /* @@ -991,11 +891,10 @@ int PipelineHandlerISI::configure(Camera *camera, CameraConfiguration *c) * size is taken from the sink's COMPOSE (or source's CROP, * if any) rectangles. */ - const ISICameraConfiguration::PipeFormat &pipeFormat = - ISICameraConfiguration::formatsMap_.at(config.pixelFormat); + unsigned int isiCode = ISICameraConfiguration::formatsMap_.at(config.pixelFormat); V4L2SubdeviceFormat isiFormat{}; - isiFormat.mbus_code = pipeFormat.isiCode; + isiFormat.mbus_code = isiCode; isiFormat.size = config.size; ret = pipe->isi->setFormat(1, &isiFormat);