{"id":14622,"url":"https://patchwork.libcamera.org/api/1.1/patches/14622/?format=json","web_url":"https://patchwork.libcamera.org/patch/14622/","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":"<20211118094823.344496-1-paul.elder@ideasonboard.com>","date":"2021-11-18T09:48:23","name":"[libcamera-devel,v2] android: Check exposure time range for manual sensor capability","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"8f7e99727a0ac401b8b1931b01508e5e30abe8b6","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14622/mbox/","series":[{"id":2723,"url":"https://patchwork.libcamera.org/api/1.1/series/2723/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2723","date":"2021-11-18T09:48:23","name":"[libcamera-devel,v2] android: Check exposure time range for manual sensor capability","version":2,"mbox":"https://patchwork.libcamera.org/series/2723/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14622/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14622/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 37AD9BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Nov 2021 09:48:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E01ED6033C;\n\tThu, 18 Nov 2021 10:48:55 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EFD6260230\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Nov 2021 10:48:54 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 02CFF3E5;\n\tThu, 18 Nov 2021 10:48:52 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tOom0ckt\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637228934;\n\tbh=Q8m9QKp7h8z3kU5K1p8+fiGfiene5tHcdWlV5XgD9gQ=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=tOom0cktdqIpDPFLT9FeNFoSBBjetqfbYzOnR44KKTEgE4VVrKX4N27Kt8L5hqFvK\n\tEurvwiIkah8vWmz7yuFrEBAw/2Qe0RRWGXpS2hkbQRam339CCXyzS6XAygXtMkjBKv\n\tmQZjyXZBHy3vQ53G6MaZi4xOWM1yHTGvyYOwRemg=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 18 Nov 2021 18:48:23 +0900","Message-Id":"<20211118094823.344496-1-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2] android: Check exposure time range for\n\tmanual sensor capability","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"In the manual sensor capability validator, add a check for the exposure\ntime range. While at it, since the minimum exposure time is not limited\nto the manual sensor capability, add a check for it when initializing\nstatic metadata.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nChanges in v2:\n- fix comparator order (cosmetic)\n- change comparators and comments to \"equal or\", as that is what is\n  specificied in the hal docs\n- add check for minimum exposure time when initializing static metadata\n  - this only prints error, should we return -EINVAL instead?\n---\n src/android/camera_capabilities.cpp | 30 +++++++++++++++++++++++++++++\n 1 file changed, 30 insertions(+)","diff":"diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\nindex f357902e..6e46f163 100644\n--- a/src/android/camera_capabilities.cpp\n+++ b/src/android/camera_capabilities.cpp\n@@ -217,6 +217,8 @@ std::vector<U> setMetadata(CameraMetadata *metadata, uint32_t tag,\n \n bool CameraCapabilities::validateManualSensorCapability()\n {\n+\tcamera_metadata_ro_entry_t entry;\n+\n \tconst char *noMode = \"Manual sensor capability unavailable: \";\n \n \tif (!staticMetadata_->entryContains<uint8_t>(ANDROID_CONTROL_AE_AVAILABLE_MODES,\n@@ -231,6 +233,26 @@ bool CameraCapabilities::validateManualSensorCapability()\n \t\treturn false;\n \t}\n \n+\tif (!staticMetadata_->hasEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE)) {\n+\t\tLOG(HAL, Info) << noMode << \"missing exposure time range\";\n+\t\treturn false;\n+\t}\n+\n+\tstaticMetadata_->getEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE, &entry);\n+\tif (entry.data.i32[0] >= 100000) {\n+\t\tLOG(HAL, Info)\n+\t\t\t<< noMode\n+\t\t\t<< \"exposure time range minimum must not be equal nor larger than 100us\";\n+\t\treturn false;\n+\t}\n+\n+\tif (entry.data.i32[1] <= 100000000) {\n+\t\tLOG(HAL, Info)\n+\t\t\t<< noMode\n+\t\t\t<< \"exposure time range maximum must not be equal nor smaller than 100ms\";\n+\t\treturn false;\n+\t}\n+\n \t/*\n \t * \\todo Return true here after we satisfy all the requirements:\n \t * https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR\n@@ -1074,6 +1096,14 @@ int CameraCapabilities::initializeStaticMetadata()\n \t\t\texposureInfo->second.min().get<int32_t>() * 1000LL,\n \t\t\texposureInfo->second.max().get<int32_t>() * 1000LL,\n \t\t};\n+\n+\t\tif (exposureTimeRange[0] >= 100000) {\n+\t\t\tLOG(HAL, Error)\n+\t\t\t\t<< \"Minimum exposure time \"\n+\t\t\t\t<< exposureTimeRange[0]\n+\t\t\t\t<< \"ns is too big (should be smaller than 100us)\";\n+\t\t}\n+\n \t\tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n \t\t\t\t\t  exposureTimeRange, 2);\n \t}\n","prefixes":["libcamera-devel","v2"]}