Patch Detail
Show a patch.
GET /api/patches/371/?format=api
{ "id": 371, "url": "https://patchwork.libcamera.org/api/patches/371/?format=api", "web_url": "https://patchwork.libcamera.org/patch/371/", "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": "<20190124113020.7203-3-jacopo@jmondi.org>", "date": "2019-01-24T11:30:20", "name": "[libcamera-devel,2/2] libcamera: ipu3: Create CIO2 V4L2 devices", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "82243e1bde8fce49576c143fa3cd08c842de9bb6", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/371/mbox/", "series": [ { "id": 127, "url": "https://patchwork.libcamera.org/api/series/127/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=127", "date": "2019-01-24T11:30:18", "name": "Add pipeline-specific per-camera data", "version": 1, "mbox": "https://patchwork.libcamera.org/series/127/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/371/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/371/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id ECD9160C82\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Jan 2019 12:30:13 +0100 (CET)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 7E855E0007;\n\tThu, 24 Jan 2019 11:30:13 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 24 Jan 2019 12:30:20 +0100", "Message-Id": "<20190124113020.7203-3-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190124113020.7203-1-jacopo@jmondi.org>", "References": "<20190124113020.7203-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 2/2] libcamera: ipu3: Create CIO2 V4L2\n\tdevices", "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": "Thu, 24 Jan 2019 11:30:14 -0000" }, "content": "Create V4L2 devices for the CIO2 capture video nodes and associate them\nwith the camera they are part of.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 50 ++++++++++++++++++++++++++++\n 1 file changed, 50 insertions(+)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 8cbc10a..9f5a40f 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -15,6 +15,8 @@\n #include \"log.h\"\n #include \"media_device.h\"\n #include \"pipeline_handler.h\"\n+#include \"utils.h\"\n+#include \"v4l2_device.h\"\n \n namespace libcamera {\n \n@@ -29,9 +31,19 @@ public:\n \tbool match(CameraManager *manager, DeviceEnumerator *enumerator);\n \n private:\n+\tclass IPU3CameraData : public CameraData\n+\t{\n+\tpublic:\n+\t\tIPU3CameraData()\n+\t\t\t: dev_(nullptr) { }\n+\t\t~IPU3CameraData() { delete dev_; }\n+\t\tV4L2Device *dev_;\n+\t};\n+\n \tMediaDevice *cio2_;\n \tMediaDevice *imgu_;\n \n+\tV4L2Device *createVideoDevice(unsigned int id);\n \tvoid registerCameras(CameraManager *manager);\n };\n \n@@ -122,6 +134,24 @@ error_release_mdev:\n \treturn false;\n }\n \n+/* Create video devices for the CIO2 unit associated with a camera. */\n+V4L2Device *PipelineHandlerIPU3::createVideoDevice(unsigned int id)\n+{\n+\tstd::string cio2Name = \"ipu3-cio2 \" + std::to_string(id);\n+\tMediaEntity *cio2 = cio2_->getEntityByName(cio2Name);\n+\tif (!cio2)\n+\t\treturn nullptr;\n+\n+\tV4L2Device *dev = new V4L2Device(*cio2);\n+\tif (dev->open()) {\n+\t\tdelete dev;\n+\t\treturn nullptr;\n+\t}\n+\tdev->close();\n+\n+\treturn dev;\n+}\n+\n /*\n * Cameras are created associating an image sensor (represented by a\n * media entity with function MEDIA_ENT_F_CAM_SENSOR) to one of the four\n@@ -172,6 +202,26 @@ void PipelineHandlerIPU3::registerCameras(CameraManager *manager)\n \n \t\tstd::string cameraName = sensor->name() + \" \" + std::to_string(id);\n \t\tstd::shared_ptr<Camera> camera = Camera::create(cameraName);\n+\n+\t\tsetCameraData(camera.get(),\n+\t\t\t std::move(utils::make_unique<IPU3CameraData>()));\n+\t\tIPU3CameraData *data =\n+\t\t\treinterpret_cast<IPU3CameraData *>(cameraData(camera.get()));\n+\n+\t\t/*\n+\t\t * If V4L2 device creation fails, the Camera instance won't be\n+\t\t * registered. The 'camera' shared pointer goes out of scope\n+\t\t * and deletes the Camera it manages.\n+\t\t */\n+\t\tV4L2Device *videoDev = createVideoDevice(id);\n+\t\tif (!videoDev) {\n+\t\t\tLOG(IPU3, Error)\n+\t\t\t\t<< \"Failed to register camera[\"\n+\t\t\t\t<< numCameras << \"] \\\"\" << cameraName << \"\\\"\";\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tdata->dev_ = videoDev;\n \t\tmanager->addCamera(std::move(camera));\n \n \t\tLOG(IPU3, Info)\n", "prefixes": [ "libcamera-devel", "2/2" ] }