All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	Helen Koike <helen.koike@collabora.co.uk>,
	Helen Koike <helen.koike@collabora.com>,
	linux-media@vger.kernel.org, jgebben@codeaurora.org,
	Helen Fornazier <helen.fornazier@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH v7] [media] vimc: Virtual Media Controller core, capture and sensor
Date: Tue, 28 Mar 2017 12:25:50 -0300	[thread overview]
Message-ID: <20170328122550.265108fb@vento.lan> (raw)
In-Reply-To: <20170328142339.GD16657@valkosipuli.retiisi.org.uk>

Em Tue, 28 Mar 2017 17:23:40 +0300
Sakari Ailus <sakari.ailus@iki.fi> escreveu:

> Hi Hans,
> 
> On Tue, Mar 28, 2017 at 12:00:36PM +0200, Hans Verkuil wrote:
> > On 27/03/17 20:09, Mauro Carvalho Chehab wrote:  
> > > Em Mon, 27 Mar 2017 12:19:51 -0300
> > > Helen Koike <helen.koike@collabora.co.uk> escreveu:
> > >   
> > >> Hi Sakari,
> > >>
> > >> On 2017-03-26 10:31 AM, Sakari Ailus wrote:  
> > >>> Hi Helen,
> > >>>
> > >>> ...    
> > >>>> +static int vimc_cap_enum_input(struct file *file, void *priv,
> > >>>> +			       struct v4l2_input *i)
> > >>>> +{
> > >>>> +	/* We only have one input */
> > >>>> +	if (i->index > 0)
> > >>>> +		return -EINVAL;
> > >>>> +
> > >>>> +	i->type = V4L2_INPUT_TYPE_CAMERA;
> > >>>> +	strlcpy(i->name, "VIMC capture", sizeof(i->name));
> > >>>> +
> > >>>> +	return 0;
> > >>>> +}
> > >>>> +
> > >>>> +static int vimc_cap_g_input(struct file *file, void *priv, unsigned int *i)
> > >>>> +{
> > >>>> +	/* We only have one input */
> > >>>> +	*i = 0;
> > >>>> +	return 0;
> > >>>> +}
> > >>>> +
> > >>>> +static int vimc_cap_s_input(struct file *file, void *priv, unsigned int i)
> > >>>> +{
> > >>>> +	/* We only have one input */
> > >>>> +	return i ? -EINVAL : 0;
> > >>>> +}    
> > >>>
> > >>> You can drop the input IOCTLs altogether here. If you had e.g. a TV
> > >>> tuner, it'd be the TV tuner driver's responsibility to implement them.
> > >>>    
> > >>
> > >> input IOCTLs seems to be mandatory from v4l2-compliance when capability 
> > >> V4L2_CAP_VIDEO_CAPTURE is set (which is the case):
> > >>
> > >> https://git.linuxtv.org/v4l-utils.git/tree/utils/v4l2-compliance/v4l2-test-input-output.cpp#n418
> > >>
> > >> https://git.linuxtv.org/v4l-utils.git/tree/utils/v4l2-compliance/v4l2-compliance.cpp#n989  
> > > 
> > > The V4L2 spec doesn't actually define what's mandatory and what's
> > > optional. The idea that was agreed on one of the media summits
> > > were to define a set of profiles for different device types,
> > > matching the features required by existing applications to work,
> > > but this was never materialized.
> > > 
> > > So, my understanding is that any driver can implement
> > > any V4L2 ioctl.
> > > 
> > > Yet, some applications require enum/get/set inputs, or otherwise
> > > they wouldn't work. It is too late to change this behavior. 
> > > So, either the driver or the core should implement those
> > > ioctls, in order to avoid breaking backward-compatibility.  
> > 
> > The closest we have to determining which ioctls are mandatory or not is
> > v4l2-compliance. That said, v4l2-compliance is actually a bit more strict
> > in some cases than the spec since some ioctls are optional in the spec, but
> > required in v4l2-compliance for the simple reason that there is no reason
> > for drivers NOT to implement those ioctls.
> > 
> > However, the v4l2-compliance test was never written for MC devices. It turns
> > out that it works reasonably well as long as a working pipeline is configured
> > first, but these input ioctls are a bit iffy.
> > 
> > There are really two options: don't implement them, or implement it as a single
> > input. Multiple inputs make no sense for MC devices: the video node is the
> > endpoint of a video pipeline, you never switch 'inputs' there.
> > 
> > The way the input ioctls are implemented here would fit nicely for an MC
> > device IMHO.
> > 
> > So should we define these ioctls or not?
> > 
> > I am inclined to define them for the following reasons:
> > 
> > - Some applications expect them, so adding them to the driver costs little but
> >   allows these applications to work, provided the correct pipeline is configured
> >   first.
> > 
> > - If a plugin is needed, then that plugin can always override these ioctls and
> >   for different 'inputs' reconfigure the pipeline.
> > 
> > I really don't see implementing this as a problem. Reporting that an MC video node
> > has a "VIMC capture" input seems perfectly reasonable to me.  
> 
> If we implement it in order to be make an application happy, I would have
> expected to hear complaints from someone using existing MC based drivers
> that do not implement the input IOCTLs.

If we implement a default method in the core, all MC-based drivers
will have it, without requiring driver changes.

> It is also confusing from application point of view since this interface
> would not be the interface to configure the input of the pipeline as it
> might look like.

It is not confusing. A MC-aware sub-dev oriented application will do
the right thing, as such apps are designed to work with some special
hardware.

The (very few) of non-MC app that doesn't fail if without those ioctl
will keep running.

The only difference on implementing it is that other non-MC
applications will start to run if the driver passes on v4l2-compliance
tests.

So, I don't see any troubles on doing that. Just benefits. 



Thanks,
Mauro

  reply	other threads:[~2017-03-28 15:26 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 15:02 [PATCH v4] [media] vimc: Virtual Media Controller core, capture and sensor Helen Koike
2016-06-12  1:59 ` kbuild test robot
2016-06-12  2:11 ` kbuild test robot
2016-07-01 12:39 ` Hans Verkuil
2016-08-17 22:08   ` Helen Koike
2016-08-17 22:09   ` [PATCH v5] " Helen Koike
2016-08-22 10:57     ` Hans Verkuil
2016-09-04 20:02       ` [PATCH v6] " Helen Koike
2016-09-06  7:33         ` Hans Verkuil
2016-09-12 12:53           ` [PATCH] [media] MAINTAINERS: add vimc entry Helen Koike
2017-01-10 19:54         ` [PATCH v6] [media] vimc: Virtual Media Controller core, capture and sensor Laurent Pinchart
2017-01-11  1:30           ` Helen Koike
2017-03-10 13:08             ` Hans Verkuil
2017-03-10 13:42               ` Helen Koike
2017-03-25 17:11                 ` [PATCH v7] " Helen Koike
2017-03-25 23:04                   ` Helen Koike
2017-03-26 13:31                   ` Sakari Ailus
2017-03-27 15:19                     ` Helen Koike
2017-03-27 18:09                       ` Mauro Carvalho Chehab
2017-03-28 10:00                         ` Hans Verkuil
2017-03-28 11:38                           ` Mauro Carvalho Chehab
2017-03-28 20:37                             ` Sakari Ailus
2017-03-29  7:49                               ` Hans Verkuil
2017-03-29  8:46                                 ` Sakari Ailus
     [not found]                               ` <CAKQmDh9QoW7qnai=i68HBBbkLBa+Ni5K7WKeYDLONjYeyhHH0A@mail.gmail.com>
2017-03-29  8:02                                 ` Hans Verkuil
2017-03-28 14:23                           ` Sakari Ailus
2017-03-28 15:25                             ` Mauro Carvalho Chehab [this message]
2017-03-28 20:39                               ` Sakari Ailus
2017-03-29  7:39                             ` Hans Verkuil
2017-03-27  9:00                   ` Hans Verkuil
2017-03-27 13:33                     ` [PATCH v8] " Helen Koike
2017-04-03 22:16                       ` [PATCH v9] " Helen Koike
2017-04-06 14:29                         ` Helen Koike
2017-04-07  9:54                         ` Hans Verkuil
2017-04-07 17:55                           ` [PATCH v10] " Helen Koike
2017-01-25 13:03         ` [PATCH v6] " Sakari Ailus
2017-01-25 15:31           ` Mauro Carvalho Chehab
2017-03-24 22:11           ` Helen Koike
2017-03-26 13:25             ` Sakari Ailus
2016-09-04 20:05       ` [PATCH v5] " Helen Koike
2016-09-05  9:01         ` Hans Verkuil

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=20170328122550.265108fb@vento.lan \
    --to=mchehab@s-opensource.com \
    --cc=helen.fornazier@gmail.com \
    --cc=helen.koike@collabora.co.uk \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jgebben@codeaurora.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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.