Show a patch.

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

{
    "id": 26372,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/26372/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26372/",
    "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": "<20260325151416.2114564-31-stefan.klug@ideasonboard.com>",
    "date": "2026-03-25T15:14:02",
    "name": "[v2,30/32] pipeline: rkisp1: rkisp1_path: Modify interface to be compatible with BufferQueue",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "5a9421505fc61362c68cbbdfdaa75b75dac473d9",
    "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/26372/mbox/",
    "series": [
        {
            "id": 5849,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5849/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5849",
            "date": "2026-03-25T15:13:32",
            "name": "rkisp1: pipeline rework for PFC",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5849/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26372/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26372/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 BED8EC32FA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Mar 2026 15:16:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 68C0462CDF;\n\tWed, 25 Mar 2026 16:16:06 +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 96C0062CDA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Mar 2026 16:16:05 +0100 (CET)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:b16a:5ed9:4ada:a95a])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 9609D1AFB; \n\tWed, 25 Mar 2026 16:14:47 +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=\"HLH0ourw\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774451687;\n\tbh=Iy4AqolszNI6X5zcfVsnGNJIhlZ4gPoEIOTgX2W+sfE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=HLH0ourwxUzJU+61e/jEYXX7CwuUiZ+9eZwf7v+PLsM/bb2Uk8ZmYu5VK6Kvrvd2r\n\tUkbOcKcOXwc7XTlQ2SIQnyPWLV45pwC5s3B0H+zJCEaKajwDvokugD9PMjutQBn4cY\n\tYbkbq/jKCoeWK9pUUm45lUNhD0x7H6UQke8fOYwY=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v2 30/32] pipeline: rkisp1: rkisp1_path: Modify interface to\n\tbe compatible with BufferQueue",
        "Date": "Wed, 25 Mar 2026 16:14:02 +0100",
        "Message-ID": "<20260325151416.2114564-31-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<20260325151416.2114564-1-stefan.klug@ideasonboard.com>",
        "References": "<20260325151416.2114564-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": "The BufferQueue delegate expects an interface equal to the one provided\nby the V4L2VideoDevice. Modify the RkISP1Path class to support that\ninterface to prepare for the migration to BufferQueue.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v2:\n- Added this patch\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 44 ++++++++++++++-----\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 42 ++----------------\n src/libcamera/pipeline/rkisp1/rkisp1_path.h   | 23 ++++++++--\n 3 files changed, 56 insertions(+), 53 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex c46515110ffc..998ee3c813bc 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -1099,14 +1099,15 @@ int PipelineHandlerRkISP1::exportFrameBuffers([[maybe_unused]] Camera *camera, S\n int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n {\n \tRkISP1CameraData *data = cameraData(camera);\n+\tutils::ScopeExitActions actions;\n \tunsigned int ipaBufferId = 1;\n \tint ret;\n \n-\tauto errorCleanup = utils::scope_exit{ [&]() {\n+\tactions += [&]() {\n \t\tparamBuffers_.clear();\n \t\tstatBuffers_.clear();\n \t\tmainPathBuffers_.clear();\n-\t} };\n+\t};\n \n \tif (!isRaw_) {\n \t\tret = param_->allocateBuffers(kRkISP1InternalBufferCount, &paramBuffers_);\n@@ -1127,6 +1128,22 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n \n \t\tfor (std::unique_ptr<FrameBuffer> &buffer : mainPathBuffers_)\n \t\t\tavailableMainPathBuffers_.push(buffer.get());\n+\t} else if (data->mainPath_->isEnabled()) {\n+\t\tret = mainPath_.importBuffers(data->mainPathStream_.configuration().bufferCount);\n+\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\n+\t\tactions += [&]() { mainPath_.releaseBuffers(); };\n+\t}\n+\n+\tif (hasSelfPath_ && data->selfPath_->isEnabled()) {\n+\t\tret = selfPath_.importBuffers(data->selfPathStream_.configuration().bufferCount);\n+\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\n+\t\tactions += [&]() { selfPath_.releaseBuffers(); };\n \t}\n \n \tauto pushBuffers = [&](const std::vector<std::unique_ptr<FrameBuffer>> &buffers,\n@@ -1147,7 +1164,7 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n \n \tdata->ipa_->mapBuffers(data->ipaBuffers_);\n \n-\terrorCleanup.release();\n+\tactions.release();\n \treturn 0;\n }\n \n@@ -1181,6 +1198,12 @@ int PipelineHandlerRkISP1::freeBuffers(Camera *camera)\n \tif (stat_->releaseBuffers())\n \t\tLOG(RkISP1, Error) << \"Failed to release stat buffers\";\n \n+\tif (mainPath_.releaseBuffers())\n+\t\tLOG(RkISP1, Error) << \"Failed to release main path buffers\";\n+\n+\tif (hasSelfPath_ && selfPath_.releaseBuffers())\n+\t\tLOG(RkISP1, Error) << \"Failed to release self path buffers\";\n+\n \treturn 0;\n }\n \n@@ -1263,16 +1286,17 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL\n \t}\n \n \tif (data->mainPath_->isEnabled()) {\n-\t\tret = mainPath_.start(data->mainPathStream_.configuration().bufferCount);\n+\t\tret = mainPath_.streamOn();\n \t\tif (ret)\n \t\t\treturn ret;\n-\t\tactions += [&]() { mainPath_.stop(); };\n+\t\tactions += [&]() { mainPath_.streamOff(); };\n \t}\n \n \tif (hasSelfPath_ && data->selfPath_->isEnabled()) {\n-\t\tret = selfPath_.start(data->selfPathStream_.configuration().bufferCount);\n+\t\tret = selfPath_.streamOn();\n \t\tif (ret)\n \t\t\treturn ret;\n+\t\tactions += [&]() { selfPath_.streamOff(); };\n \t}\n \n \tisp_->setFrameStartEnabled(true);\n@@ -1299,8 +1323,8 @@ void PipelineHandlerRkISP1::stopDevice(Camera *camera)\n \tdata->ipa_->stop();\n \n \tif (hasSelfPath_)\n-\t\tselfPath_.stop();\n-\tmainPath_.stop();\n+\t\tselfPath_.streamOff();\n+\tmainPath_.streamOff();\n \n \tif (!isRaw_) {\n \t\tret = stat_->streamOff();\n@@ -1664,9 +1688,9 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n \t\treturn false;\n \n \tisp_->frameStart.connect(this, &PipelineHandlerRkISP1::frameStart);\n-\tmainPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::imageBufferReady);\n+\tmainPath_.bufferReady.connect(this, &PipelineHandlerRkISP1::imageBufferReady);\n \tif (hasSelfPath_)\n-\t\tselfPath_.bufferReady().connect(this, &PipelineHandlerRkISP1::imageBufferReady);\n+\t\tselfPath_.bufferReady.connect(this, &PipelineHandlerRkISP1::imageBufferReady);\n \tstat_->bufferReady.connect(this, &PipelineHandlerRkISP1::statBufferReady);\n \tparam_->bufferReady.connect(this, &PipelineHandlerRkISP1::paramBufferReady);\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex ef9cfbdc327a..80a01280e6f7 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -8,6 +8,7 @@\n #include \"rkisp1_path.h\"\n \n #include <array>\n+#include <memory>\n \n #include <linux/media-bus-format.h>\n \n@@ -58,7 +59,7 @@ const std::map<PixelFormat, uint32_t> formatToMediaBus = {\n \n RkISP1Path::RkISP1Path(const char *name, const Span<const PixelFormat> &formats,\n \t\t       const Size &minResolution, const Size &maxResolution)\n-\t: name_(name), running_(false), formats_(formats),\n+\t: name_(name), formats_(formats),\n \t  minResolution_(minResolution), maxResolution_(maxResolution),\n \t  link_(nullptr)\n {\n@@ -77,6 +78,7 @@ bool RkISP1Path::init(std::shared_ptr<MediaDevice> media)\n \tif (video_->open() < 0)\n \t\treturn false;\n \n+\tvideo_->bufferReady.connect(this, [this](FrameBuffer *buffer) { this->bufferReady.emit(buffer); });\n \tpopulateFormats();\n \n \tlink_ = media->link(\"rkisp1_isp\", 2, resizer, 0);\n@@ -480,44 +482,6 @@ int RkISP1Path::configure(const StreamConfiguration &config,\n \treturn 0;\n }\n \n-int RkISP1Path::start(unsigned int bufferCount)\n-{\n-\tint ret;\n-\n-\tif (running_)\n-\t\treturn -EBUSY;\n-\n-\tret = video_->importBuffers(bufferCount);\n-\tif (ret)\n-\t\treturn ret;\n-\n-\tret = video_->streamOn();\n-\tif (ret) {\n-\t\tLOG(RkISP1, Error)\n-\t\t\t<< \"Failed to start \" << name_ << \" path\";\n-\n-\t\tvideo_->releaseBuffers();\n-\t\treturn ret;\n-\t}\n-\n-\trunning_ = true;\n-\n-\treturn 0;\n-}\n-\n-void RkISP1Path::stop()\n-{\n-\tif (!running_)\n-\t\treturn;\n-\n-\tif (video_->streamOff())\n-\t\tLOG(RkISP1, Warning) << \"Failed to stop \" << name_ << \" path\";\n-\n-\tvideo_->releaseBuffers();\n-\n-\trunning_ = false;\n-}\n-\n /*\n  * \\todo Remove the hardcoded resolutions and formats once kernels older than\n  * v6.4 will stop receiving LTS support (scheduled for December 2027 for v6.1).\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\nindex 0c68e9eb99af..d2bce01c9336 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n@@ -58,19 +58,34 @@ public:\n \t\treturn video_->exportBuffers(bufferCount, buffers);\n \t}\n \n-\tint start(unsigned int bufferCount);\n-\tvoid stop();\n+\tint allocateBuffers(unsigned int bufferCount,\n+\t\t\t    std::vector<std::unique_ptr<FrameBuffer>> *buffers)\n+\t{\n+\t\treturn video_->allocateBuffers(bufferCount, buffers);\n+\t}\n+\n+\tint importBuffers(unsigned int count)\n+\t{\n+\t\treturn video_->importBuffers(count);\n+\t}\n+\n+\tint releaseBuffers()\n+\t{\n+\t\treturn video_->releaseBuffers();\n+\t}\n+\n+\tint streamOn() { return video_->streamOn(); };\n+\tint streamOff() { return video_->streamOff(); };\n \n \tint queueBuffer(FrameBuffer *buffer) { return video_->queueBuffer(buffer); }\n-\tSignal<FrameBuffer *> &bufferReady() { return video_->bufferReady; }\n \tconst Size &maxResolution() const { return maxResolution_; }\n \n+\tSignal<FrameBuffer *> bufferReady;\n private:\n \tvoid populateFormats();\n \tSize filterSensorResolution(const CameraSensor *sensor);\n \n \tconst char *name_;\n-\tbool running_;\n \n \tconst Span<const PixelFormat> formats_;\n \tstd::set<PixelFormat> streamFormats_;\n",
    "prefixes": [
        "v2",
        "30/32"
    ]
}