Patch Detail
Show a patch.
GET /api/patches/339/?format=api
{ "id": 339, "url": "https://patchwork.libcamera.org/api/patches/339/?format=api", "web_url": "https://patchwork.libcamera.org/patch/339/", "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": "<20190122234505.32634-6-niklas.soderlund@ragnatech.se>", "date": "2019-01-22T23:45:02", "name": "[libcamera-devel,5/8] libcamera: pipelines: add method to configure streams", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "3064d7b2366740795dbc2eb57669174dc8345184", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/339/mbox/", "series": [ { "id": 118, "url": "https://patchwork.libcamera.org/api/series/118/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=118", "date": "2019-01-22T23:44:57", "name": "libcamera: add basic support for Streams and format configuration", "version": 1, "mbox": "https://patchwork.libcamera.org/series/118/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/339/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/339/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9466C60C98\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jan 2019 00:46:42 +0100 (CET)", "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid eb2ce716-1e9f-11e9-911a-0050569116f7;\n\tWed, 23 Jan 2019 00:46:20 +0100 (CET)" ], "X-Halon-ID": "eb2ce716-1e9f-11e9-911a-0050569116f7", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 23 Jan 2019 00:45:02 +0100", "Message-Id": "<20190122234505.32634-6-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190122234505.32634-1-niklas.soderlund@ragnatech.se>", "References": "<20190122234505.32634-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 5/8] libcamera: pipelines: add method to\n\tconfigure streams", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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>", "X-List-Received-Date": "Tue, 22 Jan 2019 23:46:42 -0000" }, "content": "All the streams which are to be used needs to be configured at the same\ntime, that is passed from the application to the pipeline handler in a\nsingle call. This would allow the pipeline handler to take any\ndependences between the different streams and there configuration into\naccount when setting up the hardware.\n\nThis implementation do not interact with any hardware, instead it\nextends all pipeline handlers with the argument validation needed to\nmake sure the configuration request is sound. It then proceeds to print\nthe requested frame dimensions to the log. Future work based on more\ncomponents are needed to make the pipeline specific implementations\ntruly useful.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/pipeline_handler.h | 3 +++\n src/libcamera/pipeline/ipu3/ipu3.cpp | 24 ++++++++++++++++++++++++\n src/libcamera/pipeline/uvcvideo.cpp | 24 ++++++++++++++++++++++++\n src/libcamera/pipeline/vimc.cpp | 24 ++++++++++++++++++++++++\n src/libcamera/pipeline_handler.cpp | 18 ++++++++++++++++++\n 5 files changed, 93 insertions(+)", "diff": "diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex d4473bf173b815af..751eb4e1bb4bf69b 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -18,6 +18,7 @@ namespace libcamera {\n class CameraManager;\n class DeviceEnumerator;\n class Stream;\n+class StreamConfiguration;\n \n class PipelineHandler\n {\n@@ -26,6 +27,8 @@ public:\n \n \tvirtual std::vector<Stream> streams(const Camera *camera) const = 0;\n \n+\tvirtual int configure(const Camera *camera, std::vector<StreamConfiguration *> &config) = 0;\n+\n \tvirtual bool match(CameraManager *manager, DeviceEnumerator *enumerator) = 0;\n };\n \ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex f73479125ed5e21d..5252fab226a1da71 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -29,6 +29,8 @@ public:\n \n \tstd::vector<Stream> streams(const Camera *camera) const;\n \n+\tint configure(const Camera *camera, std::vector<StreamConfiguration *> &config);\n+\n \tbool match(CameraManager *manager, DeviceEnumerator *enumerator);\n \n private:\n@@ -74,6 +76,28 @@ std::vector<Stream> PipelineHandlerIPU3::streams(const Camera *camera) const\n \treturn streams;\n }\n \n+int PipelineHandlerIPU3::configure(const Camera *camera,\n+\t\t\t\t std::vector<StreamConfiguration *> &config)\n+{\n+\tStreamConfiguration *cfg;\n+\n+\tif (!handleCamera(camera))\n+\t\treturn -EINVAL;\n+\n+\tif (config.size() != 1)\n+\t\treturn -EINVAL;\n+\n+\tcfg = config.front();\n+\n+\tif (!cfg || cfg->id() != 0)\n+\t\treturn -EINVAL;\n+\n+\tLOG(IPU3, Info) << \"TODO: Configure the camera for resolution \" <<\n+\t\tcfg->width() << \"x\" << cfg->height();\n+\n+\treturn 0;\n+}\n+\n bool PipelineHandlerIPU3::match(CameraManager *manager, DeviceEnumerator *enumerator)\n {\n \tDeviceMatch cio2_dm(\"ipu3-cio2\");\ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 87b556ba0ae17696..dd494d2599bef813 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -26,6 +26,8 @@ public:\n \n \tstd::vector<Stream> streams(const Camera *camera) const;\n \n+\tint configure(const Camera *camera, std::vector<StreamConfiguration *> &config);\n+\n \tbool match(CameraManager *manager, DeviceEnumerator *enumerator);\n \n private:\n@@ -59,6 +61,28 @@ std::vector<Stream> PipelineHandlerUVC::streams(const Camera *camera) const\n \treturn streams;\n }\n \n+int PipelineHandlerUVC::configure(const Camera *camera,\n+\t\t\t\t std::vector<StreamConfiguration *> &config)\n+{\n+\tStreamConfiguration *cfg;\n+\n+\tif (!camera || camera != camera_.get())\n+\t\treturn -EINVAL;\n+\n+\tif (config.size() != 1)\n+\t\treturn -EINVAL;\n+\n+\tcfg = config.front();\n+\n+\tif (!cfg || cfg->id() != 0)\n+\t\treturn -EINVAL;\n+\n+\tLOG(UVC, Info) << \"TODO: Configure the camera for resolution \" <<\n+\t\tcfg->width() << \"x\" << cfg->height();\n+\n+\treturn 0;\n+}\n+\n bool PipelineHandlerUVC::match(CameraManager *manager, DeviceEnumerator *enumerator)\n {\n \tDeviceMatch dm(\"uvcvideo\");\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex e894367ba6706aaf..31b08a766cb32702 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -26,6 +26,8 @@ public:\n \n \tstd::vector<Stream> streams(const Camera *camera) const;\n \n+\tint configure(const Camera *camera, std::vector<StreamConfiguration *> &config);\n+\n \tbool match(CameraManager *manager, DeviceEnumerator *enumerator);\n \n private:\n@@ -59,6 +61,28 @@ std::vector<Stream> PipeHandlerVimc::streams(const Camera *camera) const\n \treturn streams;\n }\n \n+int PipeHandlerVimc::configure(const Camera *camera,\n+\t\t\t std::vector<StreamConfiguration *> &config)\n+{\n+\tStreamConfiguration *cfg;\n+\n+\tif (!camera || camera != camera_.get())\n+\t\treturn -EINVAL;\n+\n+\tif (config.size() != 1)\n+\t\treturn -EINVAL;\n+\n+\tcfg = config.front();\n+\n+\tif (!cfg || cfg->id() != 0)\n+\t\treturn -EINVAL;\n+\n+\tLOG(VIMC, Info) << \"TODO: Configure the camera for resolution \" <<\n+\t\tcfg->width() << \"x\" << cfg->height();\n+\n+\treturn 0;\n+}\n+\n bool PipeHandlerVimc::match(CameraManager *manager, DeviceEnumerator *enumerator)\n {\n \tDeviceMatch dm(\"vimc\");\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex c2bed924dece0ac0..533ee64d6ce318c4 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -46,6 +46,24 @@ LOG_DEFINE_CATEGORY(Pipeline)\n * is not part of the PipelineHandler.\n */\n \n+/**\n+ * \\fn PipelineHandler::configure(const Camera *camera, std::vector<StreamConfiguration *> &config)\n+ * \\brief Configure a set of streams for a camera\n+ * \\param[in] camera The camera to configure streams for\n+ * \\param[in] config A array of stream configurations to try and setup\n+ *\n+ * This function is the interface to configure one or more streams of a camera\n+ * for capture. The intended user for this interface is the Camera class which\n+ * will receive the array of configurations to apply from the application.\n+ *\n+ * The caller needs to verify the StreamConfiguration objects in the passed\n+ * array after the call as it might remove one or more to satisfy hardware\n+ * limitations. The call might also alter any or all of the configuration\n+ * parameters of any stream to fit within valid operational conditions.\n+ *\n+ * \\return 0 on success or a negative error code on error.\n+ */\n+\n /**\n * \\fn PipelineHandler::match(DeviceEnumerator *enumerator)\n * \\brief Match media devices and create camera instances\n", "prefixes": [ "libcamera-devel", "5/8" ] }