{"id":19189,"url":"https://patchwork.libcamera.org/api/1.1/patches/19189/?format=json","web_url":"https://patchwork.libcamera.org/patch/19189/","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":"<20231102172439.3543870-3-kieran.bingham@ideasonboard.com>","date":"2023-11-02T17:24:39","name":"[libcamera-devel,v3,2/2] libcamera:camera_sensor, ipa: raspberrypi: Test readOnly() for HBLANK control","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"becac8e9e17a27f1652466c644b67a6590a03bed","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19189/mbox/","series":[{"id":4064,"url":"https://patchwork.libcamera.org/api/1.1/series/4064/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4064","date":"2023-11-02T17:24:37","name":"Add read-only flag to ControlInfo","version":3,"mbox":"https://patchwork.libcamera.org/series/4064/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19189/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19189/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 9004CC32B6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Nov 2023 17:24:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 62C1861DC6;\n\tThu,  2 Nov 2023 18:24:49 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 485D061DC6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Nov 2023 18:24:45 +0100 (CET)","from Monstersaurus.local\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 90A2D1B44;\n\tThu,  2 Nov 2023 18:24:27 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1698945889;\n\tbh=+bbm4psm5cdiQCmfBl2gZxOBC9GXr3hgFzDEb8VJY7g=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=kUWNzDAsJlA51pzskVweJujcThEC9N8kVdiG6l1SbDgaLDdLiXaNqOTxSKhmtFPv4\n\tVBL+ds9ThbtChOdi4NGO7VR7LhT3LG9SNQo6WdO7AcovV0Tq5PNFpreuu9t8//3H6V\n\tv4kxh3n+/OELMsvLXzjbEZJIGtNIqYnFsUCa+xh+myUo6RY/ZVGDrAkux930XDk+uV\n\t+T4d31ovO//WOz/eZHUg1Smzj79XR0CCPum5vJlrIJIsolMyegsyyjli8CxON4E0dA\n\t9NH4iizpV67aR8lKduLP4DREy2K1RCNtTYnRCyONcyEXc/Mk5onSpaNRJyIKqiwLJH\n\t0Q49tBgD7HvqQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1698945867;\n\tbh=+bbm4psm5cdiQCmfBl2gZxOBC9GXr3hgFzDEb8VJY7g=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=sHBcdCEx8e3485IrF697GpBJ+9ckznps88A0UxsHHxNjl69C1DES1hFSY0FRKeApH\n\tvfnpQ1qpWrYSyIs9+g/zdCyjFT1iMKVZQSwOrFPo/u2nH/Zv7WMMDa1zS5A88uWEOi\n\twnmPVvAbuVb0h4mShD44Z79n0A7fkmqP+t0TW+ks="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"sHBcdCEx\"; dkim-atps=neutral","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Thu,  2 Nov 2023 17:24:39 +0000","Message-Id":"<20231102172439.3543870-3-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20231102172439.3543870-1-kieran.bingham@ideasonboard.com>","References":"<20231102172439.3543870-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 2/2] libcamera:camera_sensor,\n\tipa: raspberrypi: Test readOnly() for HBLANK control","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Naushir Patuck <naush@raspberrypi.com>\n\nUse ControlInfo::readOnly() to test if the camera sensor accepts V4L2_CID_HBLANK\ncontrol changes. This replaces the current workaround where we test if the\nV4L2_CID_HBLANK min and max values are the same to determine if a control is\nread-only.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/rpi/common/ipa_base.cpp | 12 +-----------\n src/libcamera/camera_sensor.cpp | 14 ++------------\n 2 files changed, 3 insertions(+), 23 deletions(-)","diff":"diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex a1fec3aa3dd1..a623ad1bae66 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -1346,17 +1346,7 @@ void IpaBase::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)\n \tctrls.set(V4L2_CID_EXPOSURE, exposureLines);\n \tctrls.set(V4L2_CID_ANALOGUE_GAIN, gainCode);\n \n-\t/*\n-\t * At present, there is no way of knowing if a control is read-only.\n-\t * As a workaround, assume that if the minimum and maximum values of\n-\t * the V4L2_CID_HBLANK control are the same, it implies the control\n-\t * is read-only. This seems to be the case for all the cameras our IPA\n-\t * works with.\n-\t *\n-\t * \\todo The control API ought to have a flag to specify if a control\n-\t * is read-only which could be used below.\n-\t */\n-\tif (mode_.minLineLength != mode_.maxLineLength)\n+\tif (!sensorCtrls_.at(V4L2_CID_HBLANK).readOnly())\n \t\tctrls.set(V4L2_CID_HBLANK, static_cast<int32_t>(hblank));\n \n \t/*\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex ee1066c680ff..12512341feb6 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -188,20 +188,10 @@ int CameraSensor::init()\n \t * Set HBLANK to the minimum to start with a well-defined line length,\n \t * allowing IPA modules that do not modify HBLANK to use the sensor\n \t * minimum line length in their calculations.\n-\t *\n-\t * At present, there is no way of knowing if a control is read-only.\n-\t * As a workaround, assume that if the minimum and maximum values of\n-\t * the V4L2_CID_HBLANK control are the same, it implies the control\n-\t * is read-only.\n-\t *\n-\t * \\todo The control API ought to have a flag to specify if a control\n-\t * is read-only which could be used below.\n \t */\n \tconst ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK);\n-\tconst int32_t hblankMin = hblank.min().get<int32_t>();\n-\tconst int32_t hblankMax = hblank.max().get<int32_t>();\n-\n-\tif (hblankMin != hblankMax) {\n+\tif (!hblank.readOnly()) {\n+\t\tconst int32_t hblankMin = hblank.min().get<int32_t>();\n \t\tControlList ctrl(subdev_->controls());\n \n \t\tctrl.set(V4L2_CID_HBLANK, hblankMin);\n","prefixes":["libcamera-devel","v3","2/2"]}