[{"id":11396,"web_url":"https://patchwork.libcamera.org/comment/11396/","msgid":"<20200715060749.GB3051471@oden.dyn.berto.se>","date":"2020-07-15T06:07:49","subject":"Re: [libcamera-devel] [PATCH 07/20] libcamera: ipu3: cio2: Report\n\tformat and sizes","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2020-07-14 12:41:59 +0200, Jacopo Mondi wrote:\n> Add two methods to the CIO2Device class to retrieve all the supported\n> PixelFormats and sizes.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/cio2.cpp | 40 ++++++++++++++++++++++++++++\n>  src/libcamera/pipeline/ipu3/cio2.h   |  5 ++++\n>  2 files changed, 45 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\n> index 77f54da47e28..ff436e0dae41 100644\n> --- a/src/libcamera/pipeline/ipu3/cio2.cpp\n> +++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n> @@ -9,6 +9,7 @@\n>  \n>  #include <linux/media-bus-format.h>\n>  \n> +#include <libcamera/geometry.h>\n>  #include <libcamera/formats.h>\n>  #include <libcamera/stream.h>\n\nAlphabetical sort includes. With this fixed,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n>  \n> @@ -43,6 +44,45 @@ CIO2Device::~CIO2Device()\n>  \tdelete sensor_;\n>  }\n>  \n> +/**\n> + * \\brief Retrieve the list of supported PixelFormats\n> + *\n> + * Retrieve the list of supported pixel formats by matching the sensor produced\n> + * media bus codes with the formats supported by the CIO2 unit.\n> + *\n> + * \\return The list of supported PixelFormat\n> + */\n> +std::vector<PixelFormat> CIO2Device::formats() const\n> +{\n> +\tif (!sensor_)\n> +\t\treturn {};\n> +\n> +\tstd::vector<PixelFormat> formats;\n> +\tfor (unsigned int code : sensor_->mbusCodes()) {\n> +\t\tauto it = mbusCodesToPixelFormat.find(code);\n> +\t\tif (it != mbusCodesToPixelFormat.end())\n> +\t\t\tformats.push_back(it->second);\n> +\t}\n> +\n> +\treturn formats;\n> +}\n> +\n> +/**\n> + * \\brief Retrieve the list of supported size ranges\n> + * \\return The list of supported SizeRange\n> + */\n> +std::vector<SizeRange> CIO2Device::sizes() const\n> +{\n> +\tif (!sensor_)\n> +\t\treturn {};\n> +\n> +\tstd::vector<SizeRange> sizes;\n> +\tfor (const Size &size : sensor_->sizes())\n> +\t\tsizes.emplace_back(size, size);\n> +\n> +\treturn sizes;\n> +}\n> +\n>  /**\n>   * \\brief Initialize components of the CIO2 device with \\a index\n>   * \\param[in] media The CIO2 media device\n> diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h\n> index 4fd949f8e513..f905d97fa79d 100644\n> --- a/src/libcamera/pipeline/ipu3/cio2.h\n> +++ b/src/libcamera/pipeline/ipu3/cio2.h\n> @@ -20,7 +20,9 @@ namespace libcamera {\n>  class CameraSensor;\n>  class FrameBuffer;\n>  class MediaDevice;\n> +class PixelFormat;\n>  class Request;\n> +class SizeRange;\n>  class V4L2Subdevice;\n>  struct Size;\n>  struct StreamConfiguration;\n> @@ -33,6 +35,9 @@ public:\n>  \tCIO2Device();\n>  \t~CIO2Device();\n>  \n> +\tstd::vector<PixelFormat> formats() const;\n> +\tstd::vector<SizeRange> sizes() const;\n> +\n>  \tint init(const MediaDevice *media, unsigned int index);\n>  \tint configure(const Size &size, V4L2DeviceFormat *outputFormat);\n>  \n> -- \n> 2.27.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 B4742BD792\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Jul 2020 06:07:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1E7D56092A;\n\tWed, 15 Jul 2020 08:07:55 +0200 (CEST)","from mail-lj1-x243.google.com (mail-lj1-x243.google.com\n\t[IPv6:2a00:1450:4864:20::243])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A91536091A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Jul 2020 08:07:52 +0200 (CEST)","by mail-lj1-x243.google.com with SMTP id h19so1159960ljg.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2020 23:07:52 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tr15sm244475ljd.130.2020.07.14.23.07.50\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Jul 2020 23:07:50 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"IlkDz06Y\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=y6BlhIvVI+wg3BqSVqTuDPKvdxBjjqnXM4bFQiyPi9E=;\n\tb=IlkDz06YuFHFB3xv1fX+afw0rCGZnEjc3qE3DeqS45NeyKvyJiQtdcsusr459HcJ2i\n\tGKmesnyVa5LWe/S2UNw0oKf4SWWg8e8Cbaszt4CD2e0+liW8EpfWKH6uP7voZNHny0Ew\n\t2WYKFqkMB7flcbj1hFuvkhnquYLR1dc8vyWCZCd3jF7SAq7rwVZGS03uazIajRjkGxNG\n\tHynE7ZijI507C8AgYyrBEiPiQlzjeKOhJDe2yb26Z//11fxFa6cf2/SxqeTJj7ZqbX73\n\tBKHKm9PoSM2fmCeOQui7qego2UlaH90sUa22M+LFDK53X90gEtUQx76kGTDoDE2JCd5B\n\tybdg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=y6BlhIvVI+wg3BqSVqTuDPKvdxBjjqnXM4bFQiyPi9E=;\n\tb=t92i+oxIsSuePnKyqPZc3zmXlEbJ1LsXxNCW8KM7tpA5C58XMgxvmhIWZ3f+ugdGnv\n\tVg4pkiZLI6hctBiogR7EHF/JHE84e+cD859pizBerX+kLISmrwqhGi1pXVRxMQDCjuL3\n\tAxaGqRbLUxaZG94s7e+GAgy3h5x1Go8M12QOwctt1X6MyPSLL1kd4L7SQqZSnohvF3nq\n\tJ7DugCT2DcQ+S5vY1l0Zh9T8aLumdQV3kQk6tUGaBEp0WTauuMEJnRa1W9CugpXjl8Hs\n\tSpbFw+bjv4vEfCnSldHuSHDt3BPUYnC/ocxPZ+aDvw4YG7DBruWqcn5FS1sow+e8K8kT\n\tuUBA==","X-Gm-Message-State":"AOAM533rFDtFgDruLNQ+fkmkuGtYblkwDpdE1xrrI2hs1FodEDO3TbYp\n\t8MVzr03L2EgOBfjxRx8Ekjsjyg==","X-Google-Smtp-Source":"ABdhPJzAW30SZuUdgIIpSXokG3Z5k0jzPl7uvg3UvvY921wZAws+DrJnrYQbRZmlWyt3k47Kv+m3Jg==","X-Received":"by 2002:a2e:8710:: with SMTP id m16mr487296lji.401.1594793271560;\n\tTue, 14 Jul 2020 23:07:51 -0700 (PDT)","Date":"Wed, 15 Jul 2020 08:07:49 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200715060749.GB3051471@oden.dyn.berto.se>","References":"<20200714104212.48683-1-jacopo@jmondi.org>\n\t<20200714104212.48683-8-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200714104212.48683-8-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 07/20] libcamera: ipu3: cio2: Report\n\tformat and sizes","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]