[PATCH v4 0/7] v4l: subdev active state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is v4 of the subdev active state series. Changes since v3:

- Locking model change: in v3 the subdev's were responsible for locking
  their state. Now the caller of the subdev ops must lock the callee's
  state.
- Add subdev->lock which can be set by the driver. This lock will be
  used for all the states.
- Add v4l2_subdev_call_state_active() helper
- Doc changes wrt. locking

The main change here is the first bullet above. The idea for the change
came up when we realized that we will have race conditions very easily
if the state locking is handled by the subdev itself. It's not rare for
the v4l2-core to need to check, say, the routing of a subdev, and then
call a subdev op (e.g. get_fmt). In the previous version this would have
been accomplished by locking the state, looking at the routing,
unlocking, calling the subdev op, which then would lock again. Now the
v4l2-core can lock the state for the duration of the operation. This
also simplifies driver code nicely.

In the longer time frame we hope that we can improve the locking even
more by locking all the relevant subdev states in the pipeline at the
beginning of the operation. E.g. when the streaming is started the
v4l2-core would lock all the subdev states that are part of that
pipeline before calling s_stream.

I dropped the reviewed-bys from "media: subdev: add subdev state
locking" and "media: subdev: Add v4l2_subdev_lock_and_return_state()" as
their operation changed, and I think they need a fresh review.

I also dropped the "media: subdev: rename v4l2_subdev_pad_config.try_*
fields" just to simplify the series management. It's one of the cleanups
that can be easily done after the dust has settled.

 Tomi

Tomi Valkeinen (7):
  media: subdev: rename subdev-state alloc & free
  media: subdev: add active state to struct v4l2_subdev
  media: subdev: pass also the active state to subdevs from ioctls
  media: subdev: add subdev state locking
  media: subdev: Add v4l2_subdev_lock_and_return_state()
  media: subdev: add v4l2_subdev_call_state_active()
  media: Documentation: add documentation about subdev state

 .../driver-api/media/v4l2-subdev.rst          |  75 ++++++
 drivers/media/platform/rcar-vin/rcar-v4l2.c   |   9 +-
 drivers/media/platform/vsp1/vsp1_entity.c     |  10 +-
 drivers/media/v4l2-core/v4l2-subdev.c         | 157 +++++++++++--
 drivers/staging/media/tegra-video/vi.c        |  10 +-
 include/media/v4l2-subdev.h                   | 220 +++++++++++++++++-
 6 files changed, 450 insertions(+), 31 deletions(-)

-- 
2.25.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux