Patch Detail
Show a patch.
GET /api/patches/8529/?format=api
{ "id": 8529, "url": "https://patchwork.libcamera.org/api/patches/8529/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8529/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "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-3-jacopo@jmondi.org>", "date": "2020-07-01T12:30:23", "name": "[libcamera-devel,02/15] libcamera: ipu3: Remove streams from generateConfiguration", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "c5e1b6b2356bcc2e688410ced9c0d2a66f770e7f", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/8529/mbox/", "series": [ { "id": 1066, "url": "https://patchwork.libcamera.org/api/series/1066/?format=api", "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/8529/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8529/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 6B49CBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 1 Jul 2020 12:27:23 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4E35F60C5D;\n\tWed, 1 Jul 2020 14:27:22 +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 B8673603B4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 1 Jul 2020 14:27:20 +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 553A91C0018;\n\tWed, 1 Jul 2020 12:27:20 +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:23 +0200", "Message-Id": "<20200701123036.51922-3-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 02/15] libcamera: ipu3: Remove streams\n\tfrom generateConfiguration", "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": "Remove stream assignement from the IPU3 pipeline handler\ngenerateConfiguration() implementation.\n\nThe function aims to provide a suitable default for the requested use\ncases. Defer stream assignement to validation and only assign sizes\nand formats to stream configurations.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 93 ++++++++--------------------\n 1 file changed, 27 insertions(+), 66 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 1bdad209de6e..97fc8b60c3cb 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -31,6 +31,9 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPU3)\n \n+static constexpr unsigned int IPU3_BUFFER_COUNT = 4;\n+static constexpr unsigned int IPU3_MAX_STREAMS = 3;\n+\n class IPU3CameraData : public CameraData\n {\n public:\n@@ -61,9 +64,6 @@ public:\n \tconst std::vector<const Stream *> &streams() { return streams_; }\n \n private:\n-\tstatic constexpr unsigned int IPU3_BUFFER_COUNT = 4;\n-\tstatic constexpr unsigned int IPU3_MAX_STREAMS = 3;\n-\n \tvoid assignStreams();\n \tvoid adjustStream(StreamConfiguration &cfg, bool scale);\n \n@@ -293,94 +293,55 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n {\n \tIPU3CameraData *data = cameraData(camera);\n \tIPU3CameraConfiguration *config = new IPU3CameraConfiguration(camera, data);\n-\tstd::set<Stream *> streams = {\n-\t\t&data->outStream_,\n-\t\t&data->vfStream_,\n-\t\t&data->rawStream_,\n-\t};\n \n \tif (roles.empty())\n \t\treturn config;\n \n+\tSize sensorResolution = data->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\tStream *stream = nullptr;\n-\n-\t\tcfg.pixelFormat = formats::NV12;\n \n \t\tswitch (role) {\n \t\tcase StreamRole::StillCapture:\n \t\t\t/*\n-\t\t\t * Pick the output stream by default as the Viewfinder\n-\t\t\t * and VideoRecording roles are not allowed on\n-\t\t\t * the output stream.\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\tif (streams.find(&data->outStream_) != streams.end()) {\n-\t\t\t\tstream = &data->outStream_;\n-\t\t\t} else if (streams.find(&data->vfStream_) != streams.end()) {\n-\t\t\t\tstream = &data->vfStream_;\n-\t\t\t} else {\n-\t\t\t\tLOG(IPU3, Error)\n-\t\t\t\t\t<< \"No stream available for requested role \"\n-\t\t\t\t\t<< role;\n-\t\t\t\tbreak;\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 \n-\t\t\t/*\n-\t\t\t * FIXME: Soraka: the maximum resolution reported by\n-\t\t\t * both sensors (2592x1944 for ov5670 and 4224x3136 for\n-\t\t\t * ov13858) are returned as default configurations but\n-\t\t\t * they're not correctly processed by the ImgU.\n-\t\t\t * Resolutions up tp 2560x1920 have been validated.\n-\t\t\t *\n-\t\t\t * \\todo Clarify ImgU alignment requirements.\n-\t\t\t */\n-\t\t\tcfg.size = { 2560, 1920 };\n+\t\t\toutCount++;\n \n \t\t\tbreak;\n \n \t\tcase StreamRole::StillCaptureRaw: {\n-\t\t\tif (streams.find(&data->rawStream_) == streams.end()) {\n-\t\t\t\tLOG(IPU3, Error)\n-\t\t\t\t\t<< \"Multiple raw streams are not supported\";\n-\t\t\t\tbreak;\n-\t\t\t}\n+\t\t\tcfg = data->cio2_.generateConfiguration(sensorResolution);\n+\t\t\tcfg.bufferCount = 1;\n \n-\t\t\tstream = &data->rawStream_;\n+\t\t\trawCount++;\n \n-\t\t\tcfg.size = data->cio2_.sensor()->resolution();\n-\n-\t\t\tcfg = data->cio2_.generateConfiguration(cfg.size);\n \t\t\tbreak;\n \t\t}\n \n \t\tcase StreamRole::Viewfinder:\n \t\tcase StreamRole::VideoRecording: {\n-\t\t\t/*\n-\t\t\t * We can't use the 'output' stream for viewfinder or\n-\t\t\t * video capture roles.\n-\t\t\t *\n-\t\t\t * \\todo This is an artificial limitation until we\n-\t\t\t * figure out the exact capabilities of the hardware.\n-\t\t\t */\n-\t\t\tif (streams.find(&data->vfStream_) == streams.end()) {\n-\t\t\t\tLOG(IPU3, Error)\n-\t\t\t\t\t<< \"No stream available for requested role \"\n-\t\t\t\t\t<< role;\n-\t\t\t\tbreak;\n-\t\t\t}\n-\n-\t\t\tstream = &data->vfStream_;\n-\n \t\t\t/*\n \t\t\t * Align the default viewfinder size to the maximum\n \t\t\t * available sensor resolution and to the IPU3\n \t\t\t * alignment constraints.\n \t\t\t */\n-\t\t\tconst Size &res = data->cio2_.sensor()->resolution();\n-\t\t\tunsigned int width = std::min(1280U, res.width);\n-\t\t\tunsigned int height = std::min(720U, res.height);\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+\n+\t\t\toutCount++;\n \n \t\t\tbreak;\n \t\t}\n@@ -388,16 +349,16 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \t\tdefault:\n \t\t\tLOG(IPU3, Error)\n \t\t\t\t<< \"Requested stream role not supported: \" << role;\n-\t\t\tbreak;\n+\t\t\tdelete config;\n+\t\t\treturn nullptr;\n \t\t}\n \n-\t\tif (!stream) {\n+\t\tif (rawCount > 1 || outCount > 2) {\n+\t\t\tLOG(IPU3, Error) << \"Invalid stream roles requested\";\n \t\t\tdelete config;\n \t\t\treturn nullptr;\n \t\t}\n \n-\t\tstreams.erase(stream);\n-\n \t\tconfig->addConfiguration(cfg);\n \t}\n \n", "prefixes": [ "libcamera-devel", "02/15" ] }