Show a patch.

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

{
    "id": 1563,
    "url": "https://patchwork.libcamera.org/api/patches/1563/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1563/",
    "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": "<20190701201504.28487-5-laurent.pinchart@ideasonboard.com>",
    "date": "2019-07-01T20:14:55",
    "name": "[libcamera-devel,v4,04/13] libcamera: camera: Provide a list of ControlInfo",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "0a7c89406eb8f2c2b738a9c874b63c40e57d467f",
    "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/1563/mbox/",
    "series": [
        {
            "id": 386,
            "url": "https://patchwork.libcamera.org/api/series/386/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=386",
            "date": "2019-07-01T20:14:51",
            "name": "libcamera Controls",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/386/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1563/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1563/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AEB386157D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 22:15:29 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 59CD51200\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Jul 2019 22:15:29 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562012129;\n\tbh=SzGGUSuBzXMnb5DuPM1IX8QwlJlyjWsmnxEH5UUpnKo=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=bd0xx8FophDTEi98cmy000GWdIgEQV1SmeTHHqv/TJs82rc86+KR+SE/ILQiXPPp0\n\t2h377Rrhizj4sUfNx+/w1gUTVKTJHQiAPc2ZMyXNYiKvbBicLnhhvLI1xx3DObZQiB\n\tBfXuQk730N1pibjrBfX7M3Ykz6JvsyLEagWhllfw=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  1 Jul 2019 23:14:55 +0300",
        "Message-Id": "<20190701201504.28487-5-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190701201504.28487-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20190701201504.28487-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 04/13] libcamera: camera: Provide a\n\tlist of ControlInfo",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "X-List-Received-Date": "Mon, 01 Jul 2019 20:15:30 -0000"
    },
    "content": "From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nExtend the Camera class to expose the controls it supports. Each\npipeline should generate a list of controls supported by each camera it\ncreates. These are represented by a ControlInfoMap, and an associated\nControlList of default values.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/camera.h               |  3 +++\n include/libcamera/controls.h             |  2 ++\n src/libcamera/camera.cpp                 | 12 ++++++++++++\n src/libcamera/controls.cpp               |  5 +++++\n src/libcamera/include/pipeline_handler.h |  4 ++++\n src/libcamera/pipeline_handler.cpp       | 19 +++++++++++++++++++\n 6 files changed, 45 insertions(+)",
    "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex fb2f7ba3423c..6d693d9a6c7a 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -12,6 +12,7 @@\n #include <set>\n #include <string>\n \n+#include <libcamera/controls.h>\n #include <libcamera/request.h>\n #include <libcamera/signal.h>\n #include <libcamera/stream.h>\n@@ -83,6 +84,8 @@ public:\n \tint acquire();\n \tint release();\n \n+\tconst ControlInfoMap &controls();\n+\n \tconst std::set<Stream *> &streams() const;\n \tstd::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles);\n \tint configure(CameraConfiguration *config);\ndiff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 2206155909ca..18293c9462cf 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -99,6 +99,8 @@ static inline bool operator!=(const ControlInfo &lhs, const ControlId &rhs)\n \treturn !(lhs == rhs);\n }\n \n+using ControlInfoMap = std::unordered_map<ControlId, ControlInfo>;\n+\n class ControlList\n {\n private:\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 617ea99cdf71..592dfd39eacc 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -548,6 +548,18 @@ int Camera::release()\n \treturn 0;\n }\n \n+/**\n+ * \\brief Retrieve the list of controls supported by the camera\n+ *\n+ * Camera controls remain constant through the lifetime of the camera.\n+ *\n+ * \\return A ControlInfoMap listing the controls supported by the camera\n+ */\n+const ControlInfoMap &Camera::controls()\n+{\n+\treturn pipe_->controls(this);\n+}\n+\n /**\n  * \\brief Retrieve all the camera's stream information\n  *\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 7fac1169cbfd..cd2cf337b379 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -325,6 +325,11 @@ bool operator==(const ControlInfo &lhs, const ControlId &rhs)\n \treturn lhs.id() == rhs;\n }\n \n+/**\n+ * \\typedef ControlInfoMap\n+ * \\brief A map of ControlId to ControlInfo\n+ */\n+\n /**\n  * \\class ControlList\n  * \\brief Associate a list of ControlId with their values for a camera\ndiff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex a4cbc593a179..f836d5d1a600 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -14,6 +14,7 @@\n #include <string>\n #include <vector>\n \n+#include <libcamera/controls.h>\n #include <libcamera/stream.h>\n \n namespace libcamera {\n@@ -41,6 +42,7 @@ public:\n \tCamera *camera_;\n \tPipelineHandler *pipe_;\n \tstd::list<Request *> queuedRequests_;\n+\tControlInfoMap controlInfo_;\n \n private:\n \tCameraData(const CameraData &) = delete;\n@@ -60,6 +62,8 @@ public:\n \tbool lock();\n \tvoid unlock();\n \n+\tconst ControlInfoMap &controls(Camera *camera);\n+\n \tvirtual CameraConfiguration *generateConfiguration(Camera *camera,\n \t\tconst StreamRoles &roles) = 0;\n \tvirtual int configure(Camera *camera, CameraConfiguration *config) = 0;\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex c91ef2f7d336..0283e4e5ad51 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -88,6 +88,14 @@ LOG_DEFINE_CATEGORY(Pipeline)\n  * PipelineHandler::completeRequest()\n  */\n \n+/**\n+ * \\var CameraData::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  * \\class PipelineHandler\n  * \\brief Create and manage cameras based on a set of media devices\n@@ -217,6 +225,17 @@ void PipelineHandler::unlock()\n \t\tmedia->unlock();\n }\n \n+/**\n+ * \\brief Retrieve the list of controls for a camera\n+ * \\param[in] camera The camera\n+ * \\return A ControlInfoMap listing the controls support by \\a camera\n+ */\n+const ControlInfoMap &PipelineHandler::controls(Camera *camera)\n+{\n+\tCameraData *data = cameraData(camera);\n+\treturn data->controlInfo_;\n+}\n+\n /**\n  * \\fn PipelineHandler::generateConfiguration()\n  * \\brief Generate a camera configuration for a specified camera\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "04/13"
    ]
}