diff mbox series

[PATCHv3,3/6] media: v4l UAPI: add ROI auto-controls flags

Message ID 20210319055342.127308-4-senozhatsky@chromium.org
State New
Headers show
Series media: uvcvideo: implement UVC 1.5 ROI | expand

Commit Message

Sergey Senozhatsky March 19, 2021, 5:53 a.m. UTC
UVC 1.5 defines the following Region Of Interest auto controls:

D0: Auto Exposure
D1: Auto Iris
D2: Auto White Balance
D3: Auto Focus
D4: Auto Face Detect
D5: Auto Detect and Track
D6: Image Stabilization
D7: Higher Quality
D8 – D15: Reserved, set to zero

Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
 include/uapi/linux/v4l2-common.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Ricardo Ribalda March 23, 2021, 4:04 p.m. UTC | #1
Hi Sergey

On Fri, Mar 19, 2021 at 6:53 AM Sergey Senozhatsky
<senozhatsky@chromium.org> wrote:
>

> UVC 1.5 defines the following Region Of Interest auto controls:

>

> D0: Auto Exposure

> D1: Auto Iris

> D2: Auto White Balance

> D3: Auto Focus

> D4: Auto Face Detect

> D5: Auto Detect and Track

> D6: Image Stabilization

> D7: Higher Quality

> D8 – D15: Reserved, set to zero

>

> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>

> ---

>  include/uapi/linux/v4l2-common.h | 10 ++++++++++

>  1 file changed, 10 insertions(+)

>

> diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h

> index 3651ebb8cb23..34f1c262d6aa 100644

> --- a/include/uapi/linux/v4l2-common.h

> +++ b/include/uapi/linux/v4l2-common.h

> @@ -92,6 +92,16 @@

>  #define V4L2_SEL_FLAG_LE               (1 << 1)

>  #define V4L2_SEL_FLAG_KEEP_CONFIG      (1 << 2)

>


Are you sure that you do not want to start with 1<<3, there might be
some hardware that support LE/SE
> +/* ROI auto-controls flags */

> +#define V4L2_SEL_FLAG_ROI_AUTO_EXPOSURE                (1 << 0)

> +#define V4L2_SEL_FLAG_ROI_AUTO_IRIS                    (1 << 1)

> +#define V4L2_SEL_FLAG_ROI_AUTO_WHITE_BALANCE           (1 << 2)

> +#define V4L2_SEL_FLAG_ROI_AUTO_FOCUS                   (1 << 3)

> +#define V4L2_SEL_FLAG_ROI_AUTO_FACE_DETECT             (1 << 4)

> +#define V4L2_SEL_FLAG_ROI_AUTO_DETECT_AND_TRACK        (1 << 5)

> +#define V4L2_SEL_FLAG_ROI_AUTO_IMAGE_STABILIXATION     (1 << 6)

> +#define V4L2_SEL_FLAG_ROI_AUTO_HIGHER_QUALITY          (1 << 7)

> +

>  struct v4l2_edid {

>         __u32 pad;

>         __u32 start_block;

> --

> 2.31.0.rc2.261.g7f71774620-goog

>



-- 
Ricardo Ribalda
Sergey Senozhatsky March 24, 2021, 2:22 a.m. UTC | #2
On (21/03/23 17:04), Ricardo Ribalda wrote:
> On Fri, Mar 19, 2021 at 6:53 AM Sergey Senozhatsky

> <senozhatsky@chromium.org> wrote:

> >

> > UVC 1.5 defines the following Region Of Interest auto controls:

> >

> > D0: Auto Exposure

> > D1: Auto Iris

> > D2: Auto White Balance

> > D3: Auto Focus

> > D4: Auto Face Detect

> > D5: Auto Detect and Track

> > D6: Image Stabilization

> > D7: Higher Quality

> > D8 – D15: Reserved, set to zero

> >

> > Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>

> > ---

> >  include/uapi/linux/v4l2-common.h | 10 ++++++++++

> >  1 file changed, 10 insertions(+)

> >

> > diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h

> > index 3651ebb8cb23..34f1c262d6aa 100644

> > --- a/include/uapi/linux/v4l2-common.h

> > +++ b/include/uapi/linux/v4l2-common.h

> > @@ -92,6 +92,16 @@

> >  #define V4L2_SEL_FLAG_LE               (1 << 1)

> >  #define V4L2_SEL_FLAG_KEEP_CONFIG      (1 << 2)

> >

> 

> Are you sure that you do not want to start with 1<<3, there might be

> some hardware that support LE/SE


How the hardware's going to support this? There is simply no way to
pass these flags to the firmware, the values already overlap with
auto-controls. So I guess these flags are for the driver (C code).
uvcvideo driver is not doing any "lesser or equal rectangle" magic
for ROI. No such thing is defined by UVC spec.

I can move these flags to entirely different value range and do
remapping to uvc auto-controls values in uvcvideo.
Ricardo Ribalda March 24, 2021, 7:28 a.m. UTC | #3
HI Sergey

On Wed, Mar 24, 2021 at 3:22 AM Sergey Senozhatsky
<senozhatsky@chromium.org> wrote:
>

> On (21/03/23 17:04), Ricardo Ribalda wrote:

> > On Fri, Mar 19, 2021 at 6:53 AM Sergey Senozhatsky

> > <senozhatsky@chromium.org> wrote:

> > >

> > > UVC 1.5 defines the following Region Of Interest auto controls:

> > >

> > > D0: Auto Exposure

> > > D1: Auto Iris

> > > D2: Auto White Balance

> > > D3: Auto Focus

> > > D4: Auto Face Detect

> > > D5: Auto Detect and Track

> > > D6: Image Stabilization

> > > D7: Higher Quality

> > > D8 – D15: Reserved, set to zero

> > >

> > > Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>

> > > ---

> > >  include/uapi/linux/v4l2-common.h | 10 ++++++++++

> > >  1 file changed, 10 insertions(+)

> > >

> > > diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h

> > > index 3651ebb8cb23..34f1c262d6aa 100644

> > > --- a/include/uapi/linux/v4l2-common.h

> > > +++ b/include/uapi/linux/v4l2-common.h

> > > @@ -92,6 +92,16 @@

> > >  #define V4L2_SEL_FLAG_LE               (1 << 1)

> > >  #define V4L2_SEL_FLAG_KEEP_CONFIG      (1 << 2)

> > >

> >

> > Are you sure that you do not want to start with 1<<3, there might be

> > some hardware that support LE/SE

>

> How the hardware's going to support this? There is simply no way to

> pass these flags to the firmware, the values already overlap with

> auto-controls. So I guess these flags are for the driver (C code).

> uvcvideo driver is not doing any "lesser or equal rectangle" magic

> for ROI. No such thing is defined by UVC spec.


The driver can implement se/le.

>

> I can move these flags to entirely different value range and do

> remapping to uvc auto-controls values in uvcvideo.

I think that is more correct in this case. Yes it is annoying, but if
more devices support this....



-- 
Ricardo Ribalda
Sergey Senozhatsky March 24, 2021, 7:35 a.m. UTC | #4
On (21/03/24 08:28), Ricardo Ribalda wrote:
[..]
> > >

> > > Are you sure that you do not want to start with 1<<3, there might be

> > > some hardware that support LE/SE

> >

> > How the hardware's going to support this? There is simply no way to

> > pass these flags to the firmware, the values already overlap with

> > auto-controls. So I guess these flags are for the driver (C code).

> > uvcvideo driver is not doing any "lesser or equal rectangle" magic

> > for ROI. No such thing is defined by UVC spec.

> 

> The driver can implement se/le.


Right. I wonder if we can actually fit ROI into selection API.
v4l2 selection is focusing on rectangle, that's the only thing
that matters, but in ROI rectangle and autocontrols are equally
important.
diff mbox series

Patch

diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h
index 3651ebb8cb23..34f1c262d6aa 100644
--- a/include/uapi/linux/v4l2-common.h
+++ b/include/uapi/linux/v4l2-common.h
@@ -92,6 +92,16 @@ 
 #define V4L2_SEL_FLAG_LE		(1 << 1)
 #define V4L2_SEL_FLAG_KEEP_CONFIG	(1 << 2)
 
+/* ROI auto-controls flags */
+#define V4L2_SEL_FLAG_ROI_AUTO_EXPOSURE		(1 << 0)
+#define V4L2_SEL_FLAG_ROI_AUTO_IRIS			(1 << 1)
+#define V4L2_SEL_FLAG_ROI_AUTO_WHITE_BALANCE		(1 << 2)
+#define V4L2_SEL_FLAG_ROI_AUTO_FOCUS			(1 << 3)
+#define V4L2_SEL_FLAG_ROI_AUTO_FACE_DETECT		(1 << 4)
+#define V4L2_SEL_FLAG_ROI_AUTO_DETECT_AND_TRACK	(1 << 5)
+#define V4L2_SEL_FLAG_ROI_AUTO_IMAGE_STABILIXATION	(1 << 6)
+#define V4L2_SEL_FLAG_ROI_AUTO_HIGHER_QUALITY		(1 << 7)
+
 struct v4l2_edid {
 	__u32 pad;
 	__u32 start_block;