Show a patch.

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

{
    "id": 13095,
    "url": "https://patchwork.libcamera.org/api/patches/13095/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13095/",
    "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": "<20210723040036.32346-10-laurent.pinchart@ideasonboard.com>",
    "date": "2021-07-23T04:00:28",
    "name": "[libcamera-devel,RFC,09/17] libcamera: pipeline_handler: Move CameraData members to Camera::Private",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a5c9501d70b50344ed582e73db47a4c4e8a89a67",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13095/mbox/",
    "series": [
        {
            "id": 2270,
            "url": "https://patchwork.libcamera.org/api/series/2270/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2270",
            "date": "2021-07-23T04:00:19",
            "name": "libcamera: Replace CameraData with Camera::Private",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2270/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13095/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13095/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 B8F5FC322C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Jul 2021 04:00:54 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 66925687A3;\n\tFri, 23 Jul 2021 06:00:54 +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 0803C687B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Jul 2021 06:00:46 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9E7683F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Jul 2021 06:00:45 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"seJyCIEA\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1627012845;\n\tbh=jEwNRp4l3LwS3qZ1t2bpDTdIYaFl4P4ixpYnI2f1Bwc=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=seJyCIEAHiJccfu1XnN254lJUhWxrOinH6fsb2cifLL7fBWh4VbGahq7wgp5CwSvI\n\tD37NDt/jW1xIDe3LX589Hs3KANl5lBF61MoWt5pYvhwXDsE4lnL2fG96Zb3gYVoTb5\n\t4HLx8fdRSehYiMdRA36RCnG+A4RRj05LQq3uaGGM=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 23 Jul 2021 07:00:28 +0300",
        "Message-Id": "<20210723040036.32346-10-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20210723040036.32346-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20210723040036.32346-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [RFC PATCH 09/17] libcamera: pipeline_handler:\n\tMove CameraData members to Camera::Private",
        "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": "With pipeline handlers now being able to subclass Camera::Private, start\nthe migration from CameraData to Camera::Private by moving the members\nof the base CameraData class. The controlInfo_, properties_ and pipe_\nmembers are duplicated for now, to allow migrating pipeline handlers one\nby one.\n\nThe Camera::Private class is now properly documented, don't exclude it\nfrom documentation generation.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n Documentation/Doxyfile.in                     |  1 -\n include/libcamera/internal/camera.h           |  8 +++\n include/libcamera/internal/pipeline_handler.h |  5 +-\n src/libcamera/camera.cpp                      | 60 ++++++++++++++++++-\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  2 +-\n src/libcamera/pipeline_handler.cpp            | 45 +++++---------\n 6 files changed, 83 insertions(+), 38 deletions(-)",
    "diff": "diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in\nindex aee5c9fd7e59..b8777b0c4522 100644\n--- a/Documentation/Doxyfile.in\n+++ b/Documentation/Doxyfile.in\n@@ -882,7 +882,6 @@ EXCLUDE_SYMBOLS        = libcamera::BoundMethodArgs \\\n                          libcamera::BoundMethodPack \\\n                          libcamera::BoundMethodPackBase \\\n                          libcamera::BoundMethodStatic \\\n-\t\t\t libcamera::Camera::Private \\\n \t\t\t libcamera::CameraManager::Private \\\n                          libcamera::SignalBase \\\n                          *::details \\\ndiff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h\nindex 9ec8321a9a21..44242332a52f 100644\n--- a/include/libcamera/internal/camera.h\n+++ b/include/libcamera/internal/camera.h\n@@ -29,6 +29,14 @@ public:\n \tPrivate(PipelineHandler *pipe);\n \t~Private();\n \n+\tPipelineHandler *pipe() { return pipe_.get(); }\n+\n+\tstd::list<Request *> queuedRequests_;\n+\tControlInfoMap controlInfo_;\n+\tControlList properties_;\n+\n+\tuint32_t requestSequence_;\n+\n private:\n \tenum State {\n \t\tCameraAvailable,\ndiff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\nindex 9e2d65d6f2c5..86727f90bb65 100644\n--- a/include/libcamera/internal/pipeline_handler.h\n+++ b/include/libcamera/internal/pipeline_handler.h\n@@ -39,18 +39,15 @@ class CameraData\n {\n public:\n \texplicit CameraData(PipelineHandler *pipe)\n-\t\t: pipe_(pipe), requestSequence_(0)\n+\t\t: pipe_(pipe)\n \t{\n \t}\n \tvirtual ~CameraData() = default;\n \n \tPipelineHandler *pipe_;\n-\tstd::list<Request *> queuedRequests_;\n \tControlInfoMap controlInfo_;\n \tControlList properties_;\n \n-\tuint32_t requestSequence_;\n-\n private:\n \tLIBCAMERA_DISABLE_COPY(CameraData)\n };\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex a5bb60c698bc..72a42dbeb3d3 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -332,13 +332,25 @@ std::size_t CameraConfiguration::size() const\n  * \\brief The vector of stream configurations\n  */\n \n+/**\n+ * \\class Camera::Private\n+ * \\brief Base class for camera private data\n+ *\n+ * The Camera::Private class stores all private data associated with a camera.\n+ * In addition to hiding core Camera data from the public API, it is expected to\n+ * be subclassed by pipeline handlers to store pipeline-specific data.\n+ *\n+ * Pipeline handlers can obtain the Camera::Private instance associated with a\n+ * camera by calling Camera::_d().\n+ */\n+\n /**\n  * \\brief Construct a Camera::Private instance\n  * \\param[in] pipe The pipeline handler responsible for the camera device\n  */\n Camera::Private::Private(PipelineHandler *pipe)\n-\t: pipe_(pipe->shared_from_this()), disconnected_(false),\n-\t  state_(CameraAvailable)\n+\t: requestSequence_(0), pipe_(pipe->shared_from_this()),\n+\t  disconnected_(false), state_(CameraAvailable)\n {\n }\n \n@@ -348,6 +360,50 @@ Camera::Private::~Private()\n \t\tLOG(Camera, Error) << \"Removing camera while still in use\";\n }\n \n+/**\n+ * \\fn Camera::Private::pipe()\n+ * \\brief Retrieve the pipeline handler related to this camera\n+ * \\return The pipeline handler for this camera\n+ */\n+\n+/**\n+ * \\var Camera::Private::queuedRequests_\n+ * \\brief The list of queued and not yet completed request\n+ *\n+ * The list of queued request is used to track requests queued in order to\n+ * ensure completion of all requests when the pipeline handler is stopped.\n+ *\n+ * \\sa PipelineHandler::queueRequest(), PipelineHandler::stop(),\n+ * PipelineHandler::completeRequest()\n+ */\n+\n+/**\n+ * \\var Camera::Private::controlInfo_\n+ * \\brief The set of controls supported by the camera\n+ *\n+ * The control information shall be initialised by the pipeline handler when\n+ * creating the camera, and shall not be modified afterwards.\n+ */\n+\n+/**\n+ * \\var Camera::Private::properties_\n+ * \\brief The list of properties supported by the camera\n+ *\n+ * The list of camera properties shall be initialised by the pipeline handler\n+ * when creating the camera, and shall not be modified afterwards.\n+ */\n+\n+/**\n+ * \\var Camera::Private::requestSequence_\n+ * \\brief The queuing sequence of the request\n+ *\n+ * When requests are queued, they are given a per-camera sequence number to\n+ * facilitate debugging of internal request usage.\n+ *\n+ * The requestSequence_ tracks the number of requests queued to a camera\n+ * over its lifetime.\n+ */\n+\n static const char *const camera_state_names[] = {\n \t\"Available\",\n \t\"Acquired\",\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 4a8ac97d5ef0..cc279ce733ef 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -847,7 +847,7 @@ void PipelineHandlerRkISP1::stop(Camera *camera)\n \t\tLOG(RkISP1, Warning)\n \t\t\t<< \"Failed to stop parameters for \" << camera->id();\n \n-\tASSERT(data->queuedRequests_.empty());\n+\tASSERT(camera->_d()->queuedRequests_.empty());\n \tdata->frameInfo_.clear();\n \n \tfreeBuffers(camera);\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex c9928d444b04..1f1de19d81c5 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -16,6 +16,7 @@\n #include <libcamera/camera_manager.h>\n #include <libcamera/framebuffer.h>\n \n+#include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/tracepoints.h\"\n@@ -71,17 +72,6 @@ LOG_DEFINE_CATEGORY(Pipeline)\n  * and remains valid until the instance is destroyed.\n  */\n \n-/**\n- * \\var CameraData::queuedRequests_\n- * \\brief The list of queued and not yet completed request\n- *\n- * The list of queued request is used to track requests queued in order to\n- * ensure completion of all requests when the pipeline handler is stopped.\n- *\n- * \\sa PipelineHandler::queueRequest(), PipelineHandler::stop(),\n- * PipelineHandler::completeRequest()\n- */\n-\n /**\n  * \\var CameraData::controlInfo_\n  * \\brief The set of controls supported by the camera\n@@ -98,17 +88,6 @@ LOG_DEFINE_CATEGORY(Pipeline)\n  * when creating the camera, and shall not be modified afterwards.\n  */\n \n-/**\n- * \\var CameraData::requestSequence_\n- * \\brief The queuing sequence of the request\n- *\n- * When requests are queued, they are given a per-camera sequence number to\n- * facilitate debugging of internal request usage.\n- *\n- * The requestSequence_ tracks the number of requests queued to a camera\n- * over its lifetime.\n- */\n-\n /**\n  * \\class PipelineHandler\n  * \\brief Create and manage cameras based on a set of media devices\n@@ -254,8 +233,7 @@ void PipelineHandler::unlock()\n  */\n const ControlInfoMap &PipelineHandler::controls(const Camera *camera) const\n {\n-\tconst CameraData *data = cameraData(camera);\n-\treturn data->controlInfo_;\n+\treturn camera->_d()->controlInfo_;\n }\n \n /**\n@@ -265,8 +243,7 @@ const ControlInfoMap &PipelineHandler::controls(const Camera *camera) const\n  */\n const ControlList &PipelineHandler::properties(const Camera *camera) const\n {\n-\tconst CameraData *data = cameraData(camera);\n-\treturn data->properties_;\n+\treturn camera->_d()->properties_;\n }\n \n /**\n@@ -380,8 +357,7 @@ const ControlList &PipelineHandler::properties(const Camera *camera) const\n  */\n bool PipelineHandler::hasPendingRequests(const Camera *camera) const\n {\n-\tconst CameraData *data = cameraData(camera);\n-\treturn !data->queuedRequests_.empty();\n+\treturn !camera->_d()->queuedRequests_.empty();\n }\n \n /**\n@@ -406,7 +382,7 @@ void PipelineHandler::queueRequest(Request *request)\n \tLIBCAMERA_TRACEPOINT(request_queue, request);\n \n \tCamera *camera = request->camera_;\n-\tCameraData *data = cameraData(camera);\n+\tCamera::Private *data = camera->_d();\n \tdata->queuedRequests_.push_back(request);\n \n \trequest->sequence_ = data->requestSequence_++;\n@@ -479,7 +455,7 @@ void PipelineHandler::completeRequest(Request *request)\n \n \trequest->complete();\n \n-\tCameraData *data = cameraData(camera);\n+\tCamera::Private *data = camera->_d();\n \n \twhile (!data->queuedRequests_.empty()) {\n \t\tRequest *req = data->queuedRequests_.front();\n@@ -507,6 +483,15 @@ void PipelineHandler::completeRequest(Request *request)\n void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera,\n \t\t\t\t     std::unique_ptr<CameraData> data)\n {\n+\t/*\n+\t * To be removed once all pipeline handlers will have migrated from\n+\t * CameraData to Camera::Private.\n+\t */\n+\tif (data) {\n+\t\tcamera->_d()->controlInfo_ = std::move(data->controlInfo_);\n+\t\tcamera->_d()->properties_ = std::move(data->properties_);\n+\t}\n+\n \tcameraData_[camera.get()] = std::move(data);\n \tcameras_.push_back(camera);\n \n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "09/17"
    ]
}