forked from torvalds/linux
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
RFC: media: v4l2-subdev: add subdev-wide config struct
We have 'struct v4l2_subdev_pad_config' which contains configuration for
a single pad used for the TRY functionality, and an array of those
structs is passed to various v4l2_subdev_pad_ops.
I was working on subdev internal routing between pads, and realized that
there's no way to add TRY functionality for routes, which is not pad
specific configuration. Adding a separate struct for try-route config
wouldn't work either, as e.g. set-fmt needs to know the try-route
configuration to propagate the settings.
This patch adds a new struct, 'struct v4l2_subdev_config' (which at the
moment only contains the v4l2_subdev_pad_config array) and the new
struct is used in most of the places where v4l2_subdev_pad_config was
used. All v4l2_subdev_pad_ops functions taking v4l2_subdev_pad_config
are changed to instead take v4l2_subdev_config.
Two drivers are changed to work with the above changes (drivers for HW
which I have) as an example.
I worked on a semantic patch (included below, my first spatch...) to do
this change to all drivers, but hit lots of problems with non-trivial
uses of v4l2_subdev_pad_config.
As it looks like substantial amount of manual work is needed, I'm
posting this RFC to get an ack on the changes before continuing that
work.
@ v4l2_subdev_pad_ops @
identifier pad_ops;
identifier func;
@@
(
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.enum_mbus_code = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.enum_frame_size = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.enum_frame_interval = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.get_fmt = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.set_fmt = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.get_selection = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.set_selection = func,
...,
};
|
static const struct v4l2_subdev_pad_ops pad_ops = {
...,
.init_cfg = func,
...,
};
)
@@
identifier v4l2_subdev_pad_ops.func;
identifier sd;
identifier cfg;
@@
func(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_config *cfg,
...
)
{
...
}
@@
identifier v4l2_subdev_pad_ops.func;
identifier sd;
identifier cfg;
@@
func(struct v4l2_subdev *sd,
- struct v4l2_subdev_pad_config *cfg
+ struct v4l2_subdev_config *cfg
)
{
...
}
@@
struct v4l2_subdev_fh *fh;
@@
- fh->pad
+ &fh->cfg
@@
identifier func;
identifier cfg;
@@
func(...,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_config *cfg,
...)
{
...
}
@@
struct v4l2_subdev_config *cfg;
@@
{
<...
(
- cfg->try_fmt
+ cfg->pad_configs->try_fmt
|
- cfg->try_crop
+ cfg->pad_configs->try_crop
|
- cfg->try_compose
+ cfg->pad_configs->try_compose
)
...>
}
@@
identifier pad_cfg;
@@
{
...
struct v4l2_subdev_pad_config pad_cfg;
+ struct v4l2_subdev_config cfg = { .pad_configs = &pad_cfg };
<...
- &pad_cfg
+ &cfg
...>
}
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>- Loading branch information
1 parent
4f4e664
commit 4690ebdd6fd3180366038788f7df1fa2420f00c9
Showing
4 changed files
with
78 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.