[{"id":26925,"web_url":"https://patchwork.libcamera.org/comment/26925/","msgid":"<20230424053718.GA3737@pendragon.ideasonboard.com>","date":"2023-04-24T05:37:18","subject":"Re: [libcamera-devel] [PATCH v2 6/6] libcamera: imx8-isi: Remove\n\tmbusCode from formatsMap_","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Mar 13, 2023 at 10:19:44AM +0100, Jacopo Mondi via libcamera-devel wrote:\n> Now that the media bus code selection procedure does not depend\n> on the ISICameraConfiguration::formatsMap_ remove the association\n> between PixelFormat supported by the ISI and the media bus code produced\n> by the sensor.\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n> Tested-by: Daniel Scally <dan.scally@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 159 ++++---------------\n>  1 file changed, 29 insertions(+), 130 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp\n> index a4f437f55b26..4928058f267a 100644\n> --- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp\n> +++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp\n> @@ -76,18 +76,6 @@ public:\n>  class ISICameraConfiguration : public CameraConfiguration\n>  {\n>  public:\n> -\t/*\n> -\t * formatsMap_ records the association between an output pixel format\n> -\t * and the combination of V4L2 pixel format and media bus codes that have\n> -\t * to be applied to the pipeline.\n> -\t */\n> -\tstruct PipeFormat {\n> -\t\tunsigned int isiCode;\n> -\t\tunsigned int sensorCode;\n> -\t};\n> -\n> -\tusing FormatMap = std::map<PixelFormat, PipeFormat>;\n> -\n>  \tISICameraConfiguration(ISICameraData *data)\n>  \t\t: data_(data)\n>  \t{\n> @@ -95,7 +83,7 @@ public:\n>  \n>  \tStatus validate() override;\n>  \n> -\tstatic const FormatMap formatsMap_;\n> +\tstatic const std::map<PixelFormat, unsigned int> formatsMap_;\n>  \n>  \tV4L2SubdeviceFormat sensorFormat_;\n>  \n> @@ -333,121 +321,33 @@ unsigned int ISICameraData::getMediaBusFormat(PixelFormat *pixelFormat) const\n>   * Camera Configuration\n>   */\n>  \n> -/**\n> - * \\todo Do not associate the sensor format to non-RAW pixelformats, as\n> - * the ISI can do colorspace conversion.\n> +/*\n> + * ISICameraConfiguration::formatsMap_ records the association between an output\n> + * pixel format and the ISI source pixel format to be applied to the pipeline.\n>   */\n> -const ISICameraConfiguration::FormatMap ISICameraConfiguration::formatsMap_ = {\n> -\t{\n> -\t\tformats::YUYV,\n> -\t\t{ MEDIA_BUS_FMT_YUV8_1X24,\n> -\t\t  MEDIA_BUS_FMT_UYVY8_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::AVUY8888,\n> -\t\t{ MEDIA_BUS_FMT_YUV8_1X24,\n> -\t\t  MEDIA_BUS_FMT_UYVY8_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::NV12,\n> -\t\t{ MEDIA_BUS_FMT_YUV8_1X24,\n> -\t\t  MEDIA_BUS_FMT_UYVY8_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::NV16,\n> -\t\t{ MEDIA_BUS_FMT_YUV8_1X24,\n> -\t\t  MEDIA_BUS_FMT_UYVY8_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::YUV444,\n> -\t\t{ MEDIA_BUS_FMT_YUV8_1X24,\n> -\t\t  MEDIA_BUS_FMT_UYVY8_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::RGB565,\n> -\t\t{ MEDIA_BUS_FMT_RGB888_1X24,\n> -\t\t  MEDIA_BUS_FMT_RGB565_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::BGR888,\n> -\t\t{ MEDIA_BUS_FMT_RGB888_1X24,\n> -\t\t  MEDIA_BUS_FMT_RGB565_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::RGB888,\n> -\t\t{ MEDIA_BUS_FMT_RGB888_1X24,\n> -\t\t  MEDIA_BUS_FMT_RGB565_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::XRGB8888,\n> -\t\t{ MEDIA_BUS_FMT_RGB888_1X24,\n> -\t\t  MEDIA_BUS_FMT_RGB565_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::ABGR8888,\n> -\t\t{ MEDIA_BUS_FMT_RGB888_1X24,\n> -\t\t  MEDIA_BUS_FMT_RGB565_1X16 },\n> -\t},\n> -\t{\n> -\t\tformats::SBGGR8,\n> -\t\t{ MEDIA_BUS_FMT_SBGGR8_1X8,\n> -\t\t  MEDIA_BUS_FMT_SBGGR8_1X8 },\n> -\t},\n> -\t{\n> -\t\tformats::SGBRG8,\n> -\t\t{ MEDIA_BUS_FMT_SGBRG8_1X8,\n> -\t\t  MEDIA_BUS_FMT_SGBRG8_1X8 },\n> -\t},\n> -\t{\n> -\t\tformats::SGRBG8,\n> -\t\t{ MEDIA_BUS_FMT_SGRBG8_1X8,\n> -\t\t  MEDIA_BUS_FMT_SGRBG8_1X8 },\n> -\t},\n> -\t{\n> -\t\tformats::SRGGB8,\n> -\t\t{ MEDIA_BUS_FMT_SRGGB8_1X8,\n> -\t\t  MEDIA_BUS_FMT_SRGGB8_1X8 },\n> -\t},\n> -\t{\n> -\t\tformats::SBGGR10,\n> -\t\t{ MEDIA_BUS_FMT_SBGGR10_1X10,\n> -\t\t  MEDIA_BUS_FMT_SBGGR10_1X10 },\n> -\t},\n> -\t{\n> -\t\tformats::SGBRG10,\n> -\t\t{ MEDIA_BUS_FMT_SGBRG10_1X10,\n> -\t\t  MEDIA_BUS_FMT_SGBRG10_1X10 },\n> -\t},\n> -\t{\n> -\t\tformats::SGRBG10,\n> -\t\t{ MEDIA_BUS_FMT_SGRBG10_1X10,\n> -\t\t  MEDIA_BUS_FMT_SGRBG10_1X10 },\n> -\t},\n> -\t{\n> -\t\tformats::SRGGB10,\n> -\t\t{ MEDIA_BUS_FMT_SRGGB10_1X10,\n> -\t\t  MEDIA_BUS_FMT_SRGGB10_1X10 },\n> -\t},\n> -\t{\n> -\t\tformats::SBGGR12,\n> -\t\t{ MEDIA_BUS_FMT_SBGGR12_1X12,\n> -\t\t  MEDIA_BUS_FMT_SBGGR12_1X12 },\n> -\t},\n> -\t{\n> -\t\tformats::SGBRG12,\n> -\t\t{ MEDIA_BUS_FMT_SGBRG12_1X12,\n> -\t\t  MEDIA_BUS_FMT_SGBRG12_1X12 },\n> -\t},\n> -\t{\n> -\t\tformats::SGRBG12,\n> -\t\t{ MEDIA_BUS_FMT_SGRBG12_1X12,\n> -\t\t  MEDIA_BUS_FMT_SGRBG12_1X12 },\n> -\t},\n> -\t{\n> -\t\tformats::SRGGB12,\n> -\t\t{ MEDIA_BUS_FMT_SRGGB12_1X12,\n> -\t\t  MEDIA_BUS_FMT_SRGGB12_1X12 },\n> -\t},\n> +const std::map<PixelFormat, unsigned int> ISICameraConfiguration::formatsMap_ = {\n> +\t{ formats::YUYV, MEDIA_BUS_FMT_UYVY8_1X16 },\n> +\t{ formats::AVUY8888, MEDIA_BUS_FMT_UYVY8_1X16 },\n> +\t{ formats::NV12, MEDIA_BUS_FMT_UYVY8_1X16 },\n> +\t{ formats::NV16, MEDIA_BUS_FMT_UYVY8_1X16 },\n> +\t{ formats::YUV444, MEDIA_BUS_FMT_UYVY8_1X16 },\n> +\t{ formats::RGB565, MEDIA_BUS_FMT_RGB565_1X16 },\n> +\t{ formats::BGR888, MEDIA_BUS_FMT_RGB565_1X16 },\n> +\t{ formats::RGB888, MEDIA_BUS_FMT_RGB565_1X16 },\n> +\t{ formats::XRGB8888, MEDIA_BUS_FMT_RGB565_1X16 },\n> +\t{ formats::ABGR8888, MEDIA_BUS_FMT_RGB565_1X16 },\n\nThis still doesn't look right. Please see my last answer to the same\npatch in v1.\n\n> +\t{ formats::SBGGR8, MEDIA_BUS_FMT_SBGGR8_1X8 },\n> +\t{ formats::SGBRG8, MEDIA_BUS_FMT_SGBRG8_1X8 },\n> +\t{ formats::SGRBG8, MEDIA_BUS_FMT_SGRBG8_1X8 },\n> +\t{ formats::SRGGB8, MEDIA_BUS_FMT_SRGGB8_1X8 },\n> +\t{ formats::SBGGR10, MEDIA_BUS_FMT_SBGGR10_1X10 },\n> +\t{ formats::SGBRG10, MEDIA_BUS_FMT_SGBRG10_1X10 },\n> +\t{ formats::SGRBG10, MEDIA_BUS_FMT_SGRBG10_1X10 },\n> +\t{ formats::SRGGB10, MEDIA_BUS_FMT_SRGGB10_1X10 },\n> +\t{ formats::SBGGR12, MEDIA_BUS_FMT_SBGGR12_1X12 },\n> +\t{ formats::SGBRG12, MEDIA_BUS_FMT_SGBRG12_1X12 },\n> +\t{ formats::SGRBG12, MEDIA_BUS_FMT_SGRBG12_1X12 },\n> +\t{ formats::SRGGB12, MEDIA_BUS_FMT_SRGGB12_1X12 },\n>  };\n>  \n>  /*\n> @@ -991,11 +891,10 @@ int PipelineHandlerISI::configure(Camera *camera, CameraConfiguration *c)\n>  \t\t * size is taken from the sink's COMPOSE (or source's CROP,\n>  \t\t * if any) rectangles.\n>  \t\t */\n> -\t\tconst ISICameraConfiguration::PipeFormat &pipeFormat =\n> -\t\t\tISICameraConfiguration::formatsMap_.at(config.pixelFormat);\n> +\t\tunsigned int isiCode = ISICameraConfiguration::formatsMap_.at(config.pixelFormat);\n>  \n>  \t\tV4L2SubdeviceFormat isiFormat{};\n> -\t\tisiFormat.mbus_code = pipeFormat.isiCode;\n> +\t\tisiFormat.mbus_code = isiCode;\n>  \t\tisiFormat.size = config.size;\n>  \n>  \t\tret = pipe->isi->setFormat(1, &isiFormat);","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B1FF1BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Apr 2023 05:37:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 00943627CF;\n\tMon, 24 Apr 2023 07:37:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 84F0561EB1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Apr 2023 07:37:07 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(133-32-181-51.west.xps.vectant.ne.jp [133.32.181.51])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ACE574AD;\n\tMon, 24 Apr 2023 07:36:56 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1682314630;\n\tbh=s/91dUUwerCHvKm6Wcg1OTEzMLZdzKWlOevqB4/Iq+U=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=f0mXQ8CasBBf8CqCzuFi45fa2cLeuA07e6w8fdpcfDzNDY3+WY+vHFB2Y6LKCPh8u\n\ts0GYBwSbQ5CTGq1FFULlble2Q9pG/U7iW8DnlJiHZ9TDVETlnnXbTPzwOzFYH3xc9p\n\t/bXf/nj7jgH7z7NLXskCfgbwTXRtRrgpXN7hA2vqVLkjw9gzJsK/0D1oKyk6Bw5KOa\n\tT2giDHFA9dRK4+lzK21J3/iQ5vo3VCIaM5RtlZjiLz1LSHkCqWd3vqHf6h2fDXhdxX\n\tC5OyyxctD+sxONKA6Jr6Uk8Z06iG0cCbZyMXoMrFxOhn4Kq1R7B+tHUwyVX0EGDPW1\n\tnKCFwB8F79s/A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1682314617;\n\tbh=s/91dUUwerCHvKm6Wcg1OTEzMLZdzKWlOevqB4/Iq+U=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=bss77PGE7ov547tVA13SnJ5U+oplelRnNz49z01atjaQOlfWXwcznYuMUsotgIqfU\n\tdu2tYW7AsQF4FWNwrlDF4CawvAujcpsJwYROAnq9ugxaEDuZXl6IPFRe9qJIXSVW3t\n\t0AWFwKmlcrfkcM2GE1779i+8jNsHmuZoCcY3zvic="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"bss77PGE\"; dkim-atps=neutral","Date":"Mon, 24 Apr 2023 08:37:18 +0300","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Message-ID":"<20230424053718.GA3737@pendragon.ideasonboard.com>","References":"<20230313091944.9530-1-jacopo.mondi@ideasonboard.com>\n\t<20230313091944.9530-7-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230313091944.9530-7-jacopo.mondi@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 6/6] libcamera: imx8-isi: Remove\n\tmbusCode from formatsMap_","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]