{"id":9221,"url":"https://patchwork.libcamera.org/api/patches/9221/?format=json","web_url":"https://patchwork.libcamera.org/patch/9221/","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":"<20200805123004.18794-1-jacopo@jmondi.org>","date":"2020-08-05T12:30:04","name":"[libcamera-devel] libcamera: camera_sensor: Match V4L2 specification","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"2cbdedf0ccb5ad40ffd4f07676590726178c6e91","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/9221/mbox/","series":[{"id":1194,"url":"https://patchwork.libcamera.org/api/series/1194/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1194","date":"2020-08-05T12:30:04","name":"[libcamera-devel] libcamera: camera_sensor: Match V4L2 specification","version":1,"mbox":"https://patchwork.libcamera.org/series/1194/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9221/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9221/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 05F6ABD86F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Aug 2020 12:26:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9585D60564;\n\tWed,  5 Aug 2020 14:26:29 +0200 (CEST)","from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2CC7A60492\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Aug 2020 14:26:28 +0200 (CEST)","from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id A59E41BF211;\n\tWed,  5 Aug 2020 12:26:27 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  5 Aug 2020 14:30:04 +0200","Message-Id":"<20200805123004.18794-1-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.27.0","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] libcamera: camera_sensor: Match V4L2\n\tspecification","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":"Adjust the top-left corner coordinates of the analogCrop rectangle\nto match the libcamera and V4L2 specification.\n\nAs per the V4L2 selection API specification, all rectangles accessed\nusing V4L2_SEL_TGT_* are defined relatively to the full pixel array,\nwhich is retrieved using the V4L2_SEL_TGT_NATIVE target. Libcamera\ndefines the analogCrop rectangle to be defined relatively\nto the active pixel matrix rectangle.\n\nTo compensate the difference in the reference rectangle between the two\nspecification, subtract from the TGT_CROP rectangle top-left corner the\noffset of the active pixel array previously obtained with\nTGT_CROP_DEFAULT.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n\nThis patch depends on the inclusion of the following patch in the\nLinux kernel:\n[PATCH 4/4] media: i2c: imx219: Selection compliance fixes\n---\n src/libcamera/camera_sensor.cpp | 12 ++++++++++++\n 1 file changed, 12 insertions(+)\n\n--\n2.27.0","diff":"diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 350f49accad9..8f09206ff635 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -508,6 +508,18 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const\n \t\treturn ret;\n \t}\n\n+\t/*\n+\t * The top-left corner position of the selection rectangle returned by\n+\t * the V4L2_SEL_TGT_CROP target is defined relatively to the full pixel\n+\t * array, while libcamera's analogCrop is defined relatively to the\n+\t * active portion of the pixel matrix.\n+\t *\n+\t * Subtract from the top-left coordinates the offsets of the\n+\t * CROP_DEFAULT target rectangle to align the two.\n+\t */\n+\tinfo->analogCrop.x -= rect.x;\n+\tinfo->analogCrop.y -= rect.y;\n+\n \t/* The bit depth and image size depend on the currently applied format. */\n \tV4L2SubdeviceFormat format{};\n \tret = subdev_->getFormat(pad_, &format);\n","prefixes":["libcamera-devel"]}