{"id":8784,"url":"https://patchwork.libcamera.org/api/1.1/patches/8784/?format=json","web_url":"https://patchwork.libcamera.org/patch/8784/","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":"<20200714104212.48683-10-jacopo@jmondi.org>","date":"2020-07-14T10:42:01","name":"[libcamera-devel,09/20] libcamera: ipu3: Report StreamFormats","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"9fd5908fcbe2ea7e4e13c04ab45f3ed89e58f737","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/8784/mbox/","series":[{"id":1104,"url":"https://patchwork.libcamera.org/api/1.1/series/1104/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1104","date":"2020-07-14T10:41:52","name":"libcamera: ipu3: Rework pipe configuration","version":1,"mbox":"https://patchwork.libcamera.org/series/1104/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8784/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8784/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 5A456BD792\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Jul 2020 10:38:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 335AF607EB;\n\tTue, 14 Jul 2020 12:38:58 +0200 (CEST)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4BC1B60839\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2020 12:38:54 +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 relay10.mail.gandi.net (Postfix) with ESMTPSA id B0686240014;\n\tTue, 14 Jul 2020 10:38:53 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 14 Jul 2020 12:42:01 +0200","Message-Id":"<20200714104212.48683-10-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200714104212.48683-1-jacopo@jmondi.org>","References":"<20200714104212.48683-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 09/20] 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: 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 517d9bd11fbf..b480d41f89ab 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@@ -322,18 +325,26 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \t\t\t * output constraints and required frame margin\n \t\t\t * by rounding down to the closest alignment.\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@@ -345,11 +356,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@@ -361,6 +373,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","09/20"]}