{"id":15185,"url":"https://patchwork.libcamera.org/api/1.1/patches/15185/?format=json","web_url":"https://patchwork.libcamera.org/patch/15185/","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":"<20211221043610.2512334-8-paul.elder@ideasonboard.com>","date":"2021-12-21T04:36:09","name":"[libcamera-devel,v4,7/8] android: Check exposure time range for manual sensor capability","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"014211453549352674fc19d3b7403630cd2a91d8","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/users/17/?format=json","username":"epaul","first_name":"Paul","last_name":"Elder","email":"paul.elder@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/15185/mbox/","series":[{"id":2849,"url":"https://patchwork.libcamera.org/api/1.1/series/2849/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2849","date":"2021-12-21T04:36:02","name":"The Great AE Changes","version":3,"mbox":"https://patchwork.libcamera.org/series/2849/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15185/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15185/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 5087DBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 21 Dec 2021 04:36:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EEB8060903;\n\tTue, 21 Dec 2021 05:36:30 +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 147A2608E8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Dec 2021 05:36:28 +0100 (CET)","from pyrite.mediacom.info (unknown\n\t[IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6EBFC881;\n\tTue, 21 Dec 2021 05:36:26 +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=\"aUEv6oX/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640061387;\n\tbh=NCGU+UFk0uU5BG8rtRhiVTrbDKwMgSL6EDVWg26Nt2M=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=aUEv6oX/lA4H36mD17bjW1qV3LVlvxBA6fzQuwg5FGtYYJU4ssQo9ULP53tdCdOqT\n\tmtRbMDExt4WQEuZwBlOPnZrhGop1pA6T6uhW4sT/omqCA5fuqvv5thPqAW/z6G0a+u\n\tXjCiGCrNZhMVk9ato9SaV8RFY4+JZfzCCHVnzCww=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 20 Dec 2021 22:36:09 -0600","Message-Id":"<20211221043610.2512334-8-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20211221043610.2512334-1-paul.elder@ideasonboard.com>","References":"<20211221043610.2512334-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 7/8] android: Check exposure time range\n\tfor manual 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 presence\nof the exposure time range key, and for the maximum exposure time. The\nminimum exposure time is a requirement for adding the key in the first\nplace; add a check for this as well.\n\nIf either requirement is not met, the manual sensor capability\nvalidation will fail, therefore disabling the FULL hardware level. The\nexposure time range key is optional in non-FULL hardware levels.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n---\nChanges in v4:\n- s/i32/i64\n\nChanges in v3:\n- squash \"android: capabilities: Add exposure time keys only if\n  available\"\n- fix the minumum exposure time check\n  - only make the exposure time range key available if this check\n    passes. additionally, if the max exposure time passes its check,\n    tick the box for manual sensor and FULL\n- update commit message accordingly\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---\n src/android/camera_capabilities.cpp | 33 +++++++++++++++++++++++++----\n 1 file changed, 29 insertions(+), 4 deletions(-)","diff":"diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\nindex 318ab666..1bea15ca 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,19 @@ 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.i64[1] <= 100000000) {\n+\t\tLOG(HAL, Info)\n+\t\t\t<< noMode\n+\t\t\t<< \"exposure time range maximum must be larger 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@@ -808,7 +823,6 @@ int CameraCapabilities::initializeStaticMetadata()\n \t\tANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES,\n \t\tANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,\n \t\tANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,\n-\t\tANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n \t\tANDROID_SENSOR_INFO_MAX_FRAME_DURATION,\n \t\tANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n \t\tANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,\n@@ -886,7 +900,6 @@ int CameraCapabilities::initializeStaticMetadata()\n \t\tANDROID_NOISE_REDUCTION_MODE,\n \t\tANDROID_REQUEST_PIPELINE_DEPTH,\n \t\tANDROID_SCALER_CROP_REGION,\n-\t\tANDROID_SENSOR_EXPOSURE_TIME,\n \t\tANDROID_SENSOR_FRAME_DURATION,\n \t\tANDROID_SENSOR_ROLLING_SHUTTER_SKEW,\n \t\tANDROID_SENSOR_TEST_PATTERN_MODE,\n@@ -1148,8 +1161,20 @@ 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-\t\tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n-\t\t\t\t\t  exposureTimeRange, 2);\n+\n+\t\tif (exposureTimeRange[0] < 100000) {\n+\t\t\tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n+\t\t\t\t\texposureTimeRange, 2);\n+\n+\t\t\tavailableCharacteristicsKeys_.insert(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE);\n+\t\t\tavailableRequestKeys_.insert(ANDROID_SENSOR_EXPOSURE_TIME);\n+\t\t\tavailableResultKeys_.insert(ANDROID_SENSOR_EXPOSURE_TIME);\n+\t\t} else {\n+\t\t\tLOG(HAL, Info)\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 \t}\n \n \tstaticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, orientation_);\n","prefixes":["libcamera-devel","v4","7/8"]}