Show a patch.

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

{
    "id": 19756,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19756/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19756/",
    "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": "<20240319120517.362082-17-stefan.klug@ideasonboard.com>",
    "date": "2024-03-19T12:05:17",
    "name": "[v3,16/16] pipeline: rkisp1: Apply initial controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "211e5077f957ff4b429c1f49147910f8787179a1",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19756/mbox/",
    "series": [
        {
            "id": 4230,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4230/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4230",
            "date": "2024-03-19T12:05:01",
            "name": "Preparation for per-frame-controls and initial tests",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/4230/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19756/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19756/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 90D0FC32CB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Mar 2024 12:05:48 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3041E63075;\n\tTue, 19 Mar 2024 13:05:48 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9CBE462CA7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Mar 2024 13:05:31 +0100 (CET)",
            "from jasper.fritz.box (unknown\n\t[IPv6:2a00:6020:448c:6c00:1478:344b:8fcb:baf5])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ED148F02;\n\tTue, 19 Mar 2024 13:05:04 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"XkLeYQyy\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710849905;\n\tbh=j0qVsA7Ec5j4cYznYL9ApPVX34uJ15f5sSF/tB0rpSw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=XkLeYQyyIJPVtLtIxhBYuusqkoKU57B19AaqzDMz9x6x9iV3lYN1BTk9qR60ijiYB\n\tpOAOg+Ik3FzQm6+v1LWaQQVb6Akv4zPYK0EM2RdDkUEgdGjzrbsJHq20xlg1Be7WFG\n\t1+CFOB7rdqKb6haFKXXD33Qs+Vs88GQIl8SfuMcM=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v3 16/16] pipeline: rkisp1: Apply initial controls",
        "Date": "Tue, 19 Mar 2024 13:05:17 +0100",
        "Message-Id": "<20240319120517.362082-17-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.40.1",
        "In-Reply-To": "<20240319120517.362082-1-stefan.klug@ideasonboard.com>",
        "References": "<20240319120517.362082-1-stefan.klug@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Controls passed to Camera::start() are now correctly applied.  This is needed\nto pass the per-frame-controls test.  The code uses the return value of\nipa->start() to return the initial controls and pass them to the sensor instead\nof the setSensorControls signal because setSensorControls is asynchronous and\nwould reach the sensor too late.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/ipa/rkisp1.mojom       |  7 ++++++-\n src/ipa/rkisp1/rkisp1.cpp                | 21 ++++++++++++++++-----\n src/libcamera/pipeline/rkisp1/rkisp1.cpp |  9 +++++++--\n 3 files changed, 29 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex 1009e970..828308c6 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -13,13 +13,18 @@ struct IPAConfigInfo {\n \tlibcamera.ControlInfoMap sensorControls;\n };\n \n+struct StartResult {\n+\tlibcamera.ControlList controls;\n+\tint32 code;\n+};\n+\n interface IPARkISP1Interface {\n \tinit(libcamera.IPASettings settings,\n \t     uint32 hwRevision,\n \t     libcamera.IPACameraSensorInfo sensorInfo,\n \t     libcamera.ControlInfoMap sensorControls)\n \t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\n-\tstart() => (int32 ret);\n+\tstart(libcamera.ControlList controls) => (StartResult result);\n \tstop();\n \n \tconfigure(IPAConfigInfo configInfo,\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 240e11e6..6cde23cb 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -53,7 +53,7 @@ public:\n \t\t const IPACameraSensorInfo &sensorInfo,\n \t\t const ControlInfoMap &sensorControls,\n \t\t ControlInfoMap *ipaControls) override;\n-\tint start() override;\n+\tvoid start(const ControlList &controls, StartResult *result) override;\n \tvoid stop() override;\n \n \tint configure(const IPAConfigInfo &ipaConfig,\n@@ -86,6 +86,7 @@ private:\n \n \t/* Local parameter storage */\n \tstruct IPAContext context_;\n+\tbool initialControlsDone_;\n };\n \n namespace {\n@@ -199,12 +200,19 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \treturn 0;\n }\n \n-int IPARkISP1::start()\n+void IPARkISP1::start(const ControlList &controls, StartResult *result)\n {\n-\tControlList ctrls = getControls(0);\n-\tsetSensorControls.emit(0, ctrls);\n+\tinitialControlsDone_ = false;\n+\t/*\n+\t * Todo: This is really shady. In order to apply the initial controls we already\n+\t * queue a request for frame 0 and return the results.\n+\t * We need to discuss the official recommendation to handle start controls\n+\t */\n+\tqueueRequest(0, controls);\n \n-\treturn 0;\n+\tresult->controls = getControls(0);\n+\tresult->code = 0;\n+\tinitialControlsDone_ = true;\n }\n \n void IPARkISP1::stop()\n@@ -323,6 +331,9 @@ void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls)\n \t\talgo->queueRequest(context_, frame, frameContext, controls);\n \t}\n \n+\tif (!initialControlsDone_)\n+\t\treturn;\n+\n \t/* Fast path, if we are not regulating */\n \tif (!frameContext.agc.autoEnabled) {\n \t\tControlList ctrls = getControls(frame);\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex ab452d8f..fec3c58b 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -927,13 +927,18 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL\n \tif (ret)\n \t\treturn ret;\n \n-\tret = data->ipa_->start();\n-\tif (ret) {\n+\tControlList ctrls;\n+\tif (!!controls)\n+\t\tctrls = *controls;\n+\tipa::rkisp1::StartResult res;\n+\tdata->ipa_->start(ctrls, &res);\n+\tif (res.code) {\n \t\tfreeBuffers(camera);\n \t\tLOG(RkISP1, Error)\n \t\t\t<< \"Failed to start IPA \" << camera->id();\n \t\treturn ret;\n \t}\n+\tdata->delayedCtrls_->reset(&res.controls);\n \n \tdata->frame_ = 0;\n \n",
    "prefixes": [
        "v3",
        "16/16"
    ]
}