{"id":306,"url":"https://patchwork.libcamera.org/api/patches/306/?format=json","web_url":"https://patchwork.libcamera.org/patch/306/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190121172705.19985-6-jacopo@jmondi.org>","date":"2019-01-21T17:27:04","name":"[libcamera-devel,5/6] libcamera: ipu3: Create CIO2 V4L2 devices","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"a097ef0ec0ca781114a7cab9a2414af79dc59f03","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/306/mbox/","series":[{"id":105,"url":"https://patchwork.libcamera.org/api/series/105/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=105","date":"2019-01-21T17:26:59","name":"libcamera: Augment V4L2 device","version":1,"mbox":"https://patchwork.libcamera.org/series/105/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/306/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/306/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 081C860CA0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Jan 2019 18:27:06 +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 relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 966821BF213;\n\tMon, 21 Jan 2019 17:27:05 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 21 Jan 2019 18:27:04 +0100","Message-Id":"<20190121172705.19985-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190121172705.19985-1-jacopo@jmondi.org>","References":"<20190121172705.19985-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 5/6] 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":"Mon, 21 Jan 2019 17:27:06 -0000"},"content":"Create V4L2 devices for the CIO2 capture video nodes.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 36 +++++++++++++++++++++++++---\n 1 file changed, 33 insertions(+), 3 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex daf681c..0689ce8 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@@ -30,6 +32,9 @@ private:\n \tMediaDevice *cio2_;\n \tMediaDevice *imgu_;\n \n+\tstd::vector<std::unique_ptr<V4L2Device>> videoDevices_;\n+\n+\tvoid createVideoDevices();\n \tvoid registerCameras(CameraManager *manager);\n };\n \n@@ -91,6 +96,12 @@ bool PipelineHandlerIPU3::match(CameraManager *manager, DeviceEnumerator *enumer\n \tcio2_->acquire();\n \timgu_->acquire();\n \n+\t/* Create video device nodes for CIO2 outputs */\n+\tif (cio2_->open())\n+\t\tgoto error_release_mdev;\n+\n+\tcreateVideoDevices();\n+\n \t/*\n \t * Disable all links that are enabled by default on CIO2, as camera\n \t * creation enables all valid links it finds.\n@@ -98,9 +109,6 @@ bool PipelineHandlerIPU3::match(CameraManager *manager, DeviceEnumerator *enumer\n \t * Close the CIO2 media device after, as links are enabled and should\n \t * not need to be changed after.\n \t */\n-\tif (cio2_->open())\n-\t\tgoto error_release_mdev;\n-\n \tif (cio2_->disableLinks())\n \t\tgoto error_close_cio2;\n \n@@ -120,6 +128,28 @@ error_release_mdev:\n \treturn false;\n }\n \n+/*\n+ * Create video devices for the CIO2 unit capture nodes and cache them\n+ * for later reuse.\n+ */\n+void PipelineHandlerIPU3::createVideoDevices()\n+{\n+\tfor (unsigned int id = 0; id < 3; ++id) {\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\tcontinue;\n+\n+\t\tstd::unique_ptr<V4L2Device> dev =\n+\t\t\tutils::make_unique<V4L2Device>(*cio2);\n+\t\tif (dev->open())\n+\t\t\tcontinue;\n+\t\tdev->close();\n+\n+\t\tvideoDevices_.push_back(std::move(dev));\n+\t}\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","prefixes":["libcamera-devel","5/6"]}