Show a patch.

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

{
    "id": 17848,
    "url": "https://patchwork.libcamera.org/api/patches/17848/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17848/",
    "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": "<20221123134346.129807-3-jacopo@jmondi.org>",
    "date": "2022-11-23T13:43:44",
    "name": "[libcamera-devel,v2,2/4] ipa: rkisp1: Use IPAConfig in IPA::configure()",
    "commit_ref": "855228f7d5243278459f32fc372cbbecbde9cdfc",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "37130517be4f9f06524b8d45ba90f6db5f7cd219",
    "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/17848/mbox/",
    "series": [
        {
            "id": 3633,
            "url": "https://patchwork.libcamera.org/api/series/3633/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3633",
            "date": "2022-11-23T13:43:42",
            "name": "ipa: Validate controls in CameraSensor",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3633/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17848/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17848/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 375EFBE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Nov 2022 13:44:00 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E98556331E;\n\tWed, 23 Nov 2022 14:43:59 +0100 (CET)",
            "from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::224])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B5CF963311\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Nov 2022 14:43:58 +0100 (CET)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 778C2E0014;\n\tWed, 23 Nov 2022 13:43:56 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669211039;\n\tbh=B4yGLK0L1CqI8Ruh1+blBFV5EgL9RagzdtM5FeuENh4=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=F/P7aobVjl6kXbMd3VGEGDt+dClWar0SJXAlTQ+mro76tEKXb6w1PLGVltIc8O2rk\n\tUB556fB6qH8qwKATFxIH8hsih212xEo55YBdk66jZOwikdepkXinpEacA6YYjzRU5q\n\t8tkIhahZSte4DfrUo7gQrJodC5khqgvZg4wnJL5IJ1Qnj9LLICMJ2aQKf6lj7eSm28\n\tRrf3gV9DMZS40BU6vWu320LwL8v/RtA4Bspc/d4IQs8hUEqk3kDOgF83gcJwiqFe9I\n\tVNtut0s01vcLhFQlhyVfybqh5usjuWHsy/3vbDMqK81rrWqdqIm0SeDab5bGS8D4vl\n\tewe8hHsU878jw==",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 23 Nov 2022 14:43:44 +0100",
        "Message-Id": "<20221123134346.129807-3-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.38.1",
        "In-Reply-To": "<20221123134346.129807-1-jacopo@jmondi.org>",
        "References": "<20221123134346.129807-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 2/4] ipa: rkisp1: Use IPAConfig in\n\tIPA::configure()",
        "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>",
        "From": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>",
        "Cc": "Nicholas Roth <nicholas@rothemail.net>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The RkISP1 implementation of IPA::configure() still uses the legacy\ninterface where sensor controls (and eventually lens controls) are\npassed from the pipeline handler to the IPA in a map.\n\nSince the introduction of mojom-based IPA interface definition, it is\npossible to define custom data types and use them in the interface\ndefinition between the pipeline handler and the IPA.\n\nAlign the RkISP1 IPA::configure() implementation with the one in the\nIPU3 IPA module by using a custom data type instead of relying on a map\nto pass controls to the IPA.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/ipa/rkisp1.mojom       | 10 ++++++---\n src/ipa/rkisp1/rkisp1.cpp                | 26 ++++++++++--------------\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++++------\n 3 files changed, 24 insertions(+), 24 deletions(-)",
    "diff": "diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex eaf3955e4096..36bf291e8a51 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -8,6 +8,11 @@ module ipa.rkisp1;\n \n import \"include/libcamera/ipa/core.mojom\";\n \n+struct IPAConfigInfo {\n+\tlibcamera.IPACameraSensorInfo sensorInfo;\n+\tlibcamera.ControlInfoMap sensorControls;\n+};\n+\n interface IPARkISP1Interface {\n \tinit(libcamera.IPASettings settings,\n \t     uint32 hwRevision)\n@@ -15,9 +20,8 @@ interface IPARkISP1Interface {\n \tstart() => (int32 ret);\n \tstop();\n \n-\tconfigure(libcamera.IPACameraSensorInfo sensorInfo,\n-\t\t  map<uint32, libcamera.IPAStream> streamConfig,\n-\t\t  map<uint32, libcamera.ControlInfoMap> entityControls)\n+\tconfigure(IPAConfigInfo configInfo,\n+\t\t  map<uint32, libcamera.IPAStream> streamConfig)\n \t\t=> (int32 ret);\n \n \tmapBuffers(array<libcamera.IPABuffer> buffers);\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex d237758f7bf0..088d7c74d448 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -53,9 +53,8 @@ public:\n \tint start() override;\n \tvoid stop() override;\n \n-\tint configure(const IPACameraSensorInfo &info,\n-\t\t      const std::map<uint32_t, IPAStream> &streamConfig,\n-\t\t      const std::map<uint32_t, ControlInfoMap> &entityControls) override;\n+\tint configure(const IPAConfigInfo &ipaConfig,\n+\t\t      const std::map<uint32_t, IPAStream> &streamConfig) override;\n \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n \n@@ -73,7 +72,7 @@ private:\n \tstd::map<unsigned int, FrameBuffer> buffers_;\n \tstd::map<unsigned int, MappedFrameBuffer> mappedBuffers_;\n \n-\tControlInfoMap ctrls_;\n+\tControlInfoMap sensorControls_;\n \n \t/* revision-specific data */\n \trkisp1_cif_isp_version hwRevision_;\n@@ -206,20 +205,16 @@ void IPARkISP1::stop()\n  * assemble one. Make sure the reported sensor information are relevant\n  * before accessing them.\n  */\n-int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n-\t\t\t [[maybe_unused]] const std::map<uint32_t, IPAStream> &streamConfig,\n-\t\t\t const std::map<uint32_t, ControlInfoMap> &entityControls)\n+int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n+\t\t\t [[maybe_unused]] const std::map<uint32_t, IPAStream> &streamConfig)\n {\n-\tif (entityControls.empty())\n-\t\treturn -EINVAL;\n-\n-\tctrls_ = entityControls.at(0);\n+\tsensorControls_ = ipaConfig.sensorControls;\n \n-\tconst auto itExp = ctrls_.find(V4L2_CID_EXPOSURE);\n+\tconst auto itExp = sensorControls_.find(V4L2_CID_EXPOSURE);\n \tint32_t minExposure = itExp->second.min().get<int32_t>();\n \tint32_t maxExposure = itExp->second.max().get<int32_t>();\n \n-\tconst auto itGain = ctrls_.find(V4L2_CID_ANALOGUE_GAIN);\n+\tconst auto itGain = sensorControls_.find(V4L2_CID_ANALOGUE_GAIN);\n \tint32_t minGain = itGain->second.min().get<int32_t>();\n \tint32_t maxGain = itGain->second.max().get<int32_t>();\n \n@@ -235,7 +230,8 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n \t/* Set the hardware revision for the algorithms. */\n \tcontext_.configuration.hw.revision = hwRevision_;\n \n-\tconst ControlInfo vBlank = ctrls_.find(V4L2_CID_VBLANK)->second;\n+\tconst IPACameraSensorInfo &info = ipaConfig.sensorInfo;\n+\tconst ControlInfo vBlank = sensorControls_.find(V4L2_CID_VBLANK)->second;\n \tcontext_.configuration.sensor.defVBlank = vBlank.def().get<int32_t>();\n \tcontext_.configuration.sensor.size = info.outputSize;\n \tcontext_.configuration.sensor.lineDuration = info.minLineLength * 1.0s / info.pixelRate;\n@@ -353,7 +349,7 @@ void IPARkISP1::setControls(unsigned int frame)\n \tuint32_t exposure = frameContext.agc.exposure;\n \tuint32_t gain = camHelper_->gainCode(frameContext.agc.gain);\n \n-\tControlList ctrls(ctrls_);\n+\tControlList ctrls(sensorControls_);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));\n \tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain));\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 3d3a7086c03a..4f0e1f8b1a35 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -715,18 +715,18 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n \t\treturn ret;\n \n \t/* Inform IPA of stream configuration and sensor controls. */\n-\tIPACameraSensorInfo sensorInfo = {};\n-\tret = data->sensor_->sensorInfo(&sensorInfo);\n+\tipa::rkisp1::IPAConfigInfo ipaConfig{};\n+\n+\tret = data->sensor_->sensorInfo(&ipaConfig.sensorInfo);\n \tif (ret) {\n \t\t/* \\todo Turn this into a hard failure. */\n \t\tLOG(RkISP1, Warning) << \"Camera sensor information not available\";\n-\t\tsensorInfo = {};\n+\t\tipaConfig.sensorInfo = {};\n \t}\n \n-\tstd::map<uint32_t, ControlInfoMap> entityControls;\n-\tentityControls.emplace(0, data->sensor_->controls());\n+\tipaConfig.sensorControls = data->sensor_->controls();\n \n-\tret = data->ipa_->configure(sensorInfo, streamConfig, entityControls);\n+\tret = data->ipa_->configure(ipaConfig, streamConfig);\n \tif (ret) {\n \t\tLOG(RkISP1, Error) << \"failed configuring IPA (\" << ret << \")\";\n \t\treturn ret;\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "2/4"
    ]
}