[{"id":11051,"web_url":"https://patchwork.libcamera.org/comment/11051/","msgid":"<20200701163004.GG2399385@oden.dyn.berto.se>","date":"2020-07-01T16:30:04","subject":"Re: [libcamera-devel] [PATCH 05/15] libcamera: ipu3: Report\n\tStreamFormats","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-01 14:30:26 +0200, Jacopo Mondi wrote:\n> Report StreamFormats associated to each StreamConfiguration generated\n> by the IPU3 pipeline handler.\n> \n> The StreamFormats are generated differently for RAW and processed\n> streams, with the former using the sensor enumerated resolutions and\n> the latter using a continuous range of sizes constructed by matching the\n> sensor capabilities with the platform constraints.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 47 +++++++++++++++++++++-------\n>  1 file changed, 35 insertions(+), 12 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index cd18c6f31023..ed2360347fb4 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -33,6 +33,9 @@ LOG_DEFINE_CATEGORY(IPU3)\n>  \n>  static constexpr unsigned int IPU3_BUFFER_COUNT = 4;\n>  static constexpr unsigned int IPU3_MAX_STREAMS = 3;\n> +static constexpr unsigned int IPU3_OUTPUT_MAX_WIDTH = 4480;\n> +static constexpr unsigned int IPU3_OUTPUT_MAX_HEIGHT = 34004;\n> +static const Size minIPU3OutputSize = { 2, 2 };\n>  \n>  class IPU3CameraData : public CameraData\n>  {\n> @@ -295,15 +298,19 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n>  \tIPU3CameraConfiguration *config = new IPU3CameraConfiguration(camera, data);\n> +\tCIO2Device *cio2 = &data->cio2_;\n\nThis chance touches none of the code that is added and only modifies \ncode that is already here. I like it the way it is and that data is used \nin the code below. If it must change I would do so in a separate patch.\n\nWhit this fixed,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n>  \n>  \tif (roles.empty())\n>  \t\treturn config;\n>  \n> -\tSize sensorResolution = data->cio2_.sensor()->resolution();\n> +\tSize sensorResolution = cio2->sensor()->resolution();\n>  \tunsigned int rawCount = 0;\n>  \tunsigned int outCount = 0;\n>  \tfor (const StreamRole role : roles) {\n> -\t\tStreamConfiguration cfg = {};\n> +\t\tstd::map<PixelFormat, std::vector<SizeRange>> streamFormats;\n> +\t\tunsigned int bufferCount;\n> +\t\tPixelFormat pixelFormat;\n> +\t\tSize size;\n>  \n>  \t\tswitch (role) {\n>  \t\tcase StreamRole::StillCapture:\n> @@ -311,19 +318,29 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  \t\t\t * Use the sensor resolution adjusted to respect the\n>  \t\t\t * ImgU output alignement contraints.\n>  \t\t\t */\n> -\t\t\tcfg.pixelFormat = formats::NV12;\n> -\t\t\tcfg.size = sensorResolution;\n> -\t\t\tcfg.size.width &= ~7;\n> -\t\t\tcfg.size.height &= ~3;\n> -\t\t\tcfg.bufferCount = IPU3_BUFFER_COUNT;\n> +\t\t\tpixelFormat = formats::NV12;\n> +\t\t\tsize.width = std::min(sensorResolution.width,\n> +\t\t\t\t\t      IPU3_OUTPUT_MAX_WIDTH);\n> +\t\t\tsize.height = std::min(sensorResolution.height,\n> +\t\t\t\t\t       IPU3_OUTPUT_MAX_HEIGHT);\n> +\t\t\tsize.width &= ~7;\n> +\t\t\tsize.height &= ~3;\n> +\t\t\tbufferCount = IPU3_BUFFER_COUNT;\n> +\t\t\tstreamFormats[pixelFormat] = { { minIPU3OutputSize, size } };\n>  \n>  \t\t\toutCount++;\n>  \n>  \t\t\tbreak;\n>  \n>  \t\tcase StreamRole::StillCaptureRaw: {\n> -\t\t\tcfg = data->cio2_.generateConfiguration(sensorResolution);\n> -\t\t\tcfg.bufferCount = 1;\n> +\t\t\tStreamConfiguration cio2Config =\n> +\t\t\t\tcio2->generateConfiguration(sensorResolution);\n> +\t\t\tpixelFormat = cio2Config.pixelFormat;\n> +\t\t\tsize = cio2Config.size;\n> +\t\t\tbufferCount = cio2Config.bufferCount;\n> +\n> +\t\t\tfor (const PixelFormat &format : cio2->formats())\n> +\t\t\t\tstreamFormats[format] = cio2->sizes();\n>  \n>  \t\t\trawCount++;\n>  \n> @@ -339,9 +356,10 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  \t\t\t */\n>  \t\t\tunsigned int width = std::min(1280U, sensorResolution.width);\n>  \t\t\tunsigned int height = std::min(720U, sensorResolution.height);\n> -\t\t\tcfg.size = { width & ~7, height & ~3 };\n> -\t\t\tcfg.pixelFormat = formats::NV12;\n> -\t\t\tcfg.bufferCount = IPU3_BUFFER_COUNT;\n> +\t\t\tsize = { width & ~7, height & ~3 };\n> +\t\t\tpixelFormat = formats::NV12;\n> +\t\t\tbufferCount = IPU3_BUFFER_COUNT;\n> +\t\t\tstreamFormats[pixelFormat] = { { minIPU3OutputSize, size } };\n>  \n>  \t\t\toutCount++;\n>  \n> @@ -361,6 +379,11 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n>  \t\t\treturn nullptr;\n>  \t\t}\n>  \n> +\t\tStreamFormats formats(streamFormats);\n> +\t\tStreamConfiguration cfg(formats);\n> +\t\tcfg.size = size;\n> +\t\tcfg.pixelFormat = pixelFormat;\n> +\t\tcfg.bufferCount = bufferCount;\n>  \t\tconfig->addConfiguration(cfg);\n>  \t}\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 757D9BFFE2\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 Jul 2020 16:30:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1445C60C53;\n\tWed,  1 Jul 2020 18:30:08 +0200 (CEST)","from mail-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C4CB609A9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 Jul 2020 18:30:06 +0200 (CEST)","by mail-lj1-x241.google.com with SMTP id z24so2986665ljn.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 01 Jul 2020 09:30:06 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\to6sm1980586ljh.42.2020.07.01.09.30.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 01 Jul 2020 09:30:05 -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=\"fbxIHnEm\"; 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=MQTRZl3UHi/2SzkwHSj5TNB1PQcdwfLlqNxDrupd2pw=;\n\tb=fbxIHnEm7eJTcZC3Q01jvBRyXh8fJlIb4IbQWiNLwloIfw7Og9HVgSqUp2kWQlDXLn\n\t/yHEZp9AVo3j8Orn4HQeAQT+SlhGkvHJ0Zo2bLI5QYx7JkpLdex4VGjpcHmavOrZJY5d\n\tn5bUCMp1tN0apWtRAKk6FMPzQzXG3KAeWLB3TL7TSscwjD2yisecwtWQMNnzta8CK6J5\n\tVvzQB9s5aeXeR20CAkOcMNqt/Icev8PryMbD/HpHwXYIT/I+JvAj//yQvJViDpmZUekY\n\tdasf8y9P8l1XF4gIfJhPyi19p6H3cgrj11vPcT1C69rjLudOosmBRTsSv20Fl7/VtnA1\n\tWRhw==","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=MQTRZl3UHi/2SzkwHSj5TNB1PQcdwfLlqNxDrupd2pw=;\n\tb=DK+/DzP5JTLUyc1pxxZU5xL5sYJ6QYOH1lj/SalNbwFsPtod0B8uHr89Ote4SywbWD\n\tQZqeFc3EREUGETLW5LtqH4YE2a3PkLyfm1xZVWh8b3Exbj0Sk8V1wmdwbpkt40Uh7C9J\n\t4VI15ULNwwBFLtZCe7mLphhUn6NO4bB24dIsgAbahkEXDR03W5yygYbBwgTzqnHxJHlF\n\tJAR5S6GfpOh/9652nzLqKjysSAo9MU6Fl7TE/Bjn4vmZZJj2X1iihIww1MT6Or9uFFXp\n\tHRPviVUlux/H+b37KCy/XTIiT+YiLHnyeS9hJsBFS6chEVt7fZYYlJ6aJVy1a2ubF2tq\n\tA6hg==","X-Gm-Message-State":"AOAM532PjyfOG9wM4hZPqn7NVojLq6YejsA2qCkK/wuzngKAz855roZD\n\tVyqrArRYn3Q/VWxIppThfBndcIDj0D8=","X-Google-Smtp-Source":"ABdhPJwVfTVUp/m8/306cwGFx2/ZNcnejJjl4fNuw8PesekMY4X3kQ7lir8jfgmhFnDTYW98dgTRqQ==","X-Received":"by 2002:a2e:390a:: with SMTP id\n\tg10mr13017883lja.373.1593621005642; \n\tWed, 01 Jul 2020 09:30:05 -0700 (PDT)","Date":"Wed, 1 Jul 2020 18:30:04 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200701163004.GG2399385@oden.dyn.berto.se>","References":"<20200701123036.51922-1-jacopo@jmondi.org>\n\t<20200701123036.51922-6-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200701123036.51922-6-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 05/15] libcamera: ipu3: Report\n\tStreamFormats","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>"}}]