Show a patch.

GET /api/1.1/patches/451/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 451,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/451/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/451/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190130115615.17362-6-niklas.soderlund@ragnatech.se>",
    "date": "2019-01-30T11:56:14",
    "name": "[libcamera-devel,v5,5/6] libcamera: pipeline: extend pipelines to support stream configuration",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "05e2d72a188dfe5fc6eb2643471be20634cf481b",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/451/mbox/",
    "series": [
        {
            "id": 156,
            "url": "https://patchwork.libcamera.org/api/1.1/series/156/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=156",
            "date": "2019-01-30T11:56:09",
            "name": "libcamera: add basic support for streams and format configuration",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/156/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/451/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/451/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 51DE560B2D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 30 Jan 2019 12:57:01 +0100 (CET)",
            "from wyvern.c.hoisthospitality.com (unknown [217.64.245.162])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 241ddefd-2486-11e9-911a-0050569116f7;\n\tWed, 30 Jan 2019 12:56:58 +0100 (CET)"
        ],
        "X-Halon-ID": "241ddefd-2486-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, 30 Jan 2019 12:56:14 +0100",
        "Message-Id": "<20190130115615.17362-6-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190130115615.17362-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190130115615.17362-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v5 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": "Wed, 30 Jan 2019 11:57:01 -0000"
    },
    "content": "All streams which are to be used for capture need to be configured at\nthe same time. This allows the pipeline handler to take any dependencies\nbetween the different streams and their configuration into account when\nsetting up the hardware.\n\nExtend the pipeline API and all pipeline implementations with two new\nfunctions, one to read a default configuration and one to set a new\nconfiguration. Both functions operate on a group of streams which the\npipeline handler should 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\nreturn a null format and logs that a default configuration have been\nrequested and log that a new configuration have been requested. Future\nwork based on more components are needed to make the pipelines return a\ngood default format and actually interact with the hardware.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/pipeline_handler.h |  7 +++++\n src/libcamera/pipeline/ipu3/ipu3.cpp     | 36 ++++++++++++++++++++++++\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, 147 insertions(+)",
    "diff": "diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex 080997e22e545e01..b4321f0fa0f765be 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -18,6 +18,8 @@ class Camera;\n class CameraManager;\n class DeviceEnumerator;\n class MediaDevice;\n+class Stream;\n+class StreamConfiguration;\n \n class CameraData\n {\n@@ -38,6 +40,11 @@ public:\n \tPipelineHandler(CameraManager *manager);\n \tvirtual ~PipelineHandler();\n \n+\tvirtual std::map<Stream *, StreamConfiguration>\n+\tstreamConfiguration(Camera *camera, std::vector<Stream *> &streams) = 0;\n+\tvirtual int configureStreams(Camera *camera,\n+\t\t\t\t     std::map<Stream *, 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 52844da78419943d..39553b7c19823a52 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<Stream *, StreamConfiguration>\n+\tstreamConfiguration(Camera *camera,\n+\t\t\t    std::vector<Stream *> &streams);\n+\tint configureStreams(Camera *camera,\n+\t\t\t     std::map<Stream *, StreamConfiguration> &config);\n+\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n@@ -68,6 +74,36 @@ PipelineHandlerIPU3::~PipelineHandlerIPU3()\n \t\timgu_->release();\n }\n \n+std::map<Stream *, StreamConfiguration>\n+PipelineHandlerIPU3::streamConfiguration(Camera *camera,\n+\t\t\t\t\t std::vector<Stream *> &streams)\n+{\n+\tIPU3CameraData *data = dynamic_cast<IPU3CameraData *>(cameraData(camera));\n+\n+\tstd::map<Stream *, StreamConfiguration> configs;\n+\n+\tStreamConfiguration config{};\n+\n+\tLOG(IPU3, Info) << \"TODO: Return a good default format\";\n+\n+\tconfigs[&data->stream_] = config;\n+\n+\treturn configs;\n+}\n+\n+int PipelineHandlerIPU3::configureStreams(Camera *camera,\n+\t\t\t\t\t  std::map<Stream *, StreamConfiguration> &config)\n+{\n+\tIPU3CameraData *data = dynamic_cast<IPU3CameraData *>(cameraData(camera));\n+\n+\tStreamConfiguration *cfg = &config[&data->stream_];\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 8ea7ac74d2a5395d..4647ed95e929940a 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<Stream *, StreamConfiguration>\n+\tstreamConfiguration(Camera *camera,\n+\t\t\t    std::vector<Stream *> &streams);\n+\tint configureStreams(Camera *camera,\n+\t\t\t     std::map<Stream *, StreamConfiguration> &config);\n+\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n@@ -43,6 +52,32 @@ PipelineHandlerUVC::~PipelineHandlerUVC()\n \t\tmedia_->release();\n }\n \n+std::map<Stream *, StreamConfiguration>\n+PipelineHandlerUVC::streamConfiguration(Camera *camera,\n+\t\t\t\t\tstd::vector<Stream *> &streams)\n+{\n+\tstd::map<Stream *, StreamConfiguration> configs;\n+\n+\tStreamConfiguration config{};\n+\n+\tLOG(UVC, Info) << \"TODO: Return a good default format\";\n+\n+\tconfigs[&stream_] = config;\n+\n+\treturn configs;\n+}\n+\n+int PipelineHandlerUVC::configureStreams(Camera *camera,\n+\t\t\t\t\t std::map<Stream *, StreamConfiguration> &config)\n+{\n+\tStreamConfiguration *cfg = &config[&stream_];\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 9e1cf11a20c7a7e3..835f8f512c4ac53a 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<Stream *, StreamConfiguration>\n+\tstreamConfiguration(Camera *camera,\n+\t\t\t    std::vector<Stream *> &streams);\n+\tint configureStreams(Camera *camera,\n+\t\t\t     std::map<Stream *, StreamConfiguration> &config);\n+\n \tbool match(DeviceEnumerator *enumerator);\n \n private:\n@@ -38,6 +47,32 @@ PipeHandlerVimc::~PipeHandlerVimc()\n \t\tmedia_->release();\n }\n \n+std::map<Stream *, StreamConfiguration>\n+PipeHandlerVimc::streamConfiguration(Camera *camera,\n+\t\t\t\t     std::vector<Stream *> &streams)\n+{\n+\tstd::map<Stream *, StreamConfiguration> configs;\n+\n+\tStreamConfiguration config{};\n+\n+\tLOG(VIMC, Info) << \"TODO: Return a good default format\";\n+\n+\tconfigs[&stream_] = config;\n+\n+\treturn configs;\n+}\n+\n+int PipeHandlerVimc::configureStreams(Camera *camera,\n+\t\t\t\t      std::map<Stream *, StreamConfiguration> &config)\n+{\n+\tStreamConfiguration *cfg = &config[&stream_];\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..3a560e10c442717f 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()\n+ * \\brief Retrieve a group of stream configurations for a specified camera\n+ * \\param[in] camera The camera to fetch default configuration from\n+ * \\param[in] streams An array of streams to fetch information about\n+ *\n+ * Retrieve the species camera's default configuration for a specified group of\n+ * streams. The caller shall populate the \\a streams array with the streams it\n+ * wish to fetch the configuration from. The map of streams and configuration\n+ * returned can then be examined by the caller to learn about the defualt\n+ * parameters for 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 streams and configurations or an\n+ * empty map on error.\n+ */\n+\n+/**\n+ * \\fn PipelineHandler::configureStreams()\n+ * \\brief Configure a group of streams for capture\n+ * \\param[in] camera The camera to configure\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",
        "v5",
        "5/6"
    ]
}