All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFCv2 PATCH 00/17] gspca: allow use of control framework and other fixes
@ 2012-05-06 12:28 Hans Verkuil
  2012-05-06 12:28 ` [RFCv2 PATCH 01/17] v4l2-dev: make it possible to skip locking for selected ioctls Hans Verkuil
  0 siblings, 1 reply; 21+ messages in thread
From: Hans Verkuil @ 2012-05-06 12:28 UTC (permalink / raw)
  To: linux-media; +Cc: Hans de Goede

Hi all,

Here is my second version of this patch series.

Thanks to Hans de Goede for his help.

Changes since v1:

- HdG provided some patches that fix zc3xx-related jpeg problems
- controls are now initialized in a new cam_op: init_controls
- converted the stv06xx and mars drivers as well
- switched to V4L2 core locking, except for the DQBUF/QBUF/QUERYBUF ioctls.

Regarding locking: there are two possible methods: either do it all in the
driver, or use the V4L2 core serialization lock. Using the core lock is easy,
but, as HdG pointed out to me, it can introduce unnecessary latency if you
try to dequeue a buffer that is available, but someone else is changing a
control at the same time and is holding the core lock.

The problem on the other hand with driver locking is that in order to change
values in a control handler in the driver (which happens frequently in gspca),
you need to call v4l2_ctrl_[gs]_ctrl in order to correctly take a mutex in the
control handler, preventing someone else from changing the control at the same
time.

Since the driver needs to take its own lock when setting a control you run
into a problem: calling v4l2_ctrl_[gs]_ctrl can only be done if you are not
holding your driver lock, otherwise the s_ctrl op that actually sets the new
control value will also try to get that same lock: deadlock!

It's possible to solve this, but that requires pushing all the locking down
into the subdrivers. And that's a lot of work.

Instead I decided to make it possible to skip taking the core lock for
selected ioctls. The first patch adds that functionality.

This works much better and reduces the code size instead of adding to it.

Tested all four subdrivers with suspend/resume.

HdG: I propose that you take over unless you disagree with my locking changes
or if there are new things that crop up.

The git tree is here: git://linuxtv.org/hverkuil/media_tree.git gspca3

I will take on the first two core patches (I've got some more in that area
as well) and process them myself.

Regards,

	Hans


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

end of thread, other threads:[~2012-05-06 17:58 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-06 12:28 [RFCv2 PATCH 00/17] gspca: allow use of control framework and other fixes Hans Verkuil
2012-05-06 12:28 ` [RFCv2 PATCH 01/17] v4l2-dev: make it possible to skip locking for selected ioctls Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 02/17] v4l2-framework.txt: add paragraph on driver locking and the control framework Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 03/17] gspca: allow subdrivers to use " Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 04/17] gspca: use video_drvdata(file) instead of file->private_data Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 05/17] gscpa: use v4l2_fh and add G/S_PRIORITY support Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 06/17] gspca: add support for control events Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 07/17] gspca: fix querycap and incorrect return codes Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 08/17] gspca: fix locking issues related to suspend/resume Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 09/17] gspca_zc3xx: Fix setting of jpeg quality while streaming Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 10/17] gspca_zc3xx: Fix JPEG quality setting code Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 11/17] gscpa_zc3xx: Always automatically adjust BRC as needed Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 12/17] gscpa_zc3xx: Disable the highest quality setting as it is not usable Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 13/17] gspca: switch to V4L2 core locking, except for the buffer queuing ioctls Hans Verkuil
2012-05-06 15:25     ` Hans de Goede
2012-05-06 15:51       ` Hans Verkuil
2012-05-06 17:58         ` Hans de Goede
2012-05-06 12:28   ` [RFCv2 PATCH 14/17] gspca-zc3xx: convert to the control framework Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 15/17] gcpca-sn9c20x: " Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 16/17] gspca-stv06xx: " Hans Verkuil
2012-05-06 12:28   ` [RFCv2 PATCH 17/17] gspca-mars: " Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.