{"id":10550,"url":"https://patchwork.libcamera.org/api/patches/10550/?format=json","web_url":"https://patchwork.libcamera.org/patch/10550/","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":"<20201202135354.264212-4-jacopo@jmondi.org>","date":"2020-12-02T13:53:53","name":"[libcamera-devel,v2,3/4] libcamera: camera_sensor: Initialize PixelArray properties","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"7221ae4495ae721076870f5f33c125025659f3c9","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/10550/mbox/","series":[{"id":1501,"url":"https://patchwork.libcamera.org/api/series/1501/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1501","date":"2020-12-02T13:53:50","name":"libcamera: Collect pixel array properties","version":2,"mbox":"https://patchwork.libcamera.org/series/1501/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10550/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10550/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 9F415BE176\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Dec 2020 13:54:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7AB54635A6;\n\tWed,  2 Dec 2020 14:54:01 +0100 (CET)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5AD21635A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Dec 2020 14:53:58 +0100 (CET)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 02ECB20010\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Dec 2020 13:53:57 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  2 Dec 2020 14:53:53 +0100","Message-Id":"<20201202135354.264212-4-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.29.1","In-Reply-To":"<20201202135354.264212-1-jacopo@jmondi.org>","References":"<20201202135354.264212-1-jacopo@jmondi.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 3/4] libcamera: camera_sensor:\n\tInitialize PixelArray 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=\"utf-8\"","Content-Transfer-Encoding":"base64","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'PixelArrayActiveAreas' by inspecting the V4L2 CROP_BOUNDS and\nCROP_DEFAULT selection targets.\n\nThe properties are registered only if the sensor subdevice support\nthe above mentioned selection targets.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/camera_sensor.cpp | 19 +++++++++++++++++++\n 1 file changed, 19 insertions(+)","diff":"diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 7e6995c43010..1628ba9c892b 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -288,6 +288,25 @@ 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, bounds.size());\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 full pixel array size,\n+\t\t * while properties::PixelArrayActiveAreas is defined relatively\n+\t\t * to properties::PixelArraySize. Adjust it.\n+\t\t */\n+\t\tcrop.x -= bounds.x;\n+\t\tcrop.y -= bounds.y;\n+\t\tproperties_.set(properties::PixelArrayActiveAreas, { crop });\n+\t}\n+\n \treturn 0;\n }\n \n","prefixes":["libcamera-devel","v2","3/4"]}