[{"id":21116,"web_url":"https://patchwork.libcamera.org/comment/21116/","msgid":"<20211123105032.GI4088@pyrite.rasen.tech>","date":"2021-11-23T10:50:32","subject":"Re: [libcamera-devel] [PATCH v4 5/7] android: Check exposure time\n\trange for manual sensor capability","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hello,\n\nOn Tue, Nov 23, 2021 at 07:40:40PM +0900, Paul Elder wrote:\n> In the manual sensor capability validator, add a check for the presence\n> of the exposure time range key, and for the maximum exposure time. The\n> minimum exposure time is a requirement for adding the key in the first\n> place; add a check for this as well.\n> \n> If either requirement is not met, the manual sensor capability\n> validation will fail, therefore disabling the FULL hardware level. The\n> exposure time range key is optional in non-FULL hardware levels.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> \n> ---\n> Changes in v4:\n> - s/i32/i64\n> \n> Changes 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> \n> Changes 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(-)\n> \n> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\n> index 875d38da..f7397d27 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> @@ -798,7 +813,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> @@ -876,7 +890,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> @@ -1082,8 +1095,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\nWelp, it turns out this adds CTS failures:\n\njunit.framework.AssertionFailedError: Missing field: SENSOR_EXPOSURE_TIME\n\njava.lang.Throwable(Test failed for camera 0: Key android.sensor.exposureTime shouldn't be null)\n\nIs it fine to have these failures, since they'll be fixed soon with the\nAE series? Or should I replace the result key one with a todo?\n\n\nPaul\n\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> -- \n> 2.27.0\n>","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 12EFABF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 10:50:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 658A360394;\n\tTue, 23 Nov 2021 11:50:42 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F5EC60376\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 11:50:41 +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 C45D5A1B;\n\tTue, 23 Nov 2021 11:50:38 +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=\"bTvttrTX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637664640;\n\tbh=MjkSRLM3of4e5sUpiX/tdv28aPY+F2sd33C9BuA2htU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=bTvttrTXjJkTRWhoR9vTD/mVljvOkgoZFSahpwg1bMRk9QnaAG7QHuelPH0VodVgO\n\tnV+d9PGSN1upGsksxK28asTuy93r0Q8KIKuOlODyMqk0aEvNOMjHDsCTFb606iJ4yN\n\t8S0Mm+2yFqOv+b/LvzJIRmRyrESXCobZQuhq56dE=","Date":"Tue, 23 Nov 2021 19:50:32 +0900","From":"paul.elder@ideasonboard.com","To":"libcamera-devel@lists.libcamera.org","Message-ID":"<20211123105032.GI4088@pyrite.rasen.tech>","References":"<20211123104042.3100902-1-paul.elder@ideasonboard.com>\n\t<20211123104042.3100902-6-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20211123104042.3100902-6-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v4 5/7] android: Check exposure time\n\trange for 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>"}},{"id":21228,"web_url":"https://patchwork.libcamera.org/comment/21228/","msgid":"<163783855796.3059017.10246905775592457370@Monstersaurus>","date":"2021-11-25T11:09:17","subject":"Re: [libcamera-devel] [PATCH v4 5/7] android: Check exposure time\n\trange for manual sensor capability","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting paul.elder@ideasonboard.com (2021-11-23 10:50:32)\n> Hello,\n> \n> On Tue, Nov 23, 2021 at 07:40:40PM +0900, Paul Elder wrote:\n> > In the manual sensor capability validator, add a check for the presence\n> > of the exposure time range key, and for the maximum exposure time. The\n> > minimum exposure time is a requirement for adding the key in the first\n> > place; add a check for this as well.\n> > \n> > If either requirement is not met, the manual sensor capability\n> > validation will fail, therefore disabling the FULL hardware level. The\n> > exposure time range key is optional in non-FULL hardware levels.\n> > \n> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> > \n> > ---\n> > Changes in v4:\n> > - s/i32/i64\n> > \n> > Changes 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> > \n> > Changes 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(-)\n> > \n> > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\n> > index 875d38da..f7397d27 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> > +     camera_metadata_ro_entry_t entry;\n> > +\n> >       const char *noMode = \"Manual sensor capability unavailable: \";\n> >  \n> >       if (!staticMetadata_->entryContains<uint8_t>(ANDROID_CONTROL_AE_AVAILABLE_MODES,\n> > @@ -231,6 +233,19 @@ bool CameraCapabilities::validateManualSensorCapability()\n> >               return false;\n> >       }\n> >  \n> > +     if (!staticMetadata_->hasEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE)) {\n> > +             LOG(HAL, Info) << noMode << \"missing exposure time range\";\n> > +             return false;\n> > +     }\n> > +\n> > +     staticMetadata_->getEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE, &entry);\n> > +     if (entry.data.i64[1] <= 100000000) {\n> > +             LOG(HAL, Info)\n> > +                     << noMode\n> > +                     << \"exposure time range maximum must be larger than 100ms\";\n> > +             return false;\n> > +     }\n> > +\n> >       /*\n> >        * \\todo Return true here after we satisfy all the requirements:\n> >        * https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR\n> > @@ -798,7 +813,6 @@ int CameraCapabilities::initializeStaticMetadata()\n> >               ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES,\n> >               ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,\n> >               ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,\n> > -             ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n> >               ANDROID_SENSOR_INFO_MAX_FRAME_DURATION,\n> >               ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n> >               ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,\n> > @@ -876,7 +890,6 @@ int CameraCapabilities::initializeStaticMetadata()\n> >               ANDROID_NOISE_REDUCTION_MODE,\n> >               ANDROID_REQUEST_PIPELINE_DEPTH,\n> >               ANDROID_SCALER_CROP_REGION,\n> > -             ANDROID_SENSOR_EXPOSURE_TIME,\n> >               ANDROID_SENSOR_FRAME_DURATION,\n> >               ANDROID_SENSOR_ROLLING_SHUTTER_SKEW,\n> >               ANDROID_SENSOR_TEST_PATTERN_MODE,\n> > @@ -1082,8 +1095,20 @@ int CameraCapabilities::initializeStaticMetadata()\n> >                       exposureInfo->second.min().get<int32_t>() * 1000LL,\n> >                       exposureInfo->second.max().get<int32_t>() * 1000LL,\n> >               };\n> > -             staticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n> > -                                       exposureTimeRange, 2);\n> > +\n> > +             if (exposureTimeRange[0] < 100000) {\n> > +                     staticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n> > +                                     exposureTimeRange, 2);\n> > +\n> > +                     availableCharacteristicsKeys_.insert(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE);\n> > +                     availableRequestKeys_.insert(ANDROID_SENSOR_EXPOSURE_TIME);\n> > +                     availableResultKeys_.insert(ANDROID_SENSOR_EXPOSURE_TIME);\n> \n> Welp, it turns out this adds CTS failures:\n> \n> junit.framework.AssertionFailedError: Missing field: SENSOR_EXPOSURE_TIME\n> \n> java.lang.Throwable(Test failed for camera 0: Key android.sensor.exposureTime shouldn't be null)\n> \n> Is it fine to have these failures, since they'll be fixed soon with the\n> AE series? Or should I replace the result key one with a todo?\n\nI'd be tempted to move this patch to the series that adds the\nrequirements.\n\nThen we don't lose the patch, and don't add a regression when testing.\n\n\n\n> \n> \n> Paul\n> \n> > +             } else {\n> > +                     LOG(HAL, Info)\n> > +                             << \"Minimum exposure time \"\n> > +                             << exposureTimeRange[0]\n> > +                             << \"ns is too big (should be smaller than 100us)\";\n> > +             }\n> >       }\n> >  \n> >       staticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, orientation_);\n> > -- \n> > 2.27.0\n> >","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 5ABE1BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Nov 2021 11:09:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B979C6036F;\n\tThu, 25 Nov 2021 12:09:22 +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 7D37560231\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Nov 2021 12:09:21 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 09F4290E;\n\tThu, 25 Nov 2021 12:09:21 +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=\"AXmk4Uri\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637838561;\n\tbh=Xnu1tITbJKpSKYH+WTCVwE8479v19DR3CGoihSUd2tM=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=AXmk4UriGNGaBworTYn7WBooYS9YkdYPkWNbGG+z2Dcw8ZJTO7T/zN38cnxvUKO8p\n\t7QHbY1A5g6kev0W1zeSVS0UwfxGbh3jcUKxtqNOMxBeZ+DmuOq7b42Wk+3uERdgp40\n\tc65Y+LhnYuhnGpQN4YG03Ph7qTfCmziB8JrlHRE4=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211123105032.GI4088@pyrite.rasen.tech>","References":"<20211123104042.3100902-1-paul.elder@ideasonboard.com>\n\t<20211123104042.3100902-6-paul.elder@ideasonboard.com>\n\t<20211123105032.GI4088@pyrite.rasen.tech>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org, paul.elder@ideasonboard.com","Date":"Thu, 25 Nov 2021 11:09:17 +0000","Message-ID":"<163783855796.3059017.10246905775592457370@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 5/7] android: Check exposure time\n\trange for 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>"}},{"id":21834,"web_url":"https://patchwork.libcamera.org/comment/21834/","msgid":"<20211220230935.GE2742@pyrite.rasen.tech>","date":"2021-12-20T23:09:35","subject":"Re: [libcamera-devel] [PATCH v4 5/7] android: Check exposure time\n\trange for manual sensor capability","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Thu, Nov 25, 2021 at 11:09:17AM +0000, Kieran Bingham wrote:\n> Quoting paul.elder@ideasonboard.com (2021-11-23 10:50:32)\n> > Hello,\n> > \n> > On Tue, Nov 23, 2021 at 07:40:40PM +0900, Paul Elder wrote:\n> > > In the manual sensor capability validator, add a check for the presence\n> > > of the exposure time range key, and for the maximum exposure time. The\n> > > minimum exposure time is a requirement for adding the key in the first\n> > > place; add a check for this as well.\n> > > \n> > > If either requirement is not met, the manual sensor capability\n> > > validation will fail, therefore disabling the FULL hardware level. The\n> > > exposure time range key is optional in non-FULL hardware levels.\n> > > \n> > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > > Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> > > \n> > > ---\n> > > Changes in v4:\n> > > - s/i32/i64\n> > > \n> > > Changes 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> > > \n> > > Changes 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(-)\n> > > \n> > > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\n> > > index 875d38da..f7397d27 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> > > +     camera_metadata_ro_entry_t entry;\n> > > +\n> > >       const char *noMode = \"Manual sensor capability unavailable: \";\n> > >  \n> > >       if (!staticMetadata_->entryContains<uint8_t>(ANDROID_CONTROL_AE_AVAILABLE_MODES,\n> > > @@ -231,6 +233,19 @@ bool CameraCapabilities::validateManualSensorCapability()\n> > >               return false;\n> > >       }\n> > >  \n> > > +     if (!staticMetadata_->hasEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE)) {\n> > > +             LOG(HAL, Info) << noMode << \"missing exposure time range\";\n> > > +             return false;\n> > > +     }\n> > > +\n> > > +     staticMetadata_->getEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE, &entry);\n> > > +     if (entry.data.i64[1] <= 100000000) {\n> > > +             LOG(HAL, Info)\n> > > +                     << noMode\n> > > +                     << \"exposure time range maximum must be larger than 100ms\";\n> > > +             return false;\n> > > +     }\n> > > +\n> > >       /*\n> > >        * \\todo Return true here after we satisfy all the requirements:\n> > >        * https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR\n> > > @@ -798,7 +813,6 @@ int CameraCapabilities::initializeStaticMetadata()\n> > >               ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES,\n> > >               ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,\n> > >               ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT,\n> > > -             ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n> > >               ANDROID_SENSOR_INFO_MAX_FRAME_DURATION,\n> > >               ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n> > >               ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,\n> > > @@ -876,7 +890,6 @@ int CameraCapabilities::initializeStaticMetadata()\n> > >               ANDROID_NOISE_REDUCTION_MODE,\n> > >               ANDROID_REQUEST_PIPELINE_DEPTH,\n> > >               ANDROID_SCALER_CROP_REGION,\n> > > -             ANDROID_SENSOR_EXPOSURE_TIME,\n> > >               ANDROID_SENSOR_FRAME_DURATION,\n> > >               ANDROID_SENSOR_ROLLING_SHUTTER_SKEW,\n> > >               ANDROID_SENSOR_TEST_PATTERN_MODE,\n> > > @@ -1082,8 +1095,20 @@ int CameraCapabilities::initializeStaticMetadata()\n> > >                       exposureInfo->second.min().get<int32_t>() * 1000LL,\n> > >                       exposureInfo->second.max().get<int32_t>() * 1000LL,\n> > >               };\n> > > -             staticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n> > > -                                       exposureTimeRange, 2);\n> > > +\n> > > +             if (exposureTimeRange[0] < 100000) {\n> > > +                     staticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n> > > +                                     exposureTimeRange, 2);\n> > > +\n> > > +                     availableCharacteristicsKeys_.insert(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE);\n> > > +                     availableRequestKeys_.insert(ANDROID_SENSOR_EXPOSURE_TIME);\n> > > +                     availableResultKeys_.insert(ANDROID_SENSOR_EXPOSURE_TIME);\n> > \n> > Welp, it turns out this adds CTS failures:\n> > \n> > junit.framework.AssertionFailedError: Missing field: SENSOR_EXPOSURE_TIME\n> > \n> > java.lang.Throwable(Test failed for camera 0: Key android.sensor.exposureTime shouldn't be null)\n> > \n> > Is it fine to have these failures, since they'll be fixed soon with the\n> > AE series? Or should I replace the result key one with a todo?\n> \n> I'd be tempted to move this patch to the series that adds the\n> requirements.\n\nAlright, I'll move it immediately after \"android: Plumb all AE-related\ncontrols\".\n\n\nPaul\n\n> \n> Then we don't lose the patch, and don't add a regression when testing.\n> \n> \n> \n> > \n> > \n> > Paul\n> > \n> > > +             } else {\n> > > +                     LOG(HAL, Info)\n> > > +                             << \"Minimum exposure time \"\n> > > +                             << exposureTimeRange[0]\n> > > +                             << \"ns is too big (should be smaller than 100us)\";\n> > > +             }\n> > >       }\n> > >  \n> > >       staticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, orientation_);\n> > > -- \n> > > 2.27.0\n> > >","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 62E42BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Dec 2021 23:09:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 92F49608E7;\n\tTue, 21 Dec 2021 00:09:44 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F37560592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Dec 2021 00:09:42 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6C807881;\n\tTue, 21 Dec 2021 00:09:40 +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=\"jctUnOqS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640041781;\n\tbh=4Zan9yXiuAdTfPRUKNHCsBV5HkvUzlJPIJRzoCxRRiE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jctUnOqSFA3AJsN4d/CcS/uyoULD1GccMFf6HrLkbnc8utkac4iuvGX2gRno2yemY\n\tG19yQs30NQ4yPQeNAwcK2hYWmhE9WKyZRnpSRDFLNaa79tAZJJo82TtAC0Uiq0YTh4\n\tJCdz/z+njhVVBoNZhiH2qhCqfbrK7RUZb9KM2Cl8=","Date":"Mon, 20 Dec 2021 17:09:35 -0600","From":"paul.elder@ideasonboard.com","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20211220230935.GE2742@pyrite.rasen.tech>","References":"<20211123104042.3100902-1-paul.elder@ideasonboard.com>\n\t<20211123104042.3100902-6-paul.elder@ideasonboard.com>\n\t<20211123105032.GI4088@pyrite.rasen.tech>\n\t<163783855796.3059017.10246905775592457370@Monstersaurus>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<163783855796.3059017.10246905775592457370@Monstersaurus>","Subject":"Re: [libcamera-devel] [PATCH v4 5/7] android: Check exposure time\n\trange for 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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]