Patch Detail
Show a patch.
GET /api/patches/538/?format=api
{ "id": 538, "url": "https://patchwork.libcamera.org/api/patches/538/?format=api", "web_url": "https://patchwork.libcamera.org/patch/538/", "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": "<20190206060818.13907-24-laurent.pinchart@ideasonboard.com>", "date": "2019-02-06T06:08:14", "name": "[libcamera-devel,23/27] libcamera: pipeline: ipu3: Create video devices and subdevices", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "8ff6f1c4591a5d31d69f426c5e4b41bc5e2cbe0e", "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/538/mbox/", "series": [ { "id": 170, "url": "https://patchwork.libcamera.org/api/series/170/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=170", "date": "2019-02-06T06:07:51", "name": "Capture frames throught requests", "version": 1, "mbox": "https://patchwork.libcamera.org/series/170/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/538/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/538/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "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 1303D6102A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 6 Feb 2019 07:08:29 +0100 (CET)", "from pendragon.ideasonboard.com (d51A4137F.access.telenet.be\n\t[81.164.19.127])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B4B942D7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 6 Feb 2019 07:08:28 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549433308;\n\tbh=BRNAza+w9JzDD6WKA/TZlvelODYw38XZ+wNVJP90JK4=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=rqTEbixDU4UoN3tZdQPCbOZ3frp4a/rM80mEm7L4eGXnw5XXfXLxMyJ0gRnljQAuh\n\tH5libZTXOPRyORUiT3lEiN40UyTS3QskOVIqcg+sjAkMUSpFmeokjusUribWPD/Zvk\n\ts0pLrUBohxoV1ghZ/0LOJ5YZ0Ov3TW9CLzl2lkH4=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 6 Feb 2019 08:08:14 +0200", "Message-Id": "<20190206060818.13907-24-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.19.2", "In-Reply-To": "<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>", "References": "<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 23/27] libcamera: pipeline: ipu3: Create\n\tvideo devices and subdevices", "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": "Wed, 06 Feb 2019 06:08:30 -0000" }, "content": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nCreate the video devices and subdevices associated with an IPU3 camera.\nWhile at there, move the IPU3 pipeline handler class definition and the\nassociated IPU3CameraData to a separate header as the class has now\ngrown enough.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 76 ++++++++++++++++------------\n 1 file changed, 44 insertions(+), 32 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 3f096bf1251b..9629057a1b2f 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -17,6 +17,7 @@\n #include \"pipeline_handler.h\"\n #include \"utils.h\"\n #include \"v4l2_device.h\"\n+#include \"v4l2_subdevice.h\"\n \n namespace libcamera {\n \n@@ -49,23 +50,32 @@ private:\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\t\t: cio2_(nullptr), csi2_(nullptr), sensor_(nullptr) {}\n+\n+\t\t~IPU3CameraData()\n+\t\t{\n+\t\t\tdelete cio2_;\n+\t\t\tdelete csi2_;\n+\t\t\tdelete sensor_;\n+\t\t}\n+\n+\t\tV4L2Device *cio2_;\n+\t\tV4L2Subdevice *csi2_;\n+\t\tV4L2Subdevice *sensor_;\n+\n \t\tStream stream_;\n \t};\n \n-\tstd::shared_ptr<MediaDevice> cio2_;\n-\tstd::shared_ptr<MediaDevice> imgu_;\n-\n \tIPU3CameraData *cameraData(const Camera *camera)\n \t{\n \t\treturn static_cast<IPU3CameraData *>(\n \t\t\tPipelineHandler::cameraData(camera));\n \t}\n \n-\tV4L2Device *createVideoDevice(unsigned int id);\n \tvoid registerCameras();\n+\n+\tstd::shared_ptr<MediaDevice> cio2_;\n+\tstd::shared_ptr<MediaDevice> imgu_;\n };\n \n PipelineHandlerIPU3::PipelineHandlerIPU3(CameraManager *manager)\n@@ -208,24 +218,6 @@ 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@@ -241,6 +233,7 @@ void PipelineHandlerIPU3::registerCameras()\n \tfor (unsigned int id = 0; id < 4; ++id) {\n \t\tstd::string csi2Name = \"ipu3-csi2 \" + std::to_string(id);\n \t\tMediaEntity *csi2 = cio2_->getEntityByName(csi2Name);\n+\t\tint ret;\n \n \t\t/*\n \t\t * This shall not happen, as the device enumerator matched\n@@ -281,18 +274,37 @@ void PipelineHandlerIPU3::registerCameras()\n \t\tstd::shared_ptr<Camera> camera = Camera::create(this, cameraName, streams);\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 * Create and open video devices and subdevices associated with\n+\t\t * the camera.\n+\t\t *\n+\t\t * If any of these operations fails, the Camera instance won't\n+\t\t * be registered. The 'camera' shared pointer and the 'data'\n+\t\t * unique pointers go out of scope and delete the objects they\n+\t\t * manage.\n \t\t */\n-\t\tdata->dev_ = createVideoDevice(id);\n-\t\tif (!data->dev_) {\n+\t\tstd::string cio2Name = \"ipu3-cio2 \" + std::to_string(id);\n+\t\tMediaEntity *cio2 = cio2_->getEntityByName(cio2Name);\n+\t\tif (!cio2) {\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\t\t<< \"Failed to get entity '\" << cio2Name << \"'\";\n \t\t\tcontinue;\n \t\t}\n \n+\t\tdata->cio2_ = new V4L2Device(cio2);\n+\t\tret = data->cio2_->open();\n+\t\tif (ret)\n+\t\t\tcontinue;\n+\n+\t\tdata->sensor_ = new V4L2Subdevice(sensor);\n+\t\tret = data->sensor_->open();\n+\t\tif (ret)\n+\t\t\tcontinue;\n+\n+\t\tdata->csi2_ = new V4L2Subdevice(csi2);\n+\t\tret = data->csi2_->open();\n+\t\tif (ret)\n+\t\t\tcontinue;\n+\n \t\tsetCameraData(camera.get(), std::move(data));\n \t\tregisterCamera(std::move(camera));\n \n", "prefixes": [ "libcamera-devel", "23/27" ] }