From patchwork Mon Nov 20 18:45:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 19214 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id EDE9EBDE6B for ; Mon, 20 Nov 2023 18:45:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 432A3629AF; Mon, 20 Nov 2023 19:45:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1700505939; bh=WNJRQuALJdq3G+qT0W+PPvaBTWv/U65WrswojyEIhzg=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=zcmjhkneTyiIa96pBxBmc1Dxa9EOC7zk6bWBRz7bnl1Gl5fdBVwUVG0gt1zgfsdSl 9hKfyOUWGFfR6+iHMaU6SaXBZsWxxUkFjBIyczV+E0gbRv3g1xaNjeMXYFzzTSNXec uHzies07DBFoEwymEBaCEOg3j94Qds2VRhDjMdjCiEVpYMZDmfTf5tmetq7JRR8pHP PPNxIluFHOyUX04/GT8Wrxu1QsxLM0Q3h465snkKVAeuimcqXlomM9RgxzxtjMv55T hWPDziORCXZVexoZ3iiGp9JMOxjsZJF290dwnA5iUBb+1zuDmDlAFqbBRoGB86QBTi S+Y5I5hWLbVrA== Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EFD1F61DAF for ; Mon, 20 Nov 2023 19:45:36 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="byMt5zDW"; dkim-atps=neutral Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3AKD0e2l026050; Mon, 20 Nov 2023 19:45:35 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=selector1; bh=n0lA1+8 zcqFzHT3H/dbU5POVDPzzYaN+BTcFE0pgioM=; b=byMt5zDWVOHJLSdGL/G+cT5 RbjMHy8V9ZIyOCsaBIhW3jKSVgkq+SaX2ECatO/8+4Xivw+0V07+mFFGGeOsaFKi iY4xfDx2bZSKVmDNkW8uAydEvjUXt1o4xnsr9wNx7dMTGbD5sEFO++LJO3psp/Oj lZ8zxhRYumoxFOrNP9uNuv2KYctN0ph7BgWZQlgFjDtLgZbMXvUURyFR4zOziLqo 26uvPaBpKb9sx7dW5Y1AYoxVDF5VgxaAXtcS236Bum/oRwEc1FqwJQG8uIfRMpzd ndtDU+uMKhE4NJnHmiWwOXw9291/aZo74oeuwQBwPo8R42gGCpnPPiM1sVPAbiw= = Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3uf7q4647j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 19:45:35 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B83A310003D; Mon, 20 Nov 2023 19:45:34 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id ABB83252252; Mon, 20 Nov 2023 19:45:34 +0100 (CET) Received: from localhost (10.129.178.213) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 20 Nov 2023 19:45:34 +0100 To: Date: Mon, 20 Nov 2023 19:45:29 +0100 Message-ID: <20231120184529.730565-1-alain.volmat@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.129.178.213] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272, Aquarius:18.0.987, Hydra:6.0.619, FMLib:17.11.176.26 definitions=2023-11-20_19,2023-11-20_01,2023-05-22_02 Subject: [libcamera-devel] [PATCH] libcamera: camera_sensor: fix HBLANK RO check X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alain Volmat via libcamera-devel From: Alain Volmat Reply-To: Alain Volmat Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Perform the HBLANK readonly check by looking at the v4l2_query_ext_ctrl struct for the V4L2_CID_HBLANK instead of checking for min/max values. Signed-off-by: Alain Volmat --- src/libcamera/camera_sensor.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 0ef78d9c..3281c1f9 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -188,21 +188,12 @@ int CameraSensor::init() * Set HBLANK to the minimum to start with a well-defined line length, * allowing IPA modules that do not modify HBLANK to use the sensor * minimum line length in their calculations. - * - * At present, there is no way of knowing if a control is read-only. - * As a workaround, assume that if the minimum and maximum values of - * the V4L2_CID_HBLANK control are the same, it implies the control - * is read-only. - * - * \todo The control API ought to have a flag to specify if a control - * is read-only which could be used below. */ if (ctrls.infoMap()->find(V4L2_CID_HBLANK) != ctrls.infoMap()->end()) { - const ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK); - const int32_t hblankMin = hblank.min().get(); - const int32_t hblankMax = hblank.max().get(); - - if (hblankMin != hblankMax) { + const struct v4l2_query_ext_ctrl *hblankInfo = subdev_->controlInfo(V4L2_CID_HBLANK); + if (!(hblankInfo->flags & V4L2_CTRL_FLAG_READ_ONLY)) { + const ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK); + const int32_t hblankMin = hblank.min().get(); ControlList ctrl(subdev_->controls()); ctrl.set(V4L2_CID_HBLANK, hblankMin);