18 Aug, 2013

1 commit

  • The graph traversal API (media_entity_graph_walk_*) doesn't support
    cyclic graphs and will fail to correctly walk a graph when circular
    links exist. Support circular graph traversal by checking whether an
    entity has already been visited before pushing it to the stack.

    Signed-off-by: Laurent Pinchart
    Acked-by: Sakari Ailus
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     

19 Jun, 2013

1 commit

  • This function allows to remove all media entity's links to other
    entities, leaving no references to a media entity's links array
    at its remote entities.
    Currently, when a driver of some entity is removed it will free its
    media entities links[] array, leaving dangling pointers at other
    entities that are part of same media graph. This is troublesome when
    drivers of a media device entities are in separate kernel modules,
    removing only some modules will leave others in an incorrect state.
    This function is intended to be used when an entity is being
    unregistered from a media device.
    With an assumption that normally the media links should be created
    between media entities registered to a media device, with the graph
    mutex held.

    Signed-off-by: Sylwester Nawrocki
    Reviewed-by: Andrzej Hajda
    Signed-off-by: Kyungmin Park
    Acked-by: Laurent Pinchart
    Acked-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Sylwester Nawrocki
     

13 Jun, 2013

1 commit

  • Currently the media device link_notify callback is invoked before the
    actual change of state of a link when the link is being enabled, and
    after the actual change of state when the link is being disabled.
    This doesn't allow a media device driver to perform any operations
    on a full graph before a link is disabled, as well as performing
    any tasks on a modified graph right after a link's state is changed.
    This patch modifies signature of the link_notify callback. This
    callback is now called always before and after a link's state change.
    To distinguish the notifications a 'notification' argument is added
    to the link_notify callback: MEDIA_DEV_NOTIFY_PRE_LINK_CH indicates
    notification before link's state change and
    MEDIA_DEV_NOTIFY_POST_LINK_CH corresponds to a notification after
    link flags change.

    [mchehab@redhat.com: whitespace cleanups]
    Signed-off-by: Sylwester Nawrocki
    Signed-off-by: Kyungmin Park
    Acked-by: Laurent Pinchart
    Acked-by: Sakari Ailus

    Signed-off-by: Mauro Carvalho Chehab

    Sylwester Nawrocki
     

09 Jun, 2013

1 commit


14 May, 2012

1 commit

  • The purpose of the link_validate() op is to allow an entity driver to ensure
    that the properties of the pads at the both ends of the link are suitable
    for starting the pipeline. link_validate is called on sink pads on active
    links which belong to the active part of the graph.

    Signed-off-by: Sakari Ailus
    Acked-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     

17 Apr, 2011

1 commit


22 Mar, 2011

5 commits

  • Drivers often need to associate pipeline objects to entities, and to
    take stream state into account when configuring entities and links. The
    pipeline API helps drivers manage that information.

    When starting streaming, drivers call media_entity_pipeline_start(). The
    function marks all entities connected to the given entity through
    enabled links, either directly or indirectly, as streaming. Similarly,
    when stopping the stream, drivers call media_entity_pipeline_stop().

    The media_entity_pipeline_start() function takes a pointer to a media
    pipeline and stores it in every entity in the graph. Drivers should
    embed the media_pipeline structure in higher-level pipeline structures
    and can then access the pipeline through the media_entity structure.

    Link configuration will fail with -EBUSY by default if either end of the
    link is a streaming entity, unless the link is marked with the
    MEDIA_LNK_FL_DYNAMIC flag.

    Signed-off-by: Laurent Pinchart
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     
  • Create the following ioctl and implement it at the media device level to
    setup links.

    - MEDIA_IOC_SETUP_LINK: Modify the properties of a given link

    The only property that can currently be modified is the ENABLED link
    flag to enable/disable a link. Links marked with the IMMUTABLE link flag
    can not be enabled or disabled.

    Enabling or disabling a link has effects on entities' use count. Those
    changes are automatically propagated through the graph.

    Signed-off-by: Laurent Pinchart
    Signed-off-by: Stanimir Varbanov
    Signed-off-by: Sakari Ailus
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     
  • Due to the wide differences between drivers regarding power management
    needs, the media controller does not implement power management.
    However, the media_entity structure includes a use_count field that
    media drivers can use to track the number of users of every entity for
    power management needs.

    The use_count field is owned by media drivers and must not be touched by
    entity drivers. Access to the field must be protected by the media
    device graph_mutex lock.

    Signed-off-by: Laurent Pinchart
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     
  • Add media entity graph traversal. The traversal follows enabled links by
    depth first. Traversing graph backwards is prevented by comparing the next
    possible entity in the graph with the previous one. Multiply connected
    graphs are thus not supported.

    Signed-off-by: Sakari Ailus
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Vimarsh Zutshi
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Sakari Ailus
     
  • As video hardware pipelines become increasingly complex and
    configurable, the current hardware description through v4l2 subdevices
    reaches its limits. In addition to enumerating and configuring
    subdevices, video camera drivers need a way to discover and modify at
    runtime how those subdevices are connected. This is done through new
    elements called entities, pads and links.

    An entity is a basic media hardware building block. It can correspond to
    a large variety of logical blocks such as physical hardware devices
    (CMOS sensor for instance), logical hardware devices (a building block
    in a System-on-Chip image processing pipeline), DMA channels or physical
    connectors.

    A pad is a connection endpoint through which an entity can interact with
    other entities. Data (not restricted to video) produced by an entity
    flows from the entity's output to one or more entity inputs. Pads should
    not be confused with physical pins at chip boundaries.

    A link is a point-to-point oriented connection between two pads, either
    on the same entity or on different entities. Data flows from a source
    pad to a sink pad.

    Links are stored in the source entity. To make backwards graph walk
    faster, a copy of all links is also stored in the sink entity. The copy
    is known as a backlink and is only used to help graph traversal.

    The entity API is made of three functions:

    - media_entity_init() initializes an entity. The caller must provide an
    array of pads as well as an estimated number of links. The links array
    is allocated dynamically and will be reallocated if it grows beyond the
    initial estimate.

    - media_entity_cleanup() frees resources allocated for an entity. It
    must be called during the cleanup phase after unregistering the entity
    and before freeing it.

    - media_entity_create_link() creates a link between two entities. An
    entry in the link array of each entity is allocated and stores pointers
    to source and sink pads.

    When a media device is unregistered, all its entities are unregistered
    automatically.

    The code is based on Hans Verkuil initial work.

    Signed-off-by: Laurent Pinchart
    Signed-off-by: Sakari Ailus
    Acked-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart