Patch Detail
Show a patch.
GET /api/patches/414/?format=api
{ "id": 414, "url": "https://patchwork.libcamera.org/api/patches/414/?format=api", "web_url": "https://patchwork.libcamera.org/patch/414/", "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": "<20190127002208.18913-6-niklas.soderlund@ragnatech.se>", "date": "2019-01-27T00:22:07", "name": "[libcamera-devel,v3,5/6] libcamera: pipeline: extend pipelines to support stream configuration", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "557714d80f348c7f94d1dc687fca087001ab24ba", "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/414/mbox/", "series": [ { "id": 144, "url": "https://patchwork.libcamera.org/api/series/144/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=144", "date": "2019-01-27T00:22:04", "name": "libcamera: add basic support for streams and format configuration", "version": 3, "mbox": "https://patchwork.libcamera.org/series/144/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/414/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/414/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F1CDE60C7F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 27 Jan 2019 01:22:57 +0100 (CET)", "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid b1e6aa96-21c9-11e9-874f-005056917f90;\n\tSun, 27 Jan 2019 01:22:56 +0100 (CET)" ], "X-Halon-ID": "b1e6aa96-21c9-11e9-874f-005056917f90", "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": "Sun, 27 Jan 2019 01:22:07 +0100", "Message-Id": "<20190127002208.18913-6-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190127002208.18913-1-niklas.soderlund@ragnatech.se>", "References": "<20190127002208.18913-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 5/6] libcamera: pipeline: extend\n\tpipelines to support stream configuration", "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": "Sun, 27 Jan 2019 00:22:58 -0000" }, "content": "All streams which are to be used for capture needs to be configured at\nthe same time. This allows the pipeline handler to take any dependences\nbetween the different streams and there configuration into account when\nsetting up the hardware.\n\nExtend the pipeline API and all pipeline implementations with two new\nfunctions, one to read the configuration and one to update it. Both\nfunctions operate on a group of streams which the pipeline handler\nshould consider when performing the operations.\n\nIn the current implemented pipelines this is rather easy as they only\nhave one stream each per camera. Furthermore as there is yet no way for\nthe pipeline handlers to interact with the hardware all they do is log\nthat the format have been read or updated. Future work based on more\ncomponents are needed to make the pipelines actually interact with the\nhardware.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/pipeline_handler.h | 8 ++++++\n src/libcamera/pipeline/ipu3/ipu3.cpp | 32 ++++++++++++++++++++++\n src/libcamera/pipeline/uvcvideo.cpp | 35 ++++++++++++++++++++++++\n src/libcamera/pipeline/vimc.cpp | 35 ++++++++++++++++++++++++\n src/libcamera/pipeline_handler.cpp | 34 +++++++++++++++++++++++\n 5 files changed, 144 insertions(+)", "diff": "diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex ca77a40b96e69b66..c19eb9b73ede8720 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -17,6 +17,8 @@ namespace libcamera {\n class CameraManager;\n class DeviceEnumerator;\n class MediaDevice;\n+class Stream;\n+class StreamConfiguration;\n \n class Camera;\n class CameraData\n@@ -38,6 +40,12 @@ public:\n \tPipelineHandler(CameraManager *manager);\n \tvirtual ~PipelineHandler();\n \n+\tvirtual std::map<unsigned int, StreamConfiguration>\n+\tstreamConfiguration(const Camera *camera,\n+\t\t\t const std::vector<Stream> &streams) const = 0;\n+\tvirtual int configureStreams(const Camera *camera,\n+\t\t\t\t std::map<unsigned int, StreamConfiguration> &config) = 0;\n+\n \tvirtual bool match(DeviceEnumerator *enumerator) = 0;\n \n protected:\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex dbb2a89163c36cbc..ff4d73f947a683ca 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -28,6 +28,12 @@ public:\n \tPipelineHandlerIPU3(CameraManager *manager);\n \t~PipelineHandlerIPU3();\n \n+\tstd::map<unsigned int, StreamConfiguration>\n+\tstreamConfiguration(const Camera *camera,\n+\t\t\t const std::vector<Stream> &streams) const;\n+\tint configureStreams(const Camera *camera,\n+\t\t\t std::map<unsigned int, StreamConfiguration> &config);\n+\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n@@ -61,6 +67,32 @@ PipelineHandlerIPU3::~PipelineHandlerIPU3()\n \t\timgu_->release();\n }\n \n+std::map<unsigned int, StreamConfiguration>\n+PipelineHandlerIPU3::streamConfiguration(const Camera *camera,\n+\t\t\t\t\t const std::vector<Stream> &streams) const\n+{\n+\tstd::map<unsigned int, StreamConfiguration> configs;\n+\n+\tStreamConfiguration config;\n+\n+\tLOG(IPU3, Info) << \"TODO: Fetch stream configuration\";\n+\n+\tconfigs[0] = config;\n+\n+\treturn configs;\n+}\n+\n+int PipelineHandlerIPU3::configureStreams(const Camera *camera,\n+\t\t\t\t\t std::map<unsigned int, StreamConfiguration> &config)\n+{\n+\tStreamConfiguration *cfg = &config[0];\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(DeviceEnumerator *enumerator)\n {\n \tDeviceMatch cio2_dm(\"ipu3-cio2\");\ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex bc4a8d7236be589d..bba4655a0a26b622 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -9,18 +9,27 @@\n #include <libcamera/stream.h>\n \n #include \"device_enumerator.h\"\n+#include \"log.h\"\n #include \"media_device.h\"\n #include \"pipeline_handler.h\"\n #include \"v4l2_device.h\"\n \n namespace libcamera {\n \n+LOG_DEFINE_CATEGORY(UVC)\n+\n class PipelineHandlerUVC : public PipelineHandler\n {\n public:\n \tPipelineHandlerUVC(CameraManager *manager);\n \t~PipelineHandlerUVC();\n \n+\tstd::map<unsigned int, StreamConfiguration>\n+\tstreamConfiguration(const Camera *camera,\n+\t\t\t const std::vector<Stream> &streams) const;\n+\tint configureStreams(const Camera *camera,\n+\t\t\t std::map<unsigned int, StreamConfiguration> &config);\n+\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n@@ -42,6 +51,32 @@ PipelineHandlerUVC::~PipelineHandlerUVC()\n \t\tmedia_->release();\n }\n \n+std::map<unsigned int, StreamConfiguration>\n+PipelineHandlerUVC::streamConfiguration(const Camera *camera,\n+\t\t\t\t\tconst std::vector<Stream> &streams) const\n+{\n+\tstd::map<unsigned int, StreamConfiguration> configs;\n+\n+\tStreamConfiguration config;\n+\n+\tLOG(UVC, Info) << \"TODO: Fetch stream configuration\";\n+\n+\tconfigs[0] = config;\n+\n+\treturn configs;\n+}\n+\n+int PipelineHandlerUVC::configureStreams(const Camera *camera,\n+\t\t\t\t\t std::map<unsigned int, StreamConfiguration> &config)\n+{\n+\tStreamConfiguration *cfg = &config[0];\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(DeviceEnumerator *enumerator)\n {\n \tDeviceMatch dm(\"uvcvideo\");\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex c426a953aea1b3dd..c9810a8e192ac68b 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -9,17 +9,26 @@\n #include <libcamera/stream.h>\n \n #include \"device_enumerator.h\"\n+#include \"log.h\"\n #include \"media_device.h\"\n #include \"pipeline_handler.h\"\n \n namespace libcamera {\n \n+LOG_DEFINE_CATEGORY(VIMC)\n+\n class PipeHandlerVimc : public PipelineHandler\n {\n public:\n \tPipeHandlerVimc(CameraManager *manager);\n \t~PipeHandlerVimc();\n \n+\tstd::map<unsigned int, StreamConfiguration>\n+\tstreamConfiguration(const Camera *camera,\n+\t\t\t const std::vector<Stream> &streams) const;\n+\tint configureStreams(const Camera *camera,\n+\t\t\t std::map<unsigned int, StreamConfiguration> &config);\n+\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n@@ -37,6 +46,32 @@ PipeHandlerVimc::~PipeHandlerVimc()\n \t\tmedia_->release();\n }\n \n+std::map<unsigned int, StreamConfiguration>\n+PipeHandlerVimc::streamConfiguration(const Camera *camera,\n+\t\t\t\t const std::vector<Stream> &streams) const\n+{\n+\tstd::map<unsigned int, StreamConfiguration> configs;\n+\n+\tStreamConfiguration config;\n+\n+\tLOG(VIMC, Info) << \"TODO: Fetch stream configuration\";\n+\n+\tconfigs[0] = config;\n+\n+\treturn configs;\n+}\n+\n+int PipeHandlerVimc::configureStreams(const Camera *camera,\n+\t\t\t\t std::map<unsigned int, StreamConfiguration> &config)\n+{\n+\tStreamConfiguration *cfg = &config[0];\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(DeviceEnumerator *enumerator)\n {\n \tDeviceMatch dm(\"vimc\");\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 1c8640799f714686..ee6d80908f67d564 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -75,6 +75,40 @@ PipelineHandler::~PipelineHandler()\n {\n };\n \n+\n+/**\n+ * \\fn PipelineHandler::streamConfiguration(const Camera *camera, * const std::vector<Stream> &streams)\n+ * \\brief Retrieve a group of stream configurations for a specified camera\n+ * \\param[in] camera The camera to fetch the configuration from\n+ * \\param[in] streams An array of streams to fetch information about\n+ *\n+ * Retrieve the species camera's configuration for a specified group of streams.\n+ * The caller shall populate the \\a streams array with the streams it wish to\n+ * fetch the configuration from. The map of stream IDs and configuration\n+ * returned can then be examined by the caller to learn about the parameters for\n+ * the specified streams.\n+ *\n+ * The intended companion to this is \\a configureStreams() which can be used to\n+ * change the group of streams parameters.\n+ *\n+ * \\return A map of successfully retrieved stream IDs and configurations or an\n+ * empty map on error.\n+ */\n+\n+/**\n+ * \\fn PipelineHandler::configureStreams(const Camera *camera, std::map<unsigned int, StreamConfiguration> &config)\n+ * \\brief Configure a group of streams for capture\n+ * \\param[in] camera The camera to apply the configuration to\n+ * \\param[in] config A map of stream configurations to apply\n+ *\n+ * Configure the specified group of streams for \\a camera according to the\n+ * configuration specified in \\a configs. The intended caller of this interface\n+ * is the Camera class which will receive configuration to apply from the\n+ * application.\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", "v3", "5/6" ] }