Show a patch.

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

{
    "id": 2025,
    "url": "https://patchwork.libcamera.org/api/patches/2025/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2025/",
    "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": "<20190927024417.725906-2-niklas.soderlund@ragnatech.se>",
    "date": "2019-09-27T02:44:05",
    "name": "[libcamera-devel,v3,01/13] libcamera: pipeline: Move IPA from pipeline to camera data",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "9ba5437c5149cae83bd2be54adef228de3913ab0",
    "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/2025/mbox/",
    "series": [
        {
            "id": 508,
            "url": "https://patchwork.libcamera.org/api/series/508/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=508",
            "date": "2019-09-27T02:44:04",
            "name": "libcamera: ipa: Add basic IPA support",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/508/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2025/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2025/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 F2F95616FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Sep 2019 04:45:24 +0200 (CEST)",
            "from bismarck.berto.se (unknown [84.172.88.101])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid cba09546-e0d0-11e9-bdc3-005056917a89;\n\tFri, 27 Sep 2019 04:44:59 +0200 (CEST)"
        ],
        "X-Halon-ID": "cba09546-e0d0-11e9-bdc3-005056917a89",
        "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": "Fri, 27 Sep 2019 04:44:05 +0200",
        "Message-Id": "<20190927024417.725906-2-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20190927024417.725906-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190927024417.725906-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 01/13] libcamera: pipeline: Move IPA\n\tfrom pipeline to camera data",
        "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>",
        "X-List-Received-Date": "Fri, 27 Sep 2019 02:45:25 -0000"
    },
    "content": "The IPA acts on a camera and not on a pipeline which can expose more\nthen one camera. Move the IPA reference to the CameraData and move the\nloading of an IPA from the specific pipeline handler implementation to\nbase PipelineHandler.\n\nIt's still possible to expose a camera without an IPA but if an IPA is\nrequest the camera is not valid and will not be registered in the system\nif a suiting IPA module can't be found.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/pipeline_handler.h |  4 +++\n src/libcamera/pipeline/vimc.cpp          | 17 ++++++------\n src/libcamera/pipeline_handler.cpp       | 33 ++++++++++++++++++++++++\n 3 files changed, 46 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex 1fdef9cea40f1f0a..4400c7ed835f551d 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -14,6 +14,7 @@\n #include <string>\n #include <vector>\n \n+#include <ipa/ipa_interface.h>\n #include <libcamera/controls.h>\n #include <libcamera/stream.h>\n \n@@ -39,10 +40,13 @@ public:\n \t}\n \tvirtual ~CameraData() {}\n \n+\tvirtual int loadIPA() { return 0; };\n+\n \tCamera *camera_;\n \tPipelineHandler *pipe_;\n \tstd::list<Request *> queuedRequests_;\n \tControlInfoMap controlInfo_;\n+\tstd::unique_ptr<IPAInterface> ipa_;\n \n private:\n \tCameraData(const CameraData &) = delete;\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex f26a91f86ec1794c..2fa48586fea0b80e 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -52,6 +52,15 @@ public:\n \t\tdelete raw_;\n \t}\n \n+\tint loadIPA() override\n+\t{\n+\t\tipa_ = IPAManager::instance()->createIPA(pipe_, 0, 0);\n+\t\tif (!ipa_)\n+\t\t\treturn -ENOENT;\n+\n+\t\treturn 0;\n+\t}\n+\n \tint init(MediaDevice *media);\n \tvoid bufferReady(Buffer *buffer);\n \n@@ -100,8 +109,6 @@ private:\n \t\treturn static_cast<VimcCameraData *>(\n \t\t\tPipelineHandler::cameraData(camera));\n \t}\n-\n-\tstd::unique_ptr<IPAInterface> ipa_;\n };\n \n VimcCameraConfiguration::VimcCameraConfiguration()\n@@ -361,12 +368,6 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)\n \tif (!media)\n \t\treturn false;\n \n-\tipa_ = IPAManager::instance()->createIPA(this, 0, 0);\n-\tif (ipa_ == nullptr)\n-\t\tLOG(VIMC, Warning) << \"no matching IPA found\";\n-\telse\n-\t\tipa_->init();\n-\n \tstd::unique_ptr<VimcCameraData> data = utils::make_unique<VimcCameraData>(this);\n \n \t/* Locate and open the capture video node. */\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 3e54aa23d92b9a36..b8a3787e10a587b5 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -12,6 +12,7 @@\n #include <libcamera/camera_manager.h>\n \n #include \"device_enumerator.h\"\n+#include \"ipa_manager.h\"\n #include \"log.h\"\n #include \"media_device.h\"\n #include \"utils.h\"\n@@ -58,6 +59,20 @@ LOG_DEFINE_CATEGORY(Pipeline)\n  * exists.\n  */\n \n+/**\n+ * \\fn CameraData::loadIPA()\n+ * \\brief Load an IPA for the camera\n+ *\n+ * This function shall be implemented by pipeline handlers that wish to have an\n+ * IPA. The function must locate and load an IPA, storing a pointer to it in\n+ * the \\a ipa_ or fail.\n+ *\n+ * If the pipeline handler do not wish to use an IPA this function shall not\n+ * be implemented.\n+ *\n+ * \\return True if a IPA could be loaded, false otherwise\n+ */\n+\n /**\n  * \\var CameraData::camera_\n  * \\brief The camera related to this CameraData instance\n@@ -96,6 +111,14 @@ LOG_DEFINE_CATEGORY(Pipeline)\n  * creating the camera, and shall not be modified afterwards.\n  */\n \n+/**\n+ * \\var CameraData::ipa_\n+ * \\brief The IPA module used by the camera\n+ *\n+ * Reference to the Image Processing Algorithms (IPA) operating on the camera's\n+ * stream(s). If no IPAs are in operation this should be set to nullptr.\n+ */\n+\n /**\n  * \\class PipelineHandler\n  * \\brief Create and manage cameras based on a set of media devices\n@@ -425,6 +448,16 @@ void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera,\n \t\t\t\t     std::unique_ptr<CameraData> data)\n {\n \tdata->camera_ = camera.get();\n+\n+\tif (data->loadIPA()) {\n+\t\tLOG(Pipeline, Warning) << \"Skipping \" << camera->name()\n+\t\t\t\t       << \" no IPA found\";\n+\t\treturn;\n+\t}\n+\n+\tif (data->ipa_)\n+\t\tdata->ipa_->init();\n+\n \tcameraData_[camera.get()] = std::move(data);\n \tcameras_.push_back(camera);\n \tmanager_->addCamera(std::move(camera));\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "01/13"
    ]
}