77c4cd7e | 23-Feb-2024 |
Hans Verkuil <hverkuil-cisco@xs4all.nl> |
media: mc: mark the media devnode as registered from the, start
commit 4bc60736154bc9e0e39d3b88918f5d3762ebe5e0 upstream.
First the media device node was created, and if successful it was marked as
media: mc: mark the media devnode as registered from the, start
commit 4bc60736154bc9e0e39d3b88918f5d3762ebe5e0 upstream.
First the media device node was created, and if successful it was marked as 'registered'. This leaves a small race condition where an application can open the device node and get an error back because the 'registered' flag was not yet set.
Change the order: first set the 'registered' flag, then actually register the media device node. If that fails, then clear the flag.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Fixes: cf4b9211b568 ("[media] media: Media device node support") Cc: stable@vger.kernel.org Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
d0e3440d | 14-Jan-2024 |
Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
media: mc: Expand MUST_CONNECT flag to always require an enabled link
[ Upstream commit b3decc5ce7d778224d266423b542326ad469cb5f ]
The MEDIA_PAD_FL_MUST_CONNECT flag indicates that the pad requires
media: mc: Expand MUST_CONNECT flag to always require an enabled link
[ Upstream commit b3decc5ce7d778224d266423b542326ad469cb5f ]
The MEDIA_PAD_FL_MUST_CONNECT flag indicates that the pad requires an enabled link to stream, but only if it has any link at all. This makes little sense, as if a pad is part of a pipeline, there are very few use cases for an active link to be mandatory only if links exist at all. A review of in-tree drivers confirms they all need an enabled link for pads marked with the MEDIA_PAD_FL_MUST_CONNECT flag.
Expand the scope of the flag by rejecting pads that have no links at all. This requires modifying the pipeline build code to add those pads to the pipeline.
Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
3b6ccc91 | 14-Jan-2024 |
Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
media: mc: Rename pad variable to clarify intent
[ Upstream commit 9ec9109cf9f611e3ec9ed0355afcc7aae5e73176 ]
The pad local variable in the media_pipeline_explore_next_link() function is used to st
media: mc: Rename pad variable to clarify intent
[ Upstream commit 9ec9109cf9f611e3ec9ed0355afcc7aae5e73176 ]
The pad local variable in the media_pipeline_explore_next_link() function is used to store the pad through which the entity has been reached. Rename it to origin to reflect that and make the code easier to read. This will be even more important in subsequent commits when expanding the function with additional logic.
Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
ebb6fb7f | 14-Jan-2024 |
Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
media: mc: Add num_links flag to media_pad
[ Upstream commit baeddf94aa61879b118f2faa37ed126d772670cc ]
Maintain a counter of the links connected to a pad in the media_pad structure. This helps che
media: mc: Add num_links flag to media_pad
[ Upstream commit baeddf94aa61879b118f2faa37ed126d772670cc ]
Maintain a counter of the links connected to a pad in the media_pad structure. This helps checking if a pad is connected to anything, which will be used in the pipeline building code.
Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
0a769022 | 14-Jan-2024 |
Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
media: mc: Fix flags handling when creating pad links
[ Upstream commit 422f7af75d03d50895938d38bc9cb8be759c440f ]
The media_create_pad_link() function doesn't correctly clear reject link type flag
media: mc: Fix flags handling when creating pad links
[ Upstream commit 422f7af75d03d50895938d38bc9cb8be759c440f ]
The media_create_pad_link() function doesn't correctly clear reject link type flags, nor does it set the DATA_LINK flag. It only works because the MEDIA_LNK_FL_DATA_LINK flag's value is 0.
Fix it by returning an error if any link type flag is set. This doesn't introduce any regression, as nobody calls the media_create_pad_link() function with link type flags (easily checked by grepping for the flag in the source code, there are very few hits).
Set the MEDIA_LNK_FL_DATA_LINK explicitly, which is a no-op that the compiler will optimize out, but is still useful to make the code more explicit and easier to understand.
Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
b5163545 | 12-Dec-2022 |
Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
media: mc: entity: Fix minor issues in comments and documentation
Commit ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()") incorrectly referred to entity instead of pad in a comment
media: mc: entity: Fix minor issues in comments and documentation
Commit ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()") incorrectly referred to entity instead of pad in a comment, and forgot to update a second comment accordingly when moving the pipe from entity to pad. Furthermore, it didn't properly reflow the documentation text it updated.
Fix those small issues.
Fixes: ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
eac564de | 21-Dec-2022 |
Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
media: mc: entity: Add entity iterator for media_pipeline
Add a media_pipeline_for_each_entity() macro to iterate over entities in a pipeline. This should be used by driver as a replacement of the m
media: mc: entity: Add entity iterator for media_pipeline
Add a media_pipeline_for_each_entity() macro to iterate over entities in a pipeline. This should be used by driver as a replacement of the media_graph_walk API, as iterating over the media_pipeline uses the cached list of pads and is thus more efficient.
Deprecate the media_graph_walk API to indicate it shouldn't be used in new drivers.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
25ba644e | 17-Dec-2022 |
Miaoqian Lin <linmq006@gmail.com> |
media: mc: entity: Fix doc for media_graph_walk_init
There is no media_graph_walk_free(). media_graph_walk_cleanup() is used to release the resources.
Signed-off-by: Miaoqian Lin <linmq006@gmail.co
media: mc: entity: Fix doc for media_graph_walk_init
There is no media_graph_walk_free(). media_graph_walk_cleanup() is used to release the resources.
Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
9e3576a1 | 31-Aug-2022 |
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> |
media: mc: convert pipeline funcs to take media_pad
Now that the pipeline is stored into pads instead of entities, we can change the relevant functions to take pads instead of entities.
Signed-off-
media: mc: convert pipeline funcs to take media_pad
Now that the pipeline is stored into pads instead of entities, we can change the relevant functions to take pads instead of entities.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
5b4f9a72 | 31-Aug-2022 |
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> |
media: mc: entity: Add has_pad_interdep entity operation
Add a new media entity operation, has_pad_interdep. The optional op is used to discover the pad interdependencies inside an entity during the
media: mc: entity: Add has_pad_interdep entity operation
Add a new media entity operation, has_pad_interdep. The optional op is used to discover the pad interdependencies inside an entity during the pipeline construction.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
ae219872 | 31-Aug-2022 |
Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
media: mc: entity: Rewrite media_pipeline_start()
[Note: the code is mostly from Laurent but the patch description is from Tomi]
The media_pipeline_start() and media_pipeline_stop() functions use t
media: mc: entity: Rewrite media_pipeline_start()
[Note: the code is mostly from Laurent but the patch description is from Tomi]
The media_pipeline_start() and media_pipeline_stop() functions use the media graph walk API to traverse the graph and validate the pipeline. The graph walk traverses the media graph following links between the entities.
Also, while the pipeline can't change between the start and stop calls, the graph is walked again from scratch at stop time, or any time a driver needs to inspect the pipeline.
With the upcoming multiplexed streams support we will need a bit more intelligent pipeline construction, as e.g. two independent streams may be passing through a single entity via separate pads in which case those pads should not be part of the same pipeline.
This patch essentially rewrites the media_pipeline_start/stop so that a pipeline is defined as a set of pads instead of entities and the media graph traversal considers the pad interdependencies when choosing which links to follow.
Currently all the entity's pads are considered as interdependent. This means that the behavior with all the current drivers stays the same, but in the future we can define a more fine-grained pipeline construction.
Additionally the media pipeline's pads are cached at media_pipeline_start() time, and re-used at media_pipeline_stop() which avoid the need to re-walk the whole graph as the previous implementation did.
Also, caching pads in the pipeline can serve in the future as the foundation to provide a better API than the media graph walk to drivers to iterate over pads and entities in the pipeline.
Note that the old media_pipeline_start/stop used the media graph walk API. The new version does not use the media graph walk API, but instead a new implementation.
There are two reasons for not changing the graph walk: it proved to be rather difficult to change the graph walk to have the features implemented in this patch, and second, this keeps the backward compatibility of the graph walk as there are users of the graph walk API
The long term plan is that all the existing code would be converted to use the new cached pipeline, thus allowing us to remove the graph walk.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
612589a3 | 31-Aug-2022 |
Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
media: mc: entity: Move media_entity_get_fwnode_pad() out of graph walk section
The media_entity_get_fwnode_pad() function is unrelated to the graph traversal code that it is currently bundled with.
media: mc: entity: Move media_entity_get_fwnode_pad() out of graph walk section
The media_entity_get_fwnode_pad() function is unrelated to the graph traversal code that it is currently bundled with. Move it with the media_entity_remote_pad() function.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
49b38947 | 31-Aug-2022 |
Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
media: mc: entity: Merge media_entity_enum_init and __media_entity_enum_init
The media_entity_enum_init() function is a wrapper around __media_entity_enum_init() that turns a media_device pointer ar
media: mc: entity: Merge media_entity_enum_init and __media_entity_enum_init
The media_entity_enum_init() function is a wrapper around __media_entity_enum_init() that turns a media_device pointer argument into the maximum entity ID in the corresponding media graph. __media_entity_enum_init() is never used outside of media_entity_enum_init(), so the two functions can be merged together.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|
8db465f7 | 31-Aug-2022 |
Jacopo Mondi <jacopo+renesas@jmondi.org> |
media: mc: entity: Add iterator helper for entity pads
Add an iterator helper to easily cycle through all pads in an entity and use it in media-entity and media-device code where appropriate.
Signe
media: mc: entity: Add iterator helper for entity pads
Add an iterator helper to easily cycle through all pads in an entity and use it in media-entity and media-device code where appropriate.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
show more ...
|