[{"id":26983,"web_url":"https://patchwork.libcamera.org/comment/26983/","msgid":"<20230428022304.GB13163@pendragon.ideasonboard.com>","date":"2023-04-28T02:23:04","subject":"Re: [libcamera-devel] [PATCH v3 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 Thu, Apr 27, 2023 at 04:47:40PM +0200, 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\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\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 a8bb36e38c8a..449d90122c4c 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> @@ -336,121 +324,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_YUV8_1X24 },\n> +\t{ formats::AVUY8888, MEDIA_BUS_FMT_YUV8_1X24 },\n> +\t{ formats::NV12, MEDIA_BUS_FMT_YUV8_1X24 },\n> +\t{ formats::NV16, MEDIA_BUS_FMT_YUV8_1X24 },\n> +\t{ formats::YUV444, MEDIA_BUS_FMT_YUV8_1X24 },\n> +\t{ formats::RGB565, MEDIA_BUS_FMT_RGB888_1X24 },\n> +\t{ formats::BGR888, MEDIA_BUS_FMT_RGB888_1X24 },\n> +\t{ formats::RGB888, MEDIA_BUS_FMT_RGB888_1X24 },\n> +\t{ formats::XRGB8888, MEDIA_BUS_FMT_RGB888_1X24 },\n> +\t{ formats::ABGR8888, MEDIA_BUS_FMT_RGB888_1X24 },\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> @@ -988,11 +888,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);\n> -- \n> 2.40.0\n>","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 5D269C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Apr 2023 02:22:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E0F5E627DE;\n\tFri, 28 Apr 2023 04:22:55 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 96794627B7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Apr 2023 04:22:54 +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 43EBF814;\n\tFri, 28 Apr 2023 04:22:40 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1682648575;\n\tbh=y07Awl2yOCwSiP1t+SBfXkG0yeFwHZ6ynQ3O81PkW4Y=;\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=MA5JAIn+/vtDXnu4iNATuMc/H1Ahf+ZhnPE+2fzX3tS+ATyqcLUK+FHO6ogiaUii0\n\tU2FRgR7/9o4uN70bg3Pk5O3o0fs8+8GJPVpKv3ScGxEyE+nlQ+LxEzROn9KRa83fql\n\txEGFrZq6qJmMoYBocTHpJUgPHEMsuEwSUWMEk9X/whPBBsds06Iu2X9NvQZe4SO8/Y\n\t0FQJ1gbeaRJPlw4O/yr5JooHZkPqq4FMMdSQz9K3M/eOq2jWVTqSQWyp12WvorY4wN\n\toozjSVnSCnUNC6Ov+rRz+wcOaL60Bc/6lVB0LbjWZj7Eei1/NWVqzr6BYr6aTLL6RX\n\tCo/w7ygzJMQhQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1682648562;\n\tbh=y07Awl2yOCwSiP1t+SBfXkG0yeFwHZ6ynQ3O81PkW4Y=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ZVjlujax3Q4l4ui4ItoRWUDXwsZ1e9QlVEpC7UFEaIR3x2ufmJt9xqQ+atyQL2R7o\n\tp2OzP9N8s7Qe63HLXwbm36mEUzcLtHR4PaRQ/vZZQP+Kh79jjxHfS/7LaBGHXiu+ej\n\tGCPp2zdt95B4ku4NnUjs835ukdCpicwWEO+dxGec="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZVjlujax\"; dkim-atps=neutral","Date":"Fri, 28 Apr 2023 05:23:04 +0300","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Message-ID":"<20230428022304.GB13163@pendragon.ideasonboard.com>","References":"<20230427144740.64075-1-jacopo.mondi@ideasonboard.com>\n\t<20230427144740.64075-7-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230427144740.64075-7-jacopo.mondi@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 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>"}}]