{"id":12210,"url":"https://patchwork.libcamera.org/api/1.1/patches/12210/?format=json","web_url":"https://patchwork.libcamera.org/patch/12210/","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":"<20210506180249.318346-2-nfraprado@collabora.com>","date":"2021-05-06T18:02:44","name":"[libcamera-devel,v4,1/6] libcamera: property: Add MinNumRequests property","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"60220c2bd0219ad896b5ce915668378519f98599","submitter":{"id":84,"url":"https://patchwork.libcamera.org/api/1.1/people/84/?format=json","name":"Nícolas F. R. A. Prado","email":"nfraprado@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12210/mbox/","series":[{"id":2005,"url":"https://patchwork.libcamera.org/api/1.1/series/2005/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2005","date":"2021-05-06T18:02:43","name":"lc-compliance: Add test to queue more requests than hardware depth","version":4,"mbox":"https://patchwork.libcamera.org/series/2005/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12210/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12210/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 A6465BDE7F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 May 2021 18:03:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7075A6891D;\n\tThu,  6 May 2021 20:03:56 +0200 (CEST)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D182C68915\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 May 2021 20:03:54 +0200 (CEST)","from localhost.localdomain (unknown\n\t[IPv6:2804:14c:1a9:2978:995d:672b:100f:2fd9])\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 1BA621F43B8B;\n\tThu,  6 May 2021 19:03:52 +0100 (BST)"],"From":"=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  6 May 2021 15:02:44 -0300","Message-Id":"<20210506180249.318346-2-nfraprado@collabora.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210506180249.318346-1-nfraprado@collabora.com>","References":"<20210506180249.318346-1-nfraprado@collabora.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 1/6] 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>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","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 ade8ffbddb0e..13d7971da409 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -1049,6 +1049,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 b22564938cdc..ccc8a2bedcc6 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1035,6 +1035,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 adebe8b5c8cd..9a1b6d4f239f 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -21,6 +21,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@@ -943,6 +944,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 e1ee640b0a92..42c53af28097 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -23,6 +23,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@@ -425,6 +426,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 faa8d6b05f46..cb8f40dca279 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 ce83dcaab8ea..ec991083b104 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -20,6 +20,7 @@\n #include <libcamera/formats.h>\n #include <libcamera/ipa/ipa_interface.h>\n #include <libcamera/ipa/ipa_module_info.h>\n+#include <libcamera/property_ids.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n@@ -516,6 +517,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 104e9aaf4fa3..55f96a78d1e7 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","v4","1/6"]}