Show a patch.

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

{
    "id": 769,
    "url": "https://patchwork.libcamera.org/api/patches/769/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/769/",
    "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": "<20190320163055.22056-24-jacopo@jmondi.org>",
    "date": "2019-03-20T16:30:47",
    "name": "[libcamera-devel,v4,23/31] libcamera: ipu3: Enable media links conditionally",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6c40115eb2362a09878191474f7ab05d41c5cb75",
    "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/769/mbox/",
    "series": [
        {
            "id": 214,
            "url": "https://patchwork.libcamera.org/api/series/214/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=214",
            "date": "2019-03-20T16:30:24",
            "name": "libcamera: ipu3: Add ImgU support + multiple streams",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/214/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/769/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/769/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4485561391\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2019 17:30:42 +0100 (CET)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id D0DF5200012;\n\tWed, 20 Mar 2019 16:30:41 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 20 Mar 2019 17:30:47 +0100",
        "Message-Id": "<20190320163055.22056-24-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190320163055.22056-1-jacopo@jmondi.org>",
        "References": "<20190320163055.22056-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 23/31] libcamera: ipu3: Enable media\n\tlinks conditionally",
        "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, 20 Mar 2019 16:30:43 -0000"
    },
    "content": "Add a method to the IPU3 pipeline handler class to enable media links on\nthe ImgU device conditionally to the requested stream configuration.\n\nFIXME: media links for viewfinder and stat node should be enabled\nunconditionally.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 128 +++++++++++++++------------\n 1 file changed, 71 insertions(+), 57 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex ac2b14156d4f..ff1e5329c83d 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -55,7 +55,6 @@ public:\n \tint linkSetup(const std::string &source, unsigned int sourcePad,\n \t\t      const std::string &sink, unsigned int sinkPad,\n \t\t      bool enable);\n-\tint enableLinks(bool enable);\n \n \tunsigned int index_;\n \tstd::string imguName_;\n@@ -201,6 +200,8 @@ private:\n \n \tint initImgU(ImgUDevice *imgu);\n \n+\tint enableImgULinks(IPU3CameraData *data, bool enable);\n+\n \tint setInputFormat(ImgUDevice *imguDevice,\n \t\t\t   const StreamConfiguration &config,\n \t\t\t   Rectangle *rect);\n@@ -364,11 +365,8 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,\n \t\t\tCIO2Config.height = cfg.height;\n \t}\n \n-\t/*\n-\t * \\todo: Enable links selectively based on the requested streams.\n-\t * As of now, enable all links unconditionally.\n-\t */\n-\tret = data->imgu->enableLinks(true);\n+\t/* Enable links selectively based on the requested streams. */\n+\tret = enableImgULinks(data, true);\n \tif (ret)\n \t\treturn ret;\n \n@@ -873,57 +871,6 @@ int ImgUDevice::linkSetup(const std::string &source, unsigned int sourcePad,\n \treturn link->setEnabled(enable);\n }\n \n-/**\n- * \\brief Enable or disable all media links in the ImgU instance to prepare\n- * for capture operations\n- *\n- * \\todo This method will probably be removed or changed once links will be\n- * enabled or disabled selectively.\n- *\n- * \\return 0 on success or a negative error code otherwise\n- */\n-int ImgUDevice::enableLinks(bool enable)\n-{\n-\tstd::string inputName = imguName_ + \" input\";\n-\tstd::string outputName = imguName_ + \" output\";\n-\tstd::string viewfinderName = imguName_ + \" viewfinder\";\n-\tstd::string statName = imguName_ + \" 3a stat\";\n-\tint ret;\n-\n-\t/* \\todo Establish rules to handle media devices open/close. */\n-\tret = mediaDevice_->open();\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tret = linkSetup(inputName, 0, imguName_, PAD_INPUT, enable);\n-\tif (ret) {\n-\t\tmediaDevice_->close();\n-\t\treturn ret;\n-\t}\n-\n-\tret = linkSetup(imguName_, PAD_OUTPUT, outputName, 0, enable);\n-\tif (ret) {\n-\t\tmediaDevice_->close();\n-\t\treturn ret;\n-\t}\n-\n-\tret = linkSetup(imguName_, PAD_VF, viewfinderName, 0, enable);\n-\tif (ret) {\n-\t\tmediaDevice_->close();\n-\t\treturn ret;\n-\t}\n-\n-\tret = linkSetup(imguName_, PAD_STAT, statName, 0, enable);\n-\tif (ret) {\n-\t\tmediaDevice_->close();\n-\t\treturn ret;\n-\t}\n-\n-\tmediaDevice_->close();\n-\n-\treturn 0;\n-}\n-\n int PipelineHandlerIPU3::mediaBusToCIO2Format(unsigned int code)\n {\n \tswitch (code) {\n@@ -1152,6 +1099,73 @@ void PipelineHandlerIPU3::deleteCIO2(CIO2Device *cio2)\n \tdelete cio2->sensor;\n }\n \n+/**\n+ * \\brief Enable links on the ImgU media graph based on the requested\n+ * stream configuration\n+ *\n+ * FIXME: viewfinder and stat should be enabled conditionally on the requested\n+ * stream configuration. As of now, the IPU3 driver requires them to be\n+ * operated unconditionally not to stall ImgU operations.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+int PipelineHandlerIPU3::enableImgULinks(IPU3CameraData *data, bool enable)\n+{\n+\tImgUDevice *imgu = data->imgu;\n+\tstd::string inputName = imgu->imguName_ + \" input\";\n+\tstd::string outputName = imgu->imguName_ + \" output\";\n+\tstd::string viewfinderName = imgu->imguName_ + \" viewfinder\";\n+\tstd::string statName = imgu->imguName_ + \" 3a stat\";\n+\tMediaDevice *media = imgu->mediaDevice_;\n+\tint ret;\n+\n+\t/* \\todo Establish rules to handle media devices open/close. */\n+\tret = media->open();\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = imgu->linkSetup(inputName, 0, imgu->imguName_,\n+\t\t\t      ImgUDevice::PAD_INPUT, enable);\n+\tif (ret) {\n+\t\tmedia->close();\n+\t\treturn ret;\n+\t}\n+\n+\t/* Output has to be operated unconditionally. */\n+\tret = imgu->linkSetup(imgu->imguName_, ImgUDevice::PAD_OUTPUT,\n+\t\t\t      outputName, 0, enable);\n+\tif (ret) {\n+\t\tmedia->close();\n+\t\treturn ret;\n+\t}\n+\n+\t/*\n+\t * FIXME: viewfinder should be linked and operated only if required\n+\t * but currently the IPU3 driver requires it regardless of the stream\n+\t * configuration.\n+\t */\n+\tif (isViewfinderActive(data) || true) {\n+\t\tret = imgu->linkSetup(imgu->imguName_, ImgUDevice::PAD_VF,\n+\t\t\t\t      viewfinderName, 0, enable);\n+\t\tif (ret) {\n+\t\t\tmedia->close();\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\t/* FIXME: stat should be conditionally operated as well. */\n+\tret = imgu->linkSetup(imgu->imguName_, ImgUDevice::PAD_STAT,\n+\t\t\t      statName, 0, enable);\n+\tif (ret) {\n+\t\tmedia->close();\n+\t\treturn ret;\n+\t}\n+\n+\tmedia->close();\n+\n+\treturn 0;\n+}\n+\n int PipelineHandlerIPU3::setInputFormat(ImgUDevice *imguDevice,\n \t\t\t\t\tconst StreamConfiguration &config,\n \t\t\t\t\tRectangle *rect)\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "23/31"
    ]
}