[{"id":1539,"web_url":"https://patchwork.libcamera.org/comment/1539/","msgid":"<998d4728-cc85-3f88-3e45-5c2f9ed69d27@ideasonboard.com>","date":"2019-04-30T09:35:24","subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: media_device: Open\n\tand close media device inside populate()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Niklas,\n\nOn 29/04/2019 20:17, Niklas Söderlund wrote:\n> Remove the need for the caller to open and close the media device when\n> populating the MediaDevice. This is done as an effort to make the usage\n> of the MediaDevice less error prone and the interface stricter.\n> \n> The rework also revealed and fixes a potential memory leak in\n> MediaDevice::populate() where if the second (or later) call to\n\n\"where resources would not be deleted if the second\" ?\n\n> MEDIA_IOC_G_TOPOLOGY would fail.\n> \n\nDiscussion topic below on MEDIA_IOC_G_TOPOLOGY related to code that is\nchanged, but not relevant to this patch.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/device_enumerator.cpp           |  8 +------\n>  src/libcamera/media_device.cpp                | 12 +++++++++--\n>  test/media_device/media_device_print_test.cpp |  6 ------\n>  test/pipeline/ipu3/ipu3_pipeline_test.cpp     |  5 -----\n>  test/v4l2_device/v4l2_device_test.cpp         |  5 -----\n>  test/v4l2_subdevice/v4l2_subdevice_test.cpp   | 21 +------------------\n>  6 files changed, 12 insertions(+), 45 deletions(-)\n> \n> diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp\n> index f6878b3d58b3f966..caf91dcff6efd564 100644\n> --- a/src/libcamera/device_enumerator.cpp\n> +++ b/src/libcamera/device_enumerator.cpp\n> @@ -205,11 +205,7 @@ int DeviceEnumerator::addDevice(const std::string &deviceNode)\n>  {\n>  \tstd::shared_ptr<MediaDevice> media = std::make_shared<MediaDevice>(deviceNode);\n>  \n> -\tint ret = media->open();\n> -\tif (ret < 0)\n> -\t\treturn ret;\n> -\n> -\tret = media->populate();\n> +\tint ret = media->populate();\n>  \tif (ret < 0) {\n>  \t\tLOG(DeviceEnumerator, Info)\n>  \t\t\t<< \"Unable to populate media device \" << deviceNode\n> @@ -236,8 +232,6 @@ int DeviceEnumerator::addDevice(const std::string &deviceNode)\n>  \t\t\treturn ret;\n>  \t}\n>  \n> -\tmedia->close();\n> -\n>  \tLOG(DeviceEnumerator, Debug)\n>  \t\t<< \"Added device \" << deviceNode << \": \" << media->driver();\n>  \n> diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\n> index 449571fb4b78fb94..4b3b8f1fa3e6aaad 100644\n> --- a/src/libcamera/media_device.cpp\n> +++ b/src/libcamera/media_device.cpp\n> @@ -221,6 +221,10 @@ int MediaDevice::populate()\n>  \n>  \tclear();\n>  \n> +\tret = open();\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n>  \t/*\n>  \t * Keep calling G_TOPOLOGY until the version number stays stable.\n>  \t */\n> @@ -237,8 +241,9 @@ int MediaDevice::populate()\n>  \t\t\tLOG(MediaDevice, Error)\n>  \t\t\t\t<< \"Failed to enumerate topology: \"\n>  \t\t\t\t<< strerror(-ret);\n> -\t\t\treturn ret;\n> +\t\t\tgoto done;\n>  \t\t}\n> +\t\tret = 0;\n>  \n>  \t\tif (version == topology.topology_version)\n>  \t\t\tbreak;\n\n\nPerhaps secondary to this patch, but I noticed due to following the\nchange to this error path:\n\nWe iterate calling ioctl(fd_, MEDIA_IOC_G_TOPOLOGY, &topology);\nallocating and freeing the associated struct arrays as we go.\n\nWould it be more efficient (or possible) to determine the topology\nversion first by calling in a loop with null pointers for those\ncomponents, and then making a final call at the end having performed a\nsingle set of allocations?\n\n\nI don't know if that's beneficial or not - but iterating with multiple\nnew and deletes of arrays seems costly.\n\n\n\n> @@ -262,6 +267,9 @@ int MediaDevice::populate()\n>  \t    populateLinks(topology))\n>  \t\tvalid_ = true;\n>  \n> +done:\n> +\tclose();\n> +\n>  \tdelete[] ents;\n>  \tdelete[] interfaces;\n>  \tdelete[] pads;\n> @@ -272,7 +280,7 @@ int MediaDevice::populate()\n>  \t\treturn -EINVAL;\n>  \t}\n>  \n> -\treturn 0;\n> +\treturn ret;\n>  }\n>  \n>  /**\n> diff --git a/test/media_device/media_device_print_test.cpp b/test/media_device/media_device_print_test.cpp\n> index 3eef973939201b27..ceffd538e13fca73 100644\n> --- a/test/media_device/media_device_print_test.cpp\n> +++ b/test/media_device/media_device_print_test.cpp\n> @@ -124,10 +124,6 @@ int MediaDevicePrintTest::testMediaDevice(const string deviceNode)\n>  \n>  \tdev.close();\n>  \n> -\tret = dev.open();\n> -\tif (ret)\n> -\t\treturn ret;\n> -\n>  \tret = dev.populate();\n>  \tif (ret)\n>  \t\treturn ret;\n> @@ -135,8 +131,6 @@ int MediaDevicePrintTest::testMediaDevice(const string deviceNode)\n>  \t/* Print out the media graph. */\n>  \tprintMediaGraph(dev, cerr);\n>  \n> -\tdev.close();\n> -\n>  \treturn 0;\n>  }\n>  \n> diff --git a/test/pipeline/ipu3/ipu3_pipeline_test.cpp b/test/pipeline/ipu3/ipu3_pipeline_test.cpp\n> index 953f0233cde485cb..1d4cc4d4950b8391 100644\n> --- a/test/pipeline/ipu3/ipu3_pipeline_test.cpp\n> +++ b/test/pipeline/ipu3/ipu3_pipeline_test.cpp\n> @@ -71,11 +71,6 @@ int IPU3PipelineTest::init()\n>  \t\treturn TestSkip;\n>  \t}\n>  \n> -\tif (cio2->open()) {\n> -\t\tcerr << \"Failed to open media device \" << cio2->deviceNode() << endl;\n> -\t\treturn TestFail;\n> -\t}\n> -\n>  \t/*\n>  \t * Camera sensor are connected to the CIO2 unit.\n>  \t * Count how many sensors are connected in the system\n> diff --git a/test/v4l2_device/v4l2_device_test.cpp b/test/v4l2_device/v4l2_device_test.cpp\n> index 90e5f7a3ee0c0f2f..833038d56ea4631d 100644\n> --- a/test/v4l2_device/v4l2_device_test.cpp\n> +++ b/test/v4l2_device/v4l2_device_test.cpp\n> @@ -46,9 +46,6 @@ int V4L2DeviceTest::init()\n>  \tif (!media_)\n>  \t\treturn TestSkip;\n>  \n> -\tif (!media_->acquire())\n> -\t\treturn TestSkip;\n> -\n>  \tMediaEntity *entity = media_->getEntityByName(\"vivid-000-vid-cap\");\n>  \tif (!entity)\n>  \t\treturn TestSkip;\n> @@ -62,8 +59,6 @@ int V4L2DeviceTest::init()\n>  \n>  void V4L2DeviceTest::cleanup()\n>  {\n> -\tmedia_->release();\n> -\n>  \tcapture_->streamOff();\n>  \tcapture_->releaseBuffers();\n>  \tcapture_->close();\n> diff --git a/test/v4l2_subdevice/v4l2_subdevice_test.cpp b/test/v4l2_subdevice/v4l2_subdevice_test.cpp\n> index 4e16ab6cf3e5f874..562a638cb28ebfb2 100644\n> --- a/test/v4l2_subdevice/v4l2_subdevice_test.cpp\n> +++ b/test/v4l2_subdevice/v4l2_subdevice_test.cpp\n> @@ -45,33 +45,16 @@ int V4L2SubdeviceTest::init()\n>  \t\treturn TestSkip;\n>  \t}\n>  \n> -\tif (!media_->acquire()) {\n> -\t\tcerr << \"Unable to acquire media device \"\n> -\t\t     << media_->deviceNode() << endl;\n> -\t\treturn TestSkip;\n> -\t}\n> -\n> -\tint ret = media_->open();\n> -\tif (ret) {\n> -\t\tcerr << \"Unable to open media device: \" << media_->deviceNode()\n> -\t\t     << \": \" << strerror(ret) << endl;\n> -\t\tmedia_->release();\n> -\t\treturn TestSkip;\n> -\t}\n> -\n>  \tMediaEntity *videoEntity = media_->getEntityByName(\"Scaler\");\n>  \tif (!videoEntity) {\n>  \t\tcerr << \"Unable to find media entity 'Scaler'\" << endl;\n> -\t\tmedia_->release();\n>  \t\treturn TestFail;\n>  \t}\n>  \n>  \tscaler_ = new V4L2Subdevice(videoEntity);\n> -\tret = scaler_->open();\n> -\tif (ret) {\n> +\tif (scaler_->open()) {\n\nIs this change necessary?\nDon't we want to print the ret value if this fails?\n\nActually it looks like that's already reported by V4L2Subdevice::open()\n\n\n>  \t\tcerr << \"Unable to open video subdevice \"\n>  \t\t     << scaler_->entity()->deviceNode() << endl;\n> -\t\tmedia_->release();\n>  \t\treturn TestSkip;\n>  \t}\n>  \n> @@ -80,7 +63,5 @@ int V4L2SubdeviceTest::init()\n>  \n>  void V4L2SubdeviceTest::cleanup()\n>  {\n> -\tmedia_->release();\n> -\n>  \tdelete scaler_;\n>  }\n>","headers":{"Return-Path":"<kieran.bingham@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 52E9F60E59\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Apr 2019 11:35:28 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B9F6B31D;\n\tTue, 30 Apr 2019 11:35:27 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1556616927;\n\tbh=NlPQhm5OCs8H9XgN/KRl6TCewk/G4JtenUryOONBHEI=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=uWPjce0+OuAGJwxydCsxzQ9FGKrqKJDP5UNRFzHoTnyOUCbbzejkml7ekE0QhunjM\n\tH6/CJ7b3XkzGSHJPzR6Z2vZ08LI8gIzTfDrZxZTSXh/reSTFBdUhbxGQkLN1qVEWHK\n\tg9yA441gmfhHQZ0hZ4QAx+IS+uqoGEZftztl4tq4=","Reply-To":"kieran.bingham@ideasonboard.com","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20190429191729.29697-1-niklas.soderlund@ragnatech.se>\n\t<20190429191729.29697-3-niklas.soderlund@ragnatech.se>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ\n\tcSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf\n\tKr2EAbc6tgg6DkAEHJb+1okosV09+0+TXywYvtEop/WUOWQ+zo+Y/OBd+8Ptgt1pDRyOBzL8\n\tRXa8ZqRf0Mwg75D+dKntZeJHzPRJyrlfQokngAAs4PaFt6UfS+ypMAF37T6CeDArQC41V3ko\n\tlPn1yMsVD0p+6i3DPvA/GPIksDC4owjnzVX9kM8Zc5Cx+XoAN0w5Eqo4t6qEVbuettxx55gq\n\t8K8FieAjgjMSxngo/HST8TpFeqI5nVeq0/lqtBRQKumuIqDg+Bkr4L1V/PSB6XgQcOdhtd36\n\tOe9X9dXB8YSNt7VjOcO7BTmFn/Z8r92mSAfHXpb07YJWJosQOQARAQABtDBLaWVyYW4gQmlu\n\tZ2hhbSA8a2llcmFuLmJpbmdoYW1AaWRlYXNvbmJvYXJkLmNvbT6JAkAEEwEKACoCGwMFCwkI\n\tBwIGFQgJCgsCBBYCAwECHgECF4ACGQEFAlnDk/gFCQeA/YsACgkQoR5GchCkYf3X5w/9EaZ7\n\tcnUcT6dxjxrcmmMnfFPoQA1iQXr/MXQJBjFWfxRUWYzjvUJb2D/FpA8FY7y+vksoJP7pWD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ADdxVQAm+Q\n\tsbsRB8KNNvVXBOVNwko86rQqF9drZuw=","Organization":"Ideas on Board","Message-ID":"<998d4728-cc85-3f88-3e45-5c2f9ed69d27@ideasonboard.com>","Date":"Tue, 30 Apr 2019 10:35:24 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.6.1","MIME-Version":"1.0","In-Reply-To":"<20190429191729.29697-3-niklas.soderlund@ragnatech.se>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: media_device: Open\n\tand close media device inside populate()","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":"Tue, 30 Apr 2019 09:35:28 -0000"}},{"id":1540,"web_url":"https://patchwork.libcamera.org/comment/1540/","msgid":"<20190430095342.GM16573@bigcity.dyn.berto.se>","date":"2019-04-30T09:53:42","subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: media_device: Open\n\tand close media device inside populate()","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Kieran,\n\nThanks for your feedback.\n\nOn 2019-04-30 10:35:24 +0100, Kieran Bingham wrote:\n\nsnip\n\n> > diff --git a/src/libcamera/media_device.cpp \n> > b/src/libcamera/media_device.cpp\n> > index 449571fb4b78fb94..4b3b8f1fa3e6aaad 100644\n> > --- a/src/libcamera/media_device.cpp\n> > +++ b/src/libcamera/media_device.cpp\n> > @@ -221,6 +221,10 @@ int MediaDevice::populate()\n> >  \n> >  \tclear();\n> >  \n> > +\tret = open();\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> >  \t/*\n> >  \t * Keep calling G_TOPOLOGY until the version number stays stable.\n> >  \t */\n> > @@ -237,8 +241,9 @@ int MediaDevice::populate()\n> >  \t\t\tLOG(MediaDevice, Error)\n> >  \t\t\t\t<< \"Failed to enumerate topology: \"\n> >  \t\t\t\t<< strerror(-ret);\n> > -\t\t\treturn ret;\n> > +\t\t\tgoto done;\n> >  \t\t}\n> > +\t\tret = 0;\n> >  \n> >  \t\tif (version == topology.topology_version)\n> >  \t\t\tbreak;\n> \n> \n> Perhaps secondary to this patch, but I noticed due to following the\n> change to this error path:\n> \n> We iterate calling ioctl(fd_, MEDIA_IOC_G_TOPOLOGY, &topology);\n> allocating and freeing the associated struct arrays as we go.\n> \n> Would it be more efficient (or possible) to determine the topology\n> version first by calling in a loop with null pointers for those\n> components, and then making a final call at the end having performed a\n> single set of allocations?\n> \n> \n> I don't know if that's beneficial or not - but iterating with multiple\n> new and deletes of arrays seems costly.\n\nUnfortunate this is not possible. The reason we iterate until we have \ntwo calls in a row with the same version is to ensure that no new \nentities have been added or removed between the calls. If they have we \nneed to resize the memory accordingly and refetch the data.\n\nLuckily it should not be common for this to happen as entities should \nonly really be register at probe() and async complete() time. And in the \ncase where no new entities are added to the graph between the calls \nthere is no over head as just two calls to MEDIA_IOC_G_TOPOLOGY are \npreformed. The first to get the sizes and a second to get the data with \nonly one memory allocation taking place between the two.","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x141.google.com (mail-lf1-x141.google.com\n\t[IPv6:2a00:1450:4864:20::141])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B74ED60E59\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Apr 2019 11:53:44 +0200 (CEST)","by mail-lf1-x141.google.com with SMTP id i68so10198825lfi.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Apr 2019 02:53:44 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tu8sm7789560lfi.83.2019.04.30.02.53.42\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 30 Apr 2019 02:53:42 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=MbLmgLLekRqAN8qLtA+UUkTmS1Q8dKJgzggAdsJJrHw=;\n\tb=hXK91ts8dw7WJXBo+R8BH3GoGlcnl8wo1GpdGXxlegCEsTOdpkPO0k4QwmDaFmzpVn\n\t965kGi0TGYeBb5SYB6BprE2ey/1u2DHvPReQYfmjSwWQhEO+bVkptwxB2FRcS0r6w5os\n\tXhPt9hy+l4PySjQaqcYlfzleFe84Q6l/J8LNKYUvXcQuQfwi5UfmtDqtfdINAzWIurta\n\tN7mP3aMObXUsCflzP9YYs13Sj8l/F9OMSECTd81pXU+3/lcj5K1wR4OJtf4ZIa7EnWnZ\n\tC8ocpmBRK75HxDBkHVwaqioHvXcNg6DrTgdz6BRA3HmGDyI+WzRt1ddCGbDOUu+YhjJm\n\tWB1w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=MbLmgLLekRqAN8qLtA+UUkTmS1Q8dKJgzggAdsJJrHw=;\n\tb=Ex3h1L/hDPoe9l1QMEY+dwCHcwMtWN8kq9WHGsu2WIjIG9I93O8hM7maxr0ryAzd3A\n\tQu5PIJUs7ThmJl3Rbk42smNnYvVq7ieprmh4o0l9xLcu1s3pb1dzPHMZJCENHwTPJFDb\n\tDGv3nyvsiobPbN6xSyEIn9PJAw3dmVV5N/buZR13lWOLAoWBalfdmbTvOjlzhnuPJrTD\n\t4gl+5/Tm5spUtKkD+5HsNnhJ8cf7E3CM952HvNID+BhVCg8vHaWSVyJfcrKlHI7Uod8P\n\t/mIE3BQaG/Lhtowea0oa7RwEKoj3HgkuSRB0t8ZCVKP+SAHoBgqorKzlPLo0yyO58kJV\n\tB8GA==","X-Gm-Message-State":"APjAAAWGnu/aga5cWZiwg/T0SxlNBmSfpRpbIoUHB+PntgvOAfixzXC6\n\tshPBOx905Ks2xUrih5K1Yd4/6w==","X-Google-Smtp-Source":"APXvYqz7TBtak2+sJEI7HenMGRkJHl5x1fJ4JOOpEvshSnyG9wqi8TT+YMU62bZnHKV6BmYbCSVyXw==","X-Received":"by 2002:a19:750e:: with SMTP id\n\ty14mr34445438lfe.74.1556618024021; \n\tTue, 30 Apr 2019 02:53:44 -0700 (PDT)","Date":"Tue, 30 Apr 2019 11:53:42 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190430095342.GM16573@bigcity.dyn.berto.se>","References":"<20190429191729.29697-1-niklas.soderlund@ragnatech.se>\n\t<20190429191729.29697-3-niklas.soderlund@ragnatech.se>\n\t<998d4728-cc85-3f88-3e45-5c2f9ed69d27@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<998d4728-cc85-3f88-3e45-5c2f9ed69d27@ideasonboard.com>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: media_device: Open\n\tand close media device inside populate()","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":"Tue, 30 Apr 2019 09:53:45 -0000"}},{"id":1542,"web_url":"https://patchwork.libcamera.org/comment/1542/","msgid":"<56ed2e7c-4343-8180-5521-5d28058a029a@ideasonboard.com>","date":"2019-04-30T10:52:59","subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: media_device: Open\n\tand close media device inside populate()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 30/04/2019 10:53, Niklas Söderlund wrote:\n> Hi Kieran,\n> \n> Thanks for your feedback.\n> \n> On 2019-04-30 10:35:24 +0100, Kieran Bingham wrote:\n> \n> snip\n> \n>>> diff --git a/src/libcamera/media_device.cpp \n>>> b/src/libcamera/media_device.cpp\n>>> index 449571fb4b78fb94..4b3b8f1fa3e6aaad 100644\n>>> --- a/src/libcamera/media_device.cpp\n>>> +++ b/src/libcamera/media_device.cpp\n>>> @@ -221,6 +221,10 @@ int MediaDevice::populate()\n>>>  \n>>>  \tclear();\n>>>  \n>>> +\tret = open();\n>>> +\tif (ret)\n>>> +\t\treturn ret;\n>>> +\n>>>  \t/*\n>>>  \t * Keep calling G_TOPOLOGY until the version number stays stable.\n>>>  \t */\n>>> @@ -237,8 +241,9 @@ int MediaDevice::populate()\n>>>  \t\t\tLOG(MediaDevice, Error)\n>>>  \t\t\t\t<< \"Failed to enumerate topology: \"\n>>>  \t\t\t\t<< strerror(-ret);\n>>> -\t\t\treturn ret;\n>>> +\t\t\tgoto done;\n>>>  \t\t}\n>>> +\t\tret = 0;\n>>>  \n>>>  \t\tif (version == topology.topology_version)\n>>>  \t\t\tbreak;\n>>\n>>\n>> Perhaps secondary to this patch, but I noticed due to following the\n>> change to this error path:\n>>\n>> We iterate calling ioctl(fd_, MEDIA_IOC_G_TOPOLOGY, &topology);\n>> allocating and freeing the associated struct arrays as we go.\n>>\n>> Would it be more efficient (or possible) to determine the topology\n>> version first by calling in a loop with null pointers for those\n>> components, and then making a final call at the end having performed a\n>> single set of allocations?\n>>\n>>\n>> I don't know if that's beneficial or not - but iterating with multiple\n>> new and deletes of arrays seems costly.\n> \n> Unfortunate this is not possible. The reason we iterate until we have \n> two calls in a row with the same version is to ensure that no new \n> entities have been added or removed between the calls. If they have we \n> need to resize the memory accordingly and refetch the data.\n>\n> Luckily it should not be common for this to happen as entities should \n> only really be register at probe() and async complete() time. And in the \n> case where no new entities are added to the graph between the calls \n> there is no over head as just two calls to MEDIA_IOC_G_TOPOLOGY are \n> preformed. The first to get the sizes and a second to get the data with \n> only one memory allocation taking place between the two.\n\nDo we need to check to ensure that the version has not changed between\nthe two instances of open that we have?\n\npopulate <open, close>\n\n### Change version number?\n\nacquire <open>\n\t# Needs to repopulate?\nrelease  <close>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6AE43600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Apr 2019 12:53:03 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C824B31D;\n\tTue, 30 Apr 2019 12:53:02 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1556621582;\n\tbh=kIUxg4HS9SGpimPR3iTaph9kndmtJRSnAIDVtP0Y1sE=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=SgPM7qIKNQGmMzuCmiWI5oQ8ig+iAarha5HkS3ajbVKx4gwt8BhGSRecPh7Q4kGBM\n\t2dv3OU/VCsz7lUy64X39ALBY9VG86f6WjEpAgVFdY7/lmljNeuabftyTOiPXRr2zHp\n\tJzVEURYsUl/aYEWiH9PcbbClsTjfdGVE1dbDQERs=","Reply-To":"kieran.bingham@ideasonboard.com","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20190429191729.29697-1-niklas.soderlund@ragnatech.se>\n\t<20190429191729.29697-3-niklas.soderlund@ragnatech.se>\n\t<998d4728-cc85-3f88-3e45-5c2f9ed69d27@ideasonboard.com>\n\t<20190430095342.GM16573@bigcity.dyn.berto.se>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ\n\tcSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGe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/UF/SjeUmaOmLSczM0s6XMeO\n\tVcE77UFtJ/+hLo4PRFKm5X1Pcar6g5m4xGqa+Xfzi9tRkwC29KMCoQOag1BhHChgqYaUH3yo\n\tUzaPwT/fY75iVI+yD0ih/e6j8qYvP8pvGwMQfrmN9YB0zB39YzCSdaUaNrWGD3iCBxg6lwSO\n\tLKeRhxxfiXCIYEf3vwOsP3YMx2JkD5doseXmWBGW1U0T/oJF+DVfKB6mv5UfsTzpVhJRgee7\n\t4jkjqFq4qsUGxcvF2xtRkfHFpZDbRgRlVmiWkqDkT4qMA+4q1y/dWwshSKi/uwVZNycuLsz+\n\t+OD8xPNCsMTqeUkAKfbD8xW4LCay3r/dD2ckoxRxtMD9eOAyu5wYzo/ydIPTh1QEj9SYyvp8\n\tO0g6CpxEwyHUQtF5oh15O018z3ZLztFJKR3RD42VKVsrnNDKnoY0f4U0z7eJv2NeF8xHMuiU\n\tRCIzqxX1GVYaNkKTnb/Qja8hnYnkUzY1Lc+OtwiGmXTwYsPZjjAaDX35J/RSKAoy5wGo/YFA\n\tJxB1gWThL4kOTbsqqXj9GLcyOImkW0lJGGR3o/fV91Zh63S5TKnf2YGGGzxki+ADdxVQAm+Q\n\tsbsRB8KNNvVXBOVNwko86rQqF9drZuw=","Organization":"Ideas on Board","Message-ID":"<56ed2e7c-4343-8180-5521-5d28058a029a@ideasonboard.com>","Date":"Tue, 30 Apr 2019 11:52:59 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.6.1","MIME-Version":"1.0","In-Reply-To":"<20190430095342.GM16573@bigcity.dyn.berto.se>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: media_device: Open\n\tand close media device inside populate()","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":"Tue, 30 Apr 2019 10:53:03 -0000"}},{"id":1563,"web_url":"https://patchwork.libcamera.org/comment/1563/","msgid":"<20190508144745.GC24112@bigcity.dyn.berto.se>","date":"2019-05-08T14:47:46","subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: media_device: Open\n\tand close media device inside populate()","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Kieran,\n\nThanks for your feedback.\n\nOn 2019-04-30 11:52:59 +0100, Kieran Bingham wrote:\n> \n> \n> On 30/04/2019 10:53, Niklas Söderlund wrote:\n> > Hi Kieran,\n> > \n> > Thanks for your feedback.\n> > \n> > On 2019-04-30 10:35:24 +0100, Kieran Bingham wrote:\n> > \n> > snip\n> > \n> >>> diff --git a/src/libcamera/media_device.cpp \n> >>> b/src/libcamera/media_device.cpp\n> >>> index 449571fb4b78fb94..4b3b8f1fa3e6aaad 100644\n> >>> --- a/src/libcamera/media_device.cpp\n> >>> +++ b/src/libcamera/media_device.cpp\n> >>> @@ -221,6 +221,10 @@ int MediaDevice::populate()\n> >>>  \n> >>>  \tclear();\n> >>>  \n> >>> +\tret = open();\n> >>> +\tif (ret)\n> >>> +\t\treturn ret;\n> >>> +\n> >>>  \t/*\n> >>>  \t * Keep calling G_TOPOLOGY until the version number stays stable.\n> >>>  \t */\n> >>> @@ -237,8 +241,9 @@ int MediaDevice::populate()\n> >>>  \t\t\tLOG(MediaDevice, Error)\n> >>>  \t\t\t\t<< \"Failed to enumerate topology: \"\n> >>>  \t\t\t\t<< strerror(-ret);\n> >>> -\t\t\treturn ret;\n> >>> +\t\t\tgoto done;\n> >>>  \t\t}\n> >>> +\t\tret = 0;\n> >>>  \n> >>>  \t\tif (version == topology.topology_version)\n> >>>  \t\t\tbreak;\n> >>\n> >>\n> >> Perhaps secondary to this patch, but I noticed due to following the\n> >> change to this error path:\n> >>\n> >> We iterate calling ioctl(fd_, MEDIA_IOC_G_TOPOLOGY, &topology);\n> >> allocating and freeing the associated struct arrays as we go.\n> >>\n> >> Would it be more efficient (or possible) to determine the topology\n> >> version first by calling in a loop with null pointers for those\n> >> components, and then making a final call at the end having performed a\n> >> single set of allocations?\n> >>\n> >>\n> >> I don't know if that's beneficial or not - but iterating with multiple\n> >> new and deletes of arrays seems costly.\n> > \n> > Unfortunate this is not possible. The reason we iterate until we have \n> > two calls in a row with the same version is to ensure that no new \n> > entities have been added or removed between the calls. If they have we \n> > need to resize the memory accordingly and refetch the data.\n> >\n> > Luckily it should not be common for this to happen as entities should \n> > only really be register at probe() and async complete() time. And in the \n> > case where no new entities are added to the graph between the calls \n> > there is no over head as just two calls to MEDIA_IOC_G_TOPOLOGY are \n> > preformed. The first to get the sizes and a second to get the data with \n> > only one memory allocation taking place between the two.\n> \n> Do we need to check to ensure that the version has not changed between\n> the two instances of open that we have?\n> \n> populate <open, close>\n> \n> ### Change version number?\n> \n> acquire <open>\n> \t# Needs to repopulate?\n> release  <close>\n\nNo there is no need to check this, the idea is to make sure we capture \nall data when populating. If we want to guard against changes later in \ntime we would need something much more sophisticated.\n\nI see two possible scenarios for when this could make sens,\n\n1. A camera is physically removed, think USB. In this case hot-plug will \n   likely save us the whole effected media device will be removed.\n\n2. A driver is unbound from a v4l2 device or a module is unloaded. The \n   later case I think is more academic as module unloading is not really \n   supported anyhow. But the former we might to wish to support at some \n   point.\n\n   Both unloading and unbinding could possibly be solved by extending \n   our hot-plug listener to react to not only media devices. But I think \n   this is something for the future.\n\nIn any case the graph versioning number check is IMHO only needed for \nthe TOPOLOGY call to make sure we extract all available data at that \npoint.","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4EE9C60E52\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 May 2019 16:47:48 +0200 (CEST)","by mail-lj1-x244.google.com with SMTP id y10so11207931lji.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 08 May 2019 07:47:48 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tv26sm3004809ljh.11.2019.05.08.07.47.46\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 08 May 2019 07:47:46 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=LAZCOsVoNWt9gJ6oPY7Xkc+L/wD4FqJ2EqzUB7VjXpo=;\n\tb=0c6hRD52hVYghDMsBBRG4j9tBKsjdsu10B1lv47yi8UgS7ufwJjQg0f6FxL9IFxGcB\n\tOOymBzLQ27L5R1gAS9k/VnwEFC9nSaUPvD4H9trqijLmzoWAeBisL8zcwEB/KT53HyfT\n\tQ2/PI1vSBuO/OoqFRZ/zLSr939L+EExzqs4E0XI8KZNqNbuqefgERW1yolLNclF/9i3D\n\tBRxckwqOi6WA26M3Yg1wRlrvgiyEuM+XV/6RhU92okTJtQeDzKgxG3CGHmZgwOl77KJc\n\tvKX07KwIcl8RTihBHgYZAI2kz7JqV588fvFoajg2CZZI05IYGsNqa74JayO9jwAVgfHi\n\tOWmg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=LAZCOsVoNWt9gJ6oPY7Xkc+L/wD4FqJ2EqzUB7VjXpo=;\n\tb=CEnAdg2FGmHut6eB+h8uZQ5257X7WiMBu2crNxCWChYLOXZET7Ss7FLpboOCeGZb/t\n\tXpWdTsMqbWsIG+iKyCfixUhK2YyhJoT+RE7AVb+btnjYxfXRC7JOKjQfdHTms4rWC0c9\n\te+BJSbZgJFaBVDxfab/d8NIchHwJyAppNt4Z2yaOsB7PzohouBRdZsK+J85N0stAYOZX\n\td0io+wKo9aDIz8smY5Q0x+cyHXgMPtu67WAD6BVudRrZBqaDz2J7J7sfU5/n5JB8mwXO\n\tYFxSA15376n9ChxOOraR0kxIsPQKOGuvprrjgObDjw+iz5N0sS8DYRA6uS4TbSCVIXGM\n\t5+zQ==","X-Gm-Message-State":"APjAAAX0Mw27IbMoQkSuIpBu8dLrPl//POneW5F8Zm3tTcdCn2zjqdE7\n\tuMCT8ptoqQKGu8Os7R6uKUG4VFC4OMc=","X-Google-Smtp-Source":"APXvYqxyTBisthdV41r0C7J2V2jmXwp9NWJpT7I/8T5N9Jekg1sZkURfmNclbXaJTh4mawkpQpvqcQ==","X-Received":"by 2002:a2e:801a:: with SMTP id j26mr12033852ljg.2.1557326867527;\n\tWed, 08 May 2019 07:47:47 -0700 (PDT)","Date":"Wed, 8 May 2019 16:47:46 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190508144745.GC24112@bigcity.dyn.berto.se>","References":"<20190429191729.29697-1-niklas.soderlund@ragnatech.se>\n\t<20190429191729.29697-3-niklas.soderlund@ragnatech.se>\n\t<998d4728-cc85-3f88-3e45-5c2f9ed69d27@ideasonboard.com>\n\t<20190430095342.GM16573@bigcity.dyn.berto.se>\n\t<56ed2e7c-4343-8180-5521-5d28058a029a@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<56ed2e7c-4343-8180-5521-5d28058a029a@ideasonboard.com>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH 02/11] libcamera: media_device: Open\n\tand close media device inside populate()","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, 08 May 2019 14:47:48 -0000"}}]