{"id":17937,"url":"https://patchwork.libcamera.org/api/patches/17937/?format=json","web_url":"https://patchwork.libcamera.org/patch/17937/","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":"<20221202124005.3643-3-naush@raspberrypi.com>","date":"2022-12-02T12:40:05","name":"[libcamera-devel,v2,2/2] libcamera:camera_sensor, ipa: raspberrypi: Test readOnly() for HBLANK control","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"1fe905a45c17bf59b3c85a40d12a89eed4542d7a","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17937/mbox/","series":[{"id":3654,"url":"https://patchwork.libcamera.org/api/series/3654/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3654","date":"2022-12-02T12:40:03","name":"Add read-only flag to ControlInfo","version":2,"mbox":"https://patchwork.libcamera.org/series/3654/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17937/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17937/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 EEDD7BE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  2 Dec 2022 12:40:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED9D663346;\n\tFri,  2 Dec 2022 13:40:09 +0100 (CET)","from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 91FE96333E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  2 Dec 2022 13:40:08 +0100 (CET)","by mail-wr1-x42d.google.com with SMTP id f18so7610423wrj.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 02 Dec 2022 04:40:08 -0800 (PST)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\ty15-20020a5d4acf000000b00241e5b917d0sm8276484wrs.36.2022.12.02.04.40.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 02 Dec 2022 04:40:07 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669984810;\n\tbh=nvrOEvJVHz7j09luDy4xiun/bWXhoqUsyv867Z9Io5c=;\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=ShR0/4ZOF9x7J4Qg17lwTtEp8aUBKKpEAR7GiQrLVZfC2oAg+OwmA64IiLPbGwZg4\n\tyfYKKQMSqxLFVUVIGd2GyMqlHuZJWw6lIJEZf/DBYP20Yplo80DTfHVqhrYe4215l6\n\tRkBvgnh7Mow7bx98MhTRydRNG3bcTLAsmgvoHPBPoSvZK60foAjIZCc0iFQFYn9Uix\n\t5M8ruYQ+O6pK+ljJrp6UguVGIkeihjTOPJpRpJEOn1FGlSPfR+NQ+96lhSo2b92OId\n\t0FxWPKVLlxcZsGxZt0czHQchRr6C2W3t+kgEGizRFiv7xRwuRGIaJ76wIuBpofOZnB\n\tdjZ/LRZsUJXiw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=jdJada7Pm/o1Cp/fS3FBp6tTdVC42aBz9VmgOPqqXrw=;\n\tb=Y39Qfskej9W8PjV+t29zoAXyBl4BMAQqvzQYEAhsmaDERvQF/lQTl7kvZTgs/WozZq\n\tzThxF90fLlSYhJQ4yVaUKJqVZZTq9Gqe8SUx0hgj7f305/goedenZj0qgv/sRyunZDk7\n\tZ4/KNhdyHbZvBmhesgVpW3telcOD8Ih8nYH0aoS/t2E3xd+ZRA7dqPQ/c6mVHtaX3hPF\n\tf1gBkZmJDrf2pww2ZP0J69E+mHjs1MuQUIftFjZ6FsymVj/0slQuBxSkj7433k48dxU0\n\tdPTEqQFYoKo0+otMKCslTzbyyl1WslBtHd+kEu7i9Za/s5wUdCdwgimwF98kokt++gce\n\tGSLA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Y39Qfske\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=jdJada7Pm/o1Cp/fS3FBp6tTdVC42aBz9VmgOPqqXrw=;\n\tb=JFarWwxEnuxQUf5YLdnQVhypftaX/A1HjWyYviZ5il2rs8WBFJBNRleylE5DTu2Vpc\n\tJYv8EFY7dP9OuBa8UawHdMfYVBHDEVnMAuOPXpbrMfy8W1dZdIweyNZQ9rSNyGGAXtQQ\n\twBYasiQYDWveXv1VcT1JmEvZNAM2JvtaZByLSf4jy7VZdjBjwMlgf7gRkLo35lYZcx5H\n\tt70mxYBloj4TBQvGTuZBSVPybHlvoe68VD5NigkU4YrabuueNl0JdIsGwwhuqukIoZf4\n\t/nm28VUmVNJUum1Z1+WSzkFqH0sPy7wwfRi2jTR+TKYEyIe2zkM+M+1Z2vUeeRDH1N5E\n\tK29w==","X-Gm-Message-State":"ANoB5pnO+xTAtmQClIYpIieHBYDaymKnBP2AKzmiDrmkSf+f+q6uMP/b\n\tjB1LtsYOl7yLnWHIWbiZvTZN6R/iafWaIj3F","X-Google-Smtp-Source":"AA0mqf6FNbUHTBOPH7SjrYFhEv8aHv4fdYPiXZsmS4wOB92KMZdQrTaw3Q78daqxI7qedKjTp4jfQw==","X-Received":"by 2002:adf:d206:0:b0:242:285f:c6f4 with SMTP id\n\tj6-20020adfd206000000b00242285fc6f4mr9425535wrh.452.1669984807927; \n\tFri, 02 Dec 2022 04:40:07 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  2 Dec 2022 12:40:05 +0000","Message-Id":"<20221202124005.3643-3-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20221202124005.3643-1-naush@raspberrypi.com>","References":"<20221202124005.3643-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Use 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>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 12 +-----------\n src/libcamera/camera_sensor.cpp     | 14 ++------------\n 2 files changed, 3 insertions(+), 23 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex bead436def3c..57f01496fc44 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -1239,17 +1239,7 @@ void IPARPi::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 \ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex ae3127d6b693..3785b6441b90 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -185,20 +185,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","v2","2/2"]}