All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v7 1/2] uvcvideo: send a control event when a Control Change interrupt arrives
Date: Mon, 07 May 2018 18:20:01 +0300	[thread overview]
Message-ID: <2106593.OlhQZDqy0L@avalon> (raw)
In-Reply-To: <alpine.DEB.2.20.1805071708130.6924@axis700.grange>

Hi Guennadi,

On Monday, 7 May 2018 18:12:14 EEST Guennadi Liakhovetski wrote:
> On Mon, 7 May 2018, Laurent Pinchart wrote:
> > On Tuesday, 10 April 2018 14:31:35 EEST Guennadi Liakhovetski wrote:
> >> On Fri, 23 Mar 2018, Laurent Pinchart wrote:
> >>> On Friday, 23 March 2018 11:24:00 EET Laurent Pinchart wrote:
> >>>> From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> >>>> 
> >>>> UVC defines a method of handling asynchronous controls, which sends a
> >>>> USB packet over the interrupt pipe. This patch implements support for
> >>>> such packets by sending a control event to the user. Since this can
> >>>> involve USB traffic and, therefore, scheduling, this has to be done
> >>>> in a work queue.
> >>>> 
> >>>> Signed-off-by: Guennadi Liakhovetski
> >>>> <guennadi.liakhovetski@intel.com>
> >>>> ---
> >>>> 
> >>>>  drivers/media/usb/uvc/uvc_ctrl.c   | 166 +++++++++++++++++++++++++---
> >>>>  drivers/media/usb/uvc/uvc_status.c | 111 ++++++++++++++++++++++---
> >>>>  drivers/media/usb/uvc/uvc_v4l2.c   |   4 +-
> >>>>  drivers/media/usb/uvc/uvcvideo.h   |  15 +++-
> >>>>  include/uapi/linux/uvcvideo.h      |   2 +
> >>>>  5 files changed, 269 insertions(+), 29 deletions(-)
> >>>> 
> >>>> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c
> >>>> b/drivers/media/usb/uvc/uvc_ctrl.c index 4042cbdb721b..f4773c56438c
> >>>> 100644
> >>>> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> >>>> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> 
> [snip]
> 
> >>>> +void uvc_ctrl_status_event(struct uvc_video_chain *chain,
> >>>> +			   struct uvc_control *ctrl, u8 *data, size_t len)
> >>>> +{
> >>>> +	struct uvc_device *dev = chain->dev;
> >>>> +	struct uvc_ctrl_work *w = &dev->async_ctrl;
> >>>> +
> >>>> +	if (list_empty(&ctrl->info.mappings))
> >>>> +		return;
> >>>> +
> >>>> +	spin_lock(&w->lock);
> >>>> +	if (w->data)
> >>>> +		/* A previous event work hasn't run yet, we lose 1 event */
> >>>> +		kfree(w->data);
> >>> 
> >>> I really don't like losing events :/
> >> 
> >> Well, I'm not sure whether having no available status URBs isn't
> >> equivalent to losing events, but if you prefer that - no problem.
> >> 
> >>>> +	w->data = kmalloc(len, GFP_ATOMIC);
> >>> 
> >>> GFP_ATOMIC allocation isn't very nice either.
> >>> 
> >>> How about if we instead delayed resubmitting the status URB until the
> >>> event is fully processed by the work queue ? That way we wouldn't lose
> >>> events, we wouldn't need memory allocation in atomic context, and if
> >>> the work queue becomes a bottleneck we could even queue multiple
> >>> status URBs and easily add them to a list for processing by the work
> >>> queue.
> >> 
> >> You mean only for control status events? Can do, sure.
> > 
> > I mean the status endpoint URB in general, so this would affect both
> > control events and button events.
> 
> I don't think any of my UVC cameras have such a button, do you have any of
> those? I'd rather not change something, that I cannot test myself and
> cannot have tested. I could leave the button processing as is and only
> change the URB submission path for control change events?

I do have cameras with a button so I can test this. It should be OK not to 
touch the input event code, my point was that if you delay resubmission of the 
status URB in the control event code it will delay input events as well.

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2018-05-07 15:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23  9:23 [PATCH v7 0/2] uvcvideo: asynchronous controls Laurent Pinchart
2018-03-23  9:24 ` [PATCH v7 1/2] uvcvideo: send a control event when a Control Change interrupt arrives Laurent Pinchart
2018-03-23 10:08   ` Laurent Pinchart
2018-04-07  9:30     ` Guennadi Liakhovetski
2018-04-07 10:50       ` Laurent Pinchart
2018-04-10 11:31     ` Guennadi Liakhovetski
2018-04-26  9:28       ` Guennadi Liakhovetski
2018-05-07 14:55         ` Laurent Pinchart
2018-05-07 14:51       ` Laurent Pinchart
2018-05-07 15:12         ` Guennadi Liakhovetski
2018-05-07 15:20           ` Laurent Pinchart [this message]
2018-05-08 11:05         ` Guennadi Liakhovetski
2018-03-23  9:24 ` [PATCH v7 2/2] uvcvideo: handle control pipe protocol STALLs Laurent Pinchart
2018-04-07 11:20   ` Laurent Pinchart
2018-04-11 12:44     ` Guennadi Liakhovetski
2018-04-20 13:21       ` Guennadi Liakhovetski
2018-05-07 15:12       ` Laurent Pinchart

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=2106593.OlhQZDqy0L@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.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 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.