linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH 05/18] [media] media-controller: enable all interface links at init
Date: Thu, 10 Dec 2015 09:37:32 -0200	[thread overview]
Message-ID: <20151210093732.650344b5@recife.lan> (raw)
In-Reply-To: <29585066.DcXagjeG5R@avalon>

Em Mon, 23 Nov 2015 21:46:53 +0200
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:

> Hi Mauro,
> 
> Thank you for the patch.
> 
> On Sunday 06 September 2015 14:30:48 Mauro Carvalho Chehab wrote:
> > Interface links are normally enabled, meaning that the interfaces are
> > bound to the entities. So, any ioctl send to the interface are reflected
> 
> s/send/sent/
> 
> > at the entities managed by the interface.
> > 
> > However, when a device is usage, other interfaces for the same hardware
> 
> s/usage/in use/
> 
> > could be decoupled from the entities linked to them, because the
> > hardware may have some parts busy.
> > 
> > That's for example, what happens when an hybrid TV device is in usage.
> 
> s/usage/use/
> 
> > If it is streaming analog TV or capturing signals from S-Video/Composite
> > connectors, typically the digital part of the hardware can't be used and
> > vice-versa.
> > 
> > This is generally due to some internal hardware or firmware limitation,
> > that it is not easily mapped via data pipelines.
> > 
> > What the Kernel drivers do internally is that they decouple the hardware
> > from the interface. So, all changes, if allowed, are done only at some
> > interface cache, but not physically changed at the hardware.
> > 
> > The usage is similar to the usage of the MEDIA_LNK_FL_ENABLED on data
> > links. So, let's use the same flag to indicate if ether the interface
> 
> s/ether/either/
> 
> > to entity link is bound/enabled or not.
> 
> I believe we'll need to experiment with the interface links to see what's 
> really needed there. As a general rule I'd like to avoid exposing too much 
> information to userspace without a clear indication that the information is 
> actually needed, as it's always easier to expose additional information later 
> than to remove information already exposed.
> 
> For this reason I'd like to see as a first step how we would do in userspace 
> without making those links dynamic. If we then realize that we're lacking 
> information we'll decide on the best course of action and on exactly what to 
> expose and how to expose it, using concrete userspace use cases.

As discussed during MC workshop, the need of marking an interface link as
active or not is because, on complex devices like hybrid TV ones, typically
either the analog side of the digital side of the device is disabled.

So, for example, if an hybrid device is working in digital mode, any
change done via the V4L2 interfaces should not be applied to the hardware.
The interface should either cache such changes to be applied the next
time the device would switch to analog mode or return EBUSY.

In other words, the link between the interface and the hardware entities
are disabled.

This is needed internally at the MC representation of the hardware
(and one of the main reasons why we need MC on hybrid devices).

Applications also need such information, as, except for a couple
applications:
	- xawtv4, (with is not a popular one)
	- mythTV
All other open source applications I'm aware of are either digital only
or analog only and some radio applications even run as applets.

So, the user may have more than one application running at the same time,
being one active and the other would need to report that it cannot be
activated because the device is busy.

So, this change is actually needed.

Anyway, I'm splitting this patch in two parts: one for DVB and another
one for V4L, as I'm reordering some patches on the final rebase due
to some troubles detected with KASAN and DEBUG_KMEMLEAK, and splitting
it avoids merge conflicts.

> 
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > 
> > diff --git a/drivers/media/dvb-core/dvbdev.c
> > b/drivers/media/dvb-core/dvbdev.c index a8e7e2398f7a..5c4fb41060b4 100644
> > --- a/drivers/media/dvb-core/dvbdev.c
> > +++ b/drivers/media/dvb-core/dvbdev.c
> > @@ -396,7 +396,8 @@ static void dvb_register_media_device(struct dvb_device
> > *dvbdev, if (!dvbdev->entity || !dvbdev->intf_devnode)
> >  		return;
> > 
> > -	media_create_intf_link(dvbdev->entity, &dvbdev->intf_devnode->intf, 0);
> > +	media_create_intf_link(dvbdev->entity, &dvbdev->intf_devnode->intf,
> > +			       MEDIA_LNK_FL_ENABLED);
> > 
> >  #endif
> >  }
> > @@ -583,20 +584,24 @@ void dvb_create_media_graph(struct dvb_adapter *adap)
> >  	/* Create indirect interface links for FE->tuner, DVR->demux and CA->ca 
> */
> > media_device_for_each_intf(intf, mdev) {
> >  		if (intf->type == MEDIA_INTF_T_DVB_CA && ca)
> > -			media_create_intf_link(ca, intf, 0);
> > +			media_create_intf_link(ca, intf, MEDIA_LNK_FL_ENABLED);
> > 
> >  		if (intf->type == MEDIA_INTF_T_DVB_FE && tuner)
> > -			media_create_intf_link(tuner, intf, 0);
> > +			media_create_intf_link(tuner, intf,
> > +					       MEDIA_LNK_FL_ENABLED);
> > 
> >  		if (intf->type == MEDIA_INTF_T_DVB_DVR && demux)
> > -			media_create_intf_link(demux, intf, 0);
> > +			media_create_intf_link(demux, intf,
> > +					       MEDIA_LNK_FL_ENABLED);
> > 
> >  		media_device_for_each_entity(entity, mdev) {
> >  			if (entity->type == MEDIA_ENT_T_DVB_TSOUT) {
> >  				if (!strcmp(entity->name, DVR_TSOUT))
> > -					media_create_intf_link(entity, intf, 0);
> > +					media_create_intf_link(entity, intf,
> > +							       MEDIA_LNK_FL_ENABLED);
> >  				if (!strcmp(entity->name, DEMUX_TSOUT))
> > -					media_create_intf_link(entity, intf, 0);
> > +					media_create_intf_link(entity, intf,
> > +							       MEDIA_LNK_FL_ENABLED);
> >  				break;
> >  			}
> >  		}
> > diff --git a/drivers/media/v4l2-core/v4l2-dev.c
> > b/drivers/media/v4l2-core/v4l2-dev.c index 07123dd569c4..8429da66754a
> > 100644
> > --- a/drivers/media/v4l2-core/v4l2-dev.c
> > +++ b/drivers/media/v4l2-core/v4l2-dev.c
> > @@ -788,7 +788,8 @@ static int video_register_media_controller(struct
> > video_device *vdev, int type) struct media_link *link;
> > 
> >  		link = media_create_intf_link(&vdev->entity,
> > -					      &vdev->intf_devnode->intf, 0);
> > +					      &vdev->intf_devnode->intf,
> > +					      MEDIA_LNK_FL_ENABLED);
> >  		if (!link) {
> >  			media_devnode_remove(vdev->intf_devnode);
> >  			media_device_unregister_entity(&vdev->entity);
> > diff --git a/drivers/media/v4l2-core/v4l2-device.c
> > b/drivers/media/v4l2-core/v4l2-device.c index e788a085ba96..bb58d90fde5e
> > 100644
> > --- a/drivers/media/v4l2-core/v4l2-device.c
> > +++ b/drivers/media/v4l2-core/v4l2-device.c
> > @@ -256,7 +256,7 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device
> > *v4l2_dev)
> > 
> >  			link = media_create_intf_link(&sd->entity,
> >  						      &vdev->intf_devnode->intf,
> > -						      0);
> > +						      MEDIA_LNK_FL_ENABLED);
> >  			if (!link)
> >  				goto clean_up;
> >  		}
> 

  reply	other threads:[~2015-12-10 11:37 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-06 17:30 [PATCH 00/18] MC fixes, improvements and cleanups Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 01/18] [media] tuner-core: add an input pad Mauro Carvalho Chehab
2015-09-11 14:48   ` Hans Verkuil
2015-11-23 20:01   ` Laurent Pinchart
2015-11-24 11:00     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 02/18] [media] au0828: add support for the connectors Mauro Carvalho Chehab
2015-09-11 14:57   ` Hans Verkuil
2015-12-10 18:24     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 03/18] [media] au0828: Create connector links Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 04/18] [media] media-device: supress backlinks at G_TOPOLOGY ioctl Mauro Carvalho Chehab
2015-09-11 14:58   ` Hans Verkuil
2015-11-23 19:56   ` Laurent Pinchart
2015-11-24 10:57     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 05/18] [media] media-controller: enable all interface links at init Mauro Carvalho Chehab
2015-09-11 15:18   ` Hans Verkuil
2015-11-23 19:46   ` Laurent Pinchart
2015-12-10 11:37     ` Mauro Carvalho Chehab [this message]
2015-09-06 17:30 ` [PATCH 06/18] [media] media.h: create connector entities for hybrid TV devices Mauro Carvalho Chehab
2015-09-11 15:19   ` Hans Verkuil
2015-11-23 18:09   ` Laurent Pinchart
2015-12-10 18:43     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 07/18] [media] dvbdev: returns error if graph object creation fails Mauro Carvalho Chehab
2015-09-11 15:20   ` Hans Verkuil
2015-12-10 17:33     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 08/18] [media] dvb core: must check dvb_create_media_graph() Mauro Carvalho Chehab
2015-09-11 15:22   ` Hans Verkuil
2015-09-06 17:30 ` [PATCH 09/18] [media] media-entity: enforce check of interface and links creation Mauro Carvalho Chehab
2015-09-11 15:23   ` Hans Verkuil
2015-09-06 17:30 ` [PATCH 10/18] [media] cx231xx: enforce check for graph creation Mauro Carvalho Chehab
2015-09-11 15:23   ` Hans Verkuil
2015-09-06 17:30 ` [PATCH 11/18] [media] au0828:: " Mauro Carvalho Chehab
2015-09-11 15:23   ` Hans Verkuil
2015-09-06 17:30 ` [PATCH 12/18] [media] media-entity: must check media_create_pad_link() Mauro Carvalho Chehab
2015-09-11 15:24   ` Hans Verkuil
2015-11-23 17:54   ` Laurent Pinchart
2015-12-10 19:13     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 13/18] [media] media-entity.h: rename entity.type to entity.function Mauro Carvalho Chehab
2015-09-11 15:25   ` Hans Verkuil
2015-11-23 17:51   ` Laurent Pinchart
2015-11-24 10:32     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 14/18] [media] media-device: export the entity function via new ioctl Mauro Carvalho Chehab
2015-09-11 15:26   ` Hans Verkuil
2015-11-23 17:46   ` Laurent Pinchart
2015-11-24 10:27     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 15/18] [media] uapi/media.h: Rename entities types to functions Mauro Carvalho Chehab
2015-09-11 15:36   ` Hans Verkuil
2015-12-10 19:54     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 16/18] [media] DocBook: update entities documentation Mauro Carvalho Chehab
2015-09-06 17:31 ` [PATCH 17/18] [media] dvbdev: move indirect links on dvr/demux to a separate function Mauro Carvalho Chehab
2015-09-11 15:38   ` Hans Verkuil
2015-09-06 17:31 ` [PATCH 18/18] [media] dvbdev: Don't create indirect links Mauro Carvalho Chehab
2015-09-11 15:48   ` Hans Verkuil
2015-12-10 20:20     ` Mauro Carvalho Chehab

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=20151210093732.650344b5@recife.lan \
    --to=mchehab@osg.samsung.com \
    --cc=hans.verkuil@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /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).