{"id":12855,"url":"https://patchwork.libcamera.org/api/patches/12855/?format=json","web_url":"https://patchwork.libcamera.org/patch/12855/","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":"<20210707144202.1327061-2-nfraprado@collabora.com>","date":"2021-07-07T14:41:53","name":"[libcamera-devel,v5,01/10] libcamera: property: Add MinNumRequests property","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"deab91d6d1f1b1e0637dfbea70d71847db04d9c5","submitter":{"id":84,"url":"https://patchwork.libcamera.org/api/people/84/?format=json","name":"Nícolas F. R. A. Prado","email":"nfraprado@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12855/mbox/","series":[{"id":2216,"url":"https://patchwork.libcamera.org/api/series/2216/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2216","date":"2021-07-07T14:41:52","name":"lc-compliance: Add test to queue more requests than hardware depth","version":5,"mbox":"https://patchwork.libcamera.org/series/2216/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12855/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12855/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 55789BD794\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Jul 2021 14:42:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EA11868503;\n\tWed,  7 Jul 2021 16:42:22 +0200 (CEST)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 311FD6028E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Jul 2021 16:42:21 +0200 (CEST)","from localhost.localdomain (unknown\n\t[IPv6:2804:14c:1a9:2434:6553:ad0c:9d2a:24db])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits))\n\t(No client certificate requested) (Authenticated sender: nfraprado)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id D7F681F434AD;\n\tWed,  7 Jul 2021 15:42:19 +0100 (BST)"],"From":"=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  7 Jul 2021 11:41:53 -0300","Message-Id":"<20210707144202.1327061-2-nfraprado@collabora.com>","X-Mailer":"git-send-email 2.32.0","In-Reply-To":"<20210707144202.1327061-1-nfraprado@collabora.com>","References":"<20210707144202.1327061-1-nfraprado@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 01/10] libcamera: property: Add\n\tMinNumRequests property","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>","Cc":"kernel@collabora.com, =?utf-8?q?Andr=C3=A9_Almeida?=\n\t<andrealmeid@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The MinNumRequests property reports the bare minimum number of requests\nneeded in the camera pipeline for capture to be possible. It is equal to\nthe number of buffers required by the driver. At this quantity, there's\nno guarantee that frames won't be dropped or that manual per-frame\ncontrols will apply correctly. The quantity needed for those may be\nadded as separate properties in the future.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp               | 6 ++++++\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 6 ++++++\n src/libcamera/pipeline/rkisp1/rkisp1.cpp           | 2 ++\n src/libcamera/pipeline/simple/simple.cpp           | 2 ++\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp       | 2 ++\n src/libcamera/pipeline/vimc/vimc.cpp               | 3 +++\n src/libcamera/property_ids.yaml                    | 9 +++++++++\n 7 files changed, 30 insertions(+)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 76c3bb3d8aa9..017018c845fa 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -1111,6 +1111,12 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t/* Initialize the camera properties. */\n \t\tdata->properties_ = cio2->sensor()->properties();\n \n+\t\t/*\n+\t\t * \\todo Make sure this is correct even after the stream is\n+\t\t * configured to CIO2\n+\t\t */\n+\t\tdata->properties_.set(properties::MinNumRequests, 1);\n+\n \t\tret = initControls(data.get());\n \t\tif (ret)\n \t\t\tcontinue;\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 082eb1ee1c23..f99a21de6918 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1045,6 +1045,12 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n \t/* Initialize the camera properties. */\n \tdata->properties_ = data->sensor_->properties();\n \n+\t/*\n+\t * \\todo Make sure this is correct after the stream is configured for\n+\t * any of the roles\n+\t */\n+\tdata->properties_.set(properties::MinNumRequests, 1);\n+\n \t/*\n \t * Set a default value for the ScalerCropMaximum property to show\n \t * that we support its use, however, initialise it to zero because\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 00df4f0b3e6b..b5cbf2394b1c 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -24,6 +24,7 @@\n #include <libcamera/ipa/core_ipa_interface.h>\n #include <libcamera/ipa/rkisp1_ipa_interface.h>\n #include <libcamera/ipa/rkisp1_ipa_proxy.h>\n+#include <libcamera/property_ids.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n@@ -944,6 +945,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n \n \t/* Initialize the camera properties. */\n \tdata->properties_ = data->sensor_->properties();\n+\tdata->properties_.set(properties::MinNumRequests, 3);\n \n \t/*\n \t * \\todo Read dealy values from the sensor itself or from a\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex b29fff9820e5..c4adea61519f 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -25,6 +25,7 @@\n \n #include <libcamera/camera.h>\n #include <libcamera/control_ids.h>\n+#include <libcamera/property_ids.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n@@ -436,6 +437,7 @@ int SimpleCameraData::init()\n \t}\n \n \tproperties_ = sensor_->properties();\n+\tproperties_.set(properties::MinNumRequests, 3);\n \n \treturn 0;\n }\ndiff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\nindex 0f634b8da609..0258111ad6cf 100644\n--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n@@ -525,6 +525,8 @@ int UVCCameraData::init(MediaDevice *media)\n \tproperties_.set(properties::PixelArraySize, resolution);\n \tproperties_.set(properties::PixelArrayActiveAreas, { Rectangle(resolution) });\n \n+\tproperties_.set(properties::MinNumRequests, 1);\n+\n \t/* Initialise the supported controls. */\n \tControlInfoMap::Map ctrls;\n \ndiff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\nindex 12f7517fd0ae..8c3f7ccb46bd 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -21,6 +21,7 @@\n #include <libcamera/control_ids.h>\n #include <libcamera/controls.h>\n #include <libcamera/formats.h>\n+#include <libcamera/property_ids.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n@@ -517,6 +518,8 @@ int VimcCameraData::init()\n \t/* Initialize the camera properties. */\n \tproperties_ = sensor_->properties();\n \n+\tproperties_.set(properties::MinNumRequests, 2);\n+\n \treturn 0;\n }\n \ndiff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml\nindex 12ecbce5eed4..4efa952ee393 100644\n--- a/src/libcamera/property_ids.yaml\n+++ b/src/libcamera/property_ids.yaml\n@@ -678,6 +678,15 @@ controls:\n         \\todo Turn this property into a \"maximum control value\" for the\n         ScalerCrop control once \"dynamic\" controls have been implemented.\n \n+  - MinNumRequests:\n+      type: int32_t\n+      description: |\n+        The bare minimum number of requests needed in the camera pipeline for\n+        capture to be possible, as required by the driver. Note that this\n+        quantity does not guarantee that frames won't be dropped or that manual\n+        per-frame controls will be applied properly.\n+\n+\n   # ----------------------------------------------------------------------------\n   # Draft properties section\n \n","prefixes":["libcamera-devel","v5","01/10"]}