[{"id":14315,"web_url":"https://patchwork.libcamera.org/comment/14315/","msgid":"<X+LSQg90qb/Wqfi6@pendragon.ideasonboard.com>","date":"2020-12-23T05:14:42","subject":"Re: [libcamera-devel] [PATCH v2 9/9] android: camera_device: Report\n\tsensor physical size","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Fri, Dec 18, 2020 at 05:47:54PM +0100, Jacopo Mondi wrote:\n> Report the ANDROID_SENSOR_INFO_PHYSICAL_SIZE property inspecting\n> the draft SensorPhysicalSize property reported by libcamera.\n> \n> Maintain a default value to support pipelines that do not register\n> the camera property.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp | 18 +++++++++++++-----\n>  1 file changed, 13 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index bad8a51ae7f7..f50a539e907d 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -919,12 +919,20 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>  \t\t\t\t  testPatterModes.data(),\n>  \t\t\t\t  testPatterModes.size());\n>  \n> -\tstd::vector<float> physicalSize = {\n> -\t\t2592, 1944,\n> -\t};\n> +\tstd::vector<float> physicalSize(2);\n> +\tif (properties.contains(properties::draft::SensorPhysicalSize)) {\n> +\t\tconst Span<const float> data =\n> +\t\t\tproperties.get<Span<const float>>(properties::draft::SensorPhysicalSize);\n> +\t\tphysicalSize = { data[0], data[1] };\n> +\t} else {\n> +\t\t/*\n> +\t\t * \\todo Drop the default once all pipelines report the\n> +\t\t * property.\n> +\t\t */\n\nDown the line this kind of issue will be caught by a pipeline handler\ntest suite. I'm wondering if we could already drop the fallback here, as\nwe log a warning when the sensor database doesn't include information\nfor the sensor.\n\nThis will leave open the question of how to handle UVC cameras, as the\nsensor database isn't applicable to them. I suppose we can't do much in\nthat case, all we need is to ensure the HAL won't crash. Later we'll\nprobably need to retrieve the information from a configuration file for\nbuilt-in UVC cameras.\n\n> +\t\tphysicalSize = { 2.592, 1.944 };\n> +\t}\n>  \tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n> -\t\t\t\t  physicalSize.data(),\n> -\t\t\t\t  physicalSize.size());\n> +\t\t\t\t  physicalSize.data(), physicalSize.size());\n>  \n>  \tuint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;\n>  \tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,","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 089F2C0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Dec 2020 05:14:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 85A8E6158A;\n\tWed, 23 Dec 2020 06:14:52 +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 3AFA060320\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Dec 2020 06:14:51 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A503FA32;\n\tWed, 23 Dec 2020 06:14:50 +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=\"DuHUb6av\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1608700490;\n\tbh=qo6RaNcQOlUSeP7C5cs5YobvxNmR0u10dv/fhzX4M9Y=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DuHUb6avwQGgrLwgd21wrpyS9bDBN5R5neUMbcibQtdd2tcqzvy4W4b9JV+wf61Z7\n\ttGiUcu/toVlhXLJOqm/ZzSA6cfAcq0X50togFY1CrrLUgTRErtw2lJRRcBktucRLJz\n\tCOnHihrJt9svTOnlp2ACYn7OMAkX4qEj6vOCcZj4=","Date":"Wed, 23 Dec 2020 07:14:42 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<X+LSQg90qb/Wqfi6@pendragon.ideasonboard.com>","References":"<20201218164754.81422-1-jacopo@jmondi.org>\n\t<20201218164754.81422-10-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20201218164754.81422-10-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v2 9/9] android: camera_device: Report\n\tsensor physical size","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","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":14320,"web_url":"https://patchwork.libcamera.org/comment/14320/","msgid":"<20201223083755.si3wa477lnmnvgnz@uno.localdomain>","date":"2020-12-23T08:37:55","subject":"Re: [libcamera-devel] [PATCH v2 9/9] android: camera_device: Report\n\tsensor physical size","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Wed, Dec 23, 2020 at 07:14:42AM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Fri, Dec 18, 2020 at 05:47:54PM +0100, Jacopo Mondi wrote:\n> > Report the ANDROID_SENSOR_INFO_PHYSICAL_SIZE property inspecting\n> > the draft SensorPhysicalSize property reported by libcamera.\n> >\n> > Maintain a default value to support pipelines that do not register\n> > the camera property.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/android/camera_device.cpp | 18 +++++++++++++-----\n> >  1 file changed, 13 insertions(+), 5 deletions(-)\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index bad8a51ae7f7..f50a539e907d 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -919,12 +919,20 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n> >  \t\t\t\t  testPatterModes.data(),\n> >  \t\t\t\t  testPatterModes.size());\n> >\n> > -\tstd::vector<float> physicalSize = {\n> > -\t\t2592, 1944,\n> > -\t};\n> > +\tstd::vector<float> physicalSize(2);\n> > +\tif (properties.contains(properties::draft::SensorPhysicalSize)) {\n> > +\t\tconst Span<const float> data =\n> > +\t\t\tproperties.get<Span<const float>>(properties::draft::SensorPhysicalSize);\n> > +\t\tphysicalSize = { data[0], data[1] };\n> > +\t} else {\n> > +\t\t/*\n> > +\t\t * \\todo Drop the default once all pipelines report the\n> > +\t\t * property.\n> > +\t\t */\n>\n> Down the line this kind of issue will be caught by a pipeline handler\n> test suite. I'm wondering if we could already drop the fallback here, as\n> we log a warning when the sensor database doesn't include information\n> for the sensor.\n\nI recently broken cros with such a decision. I would keep defaults\naround as we do for the active area for a little longer.\n\n>\n> This will leave open the question of how to handle UVC cameras, as the\n> sensor database isn't applicable to them. I suppose we can't do much in\n> that case, all we need is to ensure the HAL won't crash. Later we'll\n> probably need to retrieve the information from a configuration file for\n> built-in UVC cameras.\n>\n> > +\t\tphysicalSize = { 2.592, 1.944 };\n> > +\t}\n> >  \tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_PHYSICAL_SIZE,\n> > -\t\t\t\t  physicalSize.data(),\n> > -\t\t\t\t  physicalSize.size());\n> > +\t\t\t\t  physicalSize.data(), physicalSize.size());\n> >\n> >  \tuint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;\n> >  \tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 41758C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Dec 2020 08:37:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB123615AC;\n\tWed, 23 Dec 2020 09:37:45 +0100 (CET)","from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 11C9660526\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Dec 2020 09:37:44 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 814301BF20B;\n\tWed, 23 Dec 2020 08:37:43 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Wed, 23 Dec 2020 09:37:55 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20201223083755.si3wa477lnmnvgnz@uno.localdomain>","References":"<20201218164754.81422-1-jacopo@jmondi.org>\n\t<20201218164754.81422-10-jacopo@jmondi.org>\n\t<X+LSQg90qb/Wqfi6@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<X+LSQg90qb/Wqfi6@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 9/9] android: camera_device: Report\n\tsensor physical size","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","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]