linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFCv1 PATCH 0/5] Improvements to the core ioctl/fops handling
@ 2012-05-10  7:05 Hans Verkuil
  2012-05-10  7:05 ` [RFCv1 PATCH 1/5] v4l2-dev: make it possible to skip locking for selected ioctls Hans Verkuil
  0 siblings, 1 reply; 20+ messages in thread
From: Hans Verkuil @ 2012-05-10  7:05 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans de Goede

Hi all,

This patch series makes improvements to the way the v4l2 core handles
locking and how it handles the ioctls.

This is driven by some requirements from the work on the gspca driver,
but it is also a good starting point to clean up the v4l2-ioctl.c source.

The gspca requirement was to have better control over locking. This affects
primarily USB drivers as they want to avoid having to take a core lock when
(de)queuing buffers and polling for new frames since some of the operations
over the USB bus can take a fair amount of time and having to wait for the
lock can increase latency. Besides, for those operations it is usually not
needed to lock.

The same is true for file operations like poll, read and write.

So patch 1 makes it possible to skip locking for selected ioctls, while patch 5
inverts the default behavior of the core: it will only take the core lock for the
ioctl fop, not for the others unless a flag is set explicitly in the driver.

I've set that flag in all drivers that use the core lock, unless it was immediately
obvious that they didn't need it. Those drivers need to be audited so that we
can eventually remove the flag.

While I could have gone for the one-flag-per-fop approach, I thought this made more
sense. There are only a few fops as opposed to the zillion ioctls.

Since I used a table-driven approach in the first patch I decided to extend it to
other parts of v4l2-ioctl as well. So the determination which ioctls are
actually implemented in a driver is now done upfront, and whether an ioctl needs
to do priority handling is now done by table lookup as well.

Eventually I want to replace all the switches by table lookup, which is O(1) and
will hopefully be a lot more readable. Some work doing that is available here:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/ioctl2

This patch series is also available here:

  git://linuxtv.org/hverkuil/media_tree.git ioctl

Comments?

Regards,

	Hans

----------------------------------------------------------------
Hans Verkuil (5):
      v4l2-dev: make it possible to skip locking for selected ioctls.
      v4l2-dev/ioctl: determine the valid ioctls upfront.
      tea575x-tuner: mark VIDIOC_S_HW_FREQ_SEEK as an invalid ioctl.
      v4l2-ioctl: handle priority handling based on a table lookup.
      v4l2-dev: add flag to have the core lock all file operations.

 Documentation/video4linux/v4l2-framework.txt    |   27 ++++-
 drivers/media/common/saa7146_fops.c             |    4 +
 drivers/media/radio/wl128x/fmdrv_v4l2.c         |    4 +
 drivers/media/video/blackfin/bfin_capture.c     |    4 +
 drivers/media/video/cpia2/cpia2_v4l.c           |    4 +
 drivers/media/video/cx231xx/cx231xx-video.c     |    4 +
 drivers/media/video/davinci/vpbe_display.c      |    4 +
 drivers/media/video/davinci/vpif_capture.c      |    4 +
 drivers/media/video/davinci/vpif_display.c      |    4 +
 drivers/media/video/em28xx/em28xx-video.c       |    4 +
 drivers/media/video/fsl-viu.c                   |    4 +
 drivers/media/video/ivtv/ivtv-streams.c         |    4 +
 drivers/media/video/mem2mem_testdev.c           |    4 +
 drivers/media/video/mx2_emmaprp.c               |    4 +
 drivers/media/video/s2255drv.c                  |    4 +
 drivers/media/video/s5p-fimc/fimc-capture.c     |    4 +
 drivers/media/video/s5p-fimc/fimc-core.c        |    4 +
 drivers/media/video/s5p-g2d/g2d.c               |    4 +
 drivers/media/video/s5p-jpeg/jpeg-core.c        |    8 ++
 drivers/media/video/s5p-mfc/s5p_mfc.c           |    6 +
 drivers/media/video/s5p-tv/mixer_video.c        |    4 +
 drivers/media/video/sh_vou.c                    |    4 +
 drivers/media/video/soc_camera.c                |    4 +
 drivers/media/video/tm6000/tm6000-video.c       |    4 +
 drivers/media/video/usbvision/usbvision-video.c |    4 +
 drivers/media/video/v4l2-dev.c                  |  217 ++++++++++++++++++++++++++++++---
 drivers/media/video/v4l2-ioctl.c                |  539 ++++++++++++++++++++++------------------------------------------------------------
 drivers/staging/media/dt3155v4l/dt3155v4l.c     |    4 +
 include/media/v4l2-dev.h                        |   25 ++++
 sound/i2c/other/tea575x-tuner.c                 |    3 +
 30 files changed, 506 insertions(+), 411 deletions(-)


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2012-05-14 14:12 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-10  7:05 [RFCv1 PATCH 0/5] Improvements to the core ioctl/fops handling Hans Verkuil
2012-05-10  7:05 ` [RFCv1 PATCH 1/5] v4l2-dev: make it possible to skip locking for selected ioctls Hans Verkuil
2012-05-10  7:05   ` [RFCv1 PATCH 2/5] v4l2-dev/ioctl: determine the valid ioctls upfront Hans Verkuil
2012-05-10  8:06     ` Hans Verkuil
2012-05-10  8:10     ` Hans de Goede
2012-05-10  8:21       ` Hans de Goede
2012-05-10  8:27       ` Hans Verkuil
2012-05-14 13:00     ` Laurent Pinchart
2012-05-14 13:51       ` Hans Verkuil
2012-05-14 14:10         ` Laurent Pinchart
2012-05-10  7:05   ` [RFCv1 PATCH 3/5] tea575x-tuner: mark VIDIOC_S_HW_FREQ_SEEK as an invalid ioctl Hans Verkuil
2012-05-10  8:12     ` Hans de Goede
2012-05-10  7:05   ` [RFCv1 PATCH 4/5] v4l2-ioctl: handle priority handling based on a table lookup Hans Verkuil
2012-05-10  8:13     ` Hans de Goede
2012-05-10  7:05   ` [RFCv1 PATCH 5/5] v4l2-dev: add flag to have the core lock all file operations Hans Verkuil
2012-05-10  8:14     ` Hans de Goede
2012-05-14 12:31     ` Laurent Pinchart
2012-05-14 13:42       ` Hans Verkuil
2012-05-14 14:12         ` Laurent Pinchart
2012-05-10  8:00   ` [RFCv1 PATCH 1/5] v4l2-dev: make it possible to skip locking for selected ioctls Hans de Goede

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).