{"id":10820,"url":"https://patchwork.libcamera.org/api/patches/10820/?format=json","web_url":"https://patchwork.libcamera.org/patch/10820/","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":"<20210105190522.682324-7-jacopo@jmondi.org>","date":"2021-01-05T19:05:16","name":"[libcamera-devel,06/12] libcamera: ipu3: Initialize ScalerCropMaximum property","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c1a6908a332a08461181ae61ecbb6c3bd6d38a88","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/10820/mbox/","series":[{"id":1568,"url":"https://patchwork.libcamera.org/api/series/1568/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1568","date":"2021-01-05T19:05:10","name":"android: Exposure times + scaler crop + android metadata","version":1,"mbox":"https://patchwork.libcamera.org/series/1568/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10820/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10820/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 92A1AC0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Jan 2021 19:05:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6A00163400;\n\tTue,  5 Jan 2021 20:05:19 +0100 (CET)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 203BF62D2C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Jan 2021 20:05:16 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id D9CF4100003\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Jan 2021 19:05:15 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  5 Jan 2021 20:05:16 +0100","Message-Id":"<20210105190522.682324-7-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.29.2","In-Reply-To":"<20210105190522.682324-1-jacopo@jmondi.org>","References":"<20210105190522.682324-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 06/12] libcamera: ipu3: Initialize\n\tScalerCropMaximum 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>","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":"Initialize the camera properties by registering the sensor provided\nones and the ScalerCropMaximum property computed by the pipeline\nhandler by using the analogue crop rectangle of the sensor resolution.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 43 +++++++++++++++++++++++++++-\n 1 file changed, 42 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 879057dab328..418301b33a5e 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -14,6 +14,7 @@\n #include <libcamera/camera.h>\n #include <libcamera/control_ids.h>\n #include <libcamera/formats.h>\n+#include <libcamera/property_ids.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n@@ -121,6 +122,7 @@ private:\n \t\t\tPipelineHandler::cameraData(camera));\n \t}\n \n+\tint initProperties(IPU3CameraData *data);\n \tint initControls(IPU3CameraData *data);\n \tint registerCameras();\n \n@@ -734,6 +736,43 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)\n \treturn ret == 0;\n }\n \n+/*\n+ * \\brief Initialize the camera properties\n+ * \\param[in] data The camera data\n+ *\n+ * Initialize the camera properties by registering the pipeline handler\n+ * ones along with the properties assembled by inspecting the sensor\n+ * capabilities.\n+ *\n+ * \\return 0 on success or a negative error code for error\n+ */\n+int PipelineHandlerIPU3::initProperties(IPU3CameraData *data)\n+{\n+\tCameraSensor *sensor = data->cio2_.sensor();\n+\tdata->properties_ = sensor->properties();\n+\n+\t/*\n+\t * \\todo The ScalerCropMaximum property depends on the sensor\n+\t * configuration. Initialize the property using the analogue crop\n+\t * rectangle of the largest sensor resolution. To be updated later when\n+\t * a new one is applied.\n+\t */\n+\tV4L2SubdeviceFormat format;\n+\tformat.size = sensor->resolution();\n+\tint ret = sensor->setFormat(&format);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tCameraSensorInfo sensorInfo{};\n+\tret = sensor->sensorInfo(&sensorInfo);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tdata->properties_.set(properties::ScalerCropMaximum, sensorInfo.analogCrop);\n+\n+\treturn 0;\n+}\n+\n /*\n  * \\brief Initialize the camera controls\n  * \\param[in] data The camera data\n@@ -831,7 +870,9 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t\tcontinue;\n \n \t\t/* Initialize the camera properties. */\n-\t\tdata->properties_ = cio2->sensor()->properties();\n+\t\tret = initProperties(data.get());\n+\t\tif (ret)\n+\t\t\tcontinue;\n \n \t\tret = initControls(data.get());\n \t\tif (ret)\n","prefixes":["libcamera-devel","06/12"]}