Show a patch.

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

{
    "id": 20350,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/20350/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20350/",
    "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": "<20240617232525.878530-2-kieran.bingham@ideasonboard.com>",
    "date": "2024-06-17T23:25:23",
    "name": "[1/3] ipa: simple: softisp: Extend to pass metadata",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "c82ad5fa7e40263cb158b4012e2fcd51f52824f5",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/20350/mbox/",
    "series": [
        {
            "id": 4405,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4405/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4405",
            "date": "2024-06-17T23:25:22",
            "name": "ipa: simple: Introduce metadata reporting",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4405/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20350/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20350/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 9040AC3293\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 17 Jun 2024 23:25:34 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2ACC365494;\n\tTue, 18 Jun 2024 01:25:33 +0200 (CEST)",
            "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 4F1BA65489\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 18 Jun 2024 01:25:29 +0200 (CEST)",
            "from Monstersaurus.local\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 00A47564;\n\tTue, 18 Jun 2024 01:25:11 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"O5zBrsru\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1718666712;\n\tbh=eKdiqXSezEgKBRUN4R9yfMCeps/4UvELQ9ohHGw9QgM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=O5zBrsruAPYnEde9mEZQxc4qq+4La0GkgzjOTSrKyyldjcNTvoHS7mjvp+rRxo6+1\n\t4FCa6WDU+Ja03OTD13dnrA2XHC0o3qeSr51NxHOKWbak452/pPyJZSa5JsZczC40In\n\t1mTMkmFViADQvh/imPtBCxJCugvn2tGbEQv3nXho=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[PATCH 1/3] ipa: simple: softisp: Extend to pass metadata",
        "Date": "Tue, 18 Jun 2024 00:25:23 +0100",
        "Message-Id": "<20240617232525.878530-2-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20240617232525.878530-1-kieran.bingham@ideasonboard.com>",
        "References": "<20240617232525.878530-1-kieran.bingham@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": "Extend the Simple IPA IPC to support returning a metadata controllist\nwhen the process call has completed.\n\nFor efficiency, use the existing signal setIspParams() directly\nto avoid having an extra async callback to return the metadata.\n\nMerge the metadata reported by the ISP into any completing\nrequest to provide to the application.\n\nThis should be further extended or improved to make use of the frame\ncontext structures so that the metadata is tied to a specific frame and\nrequest completion.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/internal/software_isp/software_isp.h | 5 ++++-\n include/libcamera/ipa/soft.mojom                       | 2 +-\n src/ipa/simple/soft_simple.cpp                         | 4 +++-\n src/libcamera/pipeline/simple/simple.cpp               | 7 +++++--\n src/libcamera/software_isp/software_isp.cpp            | 6 ++++--\n 5 files changed, 17 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h\nindex c5338c05b99b..2631f40ef22a 100644\n--- a/include/libcamera/internal/software_isp/software_isp.h\n+++ b/include/libcamera/internal/software_isp/software_isp.h\n@@ -80,8 +80,10 @@ public:\n \tSignal<> ispStatsReady;\n \tSignal<const ControlList &> setSensorControls;\n \n+\tconst ControlList &metadata() { return metadata_; }\n+\n private:\n-\tvoid saveIspParams();\n+\tvoid saveIspParams(const ControlList &metadata);\n \tvoid setSensorCtrls(const ControlList &sensorControls);\n \tvoid statsReady();\n \tvoid inputReady(FrameBuffer *input);\n@@ -92,6 +94,7 @@ private:\n \tSharedMemObject<DebayerParams> sharedParams_;\n \tDebayerParams debayerParams_;\n \tDmaBufAllocator dmaHeap_;\n+\tControlList metadata_;\n \n \tstd::unique_ptr<ipa::soft::IPAProxySoft> ipa_;\n };\ndiff --git a/include/libcamera/ipa/soft.mojom b/include/libcamera/ipa/soft.mojom\nindex 3aa2066ebaa0..1a0221df7660 100644\n--- a/include/libcamera/ipa/soft.mojom\n+++ b/include/libcamera/ipa/soft.mojom\n@@ -24,5 +24,5 @@ interface IPASoftInterface {\n \n interface IPASoftEventInterface {\n \tsetSensorControls(libcamera.ControlList sensorControls);\n-\tsetIspParams();\n+\tsetIspParams(libcamera.ControlList metadata);\n };\ndiff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\nindex b7746ce09206..09c7b575301e 100644\n--- a/src/ipa/simple/soft_simple.cpp\n+++ b/src/ipa/simple/soft_simple.cpp\n@@ -250,6 +250,8 @@ void IPASoftSimple::processStats(const ControlList &sensorControls)\n \tSwIspStats::Histogram histogram = stats_->yHistogram;\n \tif (ignoreUpdates_ > 0)\n \t\tblackLevel_.update(histogram);\n+\n+\tControlList metadata(controls::controls);\n \tconst uint8_t blackLevel = blackLevel_.get();\n \n \t/*\n@@ -303,7 +305,7 @@ void IPASoftSimple::processStats(const ControlList &sensorControls)\n \t\tparams_->blue[i] = gammaTable_[idx];\n \t}\n \n-\tsetIspParams.emit();\n+\tsetIspParams.emit(metadata);\n \n \t/* \\todo Switch to the libipa/algorithm.h API someday. */\n \ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex eb36578e320e..accdb744d61b 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -860,10 +860,13 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)\n \t\t\treturn;\n \t\t}\n \n-\t\tif (converter_)\n+\t\tif (converter_) {\n \t\t\tconverter_->queueBuffers(buffer, conversionQueue_.front());\n-\t\telse\n+\t\t} else {\n \t\t\tswIsp_->queueBuffers(buffer, conversionQueue_.front());\n+\t\t\tif (request)\n+\t\t\t\trequest->metadata().merge(swIsp_->metadata());\n+\t\t}\n \n \t\tconversionQueue_.pop();\n \t\treturn;\ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex 20fb6f48fdf9..efbbea2d2279 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -68,7 +68,8 @@ LOG_DEFINE_CATEGORY(SoftwareIsp)\n SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor)\n \t: dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |\n \t\t   DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |\n-\t\t   DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf)\n+\t\t   DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf),\n+\t  metadata_(controls::controls)\n {\n \t/*\n \t * debayerParams_ must be initialized because the initial value is used for\n@@ -349,9 +350,10 @@ void SoftwareIsp::process(FrameBuffer *input, FrameBuffer *output)\n \t\t\t       ConnectionTypeQueued, input, output, debayerParams_);\n }\n \n-void SoftwareIsp::saveIspParams()\n+void SoftwareIsp::saveIspParams(const ControlList &metadata)\n {\n \tdebayerParams_ = *sharedParams_;\n+\tmetadata_.merge(metadata, ControlList::MergePolicy::OverwriteExisting);\n }\n \n void SoftwareIsp::setSensorCtrls(const ControlList &sensorControls)\n",
    "prefixes": [
        "1/3"
    ]
}