Show a patch.

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

{
    "id": 23736,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/23736/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23736/",
    "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": "<20250703114225.2074071-7-paul.elder@ideasonboard.com>",
    "date": "2025-07-03T11:42:21",
    "name": "[v2,6/8] libcamera: camera: Hook into the LayerManager",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "1559f9c554df36f68ec597cfb66b15c4416a9630",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23736/mbox/",
    "series": [
        {
            "id": 5267,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5267/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5267",
            "date": "2025-07-03T11:42:15",
            "name": "Add Layers support",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5267/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23736/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23736/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 E67C9C3293\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  3 Jul 2025 11:42:57 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B29468E64;\n\tThu,  3 Jul 2025 13:42:57 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D46468E52\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Jul 2025 13:42:56 +0200 (CEST)",
            "from neptunite.hamster-moth.ts.net (unknown\n\t[IPv6:2404:7a81:160:2100:c61b:f3bf:2578:6674])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E340782E;\n\tThu,  3 Jul 2025 13:42:30 +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=\"K1IVA8ln\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1751542952;\n\tbh=kC7XA7hFK5mk28YAu8uyaO9xVQYEwDVa+a8Yh/1qIvw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=K1IVA8lngWNWk+KybPc5cX+fQLguMtXD3BhUc5YsjLFlu0DVBwgg3XUZCuX4m+9EN\n\ttNtI93412YSe5riP/ZVLI1g2UzXk+lFSMIzOH781rOE/T0kXdW4GQCx2xz7PAeQdZ3\n\tTiDCQYZY+tQJBW4hwl9IQ66Eu9UjsMQcdaEFSnsw=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Paul Elder <paul.elder@ideasonboard.com>, kieran.bingham@ideasonboard.com,\n\tbarnabas.pocze@ideasonboard.com",
        "Subject": "[PATCH v2 6/8] libcamera: camera: Hook into the LayerManager",
        "Date": "Thu,  3 Jul 2025 20:42:21 +0900",
        "Message-ID": "<20250703114225.2074071-7-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.47.2",
        "In-Reply-To": "<20250703114225.2074071-1-paul.elder@ideasonboard.com>",
        "References": "<20250703114225.2074071-1-paul.elder@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": "Add hooks into the CameraManager to call into the LayerManager on all\nrelevant public-facing interface of Camera.\n\nThe entry point for each function into the LayerManager is has been\nchosen based on the capabilities that we want to allow to Layer\nimplementations.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v2:\n- move the LayerManager out of Camera into the CameraManager\n- remove hooks for generateConfiguration() and streams()\n- Camera now passes itself into the layer hooks, as it is required for\n  the LayerManager to fetch the closure based on the camera to pass to\n  each layer\n---\n src/libcamera/camera.cpp | 40 ++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 38 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex c3e656cab671..665fc5157349 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -18,6 +18,7 @@\n #include <libcamera/base/log.h>\n #include <libcamera/base/thread.h>\n \n+#include <libcamera/camera_manager.h>\n #include <libcamera/color_space.h>\n #include <libcamera/control_ids.h>\n #include <libcamera/framebuffer_allocator.h>\n@@ -27,6 +28,8 @@\n \n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/camera_controls.h\"\n+#include \"libcamera/internal/camera_manager.h\"\n+#include \"libcamera/internal/layer_manager.h\"\n #include \"libcamera/internal/pipeline_handler.h\"\n #include \"libcamera/internal/request.h\"\n \n@@ -741,18 +744,24 @@ void Camera::Private::setState(State state)\n void Camera::Private::emitBufferCompleted(Request *request, FrameBuffer *buffer)\n {\n \tCamera *camera = _o<Camera>();\n+\tLayerManager *layerManager = pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->bufferCompleted(camera, request, buffer);\n \tcamera->bufferCompleted.emit(request, buffer);\n }\n \n void Camera::Private::emitRequestCompleted(Request *request)\n {\n \tCamera *camera = _o<Camera>();\n+\tLayerManager *layerManager = pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->requestCompleted(camera, request);\n \tcamera->requestCompleted.emit(request);\n }\n \n void Camera::Private::emitDisconnected()\n {\n \tCamera *camera = _o<Camera>();\n+\tLayerManager *layerManager = pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->disconnected(camera);\n \tcamera->disconnected.emit();\n }\n \n@@ -943,10 +952,14 @@ Camera::Camera(std::unique_ptr<Private> d, const std::string &id,\n \t_d()->id_ = id;\n \t_d()->streams_ = streams;\n \t_d()->validator_ = std::make_unique<CameraControlValidator>(this);\n+\t_d()->pipe()->cameraManager()->_d()->layerManager()->init(this,\n+\t\t\t\t\t\t\t\t  _d()->properties_,\n+\t\t\t\t\t\t\t\t  _d()->controlInfo_);\n }\n \n Camera::~Camera()\n {\n+\t_d()->pipe()->cameraManager()->_d()->layerManager()->terminate(this);\n }\n \n /**\n@@ -1032,6 +1045,9 @@ int Camera::acquire()\n \t\treturn -EBUSY;\n \t}\n \n+\tLayerManager *layerManager = d->pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->acquire(this);\n+\n \td->setState(Private::CameraAcquired);\n \n \treturn 0;\n@@ -1064,6 +1080,9 @@ int Camera::release()\n \t\td->pipe_->invokeMethod(&PipelineHandler::release,\n \t\t\t\t       ConnectionTypeBlocking, this);\n \n+\tLayerManager *layerManager = d->pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->release(this);\n+\n \td->setState(Private::CameraAvailable);\n \n \treturn 0;\n@@ -1081,7 +1100,8 @@ int Camera::release()\n  */\n const ControlInfoMap &Camera::controls() const\n {\n-\treturn _d()->controlInfo_;\n+\tLayerManager *layerManager = _d()->pipe()->cameraManager()->_d()->layerManager();\n+\treturn layerManager->controls(this);\n }\n \n /**\n@@ -1094,7 +1114,8 @@ const ControlInfoMap &Camera::controls() const\n  */\n const ControlList &Camera::properties() const\n {\n-\treturn _d()->properties_;\n+\tLayerManager *layerManager = _d()->pipe()->cameraManager()->_d()->layerManager();\n+\treturn layerManager->properties(this);\n }\n \n /**\n@@ -1242,6 +1263,9 @@ int Camera::configure(CameraConfiguration *config)\n \t\td->activeStreams_.insert(stream);\n \t}\n \n+\tLayerManager *layerManager = d->pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->configure(this, config, d->controlInfo_);\n+\n \td->setState(Private::CameraConfigured);\n \n \treturn 0;\n@@ -1282,6 +1306,9 @@ std::unique_ptr<Request> Camera::createRequest(uint64_t cookie)\n \t/* Associate the request with the pipeline handler. */\n \td->pipe_->registerRequest(request.get());\n \n+\tLayerManager *layerManager = d->pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->createRequest(this, cookie, request.get());\n+\n \treturn request;\n }\n \n@@ -1366,6 +1393,9 @@ int Camera::queueRequest(Request *request)\n \t\t}\n \t}\n \n+\tLayerManager *layerManager = d->pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->queueRequest(this, request);\n+\n \td->pipe_->invokeMethod(&PipelineHandler::queueRequest,\n \t\t\t       ConnectionTypeQueued, request);\n \n@@ -1402,6 +1432,9 @@ int Camera::start(const ControlList *controls)\n \n \tASSERT(d->requestSequence_ == 0);\n \n+\tLayerManager *layerManager = d->pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->start(this, controls);\n+\n \tret = d->pipe_->invokeMethod(&PipelineHandler::start,\n \t\t\t\t     ConnectionTypeBlocking, this, controls);\n \tif (ret)\n@@ -1446,6 +1479,9 @@ int Camera::stop()\n \n \td->setState(Private::CameraStopping);\n \n+\tLayerManager *layerManager = d->pipe()->cameraManager()->_d()->layerManager();\n+\tlayerManager->stop(this);\n+\n \td->pipe_->invokeMethod(&PipelineHandler::stop, ConnectionTypeBlocking,\n \t\t\t       this);\n \n",
    "prefixes": [
        "v2",
        "6/8"
    ]
}