@@ -475,6 +475,20 @@ static int vivid_fop_release(struct file *file)
return v4l2_fh_release(file);
}
+void vivid_queue_setup_lock(struct vb2_queue *q)
+{
+ struct vivid_dev *dev = vb2_get_drv_priv(q);
+
+ mutex_lock(&dev->mutex);
+}
+
+void vivid_queue_setup_unlock(struct vb2_queue *q)
+{
+ struct vivid_dev *dev = vb2_get_drv_priv(q);
+
+ mutex_unlock(&dev->mutex);
+}
+
static const struct v4l2_file_operations vivid_fops = {
.owner = THIS_MODULE,
.open = v4l2_fh_open,
@@ -564,4 +564,7 @@ static inline bool vivid_is_hdmi_out(const struct vivid_dev *dev)
return dev->output_type[dev->output] == HDMI;
}
+void vivid_queue_setup_lock(struct vb2_queue *q);
+void vivid_queue_setup_unlock(struct vb2_queue *q);
+
#endif
@@ -318,6 +318,8 @@ static void sdr_cap_buf_request_complete(struct vb2_buffer *vb)
const struct vb2_ops vivid_sdr_cap_qops = {
.queue_setup = sdr_cap_queue_setup,
+ .queue_setup_lock = vivid_queue_setup_lock,
+ .queue_setup_unlock = vivid_queue_setup_unlock,
.buf_prepare = sdr_cap_buf_prepare,
.buf_queue = sdr_cap_buf_queue,
.start_streaming = sdr_cap_start_streaming,
@@ -231,6 +231,8 @@ static void vbi_cap_buf_request_complete(struct vb2_buffer *vb)
const struct vb2_ops vivid_vbi_cap_qops = {
.queue_setup = vbi_cap_queue_setup,
+ .queue_setup_lock = vivid_queue_setup_lock,
+ .queue_setup_unlock = vivid_queue_setup_unlock,
.buf_prepare = vbi_cap_buf_prepare,
.buf_queue = vbi_cap_buf_queue,
.start_streaming = vbi_cap_start_streaming,
@@ -126,6 +126,8 @@ static void vbi_out_buf_request_complete(struct vb2_buffer *vb)
const struct vb2_ops vivid_vbi_out_qops = {
.queue_setup = vbi_out_queue_setup,
+ .queue_setup_lock = vivid_queue_setup_lock,
+ .queue_setup_unlock = vivid_queue_setup_unlock,
.buf_prepare = vbi_out_buf_prepare,
.buf_queue = vbi_out_buf_queue,
.start_streaming = vbi_out_start_streaming,
@@ -271,6 +271,8 @@ static void vid_cap_buf_request_complete(struct vb2_buffer *vb)
const struct vb2_ops vivid_vid_cap_qops = {
.queue_setup = vid_cap_queue_setup,
+ .queue_setup_lock = vivid_queue_setup_lock,
+ .queue_setup_unlock = vivid_queue_setup_unlock,
.buf_prepare = vid_cap_buf_prepare,
.buf_finish = vid_cap_buf_finish,
.buf_queue = vid_cap_buf_queue,
@@ -190,6 +190,8 @@ static void vid_out_buf_request_complete(struct vb2_buffer *vb)
const struct vb2_ops vivid_vid_out_qops = {
.queue_setup = vid_out_queue_setup,
+ .queue_setup_lock = vivid_queue_setup_lock,
+ .queue_setup_unlock = vivid_queue_setup_unlock,
.buf_prepare = vid_out_buf_prepare,
.buf_queue = vid_out_buf_queue,
.start_streaming = vid_out_start_streaming,
Add these ops to serialize queue_setup with VIDIOC_S_FMT. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> --- drivers/media/platform/vivid/vivid-core.c | 14 ++++++++++++++ drivers/media/platform/vivid/vivid-core.h | 3 +++ drivers/media/platform/vivid/vivid-sdr-cap.c | 2 ++ drivers/media/platform/vivid/vivid-vbi-cap.c | 2 ++ drivers/media/platform/vivid/vivid-vbi-out.c | 2 ++ drivers/media/platform/vivid/vivid-vid-cap.c | 2 ++ drivers/media/platform/vivid/vivid-vid-out.c | 2 ++ 7 files changed, 27 insertions(+)