From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtp.nokia.com ([147.243.128.24]:41895 "EHLO mgw-da01.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751143Ab2EGEzy (ORCPT ); Mon, 7 May 2012 00:55:54 -0400 Message-ID: <4FA6C155.6030100@iki.fi> Date: Sun, 06 May 2012 21:22:13 +0300 From: Sakari Ailus MIME-Version: 1.0 To: Sylwester Nawrocki CC: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com, g.liakhovetski@gmx.de, hdegoede@redhat.com, moinejf@free.fr, hverkuil@xs4all.nl, m.szyprowski@samsung.com, riverful.kim@samsung.com, sw0312.kim@samsung.com, Kyungmin Park Subject: Re: [PATCH/RFC v4 10/12] V4L: Add auto focus targets to the selections API References: <1336156337-10935-1-git-send-email-s.nawrocki@samsung.com> <1336156337-10935-11-git-send-email-s.nawrocki@samsung.com> In-Reply-To: <1336156337-10935-11-git-send-email-s.nawrocki@samsung.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-media-owner@vger.kernel.org List-ID: Hi Sylwester, Thanks for the patch. Sylwester Nawrocki wrote: > The camera automatic focus algorithms may require setting up > a spot or rectangle coordinates or multiple such parameters. > > The automatic focus selection targets are introduced in order > to allow applications to query and set such coordinates. Those > selections are intended to be used together with the automatic > focus controls available in the camera control class. Have you thought about multiple autofocus windows, and how could they be implemented on top of this patch? I'm not saying that we should implement them now, but at least we should think how we _would_ implement them when needed. They aren't that exotic functionality these days after all. I'd guess this would involve an additional bitmask control and defining a set of new targets. A comment in the source might help here --- perhaps a good rule is to start new ranges at 0x1000 as you're doing already. > Signed-off-by: Sylwester Nawrocki > Signed-off-by: Kyungmin Park > --- > Documentation/DocBook/media/v4l/selection-api.xml | 33 +++++++++++++++++++- > .../DocBook/media/v4l/vidioc-g-selection.xml | 11 +++++++ > include/linux/videodev2.h | 5 +++ > 3 files changed, 48 insertions(+), 1 deletion(-) > > diff --git a/Documentation/DocBook/media/v4l/selection-api.xml b/Documentation/DocBook/media/v4l/selection-api.xml > index b299e47..490d29a 100644 > --- a/Documentation/DocBook/media/v4l/selection-api.xml > +++ b/Documentation/DocBook/media/v4l/selection-api.xml > @@ -1,6 +1,6 @@ >
> > - Experimental API for cropping, composing and scaling > + Experimental selections API > > > Experimental > @@ -9,6 +9,10 @@ > interface and may change in the future. > > > +
> + > + Image cropping, composing and scaling > + >
> Introduction > > @@ -321,5 +325,32 @@ V4L2_BUF_TYPE_VIDEO_OUTPUT for other devices > > >
> +
> + > +
> + Automatic focus regions of interest > + > + The camera automatic focus algorithms may require configuration of > +regions of interest in form of rectangle or spot coordinates. The automatic > +focus selection targets allow applications to query and set such coordinates. > +Those selections are intended to be used together with the > +V4L2_CID_AUTO_FOCUS_AREA > +camera class control. The V4L2_SEL_TGT_AUTO_FOCUS_ACTUAL > + target is used for querying or setting actual spot or rectangle > +coordinates, while V4L2_SEL_TGT_AUTO_FOCUS_BOUNDS target > +determines bounds for a single spot or rectangle. > +These selections are only effective when the V4L2_CID_AUTO_FOCUS_AREA > +control is set to V4L2_AUTO_FOCUS_AREA_SPOT or > +V4L2_AUTO_FOCUS_AREA_RECTANGLE. The new coordinates shall > +be accepted and applied to hardware when the focus area control value is > +changed and also during a &VIDIOC-S-SELECTION; ioctl call, only when the focus > +area control is already set to required value. > + > + For the V4L2_AUTO_FOCUS_AREA_SPOT case, the selection > +rectangle width and height > +are not used, i.e. shall be set to 0 by applications and ignored by drivers for > +the &VIDIOC-S-SELECTION; ioctl and shall be ignored by applications for the > +&VIDIOC-G-SELECTION; ioctl. > +
> >
> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-selection.xml b/Documentation/DocBook/media/v4l/vidioc-g-selection.xml > index bb04eff..87df4da 100644 > --- a/Documentation/DocBook/media/v4l/vidioc-g-selection.xml > +++ b/Documentation/DocBook/media/v4l/vidioc-g-selection.xml > @@ -195,6 +195,17 @@ exist no rectangle that satisfies the constraints. > 0x0103 > The active area and all padding pixels that are inserted or modified by hardware. > > + > + V4L2_SEL_TGT_AUTO_FOCUS_ACTUAL > + 0x1000 > + Actual automatic focus rectangle or spot coordinates. > + > + > + V4L2_SEL_TGT_AUTO_FOCUS_BOUNDS > + 0x1002 This should be 0x1001, I believe. > + Bounds of the automatic focus region of interest. > + > + > > > > diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h > index c1fae94..6bfd6c5 100644 > --- a/include/linux/videodev2.h > +++ b/include/linux/videodev2.h > @@ -777,6 +777,11 @@ struct v4l2_crop { > /* Current composing area plus all padding pixels */ > #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 > > +/* Auto focus region of interest */ > +#define V4L2_SEL_TGT_AUTO_FOCUS_ACTUAL 0x1000 > +/* Auto focus region (spot coordinates) bounds */ > +#define V4L2_SEL_TGT_AUTO_FOCUS_BOUNDS 0x1001 > + > /** > * struct v4l2_selection - selection info > * @type: buffer type (do not use *_MPLANE types) Cheers, -- Sakari Ailus sakari.ailus@iki.fi