Patch Detail
Show a patch.
GET /api/patches/2445/?format=api
{ "id": 2445, "url": "https://patchwork.libcamera.org/api/patches/2445/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2445/", "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": "<20191223072620.13022-3-paul.elder@ideasonboard.com>", "date": "2019-12-23T07:26:16", "name": "[libcamera-devel,v3,2/6] libcamera: pipeline_handler: Add map from devnum to cameras", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "cf617356a58f9e6862bc9f14d8ad8892602e75b3", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2445/mbox/", "series": [ { "id": 592, "url": "https://patchwork.libcamera.org/api/series/592/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=592", "date": "2019-12-23T07:26:14", "name": "V4L2 compatibility layer", "version": 3, "mbox": "https://patchwork.libcamera.org/series/592/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2445/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2445/checks/", "tags": {}, "headers": { "Return-Path": "<paul.elder@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 11D2B605D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Dec 2019 08:26:49 +0100 (CET)", "from neptunite.amanokami.net (173-16-160-11.client.mchsi.com\n\t[173.16.160.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D98C5330;\n\tMon, 23 Dec 2019 08:26:47 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1577086008;\n\tbh=s/apEtM2B5nIXIB1dh4v42bvpo2N+ga36ZE6MG2S6xM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=QE/feDWFTWVDyXyInJsGLQyi5oc9ig1fwxhZr0NCOOW91OKzutELvJyKnvp1d0Fv/\n\tA9BVp/00q9piWWpGX1HADPoVHY3kg//EzTipxjx16WkVBC9agyMyFpaeExFGjk8yel\n\tG12JbrTmyrvpCFUAJGYH8n7OZ5kF+UdTf/PaNKSQ=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 23 Dec 2019 01:26:16 -0600", "Message-Id": "<20191223072620.13022-3-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.23.0", "In-Reply-To": "<20191223072620.13022-1-paul.elder@ideasonboard.com>", "References": "<20191223072620.13022-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 2/6] libcamera: pipeline_handler: Add\n\tmap from devnum to cameras", "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>", "X-List-Received-Date": "Mon, 23 Dec 2019 07:26:49 -0000" }, "content": "The V4L2 compatibility layer will need a way to map device numbers to\nlibcamera Cameras. As a first step, we add a map from devnum to Cameras\nto PipelineHandler, as well as an overloaded registerCamera() method to\nadd to this map.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nNew in v3\n---\n src/libcamera/include/pipeline_handler.h | 6 +++++\n src/libcamera/pipeline_handler.cpp | 30 ++++++++++++++++++++++++\n 2 files changed, 36 insertions(+)", "diff": "diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex f3622631..563de72a 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -12,6 +12,7 @@\n #include <memory>\n #include <set>\n #include <string>\n+#include <sys/sysmacros.h>\n #include <vector>\n \n #include <ipa/ipa_interface.h>\n@@ -84,9 +85,13 @@ public:\n \n \tconst char *name() const { return name_; }\n \n+\tconst std::map<dev_t, std::weak_ptr<Camera>> &camerasByDevnum() const { return camerasByDevnum_; }\n+\n protected:\n \tvoid registerCamera(std::shared_ptr<Camera> camera,\n \t\t\t std::unique_ptr<CameraData> data);\n+\tvoid registerCamera(std::shared_ptr<Camera> camera,\n+\t\t\t std::unique_ptr<CameraData> data, dev_t devnum);\n \tvoid hotplugMediaDevice(MediaDevice *media);\n \n \tvirtual int queueRequestDevice(Camera *camera, Request *request) = 0;\n@@ -102,6 +107,7 @@ private:\n \tstd::vector<std::shared_ptr<MediaDevice>> mediaDevices_;\n \tstd::vector<std::weak_ptr<Camera>> cameras_;\n \tstd::map<const Camera *, std::unique_ptr<CameraData>> cameraData_;\n+\tstd::map<dev_t, std::weak_ptr<Camera>> camerasByDevnum_;\n \n \tconst char *name_;\n \ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 5badf31c..90211f12 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -7,6 +7,8 @@\n \n #include \"pipeline_handler.h\"\n \n+#include <sys/sysmacros.h>\n+\n #include <libcamera/buffer.h>\n #include <libcamera/camera.h>\n #include <libcamera/camera_manager.h>\n@@ -453,6 +455,28 @@ void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera,\n \tmanager_->addCamera(std::move(camera));\n }\n \n+/**\n+ * \\brief Register a camera to the camera manager and pipeline handler\n+ * \\param[in] camera The camera to be added\n+ * \\param[in] data Pipeline-specific data for the camera\n+ * \\param[in] devnum Device number of the camera\n+ *\n+ * This method is called by pipeline handlers to register the cameras they\n+ * handle with the camera manager. It associates the pipeline-specific \\a data\n+ * with the camera, for later retrieval with cameraData(). Ownership of \\a data\n+ * is transferred to the PipelineHandler.\n+ *\n+ * \\a devnum is the device number (as returned by makedev) that the \\a camera\n+ * is to be associated with.\n+ */\n+void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera,\n+\t\t\t\t std::unique_ptr<CameraData> data,\n+\t\t\t\t dev_t devnum)\n+{\n+\tregisterCamera(camera, std::move(data));\n+\tcamerasByDevnum_[devnum] = camera;\n+}\n+\n /**\n * \\brief Enable hotplug handling for a media device\n * \\param[in] media The media device\n@@ -538,6 +562,12 @@ CameraData *PipelineHandler::cameraData(const Camera *camera)\n * \\return The pipeline handler name\n */\n \n+/**\n+ * \\fn PipelineHandler::camerasByDevnum()\n+ * \\brief Retrieve the map of devnums to cameras\n+ * \\return The map of devnums to cameras\n+ */\n+\n /**\n * \\class PipelineHandlerFactory\n * \\brief Registration of PipelineHandler classes and creation of instances\n", "prefixes": [ "libcamera-devel", "v3", "2/6" ] }