{"id":10390,"url":"https://patchwork.libcamera.org/api/1.1/patches/10390/?format=json","web_url":"https://patchwork.libcamera.org/patch/10390/","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":"<20201106154947.261132-4-jacopo@jmondi.org>","date":"2020-11-06T15:49:46","name":"[libcamera-devel,3/4] libcamera: camera_sensor: Initialize PixelArray properties","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"afb1d123c6b1afe8c19c3097e74cf398b4f5ac8c","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10390/mbox/","series":[{"id":1449,"url":"https://patchwork.libcamera.org/api/1.1/series/1449/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1449","date":"2020-11-06T15:49:43","name":"libcamera: Collect pixel array properties","version":1,"mbox":"https://patchwork.libcamera.org/series/1449/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10390/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10390/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 9D65BBE084\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Nov 2020 15:49:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C4CA462D81;\n\tFri,  6 Nov 2020 16:49:54 +0100 (CET)","from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DD9F5629A6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Nov 2020 16:49:53 +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 relay2-d.mail.gandi.net (Postfix) with ESMTPSA id A2B7640002\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Nov 2020 15:49:53 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  6 Nov 2020 16:49:46 +0100","Message-Id":"<20201106154947.261132-4-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.29.1","In-Reply-To":"<20201106154947.261132-1-jacopo@jmondi.org>","References":"<20201106154947.261132-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 3/4] libcamera: camera_sensor: Initialize\n\tPixelArray properties","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 pixel array properties 'PixelArraySize' and\n'PixelArrayActiveArea' inspecting the V4L2 CROP_BOUNDS and CROP_DEFAULT\nselection targets.\n\nThe properties are registered only if the sensor subdevice support\nthe above mentioned selection targets.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/camera_sensor.cpp | 22 ++++++++++++++++++++++\n 1 file changed, 22 insertions(+)","diff":"diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 49b0a026125c..266ed7e9238e 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -288,6 +288,28 @@ int CameraSensor::initProperties()\n \t\tpropertyValue = 0;\n \tproperties_.set(properties::Rotation, propertyValue);\n \n+\tRectangle bounds{};\n+\tret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &bounds);\n+\tif (!ret) {\n+\t\tproperties_.set(properties::PixelArraySize,\n+\t\t\t\tSize(bounds.width, bounds.height));\n+\t}\n+\n+\tRectangle crop{};\n+\tret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &crop);\n+\tif (!ret) {\n+\t\t/*\n+\t\t * V4L2_SEL_TGT_CROP_DEFAULT and V4L2_SEL_TGT_CROP_BOUNDS are\n+\t\t * defined relatively to the sensor native pixel array size,\n+\t\t * while properties::PixelArrayActiveAreas is defined relatively\n+\t\t * to properties::PixelArraySize. Adjust them\n+\t\t */\n+\t\tcrop.x -= bounds.x;\n+\t\tcrop.y -= bounds.y;\n+\t\tproperties_.set(properties::PixelArrayActiveAreas,\n+\t\t\t\t{ crop });\n+\t}\n+\n \treturn 0;\n }\n \n","prefixes":["libcamera-devel","3/4"]}