{"id":8532,"url":"https://patchwork.libcamera.org/api/1.1/patches/8532/?format=json","web_url":"https://patchwork.libcamera.org/patch/8532/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200701123036.51922-6-jacopo@jmondi.org>","date":"2020-07-01T12:30:26","name":"[libcamera-devel,05/15] libcamera: ipu3: Report StreamFormats","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c48611f689b1c48f03c109fb341d16de4acb1246","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8532/mbox/","series":[{"id":1066,"url":"https://patchwork.libcamera.org/api/1.1/series/1066/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1066","date":"2020-07-01T12:30:21","name":"libcamera: ipu3: Rework streams configuration","version":1,"mbox":"https://patchwork.libcamera.org/series/1066/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8532/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8532/checks/","tags":{},"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 E9C3ABF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 Jul 2020 12:27:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C675F60C62;\n\tWed,  1 Jul 2020 14:27:24 +0200 (CEST)","from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6DEA860CAE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 Jul 2020 14:27:22 +0200 (CEST)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id E6DB51C0003;\n\tWed,  1 Jul 2020 12:27:21 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  1 Jul 2020 14:30:26 +0200","Message-Id":"<20200701123036.51922-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200701123036.51922-1-jacopo@jmondi.org>","References":"<20200701123036.51922-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Report StreamFormats associated to each StreamConfiguration generated\nby the IPU3 pipeline handler.\n\nThe StreamFormats are generated differently for RAW and processed\nstreams, with the former using the sensor enumerated resolutions and\nthe latter using a continuous range of sizes constructed by matching the\nsensor capabilities with the platform constraints.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 47 +++++++++++++++++++++-------\n 1 file changed, 35 insertions(+), 12 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 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 \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","prefixes":["libcamera-devel","05/15"]}