linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Tomasz Figa <tfiga@chromium.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCHv2 2/3] media: uvcvideo: add ROI auto controls
Date: Wed, 17 Mar 2021 18:18:11 +0900	[thread overview]
Message-ID: <YFHJUyNA53J72bVA@google.com> (raw)
In-Reply-To: <20210208051749.1785246-3-sergey.senozhatsky@gmail.com>

On (21/02/08 14:17), Sergey Senozhatsky wrote:
> This patch adds support for Region of Interest bmAutoControls.
> 
> ROI control is a compound data type:
>   Control Selector     CT_REGION_OF_INTEREST_CONTROL
>   Mandatory Requests   SET_CUR, GET_CUR, GET_MIN, GET_MAX, GET_DEF
>   wLength 10
>   Offset   Field            Size
>   0        wROI_Top         2
>   2        wROI_Left        2
>   4        wROI_Bottom      2
>   6        wROI_Right       2
>   8        bmAutoControls   2       (Bitmap)
> 
> uvc_control_mapping, however, can handle only s32 data type at the
> moment: ->get() returns s32 value, ->set() accepts s32 value; while
> v4l2_ctrl maximum/minimum/default_value can hold only s64 values.
> 
> Hence ROI control handling is split into two patches:
> a) bmAutoControls is handled via uvc_control_mapping as V4L2_CTRL_TYPE_MENU
> b) ROI rectangle (SET_CUR, GET_CUR, GET_DEF) handling is implemented
>    separately, by the means of selection API.

This approach is "no go".

I just figured out (am still debugging tho) that this patch set works on
some devices and doesn't work on other. The root cause seems to be the
fact that some firmwares error out all ROI requests when sizeof() of the
ROI data is not 5 * __u16.

So those devices are not happy if we set/get ROI rectangle 4 * __u16
and auto-controls __u16 separately; they want to set/get rect and
rectanles in one shot.

This fixes ROI on those devices.

---

+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -1190,6 +1190,7 @@ struct uvc_roi_rect {
        __u16                   left;
        __u16                   bottom;
        __u16                   right;
+       __u16                   auto_controls;
 };

---

Back to base 1.

  parent reply	other threads:[~2021-03-17  9:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08  5:17 [PATCHv2 0/3] Add UVC 1.5 Region Of Interest control to uvcvideo Sergey Senozhatsky
2021-02-08  5:17 ` [PATCHv2 1/3] media: v4l UAPI docs: document ROI selection targets Sergey Senozhatsky
2021-03-16 18:19   ` Ricardo Ribalda Delgado
2021-03-17  1:31     ` Sergey Senozhatsky
2021-03-17  8:04       ` Ricardo Ribalda Delgado
2021-03-17  8:08         ` Sergey Senozhatsky
2021-02-08  5:17 ` [PATCHv2 2/3] media: uvcvideo: add ROI auto controls Sergey Senozhatsky
2021-03-16 18:29   ` Ricardo Ribalda Delgado
2021-03-17  1:34     ` Sergey Senozhatsky
2021-03-17  8:08       ` Ricardo Ribalda Delgado
2021-03-17  8:12         ` Sergey Senozhatsky
2021-03-17  9:18   ` Sergey Senozhatsky [this message]
2021-03-17  9:27     ` Sergey Senozhatsky
2021-02-08  5:17 ` [PATCHv2 3/3] media: uvcvideo: add UVC 1.5 ROI control Sergey Senozhatsky
2021-03-16 18:46   ` Ricardo Ribalda Delgado
2021-03-17  1:59     ` Sergey Senozhatsky
2021-03-17  7:58       ` Ricardo Ribalda Delgado
2021-03-18  4:47         ` Sergey Senozhatsky
2021-03-18 21:19           ` Ricardo Ribalda
2021-03-18 21:20             ` Ricardo Ribalda
2021-03-19  5:35             ` Sergey Senozhatsky
2021-03-19 16:40               ` Ricardo Ribalda
2021-03-16  5:25 ` [PATCHv2 0/3] Add UVC 1.5 Region Of Interest control to uvcvideo Sergey Senozhatsky

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=YFHJUyNA53J72bVA@google.com \
    --to=senozhatsky@chromium.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tfiga@chromium.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).