{"id":11669,"url":"https://patchwork.libcamera.org/api/1.1/patches/11669/?format=json","web_url":"https://patchwork.libcamera.org/patch/11669/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20210323143610.787760-4-naush@raspberrypi.com>","date":"2021-03-23T14:36:06","name":"[libcamera-devel,v3,3/7] pipeline: raspberrypi: Conditionally open the embedded data node","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"3274504428dc26aa77b0cc1962ec74f22ef32c5e","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11669/mbox/","series":[{"id":1823,"url":"https://patchwork.libcamera.org/api/1.1/series/1823/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1823","date":"2021-03-23T14:36:03","name":"Raspberry Pi: ipa::init() restructuring","version":3,"mbox":"https://patchwork.libcamera.org/series/1823/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11669/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11669/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 9E2A8C32E5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Mar 2021 14:36:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 50DBD68D71;\n\tTue, 23 Mar 2021 15:36:22 +0100 (CET)","from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com\n\t[IPv6:2a00:1450:4864:20::52c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4081768D58\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Mar 2021 15:36:19 +0100 (CET)","by mail-ed1-x52c.google.com with SMTP id bx7so23698146edb.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Mar 2021 07:36:19 -0700 (PDT)","from naush-laptop.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tn6sm11282430eji.37.2021.03.23.07.36.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 23 Mar 2021 07:36:18 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"V0M4kLaS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=TqSX6AeFx6Ofk9lAqOuURZEnd2MT/7YTuqLSvTiTddg=;\n\tb=V0M4kLaSi8lLelB4h9+J7RkbOtT8elaVVa7AASHrE2shQeb+uLEcqfPDTag/KtOX8O\n\tIyfwJMvaE+jUKUX9+6T8gluv9mZG4XPK8ItL0HRa52rB2bg6xbKZ/oRW6Zpzke3mrnFz\n\t/Ur1bL47e8ERAhfq1JTZ4VyKm96qgCr+KWqxhvppAm7xCYe4rGckeTm5R4ZuBWhvYjEG\n\tPo2FeIvpEHBDH60zlL5Y38Aa6AN3SLkLkfLLOLX62+peThzAxfcEtNlwPYnlWhBDWvkF\n\tzpube2IKtgJOOERrjt7YpWeiZLCuDcuRRMwxr2yjDIjW0iGmQV6+c+m4aD+2bjiij5KC\n\tMusg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=TqSX6AeFx6Ofk9lAqOuURZEnd2MT/7YTuqLSvTiTddg=;\n\tb=SkZr7XSTt6yloqWNGFhcKDBLa8dWgkD1hT4CgT4sle0QFe+CYlWn+YXpUaEUVpnVCg\n\tgiqlicOf+saWN9AroMS8NEAPmTg4OTA6oxhK9nTDVPpBGp7cz9REEmSMz76tU/YeBkC2\n\twxXAhIK+uwMOyAsUU+09USjiaLvcE+HeHUD8JJVtnQ/UxUw9iPCPcPKE19h3LMWnlAxA\n\tPQwCHAN0JhpBwMjt9DefMJFnVi4tbZNwwZ8+CoY7jd4qc3JiUB0zpZIZpl4lE0KwkHn7\n\t0wgFqsLXz3kpGlsP5utQOyipA0K3B0GQ2Gv1dYxnNtoDFO2y/9kE++YKvuoiLEhjzT88\n\trEUA==","X-Gm-Message-State":"AOAM533tZzqRCnqWBcGzekX+wTIIDcw7PG0OZbl8woiC1MuxiRYX/kdF\n\tSIVOb35R6FHdI0ja1IKe83Tk0Bkimz3Udg==","X-Google-Smtp-Source":"ABdhPJzUg1yz/oU+9NldiTmmVQwAOYbpUjrhekEZhROtkn+hgkdyjo6BlX0LU0DdAPJYyyxiwpbcEQ==","X-Received":"by 2002:a05:6402:1d33:: with SMTP id\n\tdh19mr4867192edb.362.1616510178628; \n\tTue, 23 Mar 2021 07:36:18 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 23 Mar 2021 14:36:06 +0000","Message-Id":"<20210323143610.787760-4-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210323143610.787760-1-naush@raspberrypi.com>","References":"<20210323143610.787760-1-naush@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 3/7] pipeline: raspberrypi:\n\tConditionally open the embedded data node","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Conditionally open the embedded data node in pipeline_handler::match()\nbased on whether the ipa::init() result reports if the sensor supports\nembedded data or not.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nTested-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 59 ++++++++-----------\n 1 file changed, 23 insertions(+), 36 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex ce1994186d66..ed8cc4ead771 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -138,7 +138,7 @@ class RPiCameraData : public CameraData\n {\n public:\n \tRPiCameraData(PipelineHandler *pipe)\n-\t\t: CameraData(pipe), embeddedNodeOpened_(false), state_(State::Stopped),\n+\t\t: CameraData(pipe), state_(State::Stopped),\n \t\t  supportsFlips_(false), flipsAlterBayerOrder_(false),\n \t\t  updateScalerCrop_(true), dropFrameCount_(0), ispOutputCount_(0)\n \t{\n@@ -183,7 +183,6 @@ public:\n \n \tstd::unique_ptr<DelayedControls> delayedCtrls_;\n \tbool sensorMetadata_;\n-\tbool embeddedNodeOpened_;\n \n \t/*\n \t * All the functions in this class are called from a single calling\n@@ -749,19 +748,13 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t\tLOG(RPI, Error) << \"Failed to configure the IPA: \" << ret;\n \n \t/*\n-\t * The IPA will set data->sensorMetadata_ to true if embedded data is\n-\t * supported on this sensor. If so, open the Unicam embedded data\n-\t * node and configure the output format.\n+\t * Configure the Unicam embedded data output format only if the sensor\n+\t * supports it.\n \t */\n \tif (data->sensorMetadata_) {\n \t\tformat = {};\n \t\tformat.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA);\n \n-\t\tif (!data->embeddedNodeOpened_) {\n-\t\t\tdata->unicam_[Unicam::Embedded].dev()->open();\n-\t\t\tdata->embeddedNodeOpened_ = true;\n-\t\t}\n-\n \t\tLOG(RPI, Debug) << \"Setting embedded data format.\";\n \t\tret = data->unicam_[Unicam::Embedded].dev()->setFormat(&format);\n \t\tif (ret) {\n@@ -778,14 +771,6 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t\t */\n \t\tif (rawStream)\n \t\t\tdata->unicam_[Unicam::Embedded].setExternal(true);\n-\t} else {\n-\t\t/*\n-\t\t * No embedded data present, so we do not want to iterate over\n-\t\t * the embedded data stream when starting and stopping.\n-\t\t */\n-\t\tdata->streams_.erase(std::remove(data->streams_.begin(), data->streams_.end(),\n-\t\t\t\t\t\t &data->unicam_[Unicam::Embedded]),\n-\t\t\t\t     data->streams_.end());\n \t}\n \n \t/*\n@@ -989,24 +974,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n \tdata->isp_[Isp::Output1] = RPi::Stream(\"ISP Output1\", isp_->getEntityByName(\"bcm2835-isp0-capture2\"));\n \tdata->isp_[Isp::Stats] = RPi::Stream(\"ISP Stats\", isp_->getEntityByName(\"bcm2835-isp0-capture3\"));\n \n-\t/* This is just for convenience so that we can easily iterate over all streams. */\n-\tfor (auto &stream : data->unicam_)\n-\t\tdata->streams_.push_back(&stream);\n-\tfor (auto &stream : data->isp_)\n-\t\tdata->streams_.push_back(&stream);\n-\n-\t/*\n-\t * Open all Unicam and ISP streams. The exception is the embedded data\n-\t * stream, which only gets opened if the IPA reports that the sensor\n-\t * supports embedded data. This happens in RPiCameraData::configureIPA().\n-\t */\n-\tfor (auto const stream : data->streams_) {\n-\t\tif (stream != &data->unicam_[Unicam::Embedded]) {\n-\t\t\tif (stream->dev()->open())\n-\t\t\t\treturn false;\n-\t\t}\n-\t}\n-\n \t/* Wire up all the buffer connections. */\n \tdata->unicam_[Unicam::Image].dev()->frameStart.connect(data.get(), &RPiCameraData::frameStarted);\n \tdata->unicam_[Unicam::Image].dev()->bufferReady.connect(data.get(), &RPiCameraData::unicamBufferDequeue);\n@@ -1036,6 +1003,26 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n \t\treturn false;\n \t}\n \n+\t/*\n+\t * Open all Unicam and ISP streams. The exception is the embedded data\n+\t * stream, which only gets opened below if the IPA reports that the sensor\n+\t * supports embedded data.\n+\t *\n+\t * The below grouping is just for convenience so that we can easily\n+\t * iterate over all streams in one go.\n+\t */\n+\tdata->streams_.push_back(&data->unicam_[Unicam::Image]);\n+\tif (sensorConfig.sensorMetadata)\n+\t\tdata->streams_.push_back(&data->unicam_[Unicam::Embedded]);\n+\n+\tfor (auto &stream : data->isp_)\n+\t\tdata->streams_.push_back(&stream);\n+\n+\tfor (auto stream : data->streams_) {\n+\t\tif (stream->dev()->open())\n+\t\t\treturn false;\n+\t}\n+\n \t/*\n \t * Setup our delayed control writer with the sensor default\n \t * gain and exposure delays. Mark VBLANK for priority write.\n","prefixes":["libcamera-devel","v3","3/7"]}