Patch Detail
Show a patch.
GET /api/patches/8693/?format=api
{ "id": 8693, "url": "https://patchwork.libcamera.org/api/patches/8693/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8693/", "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": "<20200709084128.5316-3-jacopo@jmondi.org>", "date": "2020-07-09T08:41:10", "name": "[libcamera-devel,v2,02/20] libcamera: ipu3: Remove streams from generateConfiguration", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "ebfdcf3ba8cbd66c144a435d01bbd51de606e662", "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/8693/mbox/", "series": [ { "id": 1091, "url": "https://patchwork.libcamera.org/api/series/1091/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1091", "date": "2020-07-09T08:41:08", "name": "libcamera: ipu3: Rework configuration", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1091/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8693/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8693/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 6D35EBD790\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 9 Jul 2020 08:38:07 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2AD916118C;\n\tThu, 9 Jul 2020 10:38:07 +0200 (CEST)", "from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3570161158\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 9 Jul 2020 10:38:05 +0200 (CEST)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 4CA1D10000B;\n\tThu, 9 Jul 2020 08:38:02 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 9 Jul 2020 10:41:10 +0200", "Message-Id": "<20200709084128.5316-3-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200709084128.5316-1-jacopo@jmondi.org>", "References": "<20200709084128.5316-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 02/20] 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 assignment from the IPU3 pipeline handler\ngenerateConfiguration() implementation.\n\nThe function aims to provide a suitable default for the requested use\ncases. Defer stream assignment to validation and only initialize sizes\nand formats.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 104 ++++++++-------------------\n 1 file changed, 30 insertions(+), 74 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex af51fb2d1718..85d21b4db046 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -31,6 +31,14 @@ 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+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+static constexpr unsigned int IPU3_OUTPUT_WIDTH_ALIGN = 0x3f;\n+static constexpr unsigned int IPU3_OUTPUT_HEIGHT_ALIGN = 0x3;\n+\n class IPU3CameraData : public CameraData\n {\n public:\n@@ -61,9 +69,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 +298,51 @@ 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 \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 */\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-\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 * Use the sensor resolution aligned to the ImgU\n+\t\t\t * output constraints.\n \t\t\t */\n-\t\t\tcfg.size = { 2560, 1920 };\n+\t\t\tcfg.size.width = std::min(sensorResolution.width,\n+\t\t\t\t\t\t IPU3_OUTPUT_MAX_WIDTH);\n+\t\t\tcfg.size.height = std::min(sensorResolution.height,\n+\t\t\t\t\t\t IPU3_OUTPUT_MAX_HEIGHT);\n+\t\t\tcfg.size.width &= ~IPU3_OUTPUT_WIDTH_ALIGN;\n+\t\t\tcfg.size.height &= ~IPU3_OUTPUT_HEIGHT_ALIGN;\n+\t\t\tcfg.pixelFormat = formats::NV12;\n+\t\t\tcfg.bufferCount = IPU3_BUFFER_COUNT;\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-\n-\t\t\tstream = &data->rawStream_;\n-\n-\t\t\tcfg.size = data->cio2_.sensor()->resolution();\n+\t\t\tcfg = data->cio2_.generateConfiguration(sensorResolution);\n+\t\t\tcfg.bufferCount = 1;\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 * Default viewfinder to 1280x720, capped to the maximum\n+\t\t\t * sensor resolution and aligned to the ImgU output\n+\t\t\t * constraints.\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\tcfg.size = { width & ~7, height & ~3 };\n+\t\t\tcfg.size.width = std::min(1280U, sensorResolution.width);\n+\t\t\tcfg.size.height = std::min(720U, sensorResolution.height);\n+\t\t\tcfg.size.width &= ~IPU3_OUTPUT_WIDTH_ALIGN;\n+\t\t\tcfg.size.height &= ~IPU3_OUTPUT_HEIGHT_ALIGN;\n+\t\t\tcfg.pixelFormat = formats::NV12;\n+\t\t\tcfg.bufferCount = IPU3_BUFFER_COUNT;\n \n \t\t\tbreak;\n \t\t}\n@@ -388,16 +350,10 @@ 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}\n-\n-\t\tif (!stream) {\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", "v2", "02/20" ] }