{"id":13234,"url":"https://patchwork.libcamera.org/api/patches/13234/?format=json","web_url":"https://patchwork.libcamera.org/patch/13234/","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":"<20210805222436.6263-4-laurent.pinchart@ideasonboard.com>","date":"2021-08-05T22:24:29","name":"[libcamera-devel,03/10] libcamera: pipeline: simple: Delay opening of video device until init()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"2d507bc84d40755ec2c0613aa3daa798a77a405f","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13234/mbox/","series":[{"id":2314,"url":"https://patchwork.libcamera.org/api/series/2314/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2314","date":"2021-08-05T22:24:26","name":"Concurrent camera support in simple pipeline handler","version":1,"mbox":"https://patchwork.libcamera.org/series/2314/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13234/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13234/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 80741C3235\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Aug 2021 22:25:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AFBF96888B;\n\tFri,  6 Aug 2021 00:24:59 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B893D68811\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Aug 2021 00:24:56 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 60D874FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Aug 2021 00:24:56 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZgukgEu4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628202296;\n\tbh=cED4Slz0594G/5GZEExCd3pstt5tHhUSAFRaF8FPMmg=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=ZgukgEu4AzIc55q1dQTVBKsUt1psEHmWDpsG9yiae2K4VcD+kglarLfzu06STXAQk\n\tn13JWPFe5DbCjOfJ3FEgj5lD+zF1MXTLTPatIg26Vu+1ys9fPhQr0n/CKPeNpH0SKB\n\tAwIWswb1XsWuf0x0joOJRJGsDrSOul3ZFdikgRY8=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  6 Aug 2021 01:24:29 +0300","Message-Id":"<20210805222436.6263-4-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210805222436.6263-1-laurent.pinchart@ideasonboard.com>","References":"<20210805222436.6263-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 03/10] libcamera: pipeline: simple: Delay\n\topening of video device until init()","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The video device is currently opened in the SimpleCameraData\nconstructor. This requires opening the video devices on-demand the first\ntime they're accessed, which gets in the way of refactoring of\nper-entity data storage in the pipeline handler.\n\nMove opening of the video device to the SimpleCameraData::init()\nfunction. The on-demand open mechanism isn't touched yet, it will be\nrefactored later.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 11 +++++++++--\n 1 file changed, 9 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex e0695d052629..744f842dbfe6 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -308,6 +308,7 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n \t/* Remember at each entity where we came from. */\n \tstd::unordered_map<MediaEntity *, Entity> parents;\n \tMediaEntity *entity = nullptr;\n+\tMediaEntity *video = nullptr;\n \n \tqueue.push({ sensor, nullptr });\n \n@@ -321,7 +322,7 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n \t\tif (entity->function() == MEDIA_ENT_F_IO_V4L) {\n \t\t\tLOG(SimplePipeline, Debug)\n \t\t\t\t<< \"Found capture device \" << entity->name();\n-\t\t\tvideo_ = pipe->video(entity);\n+\t\t\tvideo = entity;\n \t\t\tbreak;\n \t\t}\n \n@@ -341,7 +342,7 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n \t\t}\n \t}\n \n-\tif (!video_)\n+\tif (!video)\n \t\treturn;\n \n \t/*\n@@ -384,6 +385,12 @@ int SimpleCameraData::init()\n \tSimpleConverter *converter = pipe->converter();\n \tint ret;\n \n+\tvideo_ = pipe->video(entities_.back().entity);\n+\tif (!video_) {\n+\t\tLOG(SimplePipeline, Error) << \"Failed to open video device\";\n+\t\treturn -ENODEV;\n+\t}\n+\n \t/*\n \t * Setup links first as some subdev drivers take active links into\n \t * account to propagate TRY formats. Such is life :-(\n","prefixes":["libcamera-devel","03/10"]}