All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Jacopo Mondi <jacopo@jmondi.org>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	tfiga@google.com, pavel@ucw.cz,
	"open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)" 
	<linux-media@vger.kernel.org>,
	libcamera-devel@lists.libcamera.org
Subject: Re: [PATCH v9 02/11] media: v4l2-ctrl: Document V4L2_CID_CAMERA_SENSOR_LOCATION
Date: Wed, 6 May 2020 13:09:13 +0200	[thread overview]
Message-ID: <20200506130913.7df929ff@coco.lan> (raw)
In-Reply-To: <20200506104723.l3wojjyefvazohpd@uno.localdomain>

Em Wed, 6 May 2020 12:47:23 +0200
Jacopo Mondi <jacopo@jmondi.org> escreveu:

> Hello,
> 
> On Tue, May 05, 2020 at 02:21:38PM +0200, Hans Verkuil wrote:
> > On 05/05/2020 14:02, Mauro Carvalho Chehab wrote:  
> > > Em Fri, 17 Apr 2020 14:41:01 +0200
> > > Jacopo Mondi <jacopo@jmondi.org> escreveu:
> > >  
> > >> Add documentation for the V4L2_CID_CAMERA_SENSOR_LOCATION camera
> > >> control. The newly added read-only control reports the camera device
> > >> mounting position.
> > >>
> > >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > >> ---
> > >>  .../media/v4l/ext-ctrls-camera.rst            | 32 +++++++++++++++++++
> > >>  1 file changed, 32 insertions(+)
> > >>
> > >> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
> > >> index e39f84d2447f..01a9042d53a6 100644
> > >> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
> > >> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-camera.rst
> > >> @@ -510,6 +510,38 @@ enum v4l2_scene_mode -
> > >>      value down. A value of zero stops the motion if one is in progress
> > >>      and has no effect otherwise.
> > >>
> > >> +``V4L2_CID_CAMERA_SENSOR_LOCATION (integer)``
> > >> +    This read-only control describes the camera sensor location by reporting
> > >> +    its mounting position on the device where the camera is installed. The
> > >> +    control value is constant and not modifiable by software. This control is
> > >> +    particularly meaningful for devices which have a well defined orientation,
> > >> +    such as phones, laptops and portable devices since the camera location is
> > >> +    expressed as a position relative to the device's intended usage orientation.
> > >> +    For example, a camera sensor installed on the user-facing side of a phone,
> > >> +    a tablet or a laptop device is said to be installed in the
> > >> +    ``V4L2_LOCATION_FRONT`` location while camera sensors installed on the side
> > >> +    opposite the front one are said to be installed in the
> > >> +    ``V4L2_LOCATION_BACK`` location. Camera sensors not directly attached to
> > >> +    the device or attached in a way that allows them to move freely, such as
> > >> +    webcams and digital cameras, are said to have the ``V4L2_LOCATION_EXTERNAL``
> > >> +    location.
> > >> +
> > >> +
> > >> +
> > >> +.. flat-table::
> > >> +    :header-rows:  0
> > >> +    :stub-columns: 0
> > >> +
> > >> +    * - ``  
> > > ``  
> > >> +      - The camera sensor is located on the front side of the device.
> > >> +    * - ``V4L2_LOCATION_BACK``
> > >> +      - The camera sensor is located on the back side of the device.
> > >> +    * - ``V4L2_LOCATION_EXTERNAL``
> > >> +      - The camera sensor is not directly attached to the device and is
> > >> +        freely movable.  
> > >
> > > I guess I mentioned this already, but IMHO this ioctl is somewhat flawed,
> > > for two reasons:
> > >
> > > 1) newer devices may all top of the line mobile devices now are coming
> > >    with multiple camera sensors at the same side. So, just saying that
> > >    the location is front or back is not enough. A location syscall would
> > >    need have something more to better identify the location.
> > >    It probably doesn't need to be something fancy, but, at least, on a
> > >    device with 3 back sensors, I would call them as:
> > >
> > > 	V4L2_LOCATION_BACK_1
> > > 	V4L2_LOCATION_BACK_2
> > > 	V4L2_LOCATION_BACK_3
> > >
> > >    And add some comment at the control documentation that would allow to
> > >    uniquely number the other ones, like:
> > >
> > > 	"when multiple sensors are present at the same side, sensors
> > > 	 will be numbered considering the ``(x,y)`` coordinates of the center
> > > 	 of each sensor, starting from the topmost, leftmost position.
> > >
> > > 	 She first sensor will be the topmost sensor column at the leftmost
> > > 	 side. The other sensors that will have the same ``y`` coordinate,
> > > 	 counting from the left to the right, then increment the ``y`` and
> > > 	 parse the next column again until all sensors are numbered."  
> >
> > I think this isn't a good idea. In most cases you do not care about this.
> >
> > And if you do care about this, then wouldn't it be better to do that through
> > a new control where you provide the precise coordinates in e.g. mm?
> >
> > BACK_1/2/3 really doesn't tell you anything other than that there are three
> > sensors on the back, but we knew that already.
> >
> > If we need support for the precise location in the future, then let's do that
> > right and not try to shoehorn into something that wasn't meant for it.  
> 
> I think the best move forward to describe movable cameras and such
> would be to provide a 3D rotation matrix, along the lines of what iio
> has in the 'mount-matrix' property as suggested by Rob and Laurent in
> the review of the series.
> 
> Before going the 'easy' way with this proeprty that just allow to
> enumerate fixed locations I considered the idea, but we're still
> missing a unique definition for the device usage orientation that the
> rotation matrix would be defined for.
> 
> This property implements a mechanism that covers most of devices out
> there and all devices in mainline. The properties defined here are the
> most basic ones, and could be combined and expanded to provide more
> precise definition is someone needs to do so (expecially downstream),
> but the important part is that the mechanism to retrieve the
> information is in place.

I had some discussions with Laurent about that.

Yeah, a 3D rotation matrix could work. Another option would be to
name this as CID_LENS_FACING, use about the same definition as on
Android:

 https://jmondi.org/android_metadata_tags/docs.html#static_android.lens.poseTranslation

The definition there is arguable (as some devices may have back
screens nowadays), but a name like that is what this control
really does, as it doesn't neither provide a rotation matrix
nor a camera location.

Starting with a "read-only" control sound OK to me, but I would
add some note about flippable changes that can be changed in
runtime between back/front position.

Something like:

.. note:

	Sensors that could have it side flipped is currently out
	of the scope of this control. Some changes on the behavior
	of this control may change when support for such kind of
	devices would be added upstream.

Thanks,
Mauro

  reply	other threads:[~2020-05-06 11:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17 12:40 [PATCH v9 00/11] media: report camera sensor properties Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 01/11] dt-bindings: video-interfaces: Document 'location' property Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 02/11] media: v4l2-ctrl: Document V4L2_CID_CAMERA_SENSOR_LOCATION Jacopo Mondi
2020-05-05 12:02   ` Mauro Carvalho Chehab
2020-05-05 12:21     ` Hans Verkuil
2020-05-05 14:58       ` Mauro Carvalho Chehab
2020-05-06  8:04         ` Hans Verkuil
2020-05-06  9:39           ` Mauro Carvalho Chehab
2020-05-06 11:07             ` Jacopo Mondi
2020-05-06 11:28               ` Mauro Carvalho Chehab
2020-05-07 12:36                 ` Jacopo Mondi
2020-05-07 14:05                   ` Mauro Carvalho Chehab
2020-05-07 14:09                     ` Hans Verkuil
2020-05-06 15:47               ` Laurent Pinchart
2020-05-07 12:29                 ` Jacopo Mondi
2020-05-06 10:47       ` Jacopo Mondi
2020-05-06 11:09         ` Mauro Carvalho Chehab [this message]
2020-04-17 12:41 ` [PATCH v9 03/11] dt-bindings: video-interface: Replace 'rotation' description Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 04/11] media: v4l2-ctrl: Document V4L2_CID_CAMERA_SENSOR_ROTATION Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 05/11] media: v4l2-ctrls: Add camera location and rotation Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 06/11] media: v4l2-fwnode: Add helper to parse device properties Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 07/11] include: v4l2-ctrl: Sort forward declarations Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 08/11] media: v4l2-ctrls: Sort includes alphabetically Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 09/11] media: v4l2-ctrls: Add helper to register properties Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 10/11] media: i2c: ov5670: Parse and " Jacopo Mondi
2020-04-17 12:41 ` [PATCH v9 11/11] media: i2c: ov13858: " Jacopo Mondi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200506130913.7df929ff@coco.lan \
    --to=mchehab@kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=libcamera-devel@lists.libcamera.org \
    --cc=linux-media@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tfiga@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.