[{"id":2461,"web_url":"https://patchwork.libcamera.org/comment/2461/","msgid":"<20190817162837.GA26416@pendragon.ideasonboard.com>","date":"2019-08-17T16:28:37","subject":"Re: [libcamera-devel] [PATCH 5/5] libcamera: camera_sensor:\n\tRetrieve sensor sizes","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 Sat, Aug 17, 2019 at 12:59:37PM +0200, Jacopo Mondi wrote:\n> Retrieve the camera sensor pixel array sizes and the active pixel sizes\n> using the V4L2 selection APIs.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/camera_sensor.cpp       | 13 +++++++++++++\n>  src/libcamera/include/camera_sensor.h |  2 ++\n>  2 files changed, 15 insertions(+)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 2703d10c719e..e6b01c242328 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -114,6 +114,19 @@ int CameraSensor::init()\n>  \t\treturn -EINVAL;\n>  \t}\n>  \n> +\t/* Retrieve and store the sensor pixel array and active area sizes. */\n\nNit-picking, the active area is a rectangle, not a size unlike the pixel\narray.\n\n> +\tret = subdev_->getCropBounds(0, &activeAreaSize_);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tRectangle rect = {};\n\nI think you can skip the initialisation of rect.\n\n> +\tret = subdev_->getNativeSize(0, &rect);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tpixelArraySize_.width = rect.w;\n> +\tpixelArraySize_.height = rect.h;\n> +\n>  \t/* Enumerate and cache media bus codes and sizes. */\n>  \tconst ImageFormats formats = subdev_->formats(0);\n>  \tif (formats.isEmpty()) {\n> diff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\n> index a237a1684605..f6b184bf2838 100644\n> --- a/src/libcamera/include/camera_sensor.h\n> +++ b/src/libcamera/include/camera_sensor.h\n> @@ -58,6 +58,8 @@ private:\n>  \tstd::vector<Size> sizes_;\n>  \n>  \tCameraLocation location_;\n> +\tSize pixelArraySize_;\n> +\tRectangle activeAreaSize_;\n\nShould you provide get accessors for these (with documentation :-)) ?\n\nDo we also need to expose the sensor physical size ?\n\n>  };\n>  \n>  } /* namespace libcamera */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E2E160E2B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 18:28:43 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A518B556;\n\tSat, 17 Aug 2019 18:28:42 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1566059322;\n\tbh=Cpsz1ERpGYG8pqlEPVInfUiAWsKLPEggRckOrrb6f6s=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jTvnrn7FMYQhp1HJ4Rhf5xwCyquUYgI1QwN1Vq0/9qtMXAGZZSNlzwtEqj05B7M7f\n\tL0td8b/riEVzCs4bp0cgScIZTWS95PDrL79pgBxx/q/psgWpGBl/hajdisx4b5RTHD\n\ti9k+9aHwr+rJ35ycw91PnhgP4o7tXKn6oJAkfq7o=","Date":"Sat, 17 Aug 2019 19:28:37 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190817162837.GA26416@pendragon.ideasonboard.com>","References":"<20190817105937.29353-1-jacopo@jmondi.org>\n\t<20190817105937.29353-6-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190817105937.29353-6-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 5/5] libcamera: camera_sensor:\n\tRetrieve sensor sizes","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Sat, 17 Aug 2019 16:28:43 -0000"}},{"id":2468,"web_url":"https://patchwork.libcamera.org/comment/2468/","msgid":"<20190819074551.emvs7gcsiuesjqgz@uno.localdomain>","date":"2019-08-19T07:45:51","subject":"Re: [libcamera-devel] [PATCH 5/5] libcamera: camera_sensor:\n\tRetrieve sensor sizes","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Sat, Aug 17, 2019 at 07:28:37PM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Sat, Aug 17, 2019 at 12:59:37PM +0200, Jacopo Mondi wrote:\n> > Retrieve the camera sensor pixel array sizes and the active pixel sizes\n> > using the V4L2 selection APIs.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/camera_sensor.cpp       | 13 +++++++++++++\n> >  src/libcamera/include/camera_sensor.h |  2 ++\n> >  2 files changed, 15 insertions(+)\n> >\n> > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> > index 2703d10c719e..e6b01c242328 100644\n> > --- a/src/libcamera/camera_sensor.cpp\n> > +++ b/src/libcamera/camera_sensor.cpp\n> > @@ -114,6 +114,19 @@ int CameraSensor::init()\n> >  \t\treturn -EINVAL;\n> >  \t}\n> >\n> > +\t/* Retrieve and store the sensor pixel array and active area sizes. */\n>\n> Nit-picking, the active area is a rectangle, not a size unlike the pixel\n> array.\n>\n> > +\tret = subdev_->getCropBounds(0, &activeAreaSize_);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tRectangle rect = {};\n>\n> I think you can skip the initialisation of rect.\n>\n> > +\tret = subdev_->getNativeSize(0, &rect);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tpixelArraySize_.width = rect.w;\n> > +\tpixelArraySize_.height = rect.h;\n> > +\n> >  \t/* Enumerate and cache media bus codes and sizes. */\n> >  \tconst ImageFormats formats = subdev_->formats(0);\n> >  \tif (formats.isEmpty()) {\n> > diff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\n> > index a237a1684605..f6b184bf2838 100644\n> > --- a/src/libcamera/include/camera_sensor.h\n> > +++ b/src/libcamera/include/camera_sensor.h\n> > @@ -58,6 +58,8 @@ private:\n> >  \tstd::vector<Size> sizes_;\n> >\n> >  \tCameraLocation location_;\n> > +\tSize pixelArraySize_;\n> > +\tRectangle activeAreaSize_;\n>\n> Should you provide get accessors for these (with documentation :-)) ?\n>\n\nThat, or expose them as properties, that are gathered together with\nthe Camera reported ones in a single list of Camera properties. I\nwould prefer going for properties directly instead of going through\naccessors and build the properties list from there.\n\n> Do we also need to expose the sensor physical size ?\n>\n\nFor android HAL integration purposes, yes:\nhttps://jmondi.org/android_metadata_tags/ddocs.html#static_android.sensor.info.physicalSize\nas well as rotation:\nhttps://jmondi.org/android_metadata_tags/docs.html#static_android.sensor.orientation\nand sensitiviy range:\nhttps://jmondi.org/android_metadata_tags/docs.html#static_android.sensor.info.sensitivityRange\n\nWith these we would complete support for static metadata tags marked as \"BC\"\nrequired to support the LEGACY hardware level.\n\nGoging forward there are much more sensor/lens related properties that\nwill need to be retrieved, in particular to support the RAW mode.\n\nBut that's for later.\n\n\n> >  };\n> >\n> >  } /* namespace libcamera */\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AE5FE60E38\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Aug 2019 09:44:23 +0200 (CEST)","from uno.localdomain (unknown [87.18.63.98])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id EDD25FF808;\n\tMon, 19 Aug 2019 07:44:22 +0000 (UTC)"],"X-Originating-IP":"87.18.63.98","Date":"Mon, 19 Aug 2019 09:45:51 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190819074551.emvs7gcsiuesjqgz@uno.localdomain>","References":"<20190817105937.29353-1-jacopo@jmondi.org>\n\t<20190817105937.29353-6-jacopo@jmondi.org>\n\t<20190817162837.GA26416@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"ggos7mc55hlfr65q\"","Content-Disposition":"inline","In-Reply-To":"<20190817162837.GA26416@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 5/5] libcamera: camera_sensor:\n\tRetrieve sensor sizes","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Mon, 19 Aug 2019 07:44:23 -0000"}},{"id":2485,"web_url":"https://patchwork.libcamera.org/comment/2485/","msgid":"<20190819134434.GF5011@pendragon.ideasonboard.com>","date":"2019-08-19T13:44:34","subject":"Re: [libcamera-devel] [PATCH 5/5] libcamera: camera_sensor:\n\tRetrieve sensor sizes","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Mon, Aug 19, 2019 at 09:45:51AM +0200, Jacopo Mondi wrote:\n> On Sat, Aug 17, 2019 at 07:28:37PM +0300, Laurent Pinchart wrote:\n> > On Sat, Aug 17, 2019 at 12:59:37PM +0200, Jacopo Mondi wrote:\n> > > Retrieve the camera sensor pixel array sizes and the active pixel sizes\n> > > using the V4L2 selection APIs.\n> > >\n> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > > ---\n> > >  src/libcamera/camera_sensor.cpp       | 13 +++++++++++++\n> > >  src/libcamera/include/camera_sensor.h |  2 ++\n> > >  2 files changed, 15 insertions(+)\n> > >\n> > > diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> > > index 2703d10c719e..e6b01c242328 100644\n> > > --- a/src/libcamera/camera_sensor.cpp\n> > > +++ b/src/libcamera/camera_sensor.cpp\n> > > @@ -114,6 +114,19 @@ int CameraSensor::init()\n> > >  \t\treturn -EINVAL;\n> > >  \t}\n> > >\n> > > +\t/* Retrieve and store the sensor pixel array and active area sizes. */\n> >\n> > Nit-picking, the active area is a rectangle, not a size unlike the pixel\n> > array.\n> >\n> > > +\tret = subdev_->getCropBounds(0, &activeAreaSize_);\n> > > +\tif (ret)\n> > > +\t\treturn ret;\n> > > +\n> > > +\tRectangle rect = {};\n> >\n> > I think you can skip the initialisation of rect.\n> >\n> > > +\tret = subdev_->getNativeSize(0, &rect);\n> > > +\tif (ret)\n> > > +\t\treturn ret;\n> > > +\n> > > +\tpixelArraySize_.width = rect.w;\n> > > +\tpixelArraySize_.height = rect.h;\n> > > +\n> > >  \t/* Enumerate and cache media bus codes and sizes. */\n> > >  \tconst ImageFormats formats = subdev_->formats(0);\n> > >  \tif (formats.isEmpty()) {\n> > > diff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\n> > > index a237a1684605..f6b184bf2838 100644\n> > > --- a/src/libcamera/include/camera_sensor.h\n> > > +++ b/src/libcamera/include/camera_sensor.h\n> > > @@ -58,6 +58,8 @@ private:\n> > >  \tstd::vector<Size> sizes_;\n> > >\n> > >  \tCameraLocation location_;\n> > > +\tSize pixelArraySize_;\n> > > +\tRectangle activeAreaSize_;\n> >\n> > Should you provide get accessors for these (with documentation :-)) ?\n> \n> That, or expose them as properties, that are gathered together with\n> the Camera reported ones in a single list of Camera properties. I\n> would prefer going for properties directly instead of going through\n> accessors and build the properties list from there.\n\nI'm not entirely sure about that. I think at least the active area would\nbe useful for pippeline handlers to know, and going through properties\nmay not be the best API for that. Furthermore, I wonder if pipeline\nhandlers wouldn't need to mangle data from the camera sensor before\nexposing them as controls. I suppose we'll figure it out as we move\nforward.\n\n> > Do we also need to expose the sensor physical size ?\n> \n> For android HAL integration purposes, yes:\n> https://jmondi.org/android_metadata_tags/ddocs.html#static_android.sensor.info.physicalSize\n> as well as rotation:\n> https://jmondi.org/android_metadata_tags/docs.html#static_android.sensor.orientation\n> and sensitiviy range:\n> https://jmondi.org/android_metadata_tags/docs.html#static_android.sensor.info.sensitivityRange\n> \n> With these we would complete support for static metadata tags marked as \"BC\"\n> required to support the LEGACY hardware level.\n> \n> Goging forward there are much more sensor/lens related properties that\n> will need to be retrieved, in particular to support the RAW mode.\n> \n> But that's for later.\n\nSure :-)\n\n> > >  };\n> > >\n> > >  } /* namespace libcamera */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9DDEC60C1E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Aug 2019 15:44:40 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E916510;\n\tMon, 19 Aug 2019 15:44:40 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1566222280;\n\tbh=TdVyv2xUQZ5ZiwPQ7xtZSWgetd8KPGxdIugk0wwxuuU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=XcujukHyI+uNsqi4yPLniMO0QOpI+KXzdDTvB8n6hlpNMnXW3pNNu216n5xAeUoNp\n\t9XNDLSR9zBj8KQUfSFgdINM7C+WU88y3LXnhjraMZ1DFZ9mQx9+YJCANelVHP3asOM\n\tpJbANP4FTRlS4xLomzgMiCXvBH06cWbvoWdBeTPc=","Date":"Mon, 19 Aug 2019 16:44:34 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190819134434.GF5011@pendragon.ideasonboard.com>","References":"<20190817105937.29353-1-jacopo@jmondi.org>\n\t<20190817105937.29353-6-jacopo@jmondi.org>\n\t<20190817162837.GA26416@pendragon.ideasonboard.com>\n\t<20190819074551.emvs7gcsiuesjqgz@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190819074551.emvs7gcsiuesjqgz@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 5/5] libcamera: camera_sensor:\n\tRetrieve sensor sizes","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Mon, 19 Aug 2019 13:44:40 -0000"}}]