{"id":8880,"url":"https://patchwork.libcamera.org/api/1.1/patches/8880/?format=json","web_url":"https://patchwork.libcamera.org/patch/8880/","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":"<20200720104736.19986-9-jacopo@jmondi.org>","date":"2020-07-20T10:47:25","name":"[libcamera-devel,v4,08/19] libcamera: ipu3: Report StreamFormats","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"28c461353b872d9e6f0c7b7603ce721673030e79","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/8880/mbox/","series":[{"id":1118,"url":"https://patchwork.libcamera.org/api/1.1/series/1118/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1118","date":"2020-07-20T10:47:17","name":"ipu3: rework pipe confiuguration","version":4,"mbox":"https://patchwork.libcamera.org/series/1118/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8880/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8880/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 33DDEC0109\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2020 10:44:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 02A2E6073C;\n\tMon, 20 Jul 2020 12:44:23 +0200 (CEST)","from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A81766071C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jul 2020 12:44:19 +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 relay3-d.mail.gandi.net (Postfix) with ESMTPSA id E11E760013;\n\tMon, 20 Jul 2020 10:44:18 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 20 Jul 2020 12:47:25 +0200","Message-Id":"<20200720104736.19986-9-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200720104736.19986-1-jacopo@jmondi.org>","References":"<20200720104736.19986-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 08/19] 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=\"utf-8\"","Content-Transfer-Encoding":"base64","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\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 45 +++++++++++++++++++---------\n 1 file changed, 31 insertions(+), 14 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex b998c0722edc..27200a8cc811 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -313,7 +313,10 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \n \tSize sensorResolution = data->cio2_.sensor()->resolution();\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@@ -323,18 +326,26 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \t\t\t * to the ImgU  maximum output size) and aligned down to\n \t\t\t * the required frame margin.\n \t\t\t */\n-\t\t\tcfg.size = sensorResolution.boundedTo(IMGU_OUTPUT_MAX_SIZE);\n-\t\t\tcfg.size.width = utils::alignDown(cfg.size.width - 1,\n-\t\t\t\t\t\t\t  IMGU_OUTPUT_WIDTH_MARGIN);\n-\t\t\tcfg.size.height = utils::alignDown(cfg.size.height - 1,\n-\t\t\t\t\t\t\t   IMGU_OUTPUT_HEIGHT_MARGIN);\n-\t\t\tcfg.pixelFormat = formats::NV12;\n-\t\t\tcfg.bufferCount = IPU3_BUFFER_COUNT;\n+\t\t\tsize = sensorResolution.boundedTo(IMGU_OUTPUT_MAX_SIZE);\n+\t\t\tsize.width = utils::alignDown(size.width - 1,\n+\t\t\t    \t\t\t      IMGU_OUTPUT_WIDTH_MARGIN);\n+\t\t\tsize.height = utils::alignDown(size.height - 1,\n+\t\t\t\t\t\t       IMGU_OUTPUT_HEIGHT_MARGIN);\n+\t\t\tpixelFormat = formats::NV12;\n+\t\t\tbufferCount = IPU3_BUFFER_COUNT;\n+\t\t\tstreamFormats[pixelFormat] = { { IMGU_OUTPUT_MIN_SIZE, size } };\n \n \t\t\tbreak;\n \n \t\tcase StreamRole::StillCaptureRaw: {\n-\t\t\tcfg = data->cio2_.generateConfiguration(sensorResolution);\n+\t\t\tStreamConfiguration cio2Config =\n+\t\t\t\tdata->cio2_.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 : data->cio2_.formats())\n+\t\t\t\tstreamFormats[format] = data->cio2_.sizes();\n \n \t\t\tbreak;\n \t\t}\n@@ -346,11 +357,12 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \t\t\t * capped to the maximum sensor resolution and aligned\n \t\t\t * to the ImgU output constraints.\n \t\t\t */\n-\t\t\tcfg.size = sensorResolution.boundedTo({ 1280, 720 })\n-\t\t\t\t\t\t   .alignedDownTo(IMGU_OUTPUT_WIDTH_ALIGN,\n-\t\t\t\t\t\t\t          IMGU_OUTPUT_HEIGHT_ALIGN);\n-\t\t\tcfg.pixelFormat = formats::NV12;\n-\t\t\tcfg.bufferCount = IPU3_BUFFER_COUNT;\n+\t\t\tsize = sensorResolution.boundedTo({ 1280, 720 })\n+\t\t\t\t\t       .alignedDownTo(IMGU_OUTPUT_WIDTH_ALIGN,\n+\t\t\t\t\t\t\t      IMGU_OUTPUT_HEIGHT_ALIGN);\n+\t\t\tpixelFormat = formats::NV12;\n+\t\t\tbufferCount = IPU3_BUFFER_COUNT;\n+\t\t\tstreamFormats[pixelFormat] = { { IMGU_OUTPUT_MIN_SIZE, size } };\n \n \t\t\tbreak;\n \t\t}\n@@ -362,6 +374,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","v4","08/19"]}